Changeset 162210 in webkit
- Timestamp:
- Jan 17, 2014 12:13:33 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r162207 r162210 1 2014-01-17 Bear Travis <betravis@adobe.com> 2 3 [CSS Shapes] Basic shapes' computed position should be a horizontal and vertical offset 4 https://bugs.webkit.org/show_bug.cgi?id=127010 5 6 Reviewed by Rob Buis. 7 8 Update existing parsing and animation tests. For parsing tests, top / left keywords 9 are omitted whenever possible. For animation tests, animations to bottom / right 10 offsets will use calc values based from the top / left direction. 11 12 * animations/resources/animation-test-helpers.js: 13 (parseBasicShape): Parse non-numerical arguments to the shape function. 14 (basicShapeParametersMatch): Match non-numerical arguments to the shape function. 15 * fast/shapes/parsing/parsing-shape-inside-expected.txt: Update serialized values 16 to omit top / left keywords when possible. 17 * fast/shapes/parsing/parsing-shape-outside-expected.txt: Update serialized values 18 to omit top / left keywords when possible. 19 * fast/shapes/parsing/parsing-test-utils.js: Modify shape parsing test expectations. 20 * fast/shapes/shape-outside-floats/shape-outside-animation-expected.txt: Ditto. 21 * fast/shapes/shape-outside-floats/shape-outside-animation.html: Ditto. 22 1 23 2014-01-16 Myles C. Maxfield <mmaxfield@apple.com> 2 24 -
trunk/LayoutTests/animations/resources/animation-test-helpers.js
r160429 r162210 239 239 // Normalize percentage values. 240 240 for (; i < matches.length; ++i) { 241 var param = matches[i]; 242 matches[i] = parseFloat(matches[i]); 243 if (param.indexOf('%') != -1) 244 matches[i] = matches[i] / 100; 241 var param = parseFloat(matches[i]); 242 243 if (isNaN(param)) 244 continue; 245 246 if (matches[i].indexOf('%') != -1) 247 matches[i] = param / 100; 248 else 249 matches[i] = param; 245 250 } 246 251 … … 314 319 return false; 315 320 var i = 0; 316 if (paramList1.shape == "polygon") {317 if (paramList1.params[0] != paramList2.params[0])318 return false; // fill-rule's don't match319 i++;320 }321 321 for (; i < paramList1.params.length; ++i) { 322 322 var param1 = paramList1.params[i], 323 323 param2 = paramList2.params[i]; 324 if (param1 === param2) 325 continue; 324 326 var match = isCloseEnough(param1, param2, tolerance); 325 327 if (!match) -
trunk/LayoutTests/fast/shapes/parsing/parsing-shape-inside-expected.txt
r161436 r162210 47 47 PASS getComputedStyleValue("-webkit-shape-inside", "circle(at right bottom)") is "circle(closest-side at 100% 100%)" 48 48 PASS getCSSText("-webkit-shape-inside", "circle(10px at left top 10px)") is "circle(10px at left 0% top 10px)" 49 PASS getComputedStyleValue("-webkit-shape-inside", "circle(10px at left top 10px)") is "circle(10px at left 0% top10px)"49 PASS getComputedStyleValue("-webkit-shape-inside", "circle(10px at left top 10px)") is "circle(10px at 0% 10px)" 50 50 PASS getCSSText("-webkit-shape-inside", "circle(10px at top 10px left 10px)") is "circle(10px at left 10px top 10px)" 51 PASS getComputedStyleValue("-webkit-shape-inside", "circle(10px at top 10px left 10px)") is "circle(10px at left 10px top10px)"51 PASS getComputedStyleValue("-webkit-shape-inside", "circle(10px at top 10px left 10px)") is "circle(10px at 10px 10px)" 52 52 PASS getCSSText("-webkit-shape-inside", "circle(10px at right 10px bottom 10px)") is "circle(10px at right 10px bottom 10px)" 53 53 PASS getComputedStyleValue("-webkit-shape-inside", "circle(10px at right 10px bottom 10px)") is "circle(10px at right 10px bottom 10px)" … … 75 75 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(at right bottom)") is "ellipse(closest-side closest-side at 100% 100%)" 76 76 PASS getCSSText("-webkit-shape-inside", "ellipse(10px at left top 10px)") is "ellipse(10px at left 0% top 10px)" 77 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px at left top 10px)") is "ellipse(10px closest-side at left 0% top10px)"77 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px at left top 10px)") is "ellipse(10px closest-side at 0% 10px)" 78 78 PASS getCSSText("-webkit-shape-inside", "ellipse(10px at top 10px left 10px)") is "ellipse(10px at left 10px top 10px)" 79 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px at top 10px left 10px)") is "ellipse(10px closest-side at left 10px top10px)"79 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px at top 10px left 10px)") is "ellipse(10px closest-side at 10px 10px)" 80 80 PASS getCSSText("-webkit-shape-inside", "ellipse(10px at right 10px bottom 10px)") is "ellipse(10px at right 10px bottom 10px)" 81 81 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px at right 10px bottom 10px)") is "ellipse(10px closest-side at right 10px bottom 10px)" 82 82 PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px at left top 10px)") is "ellipse(10px 20px at left 0% top 10px)" 83 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 20px at left top 10px)") is "ellipse(10px 20px at left 0% top10px)"83 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 20px at left top 10px)") is "ellipse(10px 20px at 0% 10px)" 84 84 PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px at top 10px left 10px)") is "ellipse(10px 20px at left 10px top 10px)" 85 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 20px at top 10px left 10px)") is "ellipse(10px 20px at left 10px top10px)"85 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 20px at top 10px left 10px)") is "ellipse(10px 20px at 10px 10px)" 86 86 PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px at right 10px bottom 10px)") is "ellipse(10px 20px at right 10px bottom 10px)" 87 87 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 20px at right 10px bottom 10px)") is "ellipse(10px 20px at right 10px bottom 10px)" -
trunk/LayoutTests/fast/shapes/parsing/parsing-shape-outside-expected.txt
r161436 r162210 47 47 PASS getComputedStyleValue("-webkit-shape-outside", "circle(at right bottom)") is "circle(closest-side at 100% 100%)" 48 48 PASS getCSSText("-webkit-shape-outside", "circle(10px at left top 10px)") is "circle(10px at left 0% top 10px)" 49 PASS getComputedStyleValue("-webkit-shape-outside", "circle(10px at left top 10px)") is "circle(10px at left 0% top10px)"49 PASS getComputedStyleValue("-webkit-shape-outside", "circle(10px at left top 10px)") is "circle(10px at 0% 10px)" 50 50 PASS getCSSText("-webkit-shape-outside", "circle(10px at top 10px left 10px)") is "circle(10px at left 10px top 10px)" 51 PASS getComputedStyleValue("-webkit-shape-outside", "circle(10px at top 10px left 10px)") is "circle(10px at left 10px top10px)"51 PASS getComputedStyleValue("-webkit-shape-outside", "circle(10px at top 10px left 10px)") is "circle(10px at 10px 10px)" 52 52 PASS getCSSText("-webkit-shape-outside", "circle(10px at right 10px bottom 10px)") is "circle(10px at right 10px bottom 10px)" 53 53 PASS getComputedStyleValue("-webkit-shape-outside", "circle(10px at right 10px bottom 10px)") is "circle(10px at right 10px bottom 10px)" … … 75 75 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(at right bottom)") is "ellipse(closest-side closest-side at 100% 100%)" 76 76 PASS getCSSText("-webkit-shape-outside", "ellipse(10px at left top 10px)") is "ellipse(10px at left 0% top 10px)" 77 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px at left top 10px)") is "ellipse(10px closest-side at left 0% top10px)"77 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px at left top 10px)") is "ellipse(10px closest-side at 0% 10px)" 78 78 PASS getCSSText("-webkit-shape-outside", "ellipse(10px at top 10px left 10px)") is "ellipse(10px at left 10px top 10px)" 79 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px at top 10px left 10px)") is "ellipse(10px closest-side at left 10px top10px)"79 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px at top 10px left 10px)") is "ellipse(10px closest-side at 10px 10px)" 80 80 PASS getCSSText("-webkit-shape-outside", "ellipse(10px at right 10px bottom 10px)") is "ellipse(10px at right 10px bottom 10px)" 81 81 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px at right 10px bottom 10px)") is "ellipse(10px closest-side at right 10px bottom 10px)" 82 82 PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px at left top 10px)") is "ellipse(10px 20px at left 0% top 10px)" 83 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 20px at left top 10px)") is "ellipse(10px 20px at left 0% top10px)"83 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 20px at left top 10px)") is "ellipse(10px 20px at 0% 10px)" 84 84 PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px at top 10px left 10px)") is "ellipse(10px 20px at left 10px top 10px)" 85 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 20px at top 10px left 10px)") is "ellipse(10px 20px at left 10px top10px)"85 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 20px at top 10px left 10px)") is "ellipse(10px 20px at 10px 10px)" 86 86 PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px at right 10px bottom 10px)") is "ellipse(10px 20px at right 10px bottom 10px)" 87 87 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 20px at right 10px bottom 10px)") is "ellipse(10px 20px at right 10px bottom 10px)" -
trunk/LayoutTests/fast/shapes/parsing/parsing-test-utils.js
r161436 r162210 31 31 ["circle(at top left)", "circle(at 0% 0%)", "circle(closest-side at 0% 0%)"], 32 32 ["circle(at right bottom)", "circle(at 100% 100%)", "circle(closest-side at 100% 100%)"], 33 ["circle(10px at left top 10px)", "circle(10px at left 0% top 10px)" ],34 ["circle(10px at top 10px left 10px)", "circle(10px at left 10px top 10px)" ],33 ["circle(10px at left top 10px)", "circle(10px at left 0% top 10px)", "circle(10px at 0% 10px)"], 34 ["circle(10px at top 10px left 10px)", "circle(10px at left 10px top 10px)", "circle(10px at 10px 10px)"], 35 35 ["circle(10px at right 10px bottom 10px)", "circle(10px at right 10px bottom 10px)"], 36 36 … … 47 47 ["ellipse(at top left)", "ellipse(at 0% 0%)", "ellipse(closest-side closest-side at 0% 0%)"], 48 48 ["ellipse(at right bottom)", "ellipse(at 100% 100%)", "ellipse(closest-side closest-side at 100% 100%)"], 49 ["ellipse(10px at left top 10px)", "ellipse(10px at left 0% top 10px)", "ellipse(10px closest-side at left 0% top10px)"],50 ["ellipse(10px at top 10px left 10px)", "ellipse(10px at left 10px top 10px)", "ellipse(10px closest-side at left 10px top10px)"],49 ["ellipse(10px at left top 10px)", "ellipse(10px at left 0% top 10px)", "ellipse(10px closest-side at 0% 10px)"], 50 ["ellipse(10px at top 10px left 10px)", "ellipse(10px at left 10px top 10px)", "ellipse(10px closest-side at 10px 10px)"], 51 51 ["ellipse(10px at right 10px bottom 10px)", "ellipse(10px at right 10px bottom 10px)", "ellipse(10px closest-side at right 10px bottom 10px)"], 52 ["ellipse(10px 20px at left top 10px)", "ellipse(10px 20px at left 0% top 10px)" ],53 ["ellipse(10px 20px at top 10px left 10px)", "ellipse(10px 20px at left 10px top 10px)" ],52 ["ellipse(10px 20px at left top 10px)", "ellipse(10px 20px at left 0% top 10px)", "ellipse(10px 20px at 0% 10px)"], 53 ["ellipse(10px 20px at top 10px left 10px)", "ellipse(10px 20px at left 10px top 10px)", "ellipse(10px 20px at 10px 10px)"], 54 54 ["ellipse(10px 20px at right 10px bottom 10px)", "ellipse(10px 20px at right 10px bottom 10px)"], 55 55 -
trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-animation-expected.txt
r160770 r162210 23 23 PASS - "webkitShapeOutside" property for "circle-to-bottomright-using-keyword-box" element at 1s saw something close to: circle(35% at 75% 75%) 24 24 PASS - "webkitShapeOutside" property for "circle-to-bottomright-extended-box" element at 1s saw something close to: circle(35% at 75% 75%) 25 PASS - "webkitShapeOutside" property for "circle-to-bottomright-extended-using-keyword-box" element at 1s saw something close to: circle(35% at 70% 70%)26 PASS - "webkitShapeOutside" property for "circle-to-bottomright-extended-using-keyword-2-box" element at 1s saw something close to: circle(35% at 70% 70%)25 PASS - "webkitShapeOutside" property for "circle-to-bottomright-extended-using-keyword-box" element at 1s saw something close to: circle(35% at calc((50% * 0.5) + ((100% - 10%) * 0.5)) calc((50% * 0.5) + ((100% - 20px) * 0.5))) 26 PASS - "webkitShapeOutside" property for "circle-to-bottomright-extended-using-keyword-2-box" element at 1s saw something close to: circle(35% at calc((50% * 0.5) + ((100% - 10%) * 0.5)) calc((50% * 0.5) + ((100% - 10px) * 0.5))) 27 27 -
trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-animation.html
r160770 r162210 147 147 ["circle-to-bottomright-using-keyword-anim", 1, "circle-to-bottomright-using-keyword-box", "webkitShapeOutside", "circle(35% at 75% 75%)", 0.05], 148 148 ["circle-to-bottomright-extended-anim", 1, "circle-to-bottomright-extended-box", "webkitShapeOutside", "circle(35% at 75% 75%)", 0.05], 149 ["circle-to-bottomright-extended-using-keyword-anim", 1, "circle-to-bottomright-extended-using-keyword-box", "webkitShapeOutside", "circle(35% at 70% 70%)", 0.01],150 ["circle-to-bottomright-extended-using-keyword-2-anim", 1, "circle-to-bottomright-extended-using-keyword-2-box", "webkitShapeOutside", "circle(35% at 70% 70%)", 0.01],149 ["circle-to-bottomright-extended-using-keyword-anim", 1, "circle-to-bottomright-extended-using-keyword-box", "webkitShapeOutside", "circle(35% at calc((50% * 0.5) + ((100% - 10%) * 0.5)) calc((50% * 0.5) + ((100% - 20px) * 0.5)))", 0.01], 150 ["circle-to-bottomright-extended-using-keyword-2-anim", 1, "circle-to-bottomright-extended-using-keyword-2-box", "webkitShapeOutside", "circle(35% at calc((50% * 0.5) + ((100% - 10%) * 0.5)) calc((50% * 0.5) + ((100% - 10px) * 0.5)))", 0.01], 151 151 ]; 152 152 -
trunk/Source/WebCore/ChangeLog
r162208 r162210 1 2014-01-17 Bear Travis <betravis@adobe.com> 2 3 [CSS Shapes] Basic shapes' computed position should be a horizontal and vertical offset 4 https://bugs.webkit.org/show_bug.cgi?id=127010 5 6 Reviewed by Rob Buis. 7 8 This patch updates the computed position values used for blending to be a horizontal 9 left offset and a vertical top offset. When positions include a center, bottom, or 10 right position offset, it is converted to the appropriate top/left coordinate as 11 a calc expression. Serialized values still use the original bottom/right directions 12 when present, and also omit the top/left keywords where possible. 13 14 Updated parsing and animation tests. 15 16 * css/BasicShapeFunctions.cpp: 17 (WebCore::valueForCenterCoordinate): Use the simplified BasicShapeCenterCoordinate, 18 which includes an offset and whether the direction is from the top/left or bottom/right. 19 (WebCore::valueForBasicShape): Ditto. 20 (WebCore::convertToCenterCoordinate): Ditto. 21 (WebCore::basicShapeForValue): Ditto. 22 (WebCore::floatValueForCenterCoordinate): Ditto. 23 * page/animation/CSSPropertyAnimation.cpp: 24 (WebCore::blendFunc): Remove the RenderBox parameter, which is no longer needed. 25 * rendering/style/BasicShapes.cpp: 26 (WebCore::BasicShapeCenterCoordinate::updateComputedLength): Calculate the computed 27 position offset for this center coordinate. 28 (WebCore::BasicShapeRectangle::blend): Remove the RenderBox parameter. 29 (WebCore::DeprecatedBasicShapeCircle::blend): Ditto. 30 (WebCore::BasicShapeCircle::blend): Ditto. 31 (WebCore::DeprecatedBasicShapeEllipse::blend): Ditto. 32 (WebCore::BasicShapeEllipse::blend): Ditto. 33 (WebCore::BasicShapePolygon::blend): Ditto. 34 (WebCore::BasicShapeInsetRectangle::blend): Ditto. 35 (WebCore::BasicShapeInset::blend): Ditto. 36 * rendering/style/BasicShapes.h: 37 (WebCore::BasicShapeCenterCoordinate::BasicShapeCenterCoordinate): Simplify 38 BasicShapeCenterCoordinate to contain an offset and a direction. Also add a 39 computed length, which is an offset from the top/left direction. 40 (WebCore::BasicShapeCenterCoordinate::direction): 41 (WebCore::BasicShapeCenterCoordinate::computedLength): 42 (WebCore::BasicShapeCenterCoordinate::blend): 43 1 44 2014-01-17 Alexey Proskuryakov <ap@apple.com> 2 45 -
trunk/Source/WebCore/css/BasicShapeFunctions.cpp
r162001 r162210 40 40 namespace WebCore { 41 41 42 static PassRefPtr<CSSPrimitiveValue> valueForCenterCoordinate(CSSValuePool& pool, const RenderStyle* style, const BasicShapeCenterCoordinate& center) 43 { 44 CSSValueID keyword = CSSValueInvalid; 45 switch (center.keyword()) { 46 case BasicShapeCenterCoordinate::None: 42 static PassRefPtr<CSSPrimitiveValue> valueForCenterCoordinate(CSSValuePool& pool, const RenderStyle* style, const BasicShapeCenterCoordinate& center, EBoxOrient orientation) 43 { 44 if (center.direction() == BasicShapeCenterCoordinate::TopLeft) 47 45 return pool.createValue(center.length(), style); 48 case BasicShapeCenterCoordinate::Top: 49 keyword = CSSValueTop; 50 break; 51 case BasicShapeCenterCoordinate::Right: 52 keyword = CSSValueRight; 53 break; 54 case BasicShapeCenterCoordinate::Bottom: 55 keyword = CSSValueBottom; 56 break; 57 case BasicShapeCenterCoordinate::Left: 58 keyword = CSSValueLeft; 59 break; 60 } 46 47 CSSValueID keyword = orientation == HORIZONTAL ? CSSValueRight : CSSValueBottom; 61 48 62 49 return pool.createValue(Pair::create(pool.createIdentifierValue(keyword), pool.createValue(center.length(), style))); … … 113 100 RefPtr<CSSBasicShapeCircle> circleValue = CSSBasicShapeCircle::create(); 114 101 115 circleValue->setCenterX(valueForCenterCoordinate(pool, style, circle->centerX() ));116 circleValue->setCenterY(valueForCenterCoordinate(pool, style, circle->centerY() ));102 circleValue->setCenterX(valueForCenterCoordinate(pool, style, circle->centerX(), HORIZONTAL)); 103 circleValue->setCenterY(valueForCenterCoordinate(pool, style, circle->centerY(), VERTICAL)); 117 104 circleValue->setRadius(basicShapeRadiusToCSSValue(style, pool, circle->radius())); 118 105 basicShapeValue = circleValue.release(); … … 135 122 RefPtr<CSSBasicShapeEllipse> ellipseValue = CSSBasicShapeEllipse::create(); 136 123 137 ellipseValue->setCenterX(valueForCenterCoordinate(pool, style, ellipse->centerX() ));138 ellipseValue->setCenterY(valueForCenterCoordinate(pool, style, ellipse->centerY() ));124 ellipseValue->setCenterX(valueForCenterCoordinate(pool, style, ellipse->centerX(), HORIZONTAL)); 125 ellipseValue->setCenterY(valueForCenterCoordinate(pool, style, ellipse->centerY(), VERTICAL)); 139 126 ellipseValue->setRadiusX(basicShapeRadiusToCSSValue(style, pool, ellipse->radiusX())); 140 127 ellipseValue->setRadiusY(basicShapeRadiusToCSSValue(style, pool, ellipse->radiusY())); … … 202 189 static BasicShapeCenterCoordinate convertToCenterCoordinate(const RenderStyle* style, const RenderStyle* rootStyle, CSSPrimitiveValue* value) 203 190 { 204 if (Pair* pair = value->getPairValue()) { 205 BasicShapeCenterCoordinate::Keyword keyword = BasicShapeCenterCoordinate::None; 206 switch (pair->first()->getValueID()) { 207 case CSSValueTop: 208 keyword = BasicShapeCenterCoordinate::Top; 209 break; 210 case CSSValueRight: 211 keyword = BasicShapeCenterCoordinate::Right; 212 break; 213 case CSSValueBottom: 214 keyword = BasicShapeCenterCoordinate::Bottom; 215 break; 216 case CSSValueLeft: 217 keyword = BasicShapeCenterCoordinate::Left; 218 break; 219 default: 220 ASSERT_NOT_REACHED(); 221 break; 222 } 223 return BasicShapeCenterCoordinate(keyword, convertToLength(style, rootStyle, pair->second())); 224 } 225 226 return BasicShapeCenterCoordinate(convertToLength(style, rootStyle, value)); 191 BasicShapeCenterCoordinate::Direction direction; 192 Length offset = Length(0, Fixed); 193 194 CSSValueID keyword = CSSValueTop; 195 if (!value) 196 keyword = CSSValueCenter; 197 else if (value->isValueID()) 198 keyword = value->getValueID(); 199 else if (Pair* pair = value->getPairValue()) { 200 keyword = pair->first()->getValueID(); 201 offset = convertToLength(style, rootStyle, pair->second()); 202 } else 203 offset = convertToLength(style, rootStyle, value); 204 205 switch (keyword) { 206 case CSSValueTop: 207 case CSSValueLeft: 208 direction = BasicShapeCenterCoordinate::TopLeft; 209 break; 210 case CSSValueRight: 211 case CSSValueBottom: 212 direction = BasicShapeCenterCoordinate::BottomRight; 213 break; 214 case CSSValueCenter: 215 direction = BasicShapeCenterCoordinate::TopLeft; 216 offset = Length(50, Percent); 217 break; 218 default: 219 ASSERT_NOT_REACHED(); 220 direction = BasicShapeCenterCoordinate::TopLeft; 221 break; 222 } 223 224 return BasicShapeCenterCoordinate(direction, offset); 227 225 } 228 226 … … 289 287 RefPtr<BasicShapeCircle> circle = BasicShapeCircle::create(); 290 288 291 if (circleValue->centerX() && circleValue->centerY()) { 292 circle->setCenterX(convertToCenterCoordinate(style, rootStyle, circleValue->centerX())); 293 circle->setCenterY(convertToCenterCoordinate(style, rootStyle, circleValue->centerY())); 294 } else { 295 circle->setCenterX(BasicShapeCenterCoordinate(Length(50, Percent))); 296 circle->setCenterY(BasicShapeCenterCoordinate(Length(50, Percent))); 297 } 289 circle->setCenterX(convertToCenterCoordinate(style, rootStyle, circleValue->centerX())); 290 circle->setCenterY(convertToCenterCoordinate(style, rootStyle, circleValue->centerY())); 298 291 circle->setRadius(cssValueToBasicShapeRadius(style, rootStyle, circleValue->radius())); 299 292 … … 317 310 RefPtr<BasicShapeEllipse> ellipse = BasicShapeEllipse::create(); 318 311 319 if (ellipseValue->centerX() && ellipseValue->centerY()) { 320 ellipse->setCenterX(convertToCenterCoordinate(style, rootStyle, ellipseValue->centerX())); 321 ellipse->setCenterY(convertToCenterCoordinate(style, rootStyle, ellipseValue->centerY())); 322 } else { 323 ellipse->setCenterX(BasicShapeCenterCoordinate(Length(50, Percent))); 324 ellipse->setCenterY(BasicShapeCenterCoordinate(Length(50, Percent))); 325 } 312 ellipse->setCenterX(convertToCenterCoordinate(style, rootStyle, ellipseValue->centerX())); 313 ellipse->setCenterY(convertToCenterCoordinate(style, rootStyle, ellipseValue->centerY())); 314 326 315 ellipse->setRadiusX(cssValueToBasicShapeRadius(style, rootStyle, ellipseValue->radiusX())); 327 316 ellipse->setRadiusY(cssValueToBasicShapeRadius(style, rootStyle, ellipseValue->radiusY())); … … 429 418 { 430 419 float offset = floatValueForLength(center.length(), boxDimension); 431 switch (center.keyword()) { 432 case BasicShapeCenterCoordinate::None: 420 if (center.direction() == BasicShapeCenterCoordinate::TopLeft) 433 421 return offset; 434 case BasicShapeCenterCoordinate::Top: 435 case BasicShapeCenterCoordinate::Left: 436 return offset; 437 case BasicShapeCenterCoordinate::Bottom: 438 case BasicShapeCenterCoordinate::Right: 439 return boxDimension - offset; 440 } 441 442 ASSERT_NOT_REACHED(); 443 return 0; 444 } 445 446 } 422 return boxDimension - offset; 423 } 424 425 } -
trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp
r161696 r162210 126 126 } 127 127 128 static inline PassRefPtr<ClipPathOperation> blendFunc(const AnimationBase* anim, ClipPathOperation* from, ClipPathOperation* to, double progress)128 static inline PassRefPtr<ClipPathOperation> blendFunc(const AnimationBase*, ClipPathOperation* from, ClipPathOperation* to, double progress) 129 129 { 130 130 if (!from || !to) … … 141 141 return to; 142 142 143 ASSERT(anim->renderer()->isBox()); 144 return ShapeClipPathOperation::create(toShape->blend(fromShape, progress, *toRenderBox(anim->renderer()))); 143 return ShapeClipPathOperation::create(toShape->blend(fromShape, progress)); 145 144 } 146 145 147 146 #if ENABLE(CSS_SHAPES) 148 static inline PassRefPtr<ShapeValue> blendFunc(const AnimationBase* anim, ShapeValue* from, ShapeValue* to, double progress)147 static inline PassRefPtr<ShapeValue> blendFunc(const AnimationBase*, ShapeValue* from, ShapeValue* to, double progress) 149 148 { 150 149 if (!from || !to) … … 161 160 return to; 162 161 163 ASSERT(anim->renderer()->isBox()); 164 return ShapeValue::createShapeValue(toShape->blend(fromShape, progress, *toRenderBox(anim->renderer()))); 162 return ShapeValue::createShapeValue(toShape->blend(fromShape, progress)); 165 163 } 166 164 #endif -
trunk/Source/WebCore/rendering/style/BasicShapes.cpp
r161569 r162210 33 33 34 34 #include "BasicShapeFunctions.h" 35 #include "CalculationValue.h" 35 36 #include "FloatRect.h" 36 37 #include "LengthFunctions.h" … … 39 40 40 41 namespace WebCore { 42 43 void BasicShapeCenterCoordinate::updateComputedLength() 44 { 45 if (m_direction == TopLeft) { 46 m_computedLength = m_length.isUndefined() ? Length(0, Fixed) : m_length; 47 return; 48 } 49 if (m_length.isUndefined()) { 50 m_computedLength = Length(100, Percent); 51 return; 52 } 53 54 OwnPtr<CalcExpressionLength> lhs = adoptPtr(new CalcExpressionLength(Length(100, Percent))); 55 OwnPtr<CalcExpressionLength> rhs = adoptPtr(new CalcExpressionLength(m_length)); 56 OwnPtr<CalcExpressionBinaryOperation> op = adoptPtr(new CalcExpressionBinaryOperation(lhs.release(), rhs.release(), CalcSubtract)); 57 m_computedLength = Length(CalculationValue::create(op.release(), CalculationRangeAll)); 58 } 41 59 42 60 bool BasicShape::canBlend(const BasicShape* other) const … … 74 92 } 75 93 76 FloatSize BasicShape::referenceBoxSize(const RenderBox& renderer) const77 {78 switch (layoutBox()) {79 case ContentBox:80 return renderer.contentBoxRect().size();81 case PaddingBox:82 return renderer.paddingBoxRect().size();83 case BorderBox:84 return renderer.size();85 case BoxMissing: // If <box> is not supplied, then the reference box defaults to margin-box.86 case MarginBox:87 return FloatSize(renderer.marginLeft() + renderer.width() + renderer.marginRight(),88 renderer.marginTop() + renderer.height() + renderer.marginBottom());89 case BoundingBox:90 break;91 }92 93 ASSERT_NOT_REACHED();94 return FloatSize();95 }96 97 Length BasicShapeCenterCoordinate::lengthForBlending(const FloatSize& boxSize) const98 {99 Length length = this->length();100 if (keyword() == Right)101 return Length(100 - (length.isPercent() ? length.percent() : 100.f * (length.value() / boxSize.width())), Percent);102 if (keyword() == Bottom)103 return Length(100 - (length.isPercent() ? length.percent() : 100.f * (length.value() / boxSize.height())), Percent);104 return length;105 }106 107 94 void BasicShapeRectangle::path(Path& path, const FloatRect& boundingBox) 108 95 { … … 122 109 } 123 110 124 PassRefPtr<BasicShape> BasicShapeRectangle::blend(const BasicShape* other, double progress , const RenderBox&) const111 PassRefPtr<BasicShape> BasicShapeRectangle::blend(const BasicShape* other, double progress) const 125 112 { 126 113 ASSERT(type() == other->type()); … … 152 139 } 153 140 154 PassRefPtr<BasicShape> DeprecatedBasicShapeCircle::blend(const BasicShape* other, double progress , const RenderBox&) const141 PassRefPtr<BasicShape> DeprecatedBasicShapeCircle::blend(const BasicShape* other, double progress) const 155 142 { 156 143 ASSERT(type() == other->type()); … … 194 181 } 195 182 196 PassRefPtr<BasicShape> BasicShapeCircle::blend(const BasicShape* other, double progress , const RenderBox& renderer) const183 PassRefPtr<BasicShape> BasicShapeCircle::blend(const BasicShape* other, double progress) const 197 184 { 198 185 ASSERT(type() == other->type()); … … 200 187 RefPtr<BasicShapeCircle> result = BasicShapeCircle::create(); 201 188 202 FloatSize boxSize = referenceBoxSize(renderer); 203 result->setCenterX(m_centerX.blend(o->centerX(), progress, boxSize)); 204 result->setCenterY(m_centerY.blend(o->centerY(), progress, boxSize)); 189 result->setCenterX(m_centerX.blend(o->centerX(), progress)); 190 result->setCenterY(m_centerY.blend(o->centerY(), progress)); 205 191 result->setRadius(m_radius.blend(o->radius(), progress)); 206 192 return result.release(); … … 222 208 } 223 209 224 PassRefPtr<BasicShape> DeprecatedBasicShapeEllipse::blend(const BasicShape* other, double progress , const RenderBox&) const210 PassRefPtr<BasicShape> DeprecatedBasicShapeEllipse::blend(const BasicShape* other, double progress) const 225 211 { 226 212 ASSERT(type() == other->type()); … … 262 248 } 263 249 264 PassRefPtr<BasicShape> BasicShapeEllipse::blend(const BasicShape* other, double progress , const RenderBox& renderer) const250 PassRefPtr<BasicShape> BasicShapeEllipse::blend(const BasicShape* other, double progress) const 265 251 { 266 252 ASSERT(type() == other->type()); … … 277 263 } 278 264 279 FloatSize boxSize = referenceBoxSize(renderer); 280 result->setCenterX(m_centerX.blend(o->centerX(), progress, boxSize)); 281 result->setCenterY(m_centerY.blend(o->centerY(), progress, boxSize)); 265 result->setCenterX(m_centerX.blend(o->centerX(), progress)); 266 result->setCenterY(m_centerY.blend(o->centerY(), progress)); 282 267 result->setRadiusX(m_radiusX.blend(o->radiusX(), progress)); 283 268 result->setRadiusY(m_radiusY.blend(o->radiusY(), progress)); … … 303 288 } 304 289 305 PassRefPtr<BasicShape> BasicShapePolygon::blend(const BasicShape* other, double progress , const RenderBox&) const290 PassRefPtr<BasicShape> BasicShapePolygon::blend(const BasicShape* other, double progress) const 306 291 { 307 292 ASSERT(type() == other->type()); … … 345 330 } 346 331 347 PassRefPtr<BasicShape> BasicShapeInsetRectangle::blend(const BasicShape* other, double progress , const RenderBox&) const332 PassRefPtr<BasicShape> BasicShapeInsetRectangle::blend(const BasicShape* other, double progress) const 348 333 { 349 334 ASSERT(type() == other->type()); … … 391 376 } 392 377 393 PassRefPtr<BasicShape> BasicShapeInset::blend(const BasicShape* other, double progress , const RenderBox&) const378 PassRefPtr<BasicShape> BasicShapeInset::blend(const BasicShape* other, double progress) const 394 379 { 395 380 ASSERT(type() == other->type()); -
trunk/Source/WebCore/rendering/style/BasicShapes.h
r162139 r162210 64 64 virtual void path(Path&, const FloatRect&) = 0; 65 65 virtual WindRule windRule() const { return RULE_NONZERO; } 66 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double , const RenderBox&) const = 0;66 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const = 0; 67 67 68 68 virtual Type type() const = 0; … … 76 76 { 77 77 } 78 79 FloatSize referenceBoxSize(const RenderBox&) const;80 78 81 79 private: … … 110 108 111 109 virtual void path(Path&, const FloatRect&) override; 112 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double , const RenderBox&) const override;110 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override; 113 111 114 112 virtual Type type() const override { return BasicShapeRectangleType; } … … 126 124 class BasicShapeCenterCoordinate { 127 125 public: 128 enum Keyword { 129 None, 130 Top, 131 Right, 132 Bottom, 133 Left 126 enum Direction { 127 TopLeft, 128 BottomRight 134 129 }; 135 BasicShapeCenterCoordinate() : m_keyword(None), m_length(Undefined) { } 136 explicit BasicShapeCenterCoordinate(Length length) : m_keyword(None), m_length(length) { } 137 BasicShapeCenterCoordinate(Keyword keyword, Length length) : m_keyword(keyword), m_length(length) { } 138 BasicShapeCenterCoordinate(const BasicShapeCenterCoordinate& other) : m_keyword(other.keyword()), m_length(other.length()) { } 139 140 Keyword keyword() const { return m_keyword; } 130 131 BasicShapeCenterCoordinate() 132 : m_direction(TopLeft) 133 , m_length(Undefined) 134 { 135 updateComputedLength(); 136 } 137 138 BasicShapeCenterCoordinate(Direction direction, Length length) 139 : m_direction(direction) 140 , m_length(length) 141 { 142 updateComputedLength(); 143 } 144 145 BasicShapeCenterCoordinate(const BasicShapeCenterCoordinate& other) 146 : m_direction(other.direction()) 147 , m_length(other.length()) 148 , m_computedLength(other.m_computedLength) 149 { 150 } 151 152 Direction direction() const { return m_direction; } 141 153 const Length& length() const { return m_length; } 142 Length lengthForBlending(const FloatSize&) const;143 144 BasicShapeCenterCoordinate blend(const BasicShapeCenterCoordinate& other, double progress , const FloatSize& boxSize) const145 { 146 return BasicShapeCenterCoordinate( lengthForBlending(boxSize).blend(other.lengthForBlending(boxSize), progress));147 } 148 149 private: 150 Keyword m_keyword;154 const Length& computedLength() const { return m_computedLength; } 155 156 BasicShapeCenterCoordinate blend(const BasicShapeCenterCoordinate& other, double progress) const 157 { 158 return BasicShapeCenterCoordinate(TopLeft, m_computedLength.blend(other.m_computedLength, progress)); 159 } 160 161 private: 162 Direction m_direction; 151 163 Length m_length; 164 Length m_computedLength; 165 166 void updateComputedLength(); 152 167 }; 153 168 … … 201 216 202 217 virtual void path(Path&, const FloatRect&) override; 203 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double , const RenderBox&) const override;218 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override; 204 219 205 220 virtual Type type() const override { return BasicShapeCircleType; } … … 225 240 226 241 virtual void path(Path&, const FloatRect&) override; 227 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double , const RenderBox&) const override;242 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override; 228 243 229 244 virtual Type type() const override { return DeprecatedBasicShapeCircleType; } … … 252 267 253 268 virtual void path(Path&, const FloatRect&) override; 254 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double , const RenderBox&) const override;269 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override; 255 270 256 271 virtual Type type() const override { return BasicShapeEllipseType; } … … 279 294 280 295 virtual void path(Path&, const FloatRect&) override; 281 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double , const RenderBox&) const override;296 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override; 282 297 283 298 virtual Type type() const override { return DeprecatedBasicShapeEllipseType; } … … 303 318 304 319 virtual void path(Path&, const FloatRect&) override; 305 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double , const RenderBox&) const override;320 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override; 306 321 307 322 virtual WindRule windRule() const override { return m_windRule; } … … 344 359 345 360 virtual void path(Path&, const FloatRect&) override; 346 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double , const RenderBox&) const override;361 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override; 347 362 348 363 virtual Type type() const override { return BasicShapeInsetRectangleType; } … … 383 398 384 399 virtual void path(Path&, const FloatRect&) override; 385 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double , const RenderBox&) const override;400 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override; 386 401 387 402 virtual Type type() const override { return BasicShapeInsetType; }
Note: See TracChangeset
for help on using the changeset viewer.