Title: [154730] trunk
Revision
154730
Author
[email protected]
Date
2013-08-28 02:58:33 -0700 (Wed, 28 Aug 2013)

Log Message

[CSS Grid Layout] infinity should be defined as a negative value
https://bugs.webkit.org/show_bug.cgi?id=107053

Reviewed by Andreas Kling.

>From Blink r154805 by <[email protected]>

Source/WebCore:

Reject negative values for track-breadth at parse time as
mentioned in the latest versions of the spec.

Added some extra checks to the existing tests.

* css/CSSParser.cpp:
(WebCore::CSSParser::parseGridBreadth):
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeUsedBreadthOfMaxLength):

LayoutTests:

Added some new test cases to check that track-breadth cannot be a
negative value, either it's a length, a percentage...

* fast/css-grid-layout/grid-columns-rows-get-set-expected.txt:
* fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt:
* fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js:
* fast/css-grid-layout/resources/grid-columns-rows-get-set.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (154729 => 154730)


--- trunk/LayoutTests/ChangeLog	2013-08-28 09:45:14 UTC (rev 154729)
+++ trunk/LayoutTests/ChangeLog	2013-08-28 09:58:33 UTC (rev 154730)
@@ -1,5 +1,22 @@
 2013-08-28  Sergio Villar Senin  <[email protected]>
 
+        [CSS Grid Layout] infinity should be defined as a negative value
+        https://bugs.webkit.org/show_bug.cgi?id=107053
+
+        Reviewed by Andreas Kling.
+
+        From Blink r154805 by <[email protected]>
+
+        Added some new test cases to check that track-breadth cannot be a
+        negative value, either it's a length, a percentage...
+
+        * fast/css-grid-layout/grid-columns-rows-get-set-expected.txt:
+        * fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt:
+        * fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js:
+        * fast/css-grid-layout/resources/grid-columns-rows-get-set.js:
+
+2013-08-28  Sergio Villar Senin  <[email protected]>
+
         [Soup] WebTiming information not shown in the inspector
         https://bugs.webkit.org/show_bug.cgi?id=118395
 

Modified: trunk/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-expected.txt (154729 => 154730)


--- trunk/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-expected.txt	2013-08-28 09:45:14 UTC (rev 154729)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-expected.txt	2013-08-28 09:58:33 UTC (rev 154730)
@@ -70,6 +70,10 @@
 PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'none'
 PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
 PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'none'
+PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
+PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'none'
+PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
+PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'none'
 
 Test setting grid-definition-columns and grid-definition-rows back to 'none' through JS
 PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is '18px'

Modified: trunk/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt (154729 => 154730)


--- trunk/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt	2013-08-28 09:45:14 UTC (rev 154729)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt	2013-08-28 09:58:33 UTC (rev 154730)
@@ -64,6 +64,10 @@
 PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'none'
 PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
 PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'none'
+PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
+PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'none'
+PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
+PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'none'
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js (154729 => 154730)


--- trunk/LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js	2013-08-28 09:45:14 UTC (rev 154729)
+++ trunk/LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js	2013-08-28 09:58:33 UTC (rev 154730)
@@ -152,3 +152,18 @@
 element.style.webkitGridDefinitionRows = "minmax(auto, 15%) 10vw";
 shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'none'");
 shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'none'");
+
+// Negative values are not allowed.
+element = document.createElement("div");
+document.body.appendChild(element);
+element.style.webkitGridDefinitionColumns = "-10px minmax(16px, 32px)";
+element.style.webkitGridDefinitionRows = "minmax(10%, 15%) -10vw";
+shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'none'");
+shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'none'");
+
+element = document.createElement("div");
+document.body.appendChild(element);
+element.style.webkitGridDefinitionColumns = "10px minmax(16px, -1vw)";
+element.style.webkitGridDefinitionRows = "minmax(-1%, 15%) 10vw";
+shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'none'");
+shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'none'");

Modified: trunk/LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set.js (154729 => 154730)


--- trunk/LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set.js	2013-08-28 09:45:14 UTC (rev 154729)
+++ trunk/LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set.js	2013-08-28 09:58:33 UTC (rev 154730)
@@ -180,6 +180,17 @@
 shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'none'");
 shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'none'");
 
+// Negative values are not allowed.
+element.style.webkitGridDefinitionColumns = "-1px";
+element.style.webkitGridDefinitionRows = "-6em";
+shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'none'");
+shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'none'");
+
+element.style.webkitGridDefinitionColumns = "minmax(-1%, 32%)";
+element.style.webkitGridDefinitionRows = "minmax(2vw, -6em)";
+shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'none'");
+shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'none'");
+
 debug("");
 debug("Test setting grid-definition-columns and grid-definition-rows back to 'none' through JS");
 element.style.webkitGridDefinitionColumns = "18px";

Modified: trunk/Source/WebCore/ChangeLog (154729 => 154730)


--- trunk/Source/WebCore/ChangeLog	2013-08-28 09:45:14 UTC (rev 154729)
+++ trunk/Source/WebCore/ChangeLog	2013-08-28 09:58:33 UTC (rev 154730)
@@ -1,5 +1,24 @@
 2013-08-28  Sergio Villar Senin  <[email protected]>
 
+        [CSS Grid Layout] infinity should be defined as a negative value
+        https://bugs.webkit.org/show_bug.cgi?id=107053
+
+        Reviewed by Andreas Kling.
+
+        From Blink r154805 by <[email protected]>
+
+        Reject negative values for track-breadth at parse time as
+        mentioned in the latest versions of the spec.
+
+        Added some extra checks to the existing tests.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseGridBreadth):
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::computeUsedBreadthOfMaxLength):
+
+2013-08-28  Sergio Villar Senin  <[email protected]>
+
         [Soup] WebTiming information not shown in the inspector
         https://bugs.webkit.org/show_bug.cgi?id=118395
 

Modified: trunk/Source/WebCore/css/CSSParser.cpp (154729 => 154730)


--- trunk/Source/WebCore/css/CSSParser.cpp	2013-08-28 09:45:14 UTC (rev 154729)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2013-08-28 09:58:33 UTC (rev 154730)
@@ -4925,7 +4925,7 @@
     if (currentValue->id == CSSValueWebkitMinContent || currentValue->id == CSSValueWebkitMaxContent)
         return cssValuePool().createIdentifierValue(currentValue->id);
 
-    if (!validUnit(currentValue, FLength | FPercent))
+    if (!validUnit(currentValue, FNonNeg | FLength | FPercent))
         return 0;
 
     return createPrimitiveNumericValue(currentValue);

Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (154729 => 154730)


--- trunk/Source/WebCore/rendering/RenderGrid.cpp	2013-08-28 09:45:14 UTC (rev 154729)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp	2013-08-28 09:58:33 UTC (rev 154730)
@@ -33,7 +33,7 @@
 
 namespace WebCore {
 
-static const int infinity = intMaxForLayoutUnit;
+static const int infinity = -1;
 
 class GridTrack {
 public:
@@ -303,8 +303,7 @@
 {
     if (trackLength.isFixed() || trackLength.isPercent() || trackLength.isViewportPercentage()) {
         LayoutUnit computedBreadth = computeUsedBreadthOfSpecifiedLength(direction, trackLength);
-        // FIXME: We should ASSERT that computedBreadth cannot return infinity but it's currently
-        // possible. See https://bugs.webkit.org/show_bug.cgi?id=107053
+        ASSERT(computedBreadth != infinity);
         return computedBreadth;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to