Changeset 160007 in webkit
- Timestamp:
- Dec 3, 2013 9:18:01 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r160005 r160007 1 2013-12-03 Rob Buis <rob.buis@samsung.com> 2 3 [css shapes] layout for new ellipse syntax 4 https://bugs.webkit.org/show_bug.cgi?id=124621 5 6 Add a new test for the new ellipse syntax. Also update existing shape-inside, animation, and clip-path tests to 7 test the new ellipse syntax for clipping and shape-inside. 8 9 Reviewed by Dirk Schulze. 10 11 * animations/resources/animation-test-helpers.js: 12 (parseBasicShape): 13 * css3/masking/clip-path-animation-expected.txt: 14 * css3/masking/clip-path-animation.html: 15 * css3/masking/clip-path-ellipse.html: 16 * fast/shapes/shape-inside/shape-inside-animation-expected.txt: 17 * fast/shapes/shape-inside/shape-inside-animation.html: 18 * fast/shapes/shape-inside/shape-inside-ellipse-padding.html: 19 * fast/shapes/shape-inside/shape-inside-ellipse.html: 20 * fast/shapes/shape-inside/shape-inside-empty-expected.html: 21 * fast/shapes/shape-inside/shape-inside-empty.html: 22 * fast/shapes/shape-outside-floats/shape-outside-animation-expected.txt: 23 * fast/shapes/shape-outside-floats/shape-outside-animation.html: 24 * fast/shapes/shape-outside-floats/shape-outside-floats-ellipse-000-expected.html: Added. 25 * fast/shapes/shape-outside-floats/shape-outside-floats-ellipse-000.html: Added. 26 1 27 2013-12-03 Frédéric Wang <fred.wang@free.fr> 2 28 -
trunk/LayoutTests/animations/resources/animation-test-helpers.js
r159979 r160007 220 220 break; 221 221 case "ellipse": 222 matches = s.match("ellipse\\((.*)\\s *,\\s*(.*)\\s*,\\s*(.*)\\,\\s*(.*)\\)");222 matches = s.match("ellipse\\((.*)\\s+(.*)\\s+at\\s+(.*)\\s+(.*)\\)"); 223 223 break; 224 224 case "polygon": -
trunk/LayoutTests/css3/masking/clip-path-animation-expected.txt
r159979 r160007 2 2 PASS - "webkitClipPath" property for "rectangle-box" element at 1s saw something close to: rectangle(10%, 10%, 80%, 80%, 0px, 0px) 3 3 PASS - "webkitClipPath" property for "circle-box" element at 1s saw something close to: circle(35% at 35% 35%) 4 PASS - "webkitClipPath" property for "ellipse-box" element at 1s saw something close to: ellipse(35% , 35%, 35%, 30%)4 PASS - "webkitClipPath" property for "ellipse-box" element at 1s saw something close to: ellipse(35% 30% at 35% 35%) 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%) 6 6 PASS - "webkitClipPath" property for "none-box" element at 1s saw something close to: polygon(nonzero, 20% 20%, 80% 20%, 80% 80%, 20% 80%) -
trunk/LayoutTests/css3/masking/clip-path-animation.html
r159979 r160007 43 43 44 44 @-webkit-keyframes ellipse-anim { 45 from { -webkit-clip-path: ellipse(50% , 50%, 50%, 40%); }46 to { -webkit-clip-path: ellipse(20% , 20%, 20%,20%); }45 from { -webkit-clip-path: ellipse(50% 40% at 50% 50%); } 46 to { -webkit-clip-path: ellipse(20% 20% at 20% 20%); } 47 47 } 48 48 … … 65 65 ["rectangle-anim", 1, "rectangle-box", "webkitClipPath", "rectangle(10%, 10%, 80%, 80%, 0px, 0px)", 0.05], 66 66 ["circle-anim", 1, "circle-box", "webkitClipPath", "circle(35% at 35% 35%)", 0.05], 67 ["ellipse-anim", 1, "ellipse-box", "webkitClipPath", "ellipse(35% , 35%, 35%, 30%)", 0.05],67 ["ellipse-anim", 1, "ellipse-box", "webkitClipPath", "ellipse(35% 30% at 35% 35%)", 0.05], 68 68 ["polygon-anim", 1, "polygon-box", "webkitClipPath", "polygon(nonzero, 10% 10%, 90% 10%, 90% 90%, 10% 90%)", 0.05], 69 69 ["none-anim", 1, "none-box", "webkitClipPath", "polygon(nonzero, 20% 20%, 80% 20%, 80% 80%, 20% 80%)", 0], -
trunk/LayoutTests/css3/masking/clip-path-ellipse.html
r127608 r160007 7 7 height: 200px; 8 8 background-color: green; 9 -webkit-clip-path: ellipse(100px , 100px, 100px, 75px);9 -webkit-clip-path: ellipse(100px 75px at 100px 100px); 10 10 } 11 11 </style> -
trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-animation-expected.txt
r159979 r160007 2 2 PASS - "webkitShapeInside" property for "rectangle-box" element at 1s saw something close to: rectangle(10%, 10%, 80%, 80%, 0px, 0px) 3 3 PASS - "webkitShapeInside" property for "circle-box" element at 1s saw something close to: circle(35% at 35% 35%) 4 PASS - "webkitShapeInside" property for "ellipse-box" element at 1s saw something close to: ellipse(35% , 35%, 35%, 30%)4 PASS - "webkitShapeInside" property for "ellipse-box" element at 1s saw something close to: ellipse(35% 30% at 35% 35%) 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%) 6 6 -
trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-animation.html
r159979 r160007 39 39 40 40 @-webkit-keyframes ellipse-anim { 41 from { -webkit-shape-inside: ellipse(50% , 50%, 50%, 40%); }42 to { -webkit-shape-inside: ellipse(20% , 20%, 20%,20%); }41 from { -webkit-shape-inside: ellipse(50% 40% at 50% 50%); } 42 to { -webkit-shape-inside: ellipse(20% 20% at 20% 20%); } 43 43 } 44 44 … … 55 55 ["rectangle-anim", 1, "rectangle-box", "webkitShapeInside", "rectangle(10%, 10%, 80%, 80%, 0px, 0px)", 0.05], 56 56 ["circle-anim", 1, "circle-box", "webkitShapeInside", "circle(35% at 35% 35%)", 0.05], 57 ["ellipse-anim", 1, "ellipse-box", "webkitShapeInside", "ellipse(35% , 35%, 35%, 30%)", 0.05],57 ["ellipse-anim", 1, "ellipse-box", "webkitShapeInside", "ellipse(35% 30% at 35% 35%)", 0.05], 58 58 ["polygon-anim", 1, "polygon-box", "webkitShapeInside", "polygon(nonzero, 10% 10%, 90% 10%, 90% 90%, 10% 90%)", 0.05], 59 59 ]; -
trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-ellipse-padding.html
r154500 r160007 10 10 width: 500px; 11 11 height: 500px; 12 -webkit-shape-inside: ellipse(2 20px, 220px, 250px, 150px);12 -webkit-shape-inside: ellipse(250px 150px at 220px 220px); 13 13 -webkit-shape-padding: 50px; 14 14 font: 178px/1 Ahem, sans-serif; -
trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-ellipse.html
r154500 r160007 13 13 width: 500px; 14 14 height: 500px; 15 -webkit-shape-inside: ellipse(2 20px, 220px, 200px, 100px);15 -webkit-shape-inside: ellipse(200px 100px at 220px 220px); 16 16 font: 178px/1 Ahem, sans-serif; 17 17 color: green; -
trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-empty-expected.html
r159979 r160007 25 25 </div> 26 26 <div> 27 <p>This text should be pushed down below the green rectangle. (There is an ellipse(0px , 0px, 0px, 1em) shape-inside CSS property on the green rectangle.)</p>27 <p>This text should be pushed down below the green rectangle. (There is an ellipse(0px 1em at 0px 0px) shape-inside CSS property on the green rectangle.)</p> 28 28 </div> 29 29 <div> 30 <p>This text should be pushed down below the green rectangle. (There is an ellipse( 0px, 0px, 1em,0px) shape-inside CSS property on the green rectangle.)</p>30 <p>This text should be pushed down below the green rectangle. (There is an ellipse(1em 0px at 0px 0px) shape-inside CSS property on the green rectangle.)</p> 31 31 </div> 32 32 <div> -
trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-empty.html
r159979 r160007 24 24 25 25 #shape-inside-ellipse-radiusX0 { 26 -webkit-shape-inside: ellipse(0px , 0px, 0px, 1em);26 -webkit-shape-inside: ellipse(0px 1em at 0px 0px); 27 27 } 28 28 29 29 #shape-inside-ellipse-radiusY0 { 30 -webkit-shape-inside: ellipse( 0px, 0px, 1em,0px);30 -webkit-shape-inside: ellipse(1em 0px at 0px 0px); 31 31 } 32 32 … … 52 52 </p> 53 53 <p id="shape-inside-ellipse-radiusX0"> 54 This text should be pushed down below the green rectangle. (There is an ellipse(0px , 0px, 0px, 1em) shape-inside CSS property on the green rectangle.)54 This text should be pushed down below the green rectangle. (There is an ellipse(0px 1em at 0px 0px) shape-inside CSS property on the green rectangle.) 55 55 </p> 56 56 <p id="shape-inside-ellipse-radiusY0"> 57 This text should be pushed down below the green rectangle. (There is an ellipse( 0px, 0px, 1em,0px) shape-inside CSS property on the green rectangle.)57 This text should be pushed down below the green rectangle. (There is an ellipse(1em 0px at 0px 0px) shape-inside CSS property on the green rectangle.) 58 58 </p> 59 59 <p id="shape-inside-polygon-1vertex"> -
trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-animation-expected.txt
r159979 r160007 5 5 PASS - "webkitShapeOutside" property for "rectangle-box" element at 1s saw something close to: rectangle(10%, 10%, 80%, 80%, 0px, 0px) 6 6 PASS - "webkitShapeOutside" property for "circle-box" element at 1s saw something close to: circle(35% at 35% 35%) 7 PASS - "webkitShapeOutside" property for "ellipse-box" element at 1s saw something close to: ellipse(35% , 35%, 35%, 30%)7 PASS - "webkitShapeOutside" property for "ellipse-box" element at 1s saw something close to: ellipse(35% 30% at 35% 35%) 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%) 9 9 -
trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-animation.html
r159979 r160007 43 43 44 44 @-webkit-keyframes ellipse-anim { 45 from { -webkit-shape-outside: ellipse(50% , 50%, 50%, 40%); }46 to { -webkit-shape-outside: ellipse(20% , 20%, 20%,20%); }45 from { -webkit-shape-outside: ellipse(50% 40% at 50% 50%); } 46 to { -webkit-shape-outside: ellipse(20% 20% at 20% 20%); } 47 47 } 48 48 … … 59 59 ["rectangle-anim", 1, "rectangle-box", "webkitShapeOutside", "rectangle(10%, 10%, 80%, 80%, 0px, 0px)", 0.05], 60 60 ["circle-anim", 1, "circle-box", "webkitShapeOutside", "circle(35% at 35% 35%)", 0.05], 61 ["ellipse-anim", 1, "ellipse-box", "webkitShapeOutside", "ellipse(35% , 35%, 35%, 30%)", 0.05],61 ["ellipse-anim", 1, "ellipse-box", "webkitShapeOutside", "ellipse(35% 30% at 35% 35%)", 0.05], 62 62 ["polygon-anim", 1, "polygon-box", "webkitShapeOutside", "polygon(nonzero, 10% 10%, 90% 10%, 90% 90%, 10% 90%)", 0.05], 63 63 ]; -
trunk/Source/WebCore/ChangeLog
r160005 r160007 1 2013-12-03 Rob Buis <rob.buis@samsung.com> 2 3 [css shapes] layout for new ellipse syntax 4 https://bugs.webkit.org/show_bug.cgi?id=124621 5 6 Reviewed by Dirk Schulze. 7 8 Implement support for doing layout with the new ellipse shape syntax, 9 including basic animation support. 10 11 Test: fast/shapes/shape-outside-floats/shape-outside-floats-ellipse-000.html 12 13 * rendering/shapes/Shape.cpp: 14 (WebCore::Shape::createShape): Convert new ellipse to a layout shape. 15 * rendering/style/BasicShapes.cpp: 16 (WebCore::BasicShape::canBlend): Ignore ellipses with values that 17 cannot be interpolated. 18 (WebCore::BasicShapeEllipse::floatValueForRadiusInBox): Helper function to calculate 19 either radiusX or radiusY, shared by clip-path and shape code paths. 20 (WebCore::BasicShapeEllipse::path): 21 * rendering/style/BasicShapes.h: 22 1 23 2013-12-03 Frédéric Wang <fred.wang@free.fr> 2 24 -
trunk/Source/WebCore/rendering/shapes/Shape.cpp
r159979 r160007 176 176 177 177 case BasicShape::BasicShapeEllipseType: { 178 // FIXME: Layout implementation needed. See bug https://bugs.webkit.org/show_bug.cgi?id=125079 179 shape = createRectangleShape(FloatRect(0, 0, boxWidth, boxHeight), FloatSize()); 178 const BasicShapeEllipse* ellipse = static_cast<const BasicShapeEllipse*>(basicShape); 179 float centerX = floatValueForCenterCoordinate(ellipse->centerX(), boxWidth); 180 float centerY = floatValueForCenterCoordinate(ellipse->centerY(), boxHeight); 181 float radiusX = ellipse->floatValueForRadiusInBox(ellipse->radiusX(), centerX, boxWidth); 182 float radiusY = ellipse->floatValueForRadiusInBox(ellipse->radiusY(), centerY, boxHeight); 183 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, centerY), logicalBoxSize.height(), writingMode); 184 185 shape = createShapeEllipse(logicalCenter, FloatSize(radiusX, radiusY)); 180 186 break; 181 187 } -
trunk/Source/WebCore/rendering/style/BasicShapes.cpp
r159979 r160007 60 60 } 61 61 62 return true; 62 // Ellipses with keywords for radii or center coordinates cannot be animated. 63 if (type() != BasicShape::BasicShapeEllipseType) 64 return true; 65 66 const BasicShapeEllipse* thisEllipse = static_cast<const BasicShapeEllipse*>(this); 67 const BasicShapeEllipse* otherEllipse = static_cast<const BasicShapeEllipse*>(other); 68 if (!thisEllipse->radiusX().canBlend(otherEllipse->radiusX()) 69 || !thisEllipse->radiusY().canBlend(otherEllipse->radiusY()) 70 || !thisEllipse->centerX().canBlend(otherEllipse->centerX()) 71 || !thisEllipse->centerY().canBlend(otherEllipse->centerY())) 72 return false; 63 73 } 64 74 … … 192 202 } 193 203 204 float BasicShapeEllipse::floatValueForRadiusInBox(const BasicShapeRadius& radius, float center, float boxWidthOrHeight) const 205 { 206 if (radius.type() == BasicShapeRadius::Value) 207 return floatValueForLength(radius.value(), boxWidthOrHeight); 208 209 if (radius.type() == BasicShapeRadius::ClosestSide) 210 return std::min(center, boxWidthOrHeight - center); 211 212 ASSERT(radius.type() == BasicShapeRadius::FarthestSide); 213 return std::max(center, boxWidthOrHeight - center); 214 } 215 194 216 void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox) 195 217 { 196 218 ASSERT(path.isEmpty()); 197 // FIXME: The implementation of path is incomplete. See https://bugs.webkit.org/show_bug.cgi?id=125079 198 // Compute closest-side and farthest-side from boundingBox. 199 // Compute top, left, bottom, right from boundingBox. 200 if (m_radiusX.type() != BasicShapeRadius::Value || m_radiusY.type() != BasicShapeRadius::Value) 201 return; 202 if (m_centerX.keyword() != BasicShapeCenterCoordinate::None || m_centerY.keyword() != BasicShapeCenterCoordinate::None) 203 return; 204 205 float diagonal = sqrtf((boundingBox.width() * boundingBox.width() + boundingBox.height() * boundingBox.height()) / 2); 206 float centerX = floatValueForLength(m_centerX.length(), boundingBox.width()); 207 float centerY = floatValueForLength(m_centerY.length(), boundingBox.height()); 208 float radiusX = floatValueForLength(m_radiusX.value(), diagonal); 209 float radiusY = floatValueForLength(m_radiusY.value(), diagonal); 219 220 float centerX = floatValueForCenterCoordinate(m_centerX, boundingBox.width()); 221 float centerY = floatValueForCenterCoordinate(m_centerY, boundingBox.height()); 222 float radiusX = floatValueForRadiusInBox(m_radiusX, centerX, boundingBox.width()); 223 float radiusY = floatValueForRadiusInBox(m_radiusY, centerY, boundingBox.height()); 210 224 path.addEllipse(FloatRect( 211 225 centerX - radiusX + boundingBox.x(), -
trunk/Source/WebCore/rendering/style/BasicShapes.h
r159979 r160007 256 256 const BasicShapeRadius& radiusX() const { return m_radiusX; } 257 257 const BasicShapeRadius& radiusY() const { return m_radiusY; } 258 float floatValueForRadiusInBox(const BasicShapeRadius&, float center, float boxWidthOrHeight) const; 258 259 259 260 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = std::move(centerX); }
Note: See TracChangeset
for help on using the changeset viewer.