Changeset 169248 in webkit
- Timestamp:
- May 22, 2014, 10:18:23 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/gradients/viewport-units-gradient-expected.html (added)
-
LayoutTests/fast/gradients/viewport-units-gradient.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/CSSGradientValue.cpp (modified) (5 diffs)
-
Source/WebCore/css/CSSGradientValue.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r169244 r169248 1 2014-05-22 Simon Fraser <simon.fraser@apple.com> 2 3 Make viewport units work in CSS gradients 4 https://bugs.webkit.org/show_bug.cgi?id=133204 5 <rdar://problem/17012259> 6 7 Reviewed by Tim Horton. 8 9 Make viewport percentage lengths work in gradients. 10 11 * fast/gradients/viewport-units-gradient-expected.html: Added. 12 * fast/gradients/viewport-units-gradient.html: Added. 13 1 14 2014-05-22 Ryosuke Niwa <rniwa@webkit.org> 2 15 -
trunk/Source/WebCore/ChangeLog
r169245 r169248 1 2014-05-22 Simon Fraser <simon.fraser@apple.com> 2 3 Make viewport units work in CSS gradients 4 https://bugs.webkit.org/show_bug.cgi?id=133204 5 <rdar://problem/17012259> 6 7 Reviewed by Tim Horton. 8 9 Make viewport percentage lengths work in gradients. 10 11 Test: fast/gradients/viewport-units-gradient.html 12 13 * css/CSSGradientValue.cpp: 14 (WebCore::CSSGradientValue::addStops): 15 (WebCore::CSSLinearGradientValue::createGradient): 16 (WebCore::CSSRadialGradientValue::createGradient): 17 * css/CSSGradientValue.h: 18 1 19 2014-05-22 Benjamin Poulain <bpoulain@apple.com> 2 20 -
trunk/Source/WebCore/css/CSSGradientValue.cpp
r167937 r169248 130 130 } 131 131 132 void CSSGradientValue::addStops(Gradient* gradient, const CSSToLengthConversionData& conversionData, float maxLengthForRepeat)132 void CSSGradientValue::addStops(Gradient* gradient, RenderView* renderView, const CSSToLengthConversionData& conversionData, float maxLengthForRepeat) 133 133 { 134 134 if (m_gradientType == CSSDeprecatedLinearGradient || m_gradientType == CSSDeprecatedRadialGradient) { … … 172 172 173 173 if (stop.m_position) { 174 if (stop.m_position->isPercentage()) 175 stops[i].offset = stop.m_position->getFloatValue(CSSPrimitiveValue::CSS_PERCENTAGE) / 100; 176 else if (stop.m_position->isLength() || stop.m_position->isCalculatedPercentageWithLength()) { 174 const CSSPrimitiveValue& positionValue = *stop.m_position; 175 if (positionValue.isPercentage()) 176 stops[i].offset = positionValue.getFloatValue(CSSPrimitiveValue::CSS_PERCENTAGE) / 100; 177 else if (positionValue.isLength() || positionValue.isViewportPercentageLength() || positionValue.isCalculatedPercentageWithLength()) { 177 178 if (!computedGradientLength) { 178 179 FloatSize gradientSize(gradientStart - gradientEnd); … … 180 181 } 181 182 float length; 182 if (stop.m_position->isLength()) 183 length = stop.m_position->computeLength<float>(conversionData); 183 if (positionValue.isLength()) 184 length = positionValue.computeLength<float>(conversionData); 185 else if (positionValue.isViewportPercentageLength()) 186 length = valueForLength(positionValue.viewportPercentageLength(), 0, renderView); 184 187 else { 185 Ref<CalculationValue> calculationValue { stop.m_position->cssCalcValue()->createCalculationValue(conversionData) };188 Ref<CalculationValue> calculationValue { positionValue.cssCalcValue()->createCalculationValue(conversionData) }; 186 189 length = calculationValue->evaluate(gradientLength); 187 190 } … … 702 705 703 706 // Now add the stops. 704 addStops(gradient.get(), conversionData, 1);707 addStops(gradient.get(), &renderer->view(), conversionData, 1); 705 708 706 709 return gradient.release(); … … 1116 1119 1117 1120 // Now add the stops. 1118 addStops(gradient.get(), conversionData, maxExtent);1121 addStops(gradient.get(), &renderer->view(), conversionData, maxExtent); 1119 1122 1120 1123 return gradient.release(); -
trunk/Source/WebCore/css/CSSGradientValue.h
r167937 r169248 36 36 class FloatPoint; 37 37 class Gradient; 38 class RenderView; 38 39 39 40 enum CSSGradientType { … … 110 111 } 111 112 112 void addStops(Gradient*, const CSSToLengthConversionData&, float maxLengthForRepeat = 0);113 void addStops(Gradient*, RenderView*, const CSSToLengthConversionData&, float maxLengthForRepeat = 0); 113 114 114 115 // Resolve points/radii to front end values.
Note:
See TracChangeset
for help on using the changeset viewer.