Title: [165277] trunk
Revision
165277
Author
[email protected]
Date
2014-03-07 12:29:39 -0800 (Fri, 07 Mar 2014)

Log Message

[CSS Shapes] Correctly serialize ellipse positions
https://bugs.webkit.org/show_bug.cgi?id=129700

Reviewed by Dirk Schulze.

Source/WebCore:

Updating ellipse serialization to be in line with
the CSS Shapes spec. Positions should serialize as
2 or 4-value positions, converting keywords to
percentages where possible. This uses the same method
as circle position serialization (bug 129404).

Updated existing parsing tests.

* css/CSSBasicShapes.cpp:
(WebCore::CSSBasicShapeEllipse::cssText): Use the
normalization / serialization helpers for shape position.

LayoutTests:

Update tests to use the new position serialization for
ellipse.

* fast/shapes/parsing/parsing-shape-inside-expected.txt:
* fast/shapes/parsing/parsing-shape-outside-expected.txt:
* fast/shapes/parsing/parsing-test-utils.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (165276 => 165277)


--- trunk/LayoutTests/ChangeLog	2014-03-07 20:20:17 UTC (rev 165276)
+++ trunk/LayoutTests/ChangeLog	2014-03-07 20:29:39 UTC (rev 165277)
@@ -1,3 +1,17 @@
+2014-03-07  Bear Travis  <[email protected]>
+
+        [CSS Shapes] Correctly serialize ellipse positions
+        https://bugs.webkit.org/show_bug.cgi?id=129700
+
+        Reviewed by Dirk Schulze.
+
+        Update tests to use the new position serialization for
+        ellipse.
+
+        * fast/shapes/parsing/parsing-shape-inside-expected.txt:
+        * fast/shapes/parsing/parsing-shape-outside-expected.txt:
+        * fast/shapes/parsing/parsing-test-utils.js:
+
 2014-03-07  Michał Pakuła vel Rutka  <[email protected]>
 
         Unreviewed EFL gardening

Modified: trunk/LayoutTests/fast/shapes/parsing/parsing-shape-inside-expected.txt (165276 => 165277)


--- trunk/LayoutTests/fast/shapes/parsing/parsing-shape-inside-expected.txt	2014-03-07 20:20:17 UTC (rev 165276)
+++ trunk/LayoutTests/fast/shapes/parsing/parsing-shape-inside-expected.txt	2014-03-07 20:29:39 UTC (rev 165277)
@@ -101,11 +101,11 @@
 PASS getComputedStyleValue("-webkit-shape-inside", "circle(10px at right 10px bottom 10px)") is "circle(10px at right 10px bottom 10px)"
 PASS getCSSText("-webkit-shape-inside", "ellipse(10px, 20px, 30px, 40px)") is "ellipse(10px, 20px, 30px, 40px)"
 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px, 20px, 30px, 40px)") is "ellipse(10px, 20px, 30px, 40px)"
-PASS getCSSText("-webkit-shape-inside", "ellipse()") is "ellipse()"
+PASS getCSSText("-webkit-shape-inside", "ellipse()") is "ellipse(at 50% 50%)"
 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse()") is "ellipse(closest-side closest-side at 50% 50%)"
-PASS getCSSText("-webkit-shape-inside", "ellipse(10px)") is "ellipse(10px)"
+PASS getCSSText("-webkit-shape-inside", "ellipse(10px)") is "ellipse(10px at 50% 50%)"
 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px)") is "ellipse(10px closest-side at 50% 50%)"
-PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px)") is "ellipse(10px 20px)"
+PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px)") is "ellipse(10px 20px at 50% 50%)"
 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 20px)") is "ellipse(10px 20px at 50% 50%)"
 PASS getCSSText("-webkit-shape-inside", "ellipse(10px at 10px)") is "ellipse(10px at 10px 50%)"
 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px at 10px)") is "ellipse(10px closest-side at 10px 50%)"
@@ -121,18 +121,22 @@
 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(at top left)") is "ellipse(closest-side closest-side at 0% 0%)"
 PASS getCSSText("-webkit-shape-inside", "ellipse(at right bottom)") is "ellipse(at 100% 100%)"
 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(at right bottom)") is "ellipse(closest-side closest-side at 100% 100%)"
-PASS getCSSText("-webkit-shape-inside", "ellipse(10px at left top 10px)") is "ellipse(10px at left 0% top 10px)"
+PASS getCSSText("-webkit-shape-inside", "ellipse(10px at left top 10px)") is "ellipse(10px at 0% 10px)"
 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px at left top 10px)") is "ellipse(10px closest-side at 0% 10px)"
-PASS getCSSText("-webkit-shape-inside", "ellipse(10px at top 10px left 10px)") is "ellipse(10px at left 10px top 10px)"
+PASS getCSSText("-webkit-shape-inside", "ellipse(10px at top 10px left 10px)") is "ellipse(10px at 10px 10px)"
 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px at top 10px left 10px)") is "ellipse(10px closest-side at 10px 10px)"
 PASS getCSSText("-webkit-shape-inside", "ellipse(10px at right 10px bottom 10px)") is "ellipse(10px at right 10px bottom 10px)"
 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px at right 10px bottom 10px)") is "ellipse(10px closest-side at right 10px bottom 10px)"
-PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px at left top 10px)") is "ellipse(10px 20px at left 0% top 10px)"
+PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px at left top 10px)") is "ellipse(10px 20px at 0% 10px)"
 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 20px at left top 10px)") is "ellipse(10px 20px at 0% 10px)"
-PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px at top 10px left 10px)") is "ellipse(10px 20px at left 10px top 10px)"
+PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px at top 10px left 10px)") is "ellipse(10px 20px at 10px 10px)"
 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 20px at top 10px left 10px)") is "ellipse(10px 20px at 10px 10px)"
 PASS getCSSText("-webkit-shape-inside", "ellipse(10px 20px at right 10px bottom 10px)") is "ellipse(10px 20px at right 10px bottom 10px)"
 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 20px at right 10px bottom 10px)") is "ellipse(10px 20px at right 10px bottom 10px)"
+PASS getCSSText("-webkit-shape-inside", "ellipse(10px 10px at right 10% bottom 10%)") is "ellipse(10px 10px at 90% 90%)"
+PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 10px at right 10% bottom 10%)") is "ellipse(10px 10px at 90% 90%)"
+PASS getCSSText("-webkit-shape-inside", "ellipse(10px 10px at right 0px bottom 0px)") is "ellipse(10px 10px at 100% 100%)"
+PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(10px 10px at right 0px bottom 0px)") is "ellipse(10px 10px at 100% 100%)"
 PASS getCSSText("-webkit-shape-inside", "polygon(10px 20px, 30px 40px, 40px 50px)") is "polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)"
 PASS getComputedStyleValue("-webkit-shape-inside", "polygon(10px 20px, 30px 40px, 40px 50px)") is "polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)"
 PASS getCSSText("-webkit-shape-inside", "polygon(evenodd, 10px 20px, 30px 40px, 40px 50px)") is "polygon(evenodd, 10px 20px, 30px 40px, 40px 50px)"

Modified: trunk/LayoutTests/fast/shapes/parsing/parsing-shape-outside-expected.txt (165276 => 165277)


--- trunk/LayoutTests/fast/shapes/parsing/parsing-shape-outside-expected.txt	2014-03-07 20:20:17 UTC (rev 165276)
+++ trunk/LayoutTests/fast/shapes/parsing/parsing-shape-outside-expected.txt	2014-03-07 20:29:39 UTC (rev 165277)
@@ -101,11 +101,11 @@
 PASS getComputedStyleValue("-webkit-shape-outside", "circle(10px at right 10px bottom 10px)") is "circle(10px at right 10px bottom 10px)"
 PASS getCSSText("-webkit-shape-outside", "ellipse(10px, 20px, 30px, 40px)") is "ellipse(10px, 20px, 30px, 40px)"
 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px, 20px, 30px, 40px)") is "ellipse(10px, 20px, 30px, 40px)"
-PASS getCSSText("-webkit-shape-outside", "ellipse()") is "ellipse()"
+PASS getCSSText("-webkit-shape-outside", "ellipse()") is "ellipse(at 50% 50%)"
 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse()") is "ellipse(closest-side closest-side at 50% 50%)"
-PASS getCSSText("-webkit-shape-outside", "ellipse(10px)") is "ellipse(10px)"
+PASS getCSSText("-webkit-shape-outside", "ellipse(10px)") is "ellipse(10px at 50% 50%)"
 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px)") is "ellipse(10px closest-side at 50% 50%)"
-PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px)") is "ellipse(10px 20px)"
+PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px)") is "ellipse(10px 20px at 50% 50%)"
 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 20px)") is "ellipse(10px 20px at 50% 50%)"
 PASS getCSSText("-webkit-shape-outside", "ellipse(10px at 10px)") is "ellipse(10px at 10px 50%)"
 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px at 10px)") is "ellipse(10px closest-side at 10px 50%)"
@@ -121,18 +121,22 @@
 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(at top left)") is "ellipse(closest-side closest-side at 0% 0%)"
 PASS getCSSText("-webkit-shape-outside", "ellipse(at right bottom)") is "ellipse(at 100% 100%)"
 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(at right bottom)") is "ellipse(closest-side closest-side at 100% 100%)"
-PASS getCSSText("-webkit-shape-outside", "ellipse(10px at left top 10px)") is "ellipse(10px at left 0% top 10px)"
+PASS getCSSText("-webkit-shape-outside", "ellipse(10px at left top 10px)") is "ellipse(10px at 0% 10px)"
 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px at left top 10px)") is "ellipse(10px closest-side at 0% 10px)"
-PASS getCSSText("-webkit-shape-outside", "ellipse(10px at top 10px left 10px)") is "ellipse(10px at left 10px top 10px)"
+PASS getCSSText("-webkit-shape-outside", "ellipse(10px at top 10px left 10px)") is "ellipse(10px at 10px 10px)"
 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px at top 10px left 10px)") is "ellipse(10px closest-side at 10px 10px)"
 PASS getCSSText("-webkit-shape-outside", "ellipse(10px at right 10px bottom 10px)") is "ellipse(10px at right 10px bottom 10px)"
 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px at right 10px bottom 10px)") is "ellipse(10px closest-side at right 10px bottom 10px)"
-PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px at left top 10px)") is "ellipse(10px 20px at left 0% top 10px)"
+PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px at left top 10px)") is "ellipse(10px 20px at 0% 10px)"
 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 20px at left top 10px)") is "ellipse(10px 20px at 0% 10px)"
-PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px at top 10px left 10px)") is "ellipse(10px 20px at left 10px top 10px)"
+PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px at top 10px left 10px)") is "ellipse(10px 20px at 10px 10px)"
 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 20px at top 10px left 10px)") is "ellipse(10px 20px at 10px 10px)"
 PASS getCSSText("-webkit-shape-outside", "ellipse(10px 20px at right 10px bottom 10px)") is "ellipse(10px 20px at right 10px bottom 10px)"
 PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 20px at right 10px bottom 10px)") is "ellipse(10px 20px at right 10px bottom 10px)"
+PASS getCSSText("-webkit-shape-outside", "ellipse(10px 10px at right 10% bottom 10%)") is "ellipse(10px 10px at 90% 90%)"
+PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 10px at right 10% bottom 10%)") is "ellipse(10px 10px at 90% 90%)"
+PASS getCSSText("-webkit-shape-outside", "ellipse(10px 10px at right 0px bottom 0px)") is "ellipse(10px 10px at 100% 100%)"
+PASS getComputedStyleValue("-webkit-shape-outside", "ellipse(10px 10px at right 0px bottom 0px)") is "ellipse(10px 10px at 100% 100%)"
 PASS getCSSText("-webkit-shape-outside", "polygon(10px 20px, 30px 40px, 40px 50px)") is "polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)"
 PASS getComputedStyleValue("-webkit-shape-outside", "polygon(10px 20px, 30px 40px, 40px 50px)") is "polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)"
 PASS getCSSText("-webkit-shape-outside", "polygon(evenodd, 10px 20px, 30px 40px, 40px 50px)") is "polygon(evenodd, 10px 20px, 30px 40px, 40px 50px)"

Modified: trunk/LayoutTests/fast/shapes/parsing/parsing-test-utils.js (165276 => 165277)


--- trunk/LayoutTests/fast/shapes/parsing/parsing-test-utils.js	2014-03-07 20:20:17 UTC (rev 165276)
+++ trunk/LayoutTests/fast/shapes/parsing/parsing-test-utils.js	2014-03-07 20:29:39 UTC (rev 165277)
@@ -60,9 +60,9 @@
 
     "ellipse(10px, 20px, 30px, 40px)", // FIXME: Remove this test once we do not support the deprecated CSS Shapes syntax anymore.
 
-    ["ellipse()", "ellipse()", "ellipse(closest-side closest-side at 50% 50%)"],
-    ["ellipse(10px)", "ellipse(10px)", "ellipse(10px closest-side at 50% 50%)"],
-    ["ellipse(10px 20px)", "ellipse(10px 20px)", "ellipse(10px 20px at 50% 50%)"],
+    ["ellipse()", "ellipse(at 50% 50%)", "ellipse(closest-side closest-side at 50% 50%)"],
+    ["ellipse(10px)", "ellipse(10px at 50% 50%)", "ellipse(10px closest-side at 50% 50%)"],
+    ["ellipse(10px 20px)", "ellipse(10px 20px at 50% 50%)", "ellipse(10px 20px at 50% 50%)"],
     ["ellipse(10px at 10px)", "ellipse(10px at 10px 50%)", "ellipse(10px closest-side at 10px 50%)"],
     ["ellipse(10px 20px at 10px)", "ellipse(10px 20px at 10px 50%)"],
     ["ellipse(10px at 10px 10px)", "ellipse(10px at 10px 10px)", "ellipse(10px closest-side at 10px 10px)"],
@@ -70,12 +70,14 @@
     ["ellipse(at 10px 10px)", "ellipse(at 10px 10px)", "ellipse(closest-side closest-side at 10px 10px)"],
     ["ellipse(at top left)", "ellipse(at 0% 0%)", "ellipse(closest-side closest-side at 0% 0%)"],
     ["ellipse(at right bottom)", "ellipse(at 100% 100%)", "ellipse(closest-side closest-side at 100% 100%)"],
-    ["ellipse(10px at left top 10px)", "ellipse(10px at left 0% top 10px)", "ellipse(10px closest-side at 0% 10px)"],
-    ["ellipse(10px at top 10px left 10px)", "ellipse(10px at left 10px top 10px)", "ellipse(10px closest-side at 10px 10px)"],
+    ["ellipse(10px at left top 10px)", "ellipse(10px at 0% 10px)", "ellipse(10px closest-side at 0% 10px)"],
+    ["ellipse(10px at top 10px left 10px)", "ellipse(10px at 10px 10px)", "ellipse(10px closest-side at 10px 10px)"],
     ["ellipse(10px at right 10px bottom 10px)", "ellipse(10px at right 10px bottom 10px)", "ellipse(10px closest-side at right 10px bottom 10px)"],
-    ["ellipse(10px 20px at left top 10px)", "ellipse(10px 20px at left 0% top 10px)", "ellipse(10px 20px at 0% 10px)"],
-    ["ellipse(10px 20px at top 10px left 10px)", "ellipse(10px 20px at left 10px top 10px)", "ellipse(10px 20px at 10px 10px)"],
+    ["ellipse(10px 20px at left top 10px)", "ellipse(10px 20px at 0% 10px)", "ellipse(10px 20px at 0% 10px)"],
+    ["ellipse(10px 20px at top 10px left 10px)", "ellipse(10px 20px at 10px 10px)", "ellipse(10px 20px at 10px 10px)"],
     ["ellipse(10px 20px at right 10px bottom 10px)", "ellipse(10px 20px at right 10px bottom 10px)"],
+    ["ellipse(10px 10px at right 10% bottom 10%)", "ellipse(10px 10px at 90% 90%)"],
+    ["ellipse(10px 10px at right 0px bottom 0px)", "ellipse(10px 10px at 100% 100%)"],
 
     ["polygon(10px 20px, 30px 40px, 40px 50px)", "polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)"],
     ["polygon(evenodd, 10px 20px, 30px 40px, 40px 50px)", "polygon(evenodd, 10px 20px, 30px 40px, 40px 50px)"],

Modified: trunk/Source/WebCore/ChangeLog (165276 => 165277)


--- trunk/Source/WebCore/ChangeLog	2014-03-07 20:20:17 UTC (rev 165276)
+++ trunk/Source/WebCore/ChangeLog	2014-03-07 20:29:39 UTC (rev 165277)
@@ -1,3 +1,22 @@
+2014-03-07  Bear Travis  <[email protected]>
+
+        [CSS Shapes] Correctly serialize ellipse positions
+        https://bugs.webkit.org/show_bug.cgi?id=129700
+
+        Reviewed by Dirk Schulze.
+
+        Updating ellipse serialization to be in line with
+        the CSS Shapes spec. Positions should serialize as
+        2 or 4-value positions, converting keywords to
+        percentages where possible. This uses the same method
+        as circle position serialization (bug 129404).
+
+        Updated existing parsing tests.
+
+        * css/CSSBasicShapes.cpp:
+        (WebCore::CSSBasicShapeEllipse::cssText): Use the
+        normalization / serialization helpers for shape position.
+
 2014-03-07  Brian Burg  <[email protected]>
 
         Unreviewed, rebaseline run-binding-tests results after r165242.

Modified: trunk/Source/WebCore/css/CSSBasicShapes.cpp (165276 => 165277)


--- trunk/Source/WebCore/css/CSSBasicShapes.cpp	2014-03-07 20:20:17 UTC (rev 165276)
+++ trunk/Source/WebCore/css/CSSBasicShapes.cpp	2014-03-07 20:29:39 UTC (rev 165277)
@@ -262,10 +262,13 @@
 
 String CSSBasicShapeEllipse::cssText() const
 {
+    RefPtr<CSSPrimitiveValue> normalizedCX = buildSerializablePositionOffset(m_centerX, CSSValueLeft);
+    RefPtr<CSSPrimitiveValue> normalizedCY = buildSerializablePositionOffset(m_centerY, CSSValueTop);
+
     return buildEllipseString(m_radiusX ? m_radiusX->cssText() : String(),
         m_radiusY ? m_radiusY->cssText() : String(),
-        m_centerX ? m_centerX->cssText() : String(),
-        m_centerY ? m_centerY->cssText() : String(),
+        serializePositionOffset(*normalizedCX->getPairValue(), *normalizedCY->getPairValue()),
+        serializePositionOffset(*normalizedCY->getPairValue(), *normalizedCX->getPairValue()),
         m_layoutBox ? m_layoutBox->cssText() : String());
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to