Changeset 159979 in webkit
- Timestamp:
- Dec 2, 2013 4:10:21 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 12 added
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r159975 r159979 1 2013-12-02 Bem Jones-Bey <bjonesbe@adobe.com> 2 3 [css shapes] Layout support for new circle shape syntax 4 https://bugs.webkit.org/show_bug.cgi?id=124619 5 6 Reviewed by Dirk Schulze. 7 8 Add a few tests for the new circle syntax. The old tests in 9 LayoutTests/csswg will be removed when the old syntax is removed. 10 11 Also update existing shape-inside, animation, and clip-path tests to 12 test the new syntax. 13 14 * animations/resources/animation-test-helpers.js: 15 (parseBasicShape): 16 * LayoutTests/animations/resources/animation-test-helpers.js: 17 * LayoutTests/css3/masking/clip-path-animation-expected.txt: 18 * LayoutTests/css3/masking/clip-path-animation.html: 19 * LayoutTests/css3/masking/clip-path-circle-filter.html: 20 * LayoutTests/css3/masking/clip-path-circle-overflow-hidden.html: 21 * LayoutTests/css3/masking/clip-path-circle-overflow.html: 22 * LayoutTests/css3/masking/clip-path-circle-relative-overflow.html: 23 * LayoutTests/css3/masking/clip-path-circle.html: 24 * LayoutTests/css3/masking/clip-path-restore.html: 25 * LayoutTests/fast/shapes/parsing/parsing-shape-inside-expected.txt: 26 * LayoutTests/fast/shapes/parsing/parsing-shape-outside-expected.txt: 27 * LayoutTests/fast/shapes/parsing/parsing-test-utils.js: 28 * LayoutTests/fast/shapes/shape-inside/shape-inside-animation-expected.txt: 29 * LayoutTests/fast/shapes/shape-inside/shape-inside-animation.html: 30 * LayoutTests/fast/shapes/shape-inside/shape-inside-calc-crash-expected.txt: 31 * LayoutTests/fast/shapes/shape-inside/shape-inside-calc-crash.html: 32 * LayoutTests/fast/shapes/shape-inside/shape-inside-circle-padding.html: 33 * LayoutTests/fast/shapes/shape-inside/shape-inside-circle.html: 34 * LayoutTests/fast/shapes/shape-inside/shape-inside-dynamic-nested.html: 35 * LayoutTests/fast/shapes/shape-inside/shape-inside-empty-expected.html: 36 * LayoutTests/fast/shapes/shape-inside/shape-inside-empty.html: 37 * fast/shapes/shape-outside-floats/shape-outside-animation-expected.txt: 38 * fast/shapes/shape-outside-floats/shape-outside-animation.html: 39 * fast/shapes/shape-outside-floats/shape-outside-floats-circle-000-expected.html: Added. 40 * fast/shapes/shape-outside-floats/shape-outside-floats-circle-000.html: Added. 41 * fast/shapes/shape-outside-floats/shape-outside-floats-circle-001-expected.html: Added. 42 * fast/shapes/shape-outside-floats/shape-outside-floats-circle-001.html: Added. 43 * fast/shapes/shape-outside-floats/shape-outside-floats-circle-002-expected.html: Added. 44 * fast/shapes/shape-outside-floats/shape-outside-floats-circle-002.html: Added. 45 * fast/shapes/shape-outside-floats/shape-outside-floats-circle-003-expected.html: Added. 46 * fast/shapes/shape-outside-floats/shape-outside-floats-circle-003.html: Added. 47 * fast/shapes/shape-outside-floats/shape-outside-floats-circle-004-expected.html: Added. 48 * fast/shapes/shape-outside-floats/shape-outside-floats-circle-004.html: Added. 49 * fast/shapes/shape-outside-floats/shape-outside-floats-circle-005-expected.html: Added. 50 * fast/shapes/shape-outside-floats/shape-outside-floats-circle-005.html: Added. 51 1 52 2013-12-02 Alexey Proskuryakov <ap@apple.com> 2 53 -
trunk/LayoutTests/animations/resources/animation-test-helpers.js
r156916 r159979 217 217 break; 218 218 case "circle": 219 matches = s.match("circle\\((.*)\\s *,\\s*(.*)\\s*,\\s*(.*)\\)");219 matches = s.match("circle\\((.*)\\s+at\\s+(.*)\\s+(.*)\\)"); 220 220 break; 221 221 case "ellipse": -
trunk/LayoutTests/css3/masking/clip-path-animation-expected.txt
r155105 r159979 1 1 2 2 PASS - "webkitClipPath" property for "rectangle-box" element at 1s saw something close to: rectangle(10%, 10%, 80%, 80%, 0px, 0px) 3 PASS - "webkitClipPath" property for "circle-box" element at 1s saw something close to: circle(35% , 35%,35%)3 PASS - "webkitClipPath" property for "circle-box" element at 1s saw something close to: circle(35% at 35% 35%) 4 4 PASS - "webkitClipPath" property for "ellipse-box" element at 1s saw something close to: ellipse(35%, 35%, 35%, 30%) 5 5 PASS - "webkitClipPath" property for "polygon-box" element at 1s saw something close to: polygon(nonzero, 10% 10%, 90% 10%, 90% 90%, 10% 90%) -
trunk/LayoutTests/css3/masking/clip-path-animation.html
r155105 r159979 38 38 39 39 @-webkit-keyframes circle-anim { 40 from { -webkit-clip-path: circle(50% , 50%,50%); }41 to { -webkit-clip-path: circle(20% , 20%,20%); }40 from { -webkit-clip-path: circle(50% at 50% 50%); } 41 to { -webkit-clip-path: circle(20% at 20% 20%); } 42 42 } 43 43 … … 64 64 // [animation-name, time, element-id, property, expected-value, tolerance] 65 65 ["rectangle-anim", 1, "rectangle-box", "webkitClipPath", "rectangle(10%, 10%, 80%, 80%, 0px, 0px)", 0.05], 66 ["circle-anim", 1, "circle-box", "webkitClipPath", "circle(35% , 35%,35%)", 0.05],66 ["circle-anim", 1, "circle-box", "webkitClipPath", "circle(35% at 35% 35%)", 0.05], 67 67 ["ellipse-anim", 1, "ellipse-box", "webkitClipPath", "ellipse(35%, 35%, 35%, 30%)", 0.05], 68 68 ["polygon-anim", 1, "polygon-box", "webkitClipPath", "polygon(nonzero, 10% 10%, 90% 10%, 90% 90%, 10% 90%)", 0.05], -
trunk/LayoutTests/css3/masking/clip-path-circle-filter.html
r127608 r159979 8 8 background-color: green; 9 9 -webkit-filter: blur(5px); 10 -webkit-clip-path: circle( 100px, 100px, 90px);10 -webkit-clip-path: circle(90px at 100px 100px); 11 11 } 12 12 </style> -
trunk/LayoutTests/css3/masking/clip-path-circle-overflow-hidden.html
r127608 r159979 7 7 height: 200px; 8 8 overflow: hidden; 9 -webkit-clip-path: circle(100px , 100px,100px);9 -webkit-clip-path: circle(100px at 100px 100px); 10 10 } 11 11 .child { -
trunk/LayoutTests/css3/masking/clip-path-circle-overflow.html
r127608 r159979 8 8 background-color: green; 9 9 border: 20px solid black; 10 -webkit-clip-path: circle(130px , 130px,130px);10 -webkit-clip-path: circle(130px at 130px 130px); 11 11 } 12 12 </style> -
trunk/LayoutTests/css3/masking/clip-path-circle-relative-overflow.html
r127608 r159979 8 8 background-color: green; 9 9 border: 20px solid black; 10 -webkit-clip-path: circle(50% , 50%,50%);10 -webkit-clip-path: circle(50% at 50% 50%); 11 11 } 12 12 </style> -
trunk/LayoutTests/css3/masking/clip-path-circle.html
r127608 r159979 7 7 height: 200px; 8 8 background-color: green; 9 -webkit-clip-path: circle(100px , 100px,100px);9 -webkit-clip-path: circle(100px at 100px 100px); 10 10 } 11 11 </style> -
trunk/LayoutTests/css3/masking/clip-path-restore.html
r129215 r159979 10 10 height: 200px; 11 11 background-color: green; 12 -webkit-clip-path: circle(100px , 100px,100px);12 -webkit-clip-path: circle(100px at 100px 100px); 13 13 } 14 14 .red-marker { -
trunk/LayoutTests/fast/shapes/parsing/parsing-shape-inside-expected.txt
r159968 r159979 28 28 PASS getCSSText("-webkit-shape-inside", "circle()") is "circle()" 29 29 PASS getComputedStyleValue("-webkit-shape-inside", "circle()") is "circle(closest-side at 50% 50%)" 30 PASS getCSSText("-webkit-shape-inside", "circle(farthest-side)") is "circle(farthest-side)" 31 PASS getComputedStyleValue("-webkit-shape-inside", "circle(farthest-side)") is "circle(farthest-side at 50% 50%)" 32 PASS getCSSText("-webkit-shape-inside", "circle(closest-side)") is "circle(closest-side)" 33 PASS getComputedStyleValue("-webkit-shape-inside", "circle(closest-side)") is "circle(closest-side at 50% 50%)" 30 34 PASS getCSSText("-webkit-shape-inside", "circle(10px)") is "circle(10px)" 31 35 PASS getComputedStyleValue("-webkit-shape-inside", "circle(10px)") is "circle(10px at 50% 50%)" -
trunk/LayoutTests/fast/shapes/parsing/parsing-shape-outside-expected.txt
r159968 r159979 28 28 PASS getCSSText("-webkit-shape-outside", "circle()") is "circle()" 29 29 PASS getComputedStyleValue("-webkit-shape-outside", "circle()") is "circle(closest-side at 50% 50%)" 30 PASS getCSSText("-webkit-shape-outside", "circle(farthest-side)") is "circle(farthest-side)" 31 PASS getComputedStyleValue("-webkit-shape-outside", "circle(farthest-side)") is "circle(farthest-side at 50% 50%)" 32 PASS getCSSText("-webkit-shape-outside", "circle(closest-side)") is "circle(closest-side)" 33 PASS getComputedStyleValue("-webkit-shape-outside", "circle(closest-side)") is "circle(closest-side at 50% 50%)" 30 34 PASS getCSSText("-webkit-shape-outside", "circle(10px)") is "circle(10px)" 31 35 PASS getComputedStyleValue("-webkit-shape-outside", "circle(10px)") is "circle(10px at 50% 50%)" -
trunk/LayoutTests/fast/shapes/parsing/parsing-test-utils.js
r159968 r159979 22 22 23 23 ["circle()", "circle()", "circle(closest-side at 50% 50%)"], 24 ["circle(farthest-side)", "circle(farthest-side)", "circle(farthest-side at 50% 50%)"], 25 ["circle(closest-side)", "circle(closest-side)", "circle(closest-side at 50% 50%)"], 24 26 ["circle(10px)", "circle(10px)", "circle(10px at 50% 50%)"], 25 27 ["circle(10px at 10px)", "circle(10px at 10px 50%)"], -
trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-animation-expected.txt
r152800 r159979 1 1 Moving Text Moving Text Moving Text Moving Text 2 2 PASS - "webkitShapeInside" property for "rectangle-box" element at 1s saw something close to: rectangle(10%, 10%, 80%, 80%, 0px, 0px) 3 PASS - "webkitShapeInside" property for "circle-box" element at 1s saw something close to: circle(35% , 35%,35%)3 PASS - "webkitShapeInside" property for "circle-box" element at 1s saw something close to: circle(35% at 35% 35%) 4 4 PASS - "webkitShapeInside" property for "ellipse-box" element at 1s saw something close to: ellipse(35%, 35%, 35%, 30%) 5 5 PASS - "webkitShapeInside" property for "polygon-box" element at 1s saw something close to: polygon(nonzero, 10% 10%, 90% 10%, 90% 90%, 10% 90%) -
trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-animation.html
r154500 r159979 34 34 35 35 @-webkit-keyframes circle-anim { 36 from { -webkit-shape-inside: circle(50% , 50%,50%); }37 to { -webkit-shape-inside: circle(20% , 20%,20%); }36 from { -webkit-shape-inside: circle(50% at 50% 50%); } 37 to { -webkit-shape-inside: circle(20% at 20% 20%); } 38 38 } 39 39 … … 54 54 // [animation-name, time, element-id, property, expected-value, tolerance] 55 55 ["rectangle-anim", 1, "rectangle-box", "webkitShapeInside", "rectangle(10%, 10%, 80%, 80%, 0px, 0px)", 0.05], 56 ["circle-anim", 1, "circle-box", "webkitShapeInside", "circle(35% , 35%,35%)", 0.05],56 ["circle-anim", 1, "circle-box", "webkitShapeInside", "circle(35% at 35% 35%)", 0.05], 57 57 ["ellipse-anim", 1, "ellipse-box", "webkitShapeInside", "ellipse(35%, 35%, 35%, 30%)", 0.05], 58 58 ["polygon-anim", 1, "polygon-box", "webkitShapeInside", "polygon(nonzero, 10% 10%, 90% 10%, 90% 90%, 10% 90%)", 0.05], -
trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-calc-crash-expected.txt
r156586 r159979 1 PASS window.getComputedStyle(document.getElementById('shape-inside'))['-webkit-shape-inside'] is 'circle( 30%, 50%,50%)'1 PASS window.getComputedStyle(document.getElementById('shape-inside'))['-webkit-shape-inside'] is 'circle(50% at 30% 50%)' 2 2 This test should not crash 3 3 Hello -
trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-calc-crash.html
r156586 r159979 8 8 <script> 9 9 window.onload = function() { 10 shouldBe("window.getComputedStyle(document.getElementById('shape-inside'))['-webkit-shape-inside']", "'circle( 30%, 50%,50%)'");10 shouldBe("window.getComputedStyle(document.getElementById('shape-inside'))['-webkit-shape-inside']", "'circle(50% at 30% 50%)'"); 11 11 }; 12 12 </script> 13 13 <style> 14 14 #shape-inside { 15 -webkit-shape-inside: circle( calc(50% - 20%), 50%,50%);15 -webkit-shape-inside: circle(50% at calc(50% - 20%) 50%); 16 16 } 17 17 </style> -
trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-circle-padding.html
r154500 r159979 10 10 width: 400px; 11 11 height: 400px; 12 -webkit-shape-inside: circle( 200px, 200px, 150px);12 -webkit-shape-inside: circle(150px at 200px 200px); 13 13 -webkit-shape-padding: 50px; 14 14 font: 141.42px/1 Ahem, sans-serif; -
trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-circle.html
r154500 r159979 10 10 width: 400px; 11 11 height: 400px; 12 -webkit-shape-inside: circle( 200px, 200px, 100px);12 -webkit-shape-inside: circle(100px at 200px 200px); 13 13 font: 141.42px/1 Ahem, sans-serif; 14 14 -
trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-dynamic-nested.html
r154500 r159979 56 56 } 57 57 .inside-alt { 58 -webkit-shape-inside: circle(50% , 50%,50%);58 -webkit-shape-inside: circle(50% at 50% 50%); 59 59 } 60 60 .outside { … … 62 62 } 63 63 .outside-alt { 64 -webkit-shape-inside: circle(50% , 50%,50%);64 -webkit-shape-inside: circle(50% at 50% 50%); 65 65 } 66 66 </style> -
trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-empty-expected.html
r159792 r159979 22 22 </div> 23 23 <div> 24 <p>This text should be pushed down below the green rectangle. (There is a circle(0px , 0px,0px) shape-inside CSS property on the green rectangle.)</p>24 <p>This text should be pushed down below the green rectangle. (There is a circle(0px at 0px 0px) shape-inside CSS property on the green rectangle.)</p> 25 25 </div> 26 26 <div> -
trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-empty.html
r159792 r159979 20 20 21 21 #shape-inside-circle-radius0 { 22 -webkit-shape-inside: circle(0px , 0px,0px);22 -webkit-shape-inside: circle(0px at 0px 0px); 23 23 } 24 24 … … 49 49 </p> 50 50 <p id="shape-inside-circle-radius0"> 51 This text should be pushed down below the green rectangle. (There is a circle(0px , 0px,0px) shape-inside CSS property on the green rectangle.)51 This text should be pushed down below the green rectangle. (There is a circle(0px at 0px 0px) shape-inside CSS property on the green rectangle.) 52 52 </p> 53 53 <p id="shape-inside-ellipse-radiusX0"> -
trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-animation-expected.txt
r156916 r159979 4 4 Moving Text 5 5 PASS - "webkitShapeOutside" property for "rectangle-box" element at 1s saw something close to: rectangle(10%, 10%, 80%, 80%, 0px, 0px) 6 PASS - "webkitShapeOutside" property for "circle-box" element at 1s saw something close to: circle(35% , 35%,35%)6 PASS - "webkitShapeOutside" property for "circle-box" element at 1s saw something close to: circle(35% at 35% 35%) 7 7 PASS - "webkitShapeOutside" property for "ellipse-box" element at 1s saw something close to: ellipse(35%, 35%, 35%, 30%) 8 8 PASS - "webkitShapeOutside" property for "polygon-box" element at 1s saw something close to: polygon(nonzero, 10% 10%, 90% 10%, 90% 90%, 10% 90%) -
trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-animation.html
r156916 r159979 38 38 39 39 @-webkit-keyframes circle-anim { 40 from { -webkit-shape-outside: circle(50% , 50%,50%); }41 to { -webkit-shape-outside: circle(20% , 20%,20%); }40 from { -webkit-shape-outside: circle(50% at 50% 50%); } 41 to { -webkit-shape-outside: circle(20% at 20% 20%); } 42 42 } 43 43 … … 58 58 // [animation-name, time, element-id, property, expected-value, tolerance] 59 59 ["rectangle-anim", 1, "rectangle-box", "webkitShapeOutside", "rectangle(10%, 10%, 80%, 80%, 0px, 0px)", 0.05], 60 ["circle-anim", 1, "circle-box", "webkitShapeOutside", "circle(35% , 35%,35%)", 0.05],60 ["circle-anim", 1, "circle-box", "webkitShapeOutside", "circle(35% at 35% 35%)", 0.05], 61 61 ["ellipse-anim", 1, "ellipse-box", "webkitShapeOutside", "ellipse(35%, 35%, 35%, 30%)", 0.05], 62 62 ["polygon-anim", 1, "polygon-box", "webkitShapeOutside", "polygon(nonzero, 10% 10%, 90% 10%, 90% 90%, 10% 90%)", 0.05], -
trunk/Source/WebCore/ChangeLog
r159975 r159979 1 2013-12-02 Bem Jones-Bey <bjonesbe@adobe.com> 2 3 [css shapes] Layout support for new circle shape syntax 4 https://bugs.webkit.org/show_bug.cgi?id=124619 5 6 Reviewed by Dirk Schulze. 7 8 Implement support for doing layout with the new circle shape syntax, 9 inclduing basic animation support. 10 11 Tests: fast/shapes/shape-outside-floats/shape-outside-floats-circle-000.html 12 fast/shapes/shape-outside-floats/shape-outside-floats-circle-001.html 13 fast/shapes/shape-outside-floats/shape-outside-floats-circle-002.html 14 fast/shapes/shape-outside-floats/shape-outside-floats-circle-003.html 15 fast/shapes/shape-outside-floats/shape-outside-floats-circle-004.html 16 fast/shapes/shape-outside-floats/shape-outside-floats-circle-005.html 17 18 * css/BasicShapeFunctions.cpp: 19 (WebCore::floatValueForCenterCoordinate): Used by both the CSS Shapes 20 layout code and the clip path code. 21 * css/BasicShapeFunctions.h: 22 * css/CSSBasicShapes.cpp: 23 (WebCore::buildCircleString): Update to use appendLiteral, and remove 24 call to reserveCapacity - if we find that it's actually slow when 25 doing performance tests, we can hopefully do something smarter and 26 less ugly than that. 27 * css/CSSParser.cpp: 28 (WebCore::CSSParser::parseShapeRadius): Fix a logic error that caused 29 the radius keywords not to work properly. 30 * rendering/shapes/Shape.cpp: 31 (WebCore::Shape::createShape): Convert new circle to a layout shape. 32 * rendering/style/BasicShapes.cpp: 33 (WebCore::BasicShape::canBlend): Ignore circles with values that 34 cannot be interpolated. 35 (WebCore::BasicShapeCircle::floatValueForRadiusInBox): Convert circle 36 radius keywords to a float value. 37 (WebCore::BasicShapeCircle::path): 38 (WebCore::BasicShapeCircle::blend): 39 * rendering/style/BasicShapes.h: 40 (WebCore::BasicShapeCenterCoordinate::canBlend): 41 (WebCore::BasicShapeRadius::canBlend): 42 1 43 2013-12-02 Alexey Proskuryakov <ap@apple.com> 2 44 -
trunk/Source/WebCore/css/BasicShapeFunctions.cpp
r159968 r159979 451 451 return basicShape.release(); 452 452 } 453 } 453 454 float floatValueForCenterCoordinate(const BasicShapeCenterCoordinate& center, float boxDimension) 455 { 456 float offset = floatValueForLength(center.length(), boxDimension); 457 switch (center.keyword()) { 458 case BasicShapeCenterCoordinate::None: 459 return offset; 460 case BasicShapeCenterCoordinate::Top: 461 case BasicShapeCenterCoordinate::Left: 462 return offset; 463 case BasicShapeCenterCoordinate::Bottom: 464 case BasicShapeCenterCoordinate::Right: 465 return boxDimension - offset; 466 } 467 468 ASSERT_NOT_REACHED(); 469 return 0; 470 } 471 472 } -
trunk/Source/WebCore/css/BasicShapeFunctions.h
r159526 r159979 46 46 PassRefPtr<CSSPrimitiveValue> valueForBox(BasicShape::ReferenceBox); 47 47 BasicShape::ReferenceBox boxForValue(const CSSPrimitiveValue*); 48 49 float floatValueForCenterCoordinate(const BasicShapeCenterCoordinate&, float); 48 50 } 51 49 52 #endif -
trunk/Source/WebCore/css/CSSBasicShapes.cpp
r159968 r159979 103 103 char separator[] = " "; 104 104 StringBuilder result; 105 // Compute the required capacity in advance to reduce allocations. 106 result.reserveCapacity((sizeof(opening) - 1) + (3 * (sizeof(separator) - 1)) + 1 + radius.length() + sizeof(at) + centerX.length() + centerY.length()); 107 result.append(opening); 105 result.appendLiteral(opening); 108 106 if (!radius.isNull()) 109 107 result.append(radius); … … 111 109 if (!centerX.isNull() || !centerY.isNull()) { 112 110 if (!radius.isNull()) 113 result.append (separator);114 result.append (at);115 result.append (separator);111 result.appendLiteral(separator); 112 result.appendLiteral(at); 113 result.appendLiteral(separator); 116 114 result.append(centerX); 117 result.append (separator);115 result.appendLiteral(separator); 118 116 result.append(centerY); 119 117 } 120 result.append (")");121 if (box.length()) { 122 result.append (separator);118 result.appendLiteral(")"); 119 if (box.length()) { 120 result.appendLiteral(separator); 123 121 result.append(box); 124 122 } -
trunk/Source/WebCore/css/CSSParser.cpp
r159968 r159979 5576 5576 PassRefPtr<CSSPrimitiveValue> CSSParser::parseShapeRadius(CSSParserValue* value) 5577 5577 { 5578 if (value->id == CSSValueClosestSide &&value->id == CSSValueFarthestSide)5578 if (value->id == CSSValueClosestSide || value->id == CSSValueFarthestSide) 5579 5579 return cssValuePool().createIdentifierValue(value->id); 5580 5580 -
trunk/Source/WebCore/rendering/shapes/Shape.cpp
r159954 r159979 152 152 153 153 case BasicShape::BasicShapeCircleType: { 154 // FIXME implement layout. bug 124619 155 shape = createRectangleShape(FloatRect(0, 0, boxWidth, boxHeight), FloatSize(0, 0)); 154 const BasicShapeCircle* circle = static_cast<const BasicShapeCircle*>(basicShape); 155 float centerX = floatValueForCenterCoordinate(circle->centerX(), boxWidth); 156 float centerY = floatValueForCenterCoordinate(circle->centerY(), boxHeight); 157 float radius = circle->floatValueForRadiusInBox(boxWidth, boxHeight); 158 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, centerY), logicalBoxSize.height(), writingMode); 159 160 shape = createShapeCircle(logicalCenter, radius); 156 161 break; 157 162 } -
trunk/Source/WebCore/rendering/style/BasicShapes.cpp
r159968 r159979 32 32 #include "BasicShapes.h" 33 33 34 #include "BasicShapeFunctions.h" 34 35 #include "FloatRect.h" 35 36 #include "LengthFunctions.h" … … 48 49 && static_cast<const BasicShapePolygon*>(this)->values().size() != static_cast<const BasicShapePolygon*>(other)->values().size()) 49 50 return false; 51 52 // Circles with keywords for radii or center coordinates cannot be animated. 53 if (type() == BasicShape::BasicShapeCircleType) { 54 const BasicShapeCircle* thisCircle = static_cast<const BasicShapeCircle*>(this); 55 const BasicShapeCircle* otherCircle = static_cast<const BasicShapeCircle*>(other); 56 if (!thisCircle->radius().canBlend(otherCircle->radius()) 57 || !thisCircle->centerX().canBlend(otherCircle->centerX()) 58 || !thisCircle->centerY().canBlend(otherCircle->centerY())) 59 return false; 60 } 50 61 51 62 return true; … … 111 122 } 112 123 124 float BasicShapeCircle::floatValueForRadiusInBox(float boxWidth, float boxHeight) const 125 { 126 if (m_radius.type() == BasicShapeRadius::Value) 127 return floatValueForLength(m_radius.value(), sqrtf((boxWidth * boxWidth + boxHeight * boxHeight) / 2)); 128 129 float centerX = floatValueForCenterCoordinate(m_centerX, boxWidth); 130 float centerY = floatValueForCenterCoordinate(m_centerY, boxHeight); 131 132 if (m_radius.type() == BasicShapeRadius::ClosestSide) 133 return std::min(std::min(centerX, boxWidth - centerX), std::min(centerY, boxHeight - centerY)); 134 135 // If radius.type() == BasicShapeRadius::FarthestSide. 136 return std::max(std::max(centerX, boxWidth - centerX), std::max(centerY, boxHeight - centerY)); 137 } 138 113 139 void BasicShapeCircle::path(Path& path, const FloatRect& boundingBox) 114 140 { 115 141 ASSERT(path.isEmpty()); 116 // FIXME Complete implementation of path. Bug 124619. 117 // Compute closest-side and farthest-side from boundingBox. 118 // Compute top, left, bottom, right from boundingBox. 119 if (m_radius.type() != BasicShapeRadius::Value) 120 return; 121 if (m_centerX.keyword() != BasicShapeCenterCoordinate::None || m_centerY.keyword() != BasicShapeCenterCoordinate::None) 122 return; 123 124 float diagonal = sqrtf((boundingBox.width() * boundingBox.width() + boundingBox.height() * boundingBox.height()) / 2); 125 float centerX = floatValueForLength(m_centerX.length(), boundingBox.width()); 126 float centerY = floatValueForLength(m_centerY.length(), boundingBox.height()); 127 float radius = floatValueForLength(m_radius.value(), diagonal); 142 143 float centerX = floatValueForCenterCoordinate(m_centerX, boundingBox.width()); 144 float centerY = floatValueForCenterCoordinate(m_centerY, boundingBox.height()); 145 float radius = floatValueForRadiusInBox(boundingBox.width(), boundingBox.height()); 128 146 path.addEllipse(FloatRect( 129 147 centerX - radius + boundingBox.x(), … … 139 157 const BasicShapeCircle* o = static_cast<const BasicShapeCircle*>(other); 140 158 RefPtr<BasicShapeCircle> result = BasicShapeCircle::create(); 141 142 if (m_radius.type() != BasicShapeRadius::Value || o->radius().type() != BasicShapeRadius::Value) {143 result->setCenterX(o->centerX());144 result->setCenterY(o->centerY());145 result->setRadius(o->radius());146 return result;147 }148 159 149 160 result->setCenterX(m_centerX.blend(o->centerX(), progress)); -
trunk/Source/WebCore/rendering/style/BasicShapes.h
r159968 r159979 145 145 const Length& length() const { return m_length; } 146 146 147 bool canBlend(const BasicShapeCenterCoordinate& other) const 148 { 149 // FIXME determine how to interpolate between keywords. See bug 125108. 150 return m_keyword == None && other.keyword() == None; 151 } 152 147 153 BasicShapeCenterCoordinate blend(const BasicShapeCenterCoordinate& other, double progress) const 148 154 { … … 173 179 Type type() const { return m_type; } 174 180 181 bool canBlend(const BasicShapeRadius& other) const 182 { 183 // FIXME determine how to interpolate between keywords. See bug 125108. 184 return m_type == Value && other.type() == Value; 185 } 186 175 187 BasicShapeRadius blend(const BasicShapeRadius& other, double progress) const 176 188 { … … 194 206 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; } 195 207 const BasicShapeRadius& radius() const { return m_radius; } 208 float floatValueForRadiusInBox(float boxWidth, float boxHeight) const; 196 209 197 210 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = std::move(centerX); }
Note: See TracChangeset
for help on using the changeset viewer.