[CSS Grid Layout] Vertical rectangles not considered as valid grid areas
authorsvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Mar 2014 12:43:47 +0000 (12:43 +0000)
committersvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Mar 2014 12:43:47 +0000 (12:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=130513

Reviewed by Andreas Kling.

Source/WebCore:

Grid areas sized as vertical rectangles were incorrectly
considered as invalid by the parser. That's because the condition
checking that each new row was adjacent to the previous one was
using the first row of the currently parsed grid area instead of
the last one.

Test: fast/css-grid-layout/grid-template-areas-get-set.html

* css/CSSParser.cpp:
(WebCore::CSSParser::parseGridTemplateAreas):

LayoutTests:

Added tests for grid areas sized as horizontal and vertical
rectangles. The tests were also renamed from grid-template to
grid-template-areas which better describe their nature.

* fast/css-grid-layout/grid-template-areas-get-set-expected.txt: Renamed from LayoutTests/fast/css-grid-layout/grid-template-get-set-expected.txt.
* fast/css-grid-layout/grid-template-areas-get-set.html: Renamed from LayoutTests/fast/css-grid-layout/grid-template-get-set.html.

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

LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/grid-template-areas-get-set-expected.txt [moved from LayoutTests/fast/css-grid-layout/grid-template-get-set-expected.txt with 89% similarity]
LayoutTests/fast/css-grid-layout/grid-template-areas-get-set.html [moved from LayoutTests/fast/css-grid-layout/grid-template-get-set.html with 89% similarity]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSParser.cpp

index cd80718..d488916 100644 (file)
@@ -1,3 +1,17 @@
+2014-03-20  Sergio Villar Senin  <svillar@igalia.com>
+
+        [CSS Grid Layout] Vertical rectangles not considered as valid grid areas
+        https://bugs.webkit.org/show_bug.cgi?id=130513
+
+        Reviewed by Andreas Kling.
+
+        Added tests for grid areas sized as horizontal and vertical
+        rectangles. The tests were also renamed from grid-template to
+        grid-template-areas which better describe their nature.
+
+        * fast/css-grid-layout/grid-template-areas-get-set-expected.txt: Renamed from LayoutTests/fast/css-grid-layout/grid-template-get-set-expected.txt.
+        * fast/css-grid-layout/grid-template-areas-get-set.html: Renamed from LayoutTests/fast/css-grid-layout/grid-template-get-set.html.
+
 2014-03-25  Xabier Rodriguez Calvar  <calvaris@igalia.com>
 
         [GTK] Volume slider shows below the panel with videos in certain cases
@@ -11,6 +11,8 @@ PASS getComputedStyle(gridWithTwoRowsTemplate).getPropertyValue('-webkit-grid-te
 PASS getComputedStyle(gridWithSpanningColumnsTemplate).getPropertyValue('-webkit-grid-template-areas') is "\"span span\""
 PASS getComputedStyle(gridWithSpanningRowsDotTemplate).getPropertyValue('-webkit-grid-template-areas') is "\"span\" \".\""
 PASS getComputedStyle(gridWithDotColumn).getPropertyValue('-webkit-grid-template-areas') is "\"header .\" \"footer .\""
+PASS getComputedStyle(gridWithHorizontalRectangle).getPropertyValue('-webkit-grid-template-areas') is "\"a a a\" \"a a a\""
+PASS getComputedStyle(gridWithVerticalRectangle).getPropertyValue('-webkit-grid-template-areas') is "\"a a\" \"a a\" \"a a\""
 Test grid-template-areas: initial
 PASS getComputedStyle(element).getPropertyValue('-webkit-grid-template-areas') is "\"foobar\""
 Test grid-template-areas: inherit
@@ -33,6 +33,18 @@ if (window.testRunner)
     -webkit-grid-template-areas: "header ."
                                  "footer .";
 }
+
+#gridWithHorizontalRectangle {
+    -webkit-grid-template-areas: "a a a"
+                                 "a a a";
+}
+
+#gridWithVerticalRectangle {
+    -webkit-grid-template-areas: "a a"
+                                 "a a"
+                                 "a a";
+}
+
 </style>
 <script src="../../resources/js-test-pre.js"></script>
 </head>
@@ -44,6 +56,8 @@ if (window.testRunner)
 <div class="grid" id="gridWithSpanningColumnsTemplate"></div>
 <div class="grid" id="gridWithSpanningRowsDotTemplate"></div>
 <div class="grid" id="gridWithDotColumn"></div>
+<div class="grid" id="gridWithHorizontalRectangle"></div>
+<div class="grid" id="gridWithVerticalRectangle"></div>
 <script>
     description("This test checks that grid-template-areas is properly parsed.");
 
@@ -64,6 +78,8 @@ if (window.testRunner)
     testGridTemplateAreas("gridWithSpanningColumnsTemplate", '"span span"');
     testGridTemplateAreas("gridWithSpanningRowsDotTemplate", '"span" "."');
     testGridTemplateAreas("gridWithDotColumn", '"header ." "footer ."');
+    testGridTemplateAreas("gridWithHorizontalRectangle", '"a a a" "a a a"');
+    testGridTemplateAreas("gridWithVerticalRectangle", '"a a" "a a" "a a"');
 
     debug("Test grid-template-areas: initial");
     var element = document.createElement("div");
index 881a6a7..d655ae8 100644 (file)
@@ -1,3 +1,21 @@
+2014-03-20  Sergio Villar Senin  <svillar@igalia.com>
+
+        [CSS Grid Layout] Vertical rectangles not considered as valid grid areas
+        https://bugs.webkit.org/show_bug.cgi?id=130513
+
+        Reviewed by Andreas Kling.
+
+        Grid areas sized as vertical rectangles were incorrectly
+        considered as invalid by the parser. That's because the condition
+        checking that each new row was adjacent to the previous one was
+        using the first row of the currently parsed grid area instead of
+        the last one.
+
+        Test: fast/css-grid-layout/grid-template-areas-get-set.html
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseGridTemplateAreas):
+
 2014-03-25  Xabier Rodriguez Calvar  <calvaris@igalia.com>
 
         [GTK] Volume slider shows below the panel with videos in certain cases
index 2c35b13..25494f4 100644 (file)
@@ -5222,7 +5222,7 @@ PassRefPtr<CSSValue> CSSParser::parseGridTemplateAreas()
 
                 // The following checks test that the grid area is a single filled-in rectangle.
                 // 1. The new row is adjacent to the previously parsed row.
-                if (rowCount != gridCoordinate.rows.initialPositionIndex + 1)
+                if (rowCount != gridCoordinate.rows.finalPositionIndex + 1)
                     return 0;
 
                 // 2. The new area starts at the same position as the previously parsed area.