Title: [160429] trunk
Revision
160429
Author
rwlb...@webkit.org
Date
2013-12-11 05:38:59 -0800 (Wed, 11 Dec 2013)

Log Message

[CSS Shapes] Take into account fill-rule for polygon interpolation
https://bugs.webkit.org/show_bug.cgi?id=125508

Reviewed by Dirk Schulze.

Source/WebCore:

Implement the polygon fill-rule part of http://dev.w3.org/csswg/css-shapes/#basic-shape-interpolation.

Adapt fast/shapes/shape-outside-floats/shape-outside-animation.html.

* rendering/style/BasicShapes.cpp:
(WebCore::BasicShape::canBlend):

LayoutTests:

Adapt fast/shapes/shape-outside-floats/shape-outside-animation.html so it also tests polygon animation
when using different fill rules.

* animations/resources/animation-test-helpers.js:
(parseBasicShape): also allow evenodd when parsing the polygon
* fast/shapes/shape-outside-floats/shape-outside-animation-expected.txt:
* fast/shapes/shape-outside-floats/shape-outside-animation.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (160428 => 160429)


--- trunk/LayoutTests/ChangeLog	2013-12-11 12:42:50 UTC (rev 160428)
+++ trunk/LayoutTests/ChangeLog	2013-12-11 13:38:59 UTC (rev 160429)
@@ -1,3 +1,18 @@
+2013-12-11  Rob Buis  <rob.b...@samsung.com>
+
+        [CSS Shapes] Take into account fill-rule for polygon interpolation
+        https://bugs.webkit.org/show_bug.cgi?id=125508
+
+        Reviewed by Dirk Schulze.
+
+        Adapt fast/shapes/shape-outside-floats/shape-outside-animation.html so it also tests polygon animation
+        when using different fill rules.
+
+        * animations/resources/animation-test-helpers.js:
+        (parseBasicShape): also allow evenodd when parsing the polygon
+        * fast/shapes/shape-outside-floats/shape-outside-animation-expected.txt:
+        * fast/shapes/shape-outside-floats/shape-outside-animation.html:
+
 2013-12-11  Michal Poteralski  <m.poteral...@samsung.com>
 
         Test results of postMessage-clone-port-error.html test are broken

Modified: trunk/LayoutTests/animations/resources/animation-test-helpers.js (160428 => 160429)


--- trunk/LayoutTests/animations/resources/animation-test-helpers.js	2013-12-11 12:42:50 UTC (rev 160428)
+++ trunk/LayoutTests/animations/resources/animation-test-helpers.js	2013-12-11 13:38:59 UTC (rev 160429)
@@ -222,7 +222,7 @@
         matches = s.match("ellipse\\((.*)\\s+(.*)\\s+at\\s+(.*)\\s+(.*)\\)");
         break;
     case "polygon":
-        matches = s.match("polygon\\(nonzero, (.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\)");
+        matches = s.match("polygon\\((evenodd|nonzero), (.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\)");
         break;
     default:
         return null;
@@ -232,9 +232,12 @@
         return null;
 
     matches.shift();
+    var i = 0;
+    if (shapeFunction[1] == "polygon")
+        i++; // skip nonzero|evenodd below
 
     // Normalize percentage values.
-    for (var i = 0; i < matches.length; ++i) {
+    for (; i < matches.length; ++i) {
         var param = matches[i];
         matches[i] = parseFloat(matches[i]);
         if (param.indexOf('%') != -1)
@@ -309,7 +312,13 @@
     if (paramList1.shape != paramList2.shape
         || paramList1.params.length != paramList2.params.length)
         return false;
-    for (var i = 0; i < paramList1.params.length; ++i) {
+    var i = 0;
+    if (paramList1.shape == "polygon") {
+        if (paramList1.params[0] != paramList2.params[0])
+            return false; // fill-rule's don't match
+        i++;
+    }
+    for (; i < paramList1.params.length; ++i) {
         var param1 = paramList1.params[i], 
             param2 = paramList2.params[i];
         var match = isCloseEnough(param1, param2, tolerance);

Modified: trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-animation-expected.txt (160428 => 160429)


--- trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-animation-expected.txt	2013-12-11 12:42:50 UTC (rev 160428)
+++ trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-animation-expected.txt	2013-12-11 13:38:59 UTC (rev 160429)
@@ -2,8 +2,10 @@
 Moving Text
 Moving Text
 Moving Text
+Moving Text
 PASS - "webkitShapeOutside" property for "rectangle-box" element at 1s saw something close to: rectangle(10%, 10%, 80%, 80%, 0px, 0px)
 PASS - "webkitShapeOutside" property for "circle-box" element at 1s saw something close to: circle(35% at 35% 35%)
 PASS - "webkitShapeOutside" property for "ellipse-box" element at 1s saw something close to: ellipse(35% 30% at 35% 35%)
 PASS - "webkitShapeOutside" property for "polygon-box" element at 1s saw something close to: polygon(nonzero, 10% 10%, 90% 10%, 90% 90%, 10% 90%)
+PASS - "webkitShapeOutside" property for "polygon2-box" element at 1s saw something close to: polygon(nonzero, 20% 20%, 80% 20%, 80% 80%, 20% 80%)
 

Modified: trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-animation.html (160428 => 160429)


--- trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-animation.html	2013-12-11 12:42:50 UTC (rev 160428)
+++ trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-animation.html	2013-12-11 13:38:59 UTC (rev 160429)
@@ -30,6 +30,9 @@
       -webkit-animation: polygon-anim 2s linear
     }
 
+    #polygon2-box {
+      -webkit-animation: polygon2-anim 2s linear
+    }
 
     @-webkit-keyframes rectangle-anim {
         from { -webkit-shape-outside: rectangle(0%, 0%, 100%, 100%); }
@@ -51,6 +54,11 @@
         to   { -webkit-shape-outside: polygon(nonzero, 20% 20%, 80% 20%, 80% 80%, 20% 80%); }
     }
 
+    @-webkit-keyframes polygon2-anim {
+        from { -webkit-shape-outside: polygon(evenodd, 0% 0%, 100% 0%, 100% 100%, 0% 100%); }
+        to   { -webkit-shape-outside: polygon(nonzero, 20% 20%, 80% 20%, 80% 80%, 20% 80%); }
+    }
+
   </style>
   <script src=""
   <script type="text/_javascript_">
@@ -60,6 +68,7 @@
       ["circle-anim",  1, "circle-box", "webkitShapeOutside", "circle(35% at 35% 35%)", 0.05],
       ["ellipse-anim",  1, "ellipse-box", "webkitShapeOutside", "ellipse(35% 30% at 35% 35%)", 0.05],
       ["polygon-anim",  1, "polygon-box", "webkitShapeOutside", "polygon(nonzero, 10% 10%, 90% 10%, 90% 90%, 10% 90%)", 0.05],
+      ["polygon2-anim",  1, "polygon2-box", "webkitShapeOutside", "polygon(nonzero, 20% 20%, 80% 20%, 80% 80%, 20% 80%)", 0.05],
     ];
     
     runAnimationTest(expectedValues);
@@ -83,6 +92,10 @@
   <div class="box" id="polygon-box"></div>
   Moving Text
 </div>
+<div class='container'>
+  <div class="box" id="polygon2-box"></div>
+  Moving Text
+</div>
 
 <div id="result">
 </div>

Modified: trunk/Source/WebCore/ChangeLog (160428 => 160429)


--- trunk/Source/WebCore/ChangeLog	2013-12-11 12:42:50 UTC (rev 160428)
+++ trunk/Source/WebCore/ChangeLog	2013-12-11 13:38:59 UTC (rev 160429)
@@ -1,3 +1,17 @@
+2013-12-11  Rob Buis  <rob.b...@samsung.com>
+
+        [CSS Shapes] Take into account fill-rule for polygon interpolation
+        https://bugs.webkit.org/show_bug.cgi?id=125508
+
+        Reviewed by Dirk Schulze.
+
+        Implement the polygon fill-rule part of http://dev.w3.org/csswg/css-shapes/#basic-shape-interpolation.
+
+        Adapt fast/shapes/shape-outside-floats/shape-outside-animation.html.
+
+        * rendering/style/BasicShapes.cpp:
+        (WebCore::BasicShape::canBlend):
+
 2013-12-11  Mario Sanchez Prada  <mario.pr...@samsung.com>
 
         Programmatically-inserted children lack accessibility events

Modified: trunk/Source/WebCore/rendering/style/BasicShapes.cpp (160428 => 160429)


--- trunk/Source/WebCore/rendering/style/BasicShapes.cpp	2013-12-11 12:42:50 UTC (rev 160428)
+++ trunk/Source/WebCore/rendering/style/BasicShapes.cpp	2013-12-11 13:38:59 UTC (rev 160429)
@@ -46,7 +46,8 @@
 
     // Just polygons with same number of vertices can be animated.
     if (type() == BasicShape::BasicShapePolygonType
-        && static_cast<const BasicShapePolygon*>(this)->values().size() != static_cast<const BasicShapePolygon*>(other)->values().size())
+        && (static_cast<const BasicShapePolygon*>(this)->values().size() != static_cast<const BasicShapePolygon*>(other)->values().size()
+        || static_cast<const BasicShapePolygon*>(this)->windRule() != static_cast<const BasicShapePolygon*>(other)->windRule()))
         return false;
 
     // Circles with keywords for radii or center coordinates cannot be animated.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to