Title: [123405] trunk
Revision
123405
Author
[email protected]
Date
2012-07-23 16:56:38 -0700 (Mon, 23 Jul 2012)

Log Message

[CSS Exclusions] SVG shape errors should invalidate exclusion shapes
https://bugs.webkit.org/show_bug.cgi?id=91761

Patch by Bem Jones-Bey <[email protected]> on 2012-07-23
Reviewed by Andreas Kling.

Source/WebCore:

CSS exclusion shapes that are specified with negative radiuses or
height/width are now considered invalid and ignored.

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

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

LayoutTests:

Test that negative heights. widths, and radiuses are ignored.

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

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (123404 => 123405)


--- trunk/LayoutTests/ChangeLog	2012-07-23 23:46:01 UTC (rev 123404)
+++ trunk/LayoutTests/ChangeLog	2012-07-23 23:56:38 UTC (rev 123405)
@@ -1,3 +1,15 @@
+2012-07-23  Bem Jones-Bey  <[email protected]>
+
+        [CSS Exclusions] SVG shape errors should invalidate exclusion shapes
+        https://bugs.webkit.org/show_bug.cgi?id=91761
+
+        Reviewed by Andreas Kling.
+
+        Test that negative heights. widths, and radiuses are ignored.
+
+        * fast/exclusions/parsing-wrap-shape-lengths-expected.txt:
+        * fast/exclusions/parsing-wrap-shape-lengths.html:
+
 2012-07-23  Caio Marcelo de Oliveira Filho  <[email protected]>
 
         [Qt] css3/selectors3 rebaseline after new test fonts

Modified: trunk/LayoutTests/fast/exclusions/parsing-wrap-shape-lengths-expected.txt (123404 => 123405)


--- trunk/LayoutTests/fast/exclusions/parsing-wrap-shape-lengths-expected.txt	2012-07-23 23:46:01 UTC (rev 123404)
+++ trunk/LayoutTests/fast/exclusions/parsing-wrap-shape-lengths-expected.txt	2012-07-23 23:56:38 UTC (rev 123405)
@@ -37,6 +37,20 @@
 PASS computedStyle("-webkit-shape-inside", "circle(1px, 1px, 1p)") is "auto"
 PASS innerStyle("-webkit-shape-inside", "circle(1px, 1px, calc())") is null
 PASS computedStyle("-webkit-shape-inside", "circle(1px, 1px, calc())") is "auto"
+PASS innerStyle("-webkit-shape-inside", "circle(-1.5px, +1.5px, -1.5px)") is null
+PASS computedStyle("-webkit-shape-inside", "circle(-1.5px, +1.5px, -1.5px)") is "auto"
+PASS innerStyle("-webkit-shape-inside", "rectangle(1cm, 1mm, 1in, 1px, -1pt, 1pc)") is null
+PASS computedStyle("-webkit-shape-inside", "rectangle(1cm, 1mm, 1in, 1px, -1pt, 1pc)") is "auto"
+PASS innerStyle("-webkit-shape-inside", "rectangle(1cm, 1mm, 1in, 1px, 1pt, -1pc)") is null
+PASS computedStyle("-webkit-shape-inside", "rectangle(1cm, 1mm, 1in, 1px, 1pt, -1pc)") is "auto"
+PASS innerStyle("-webkit-shape-inside", "ellipse(1em, 1em, -1em, 1em)") is null
+PASS computedStyle("-webkit-shape-inside", "ellipse(1em, 1em, -1em, 1em)") is "auto"
+PASS innerStyle("-webkit-shape-inside", "ellipse(1em, 1em, 1em, -1em)") is null
+PASS computedStyle("-webkit-shape-inside", "ellipse(1em, 1em, 1em, -1em)") is "auto"
+PASS innerStyle("-webkit-shape-inside", "rectangle(1cm, 1mm, -1in, 1px, 1pt, 1pc)") is null
+PASS computedStyle("-webkit-shape-inside", "rectangle(1cm, 1mm, -1in, 1px, 1pt, 1pc)") is "auto"
+PASS innerStyle("-webkit-shape-inside", "rectangle(1cm, 1mm, 1in, -1px, 1pt, 1pc)") is null
+PASS computedStyle("-webkit-shape-inside", "rectangle(1cm, 1mm, 1in, -1px, 1pt, 1pc)") is "auto"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/exclusions/parsing-wrap-shape-lengths.html (123404 => 123405)


--- trunk/LayoutTests/fast/exclusions/parsing-wrap-shape-lengths.html	2012-07-23 23:46:01 UTC (rev 123404)
+++ trunk/LayoutTests/fast/exclusions/parsing-wrap-shape-lengths.html	2012-07-23 23:56:38 UTC (rev 123405)
@@ -88,6 +88,18 @@
 negativeTest("-webkit-shape-inside", "circle(1px, 1px, px)");
 negativeTest("-webkit-shape-inside", "circle(1px, 1px, 1p)");
 negativeTest("-webkit-shape-inside", "circle(1px, 1px, calc())");
+
+// reject negative radiuses
+negativeTest("-webkit-shape-inside", "circle(-1.5px, +1.5px, -1.5px)");
+negativeTest("-webkit-shape-inside", "rectangle(1cm, 1mm, 1in, 1px, -1pt, 1pc)");
+negativeTest("-webkit-shape-inside", "rectangle(1cm, 1mm, 1in, 1px, 1pt, -1pc)");
+negativeTest("-webkit-shape-inside", "ellipse(1em, 1em, -1em, 1em)");
+negativeTest("-webkit-shape-inside", "ellipse(1em, 1em, 1em, -1em)");
+
+// reject negative height and width
+negativeTest("-webkit-shape-inside", "rectangle(1cm, 1mm, -1in, 1px, 1pt, 1pc)");
+negativeTest("-webkit-shape-inside", "rectangle(1cm, 1mm, 1in, -1px, 1pt, 1pc)");
+
 </script>
 <script src=""
 </body>

Modified: trunk/Source/WebCore/ChangeLog (123404 => 123405)


--- trunk/Source/WebCore/ChangeLog	2012-07-23 23:46:01 UTC (rev 123404)
+++ trunk/Source/WebCore/ChangeLog	2012-07-23 23:56:38 UTC (rev 123405)
@@ -1,3 +1,21 @@
+2012-07-23  Bem Jones-Bey  <[email protected]>
+
+        [CSS Exclusions] SVG shape errors should invalidate exclusion shapes
+        https://bugs.webkit.org/show_bug.cgi?id=91761
+
+        Reviewed by Andreas Kling.
+
+        CSS exclusion shapes that are specified with negative radiuses or
+        height/width are now considered invalid and ignored.
+
+        Tests added to
+        LayoutTests/fast/exclusions/parsing-wrap-shape-lengths.html
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseExclusionShapeRectangle):
+        (WebCore::CSSParser::parseExclusionShapeCircle):
+        (WebCore::CSSParser::parseExclusionShapeEllipse):
+
 2012-07-23  Tien-Ren Chen  <[email protected]>
 
         [chromium] Implement scrollbar theme for Android

Modified: trunk/Source/WebCore/css/CSSParser.cpp (123404 => 123405)


--- trunk/Source/WebCore/css/CSSParser.cpp	2012-07-23 23:46:01 UTC (rev 123404)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2012-07-23 23:56:38 UTC (rev 123405)
@@ -4469,7 +4469,12 @@
     unsigned argumentNumber = 0;
     CSSParserValue* argument = args->current();
     while (argument) {
-        if (!validUnit(argument, FLength | FPercent))
+        Units unitFlags = FLength | FPercent;
+        if (argumentNumber > 1) {
+            // Arguments width, height, rx, and ry cannot be negative.
+            unitFlags = unitFlags | FNonNeg;
+        }
+        if (!validUnit(argument, unitFlags))
             return 0;
 
         RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
@@ -4522,7 +4527,13 @@
     unsigned argumentNumber = 0;
     CSSParserValue* argument = args->current();
     while (argument) {
-        if (!validUnit(argument, FLength | FPercent))
+        Units unitFlags = FLength | FPercent;
+        if (argumentNumber == 2) {
+            // Argument radius cannot be negative.
+            unitFlags = unitFlags | FNonNeg;
+        }
+
+        if (!validUnit(argument, unitFlags))
             return 0;
 
         RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
@@ -4565,7 +4576,12 @@
     unsigned argumentNumber = 0;
     CSSParserValue* argument = args->current();
     while (argument) {
-        if (!validUnit(argument, FLength | FPercent))
+        Units unitFlags = FLength | FPercent;
+        if (argumentNumber > 1) {
+            // Arguments radiusX and radiusY cannot be negative.
+            unitFlags = unitFlags | FNonNeg;
+        }
+        if (!validUnit(argument, unitFlags))
             return 0;
 
         RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to