[CSS Grid Layout] grid-template-areas should accept none value
authorrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 May 2015 05:39:02 +0000 (05:39 +0000)
committerrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 May 2015 05:39:02 +0000 (05:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144624

Reviewed by Darin Adler.

Source/WebCore:

Default value for grid-template-areas property is "none":
http://dev.w3.org/csswg/css-grid/#propdef-grid-template-areas

Currently if you set the property to "none" from JavaScript, the value
doesn't get reseted and it keeps the old value.

Update fast/css-grid-layout/grid-template-areas-get-set.html adding a
new test case.

* css/CSSParser.cpp:
(WebCore::CSSParser::parseGridTemplateAreas): Add support to parse
"none" successfully.

LayoutTests:

* fast/css-grid-layout/grid-template-areas-get-set-expected.txt:
* fast/css-grid-layout/grid-template-areas-get-set.html: Add new test
case to check "none" support.

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

LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/grid-template-areas-get-set-expected.txt
LayoutTests/fast/css-grid-layout/grid-template-areas-get-set.html
Source/WebCore/ChangeLog
Source/WebCore/css/CSSParser.cpp

index 0ef3f16..f96ac0f 100644 (file)
@@ -1,3 +1,14 @@
+2015-05-05  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        [CSS Grid Layout] grid-template-areas should accept none value
+        https://bugs.webkit.org/show_bug.cgi?id=144624
+
+        Reviewed by Darin Adler.
+
+        * fast/css-grid-layout/grid-template-areas-get-set-expected.txt:
+        * fast/css-grid-layout/grid-template-areas-get-set.html: Add new test
+        case to check "none" support.
+
 2015-05-05  Ryosuke Niwa  <rniwa@webkit.org>
 
         Fix tests after r183770 on non-Mac ports. These tests are expecting Mac editing behavior.
index 73b41ce..dde64fc 100644 (file)
@@ -15,6 +15,9 @@ PASS getComputedStyle(gridWithHorizontalRectangle).getPropertyValue('-webkit-gri
 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\""
+PASS getComputedStyle(element).getPropertyValue('-webkit-grid-template-areas') is "none"
+PASS getComputedStyle(element).getPropertyValue('-webkit-grid-template-areas') is "\"foobar\""
+PASS getComputedStyle(element).getPropertyValue('-webkit-grid-template-areas') is "none"
 Test grid-template-areas: inherit
 PASS getComputedStyle(parentElement).getPropertyValue('-webkit-grid-template-areas') is "\"foo bar\""
 PASS getComputedStyle(element).getPropertyValue('-webkit-grid-template-areas') is "\"foo bar\""
index 009caad..504464e 100644 (file)
     element.style.webkitGridTemplateAreas = "'foobar'";
     testJSGridTemplateAreas(element, '"foobar"');
     element.style.webkitGridTemplateAreas = "initial";
+    testJSGridTemplateAreas(element, 'none');
+    element.style.webkitGridTemplateAreas = "'foobar'";
+    testJSGridTemplateAreas(element, '"foobar"');
+    element.style.webkitGridTemplateAreas = "none";
+    testJSGridTemplateAreas(element, 'none');
     document.body.removeChild(element);
 
     debug("Test grid-template-areas: inherit");
index 3839f9a..e17eae8 100644 (file)
@@ -1,3 +1,23 @@
+2015-05-05  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        [CSS Grid Layout] grid-template-areas should accept none value
+        https://bugs.webkit.org/show_bug.cgi?id=144624
+
+        Reviewed by Darin Adler.
+
+        Default value for grid-template-areas property is "none":
+        http://dev.w3.org/csswg/css-grid/#propdef-grid-template-areas
+
+        Currently if you set the property to "none" from JavaScript, the value
+        doesn't get reseted and it keeps the old value.
+
+        Update fast/css-grid-layout/grid-template-areas-get-set.html adding a
+        new test case.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseGridTemplateAreas): Add support to parse
+        "none" successfully.
+
 2015-05-05  Zalan Bujtas  <zalan@apple.com>
 
         Remove unused RenderLayerBacking::hasContentsLayer().
index aed1acc..b200438 100644 (file)
@@ -6012,6 +6012,11 @@ bool CSSParser::parseGridTemplateAreasRow(NamedGridAreaMap& gridAreaMap, const u
 
 PassRefPtr<CSSValue> CSSParser::parseGridTemplateAreas()
 {
+    if (m_valueList->current() && m_valueList->current()->id == CSSValueNone) {
+        m_valueList->next();
+        return cssValuePool().createIdentifierValue(CSSValueNone);
+    }
+
     NamedGridAreaMap gridAreaMap;
     unsigned rowCount = 0;
     unsigned columnCount = 0;