OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2015 Google Inc. All rights reserved. | 3 * Copyright (C) 2015 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 | 482 |
483 static float positionFromValue(CSSValue* value, const CSSToLengthConversionData&
conversionData, const IntSize& size, bool isHorizontal) | 483 static float positionFromValue(CSSValue* value, const CSSToLengthConversionData&
conversionData, const IntSize& size, bool isHorizontal) |
484 { | 484 { |
485 int origin = 0; | 485 int origin = 0; |
486 int sign = 1; | 486 int sign = 1; |
487 int edgeDistance = isHorizontal ? size.width() : size.height(); | 487 int edgeDistance = isHorizontal ? size.width() : size.height(); |
488 | 488 |
489 // In this case the center of the gradient is given relative to an edge in t
he form of: | 489 // In this case the center of the gradient is given relative to an edge in t
he form of: |
490 // [ top | bottom | right | left ] [ <percentage> | <length> ]. | 490 // [ top | bottom | right | left ] [ <percentage> | <length> ]. |
491 if (value->isValuePair()) { | 491 if (value->isValuePair()) { |
492 CSSValuePair* pair = toCSSValuePair(value); | 492 CSSValuePair& pair = toCSSValuePair(*value); |
493 CSSValueID originID = toCSSPrimitiveValue(pair->first())->getValueID(); | 493 CSSValueID originID = toCSSPrimitiveValue(pair.first()).getValueID(); |
494 value = pair->second(); | 494 value = &pair.second(); |
495 | 495 |
496 if (originID == CSSValueRight || originID == CSSValueBottom) { | 496 if (originID == CSSValueRight || originID == CSSValueBottom) { |
497 // For right/bottom, the offset is relative to the far edge. | 497 // For right/bottom, the offset is relative to the far edge. |
498 origin = edgeDistance; | 498 origin = edgeDistance; |
499 sign = -1; | 499 sign = -1; |
500 } | 500 } |
501 } | 501 } |
502 | 502 |
503 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 503 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
504 | 504 |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 visitor->trace(m_firstRadius); | 1207 visitor->trace(m_firstRadius); |
1208 visitor->trace(m_secondRadius); | 1208 visitor->trace(m_secondRadius); |
1209 visitor->trace(m_shape); | 1209 visitor->trace(m_shape); |
1210 visitor->trace(m_sizingBehavior); | 1210 visitor->trace(m_sizingBehavior); |
1211 visitor->trace(m_endHorizontalSize); | 1211 visitor->trace(m_endHorizontalSize); |
1212 visitor->trace(m_endVerticalSize); | 1212 visitor->trace(m_endVerticalSize); |
1213 CSSGradientValue::traceAfterDispatch(visitor); | 1213 CSSGradientValue::traceAfterDispatch(visitor); |
1214 } | 1214 } |
1215 | 1215 |
1216 } // namespace blink | 1216 } // namespace blink |
OLD | NEW |