Title: [130997] trunk
Revision
130997
Author
[email protected]
Date
2012-10-10 19:26:43 -0700 (Wed, 10 Oct 2012)

Log Message

column-count: 0 should not prevent margin-collapse through
https://bugs.webkit.org/show_bug.cgi?id=65159

Patch by Tab Atkins <[email protected]> on 2012-10-10
Reviewed by Tony Chang.

Source/WebCore:

This patch makes "column-count:0" be properly recognized as invalid syntax,
as it violates the property grammar in the spec.

Tests: fast/multicol/zeroColumnCount.html

* css/CSSParser.cpp:
(WebCore::CSSParser::validUnit):
(WebCore::CSSParser::parseValue):
* css/CSSParser.h:

LayoutTests:

Fixed the zeroColumnCount.html test to properly test that "0" is an invalid CSS value,
rather than just ensuring that it doesn't crash.

* fast/multicol/zeroColumnCount-expected.txt:
* fast/multicol/zeroColumnCount.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (130996 => 130997)


--- trunk/LayoutTests/ChangeLog	2012-10-11 02:24:38 UTC (rev 130996)
+++ trunk/LayoutTests/ChangeLog	2012-10-11 02:26:43 UTC (rev 130997)
@@ -1,3 +1,16 @@
+2012-10-10  Tab Atkins  <[email protected]>
+
+        column-count: 0 should not prevent margin-collapse through
+        https://bugs.webkit.org/show_bug.cgi?id=65159
+
+        Reviewed by Tony Chang.
+
+        Fixed the zeroColumnCount.html test to properly test that "0" is an invalid CSS value,
+        rather than just ensuring that it doesn't crash.
+
+        * fast/multicol/zeroColumnCount-expected.txt:
+        * fast/multicol/zeroColumnCount.html:
+
 2012-10-10  Alexander Shalamov  <[email protected]>
 
         Invalid values for media query features are not handled

Modified: trunk/LayoutTests/fast/multicol/zeroColumnCount-expected.txt (130996 => 130997)


--- trunk/LayoutTests/fast/multicol/zeroColumnCount-expected.txt	2012-10-11 02:24:38 UTC (rev 130996)
+++ trunk/LayoutTests/fast/multicol/zeroColumnCount-expected.txt	2012-10-11 02:26:43 UTC (rev 130997)
@@ -1,2 +1,10 @@
-This test succeeds if it does not crash.
+Test that column-count:0 is parsed as invalid syntax and thrown away.
 
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS getComputedStyle(document.body).webkitColumnCount is '2'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/LayoutTests/fast/multicol/zeroColumnCount.html (130996 => 130997)


--- trunk/LayoutTests/fast/multicol/zeroColumnCount.html	2012-10-11 02:24:38 UTC (rev 130996)
+++ trunk/LayoutTests/fast/multicol/zeroColumnCount.html	2012-10-11 02:26:43 UTC (rev 130997)
@@ -1,8 +1,16 @@
-This test succeeds if it does not crash.
-
-<h2 style="-webkit-column-count: 0;">
-
+<!DOCTYPE html>
+<body>
+<style>
+body {
+	-webkit-column-count: 2;
+	-webkit-column-count: 0;
+}
+</style>
+<script src=""
 <script>
+description("Test that column-count:0 is parsed as invalid syntax and thrown away.");
+shouldBe("getComputedStyle(document.body).webkitColumnCount", "'2'");
 if (window.testRunner)
     testRunner.dumpAsText();
 </script>
+<script src=""
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (130996 => 130997)


--- trunk/Source/WebCore/ChangeLog	2012-10-11 02:24:38 UTC (rev 130996)
+++ trunk/Source/WebCore/ChangeLog	2012-10-11 02:26:43 UTC (rev 130997)
@@ -1,3 +1,20 @@
+2012-10-10  Tab Atkins  <[email protected]>
+
+        column-count: 0 should not prevent margin-collapse through
+        https://bugs.webkit.org/show_bug.cgi?id=65159
+
+        Reviewed by Tony Chang.
+
+        This patch makes "column-count:0" be properly recognized as invalid syntax,
+        as it violates the property grammar in the spec.
+
+        Tests: fast/multicol/zeroColumnCount.html
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::validUnit):
+        (WebCore::CSSParser::parseValue):
+        * css/CSSParser.h:
+
 2012-10-10  Benjamin Poulain  <[email protected]>
 
         [WK2] Safari crashes on error when using CFNetwork

Modified: trunk/Source/WebCore/css/CSSParser.cpp (130996 => 130997)


--- trunk/Source/WebCore/css/CSSParser.cpp	2012-10-11 02:24:38 UTC (rev 130996)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2012-10-11 02:26:43 UTC (rev 130997)
@@ -1522,6 +1522,8 @@
         }
         if (!b && (unitflags & FInteger) && value->isInt)
             b = true;
+        if (!b && (unitflags & FPositiveInteger) && value->isInt && value->fValue > 0)
+            b = true;
         break;
     case CSSPrimitiveValue::CSS_PERCENTAGE:
         b = (unitflags & FPercent);
@@ -2436,7 +2438,7 @@
         if (id == CSSValueAuto)
             validPrimitive = true;
         else
-            validPrimitive = !id && validUnit(value, FInteger | FNonNeg, CSSQuirksMode);
+            validPrimitive = !id && validUnit(value, FPositiveInteger, CSSQuirksMode);
         break;
     case CSSPropertyWebkitColumnGap:         // normal | <length>
         if (id == CSSValueNormal)

Modified: trunk/Source/WebCore/css/CSSParser.h (130996 => 130997)


--- trunk/Source/WebCore/css/CSSParser.h	2012-10-11 02:24:38 UTC (rev 130996)
+++ trunk/Source/WebCore/css/CSSParser.h	2012-10-11 02:26:43 UTC (rev 130997)
@@ -525,19 +525,20 @@
 
     // defines units allowed for a certain property, used in parseUnit
     enum Units {
-        FUnknown   = 0x0000,
-        FInteger   = 0x0001,
-        FNumber    = 0x0002,  // Real Numbers
-        FPercent   = 0x0004,
-        FLength    = 0x0008,
-        FAngle     = 0x0010,
-        FTime      = 0x0020,
+        FUnknown = 0x0000,
+        FInteger = 0x0001,
+        FNumber = 0x0002, // Real Numbers
+        FPercent = 0x0004,
+        FLength = 0x0008,
+        FAngle = 0x0010,
+        FTime = 0x0020,
         FFrequency = 0x0040,
-        FRelative  = 0x0100,
+        FPositiveInteger = 0x0080,
+        FRelative = 0x0100,
 #if ENABLE(CSS_IMAGE_RESOLUTION)
-        FResolution= 0x0200,
+        FResolution = 0x0200,
 #endif
-        FNonNeg    = 0x0400
+        FNonNeg = 0x0400
     };
 
     friend inline Units operator|(Units a, Units b)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to