Shape-inside / shape-outside should support percent-based measurements
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jul 2012 18:24:03 +0000 (18:24 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jul 2012 18:24:03 +0000 (18:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90311

Patch by Bem Jones-Bey <bjonesbe@adobe.com> on 2012-07-19
Reviewed by Andreas Kling.

Source/WebCore:

Update the CSS Parser to accept percentage length values for exclusion
shapes.

Testing added to LayoutTests/fast/exclusions/parsing-wrap-shape-lengths.html

* css/CSSParser.cpp:
(WebCore::CSSParser::parseExclusionShapeRectangle):
(WebCore::CSSParser::parseExclusionShapeCircle):
(WebCore::CSSParser::parseExclusionShapeEllipse):
(WebCore::CSSParser::parseExclusionShapePolygon):

LayoutTests:

Added tests for percent based lengths for exclusion shapes.

* fast/exclusions/parsing-wrap-shape-lengths-expected.txt:
* fast/exclusions/parsing-wrap-shape-lengths.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123126 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/exclusions/parsing-wrap-shape-lengths-expected.txt
LayoutTests/fast/exclusions/parsing-wrap-shape-lengths.html
Source/WebCore/ChangeLog
Source/WebCore/css/CSSParser.cpp

index 5bfec86..1491696 100644 (file)
@@ -1,3 +1,15 @@
+2012-07-19  Bem Jones-Bey  <bjonesbe@adobe.com>
+
+        Shape-inside / shape-outside should support percent-based measurements
+        https://bugs.webkit.org/show_bug.cgi?id=90311
+
+        Reviewed by Andreas Kling.
+
+        Added tests for percent based lengths for exclusion shapes.
+
+        * fast/exclusions/parsing-wrap-shape-lengths-expected.txt:
+        * fast/exclusions/parsing-wrap-shape-lengths.html:
+
 2012-07-19  James Simonsen  <simonjam@chromium.org>
 
         Regression(120096): Protect the element used by ImageLoader until the end of notifyFinished().
index 3cf1928..e158cdd 100644 (file)
@@ -21,6 +21,14 @@ PASS innerStyle("-webkit-shape-inside", "circle(1vmin, 1vmin, 1vmin)") is "circl
 PASS computedStyle("-webkit-shape-inside", "circle(.5vw, 1vw, 1.5vw)") is "circle(0.5vw, 1vw, 1.5vw)"
 PASS computedStyle("-webkit-shape-inside", "circle(.5vh, 1vh, 1.5vh)") is "circle(0.5vh, 1vh, 1.5vh)"
 PASS computedStyle("-webkit-shape-inside", "circle(.5vmin, 1vmin, 1.5vmin)") is "circle(0.5vmin, 1vmin, 1.5vmin)"
+PASS innerStyle("-webkit-shape-inside", "circle(100%, 100%, 100%)") is "circle(100%, 100%, 100%)"
+PASS innerStyle("-webkit-shape-inside", "rectangle(45%, 45%, 90%, 60%, 25%, 10%)") is "rectangle(45%, 45%, 90%, 60%, 25%, 10%)"
+PASS innerStyle("-webkit-shape-inside", "ellipse(100%, 100%, 100%, 100%)") is "ellipse(100%, 100%, 100%, 100%)"
+PASS innerStyle("-webkit-shape-inside", "polygon(10% 20%, 30% 40%, 40% 50%)") is "polygon(nonzero, 10% 20%, 30% 40%, 40% 50%)"
+PASS computedStyle("-webkit-shape-inside", "circle(50%, 100%, 150%)") is "circle(50%, 100%, 150%)"
+PASS computedStyle("-webkit-shape-inside", "rectangle(45%, 45%, 90%, 60%, 25%, 10%)") is "rectangle(45%, 45%, 90%, 60%, 25%, 10%)"
+PASS computedStyle("-webkit-shape-inside", "ellipse(100%, 100%, 100%, 100%)") is "ellipse(100%, 100%, 100%, 100%)"
+PASS computedStyle("-webkit-shape-inside", "polygon(10% 20%, 30% 40%, 40% 50%)") is "polygon(nonzero, 10% 20%, 30% 40%, 40% 50%)"
 PASS innerStyle("-webkit-shape-inside", "circle(1px, 1px, 1)") is null
 PASS computedStyle("-webkit-shape-inside", "circle(1px, 1px, 1)") is "auto"
 PASS innerStyle("-webkit-shape-inside", "circle(1px, 1px, px)") is null
index c69d587..241d109 100644 (file)
@@ -72,6 +72,17 @@ testComputed("-webkit-shape-inside", "circle(.5vw, 1vw, 1.5vw)", "circle(0.5vw,
 testComputed("-webkit-shape-inside", "circle(.5vh, 1vh, 1.5vh)", "circle(0.5vh, 1vh, 1.5vh)");
 testComputed("-webkit-shape-inside", "circle(.5vmin, 1vmin, 1.5vmin)", "circle(0.5vmin, 1vmin, 1.5vmin)");
 
+// percentage lengths - units
+testInner("-webkit-shape-inside", "circle(100%, 100%, 100%)", "circle(100%, 100%, 100%)");
+testInner("-webkit-shape-inside", "rectangle(45%, 45%, 90%, 60%, 25%, 10%)", "rectangle(45%, 45%, 90%, 60%, 25%, 10%)");
+testInner("-webkit-shape-inside", "ellipse(100%, 100%, 100%, 100%)", "ellipse(100%, 100%, 100%, 100%)");
+testInner("-webkit-shape-inside", "polygon(10% 20%, 30% 40%, 40% 50%)", "polygon(nonzero, 10% 20%, 30% 40%, 40% 50%)");
+
+testComputed("-webkit-shape-inside", "circle(50%, 100%, 150%)", "circle(50%, 100%, 150%)");
+testComputed("-webkit-shape-inside", "rectangle(45%, 45%, 90%, 60%, 25%, 10%)", "rectangle(45%, 45%, 90%, 60%, 25%, 10%)");
+testComputed("-webkit-shape-inside", "ellipse(100%, 100%, 100%, 100%)", "ellipse(100%, 100%, 100%, 100%)");
+testComputed("-webkit-shape-inside", "polygon(10% 20%, 30% 40%, 40% 50%)", "polygon(nonzero, 10% 20%, 30% 40%, 40% 50%)");
+
 // reject non-lengths
 negativeTest("-webkit-shape-inside", "circle(1px, 1px, 1)");
 negativeTest("-webkit-shape-inside", "circle(1px, 1px, px)");
index 7b2d7c0..1ebac9a 100644 (file)
@@ -1,3 +1,21 @@
+2012-07-19  Bem Jones-Bey  <bjonesbe@adobe.com>
+
+        Shape-inside / shape-outside should support percent-based measurements
+        https://bugs.webkit.org/show_bug.cgi?id=90311
+
+        Reviewed by Andreas Kling.
+
+        Update the CSS Parser to accept percentage length values for exclusion
+        shapes.
+
+        Testing added to LayoutTests/fast/exclusions/parsing-wrap-shape-lengths.html
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseExclusionShapeRectangle):
+        (WebCore::CSSParser::parseExclusionShapeCircle):
+        (WebCore::CSSParser::parseExclusionShapeEllipse):
+        (WebCore::CSSParser::parseExclusionShapePolygon):
+
 2012-07-19  Tony Chang  <tony@chromium.org>
 
         Unreviewed, rolling out r123117.
index baa32df..640af02 100644 (file)
@@ -4465,7 +4465,7 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapeRectangle(CSSParserValueL
     unsigned argumentNumber = 0;
     CSSParserValue* argument = args->current();
     while (argument) {
-        if (!validUnit(argument, FLength))
+        if (!validUnit(argument, FLength | FPercent))
             return 0;
 
         RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
@@ -4518,7 +4518,7 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapeCircle(CSSParserValueList
     unsigned argumentNumber = 0;
     CSSParserValue* argument = args->current();
     while (argument) {
-        if (!validUnit(argument, FLength))
+        if (!validUnit(argument, FLength | FPercent))
             return 0;
 
         RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
@@ -4561,7 +4561,7 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapeEllipse(CSSParserValueLis
     unsigned argumentNumber = 0;
     CSSParserValue* argument = args->current();
     while (argument) {
-        if (!validUnit(argument, FLength))
+        if (!validUnit(argument, FLength | FPercent))
             return 0;
 
         RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
@@ -4622,11 +4622,11 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapePolygon(CSSParserValueLis
 
     CSSParserValue* argumentX = argument;
     while (argumentX) {
-        if (!validUnit(argumentX, FLength))
+        if (!validUnit(argumentX, FLength | FPercent))
             return 0;
 
         CSSParserValue* argumentY = args->next();
-        if (!argumentY || !validUnit(argumentY, FLength))
+        if (!argumentY || !validUnit(argumentY, FLength | FPercent))
             return 0;
 
         RefPtr<CSSPrimitiveValue> xLength = createPrimitiveNumericValue(argumentX);