[CSS Grid Layout] grid-template-areas should accept none value (issue 1117123005 by rego@igalia.com)

1 view
Skip to first unread message

re...@igalia.com

unread,
May 5, 2015, 5:30:14 AM5/5/15
to dsin...@chromium.org, le...@chromium.org, jchaf...@chromium.org, blink-...@chromium.org, jfern...@igalia.com, svi...@igalia.com, blink-re...@chromium.org, ed+bli...@opera.com, dglazko...@chromium.org, apavlo...@chromium.org, alexis...@intel.com, rob....@samsung.com
Reviewers: dsinclair, leviw, Julien - OOO 18 Apr - 14 May,

Description:
[CSS Grid Layout] grid-template-areas should accept none value

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.

This patch adds support to parse it successfully and updates the test
adding the new case.

TEST=fast/css-grid-layout/grid-template-areas-get-set.html

Please review this at https://codereview.chromium.org/1117123005/

Base URL: https://chromium.googlesource.com/chromium/blink.git@master

Affected files (+13, -0 lines):
M LayoutTests/fast/css-grid-layout/grid-template-areas-get-set.html
M
LayoutTests/fast/css-grid-layout/grid-template-areas-get-set-expected.txt
M Source/core/css/parser/CSSPropertyParser.cpp


Index:
LayoutTests/fast/css-grid-layout/grid-template-areas-get-set-expected.txt
diff --git
a/LayoutTests/fast/css-grid-layout/grid-template-areas-get-set-expected.txt
b/LayoutTests/fast/css-grid-layout/grid-template-areas-get-set-expected.txt
index
cc3fd4fcfd52215f968cf94d1d3c63f56c72160b..fbf07102e178378963aed31e2695e813c42d1c22
100644
---
a/LayoutTests/fast/css-grid-layout/grid-template-areas-get-set-expected.txt
+++
b/LayoutTests/fast/css-grid-layout/grid-template-areas-get-set-expected.txt
@@ -15,6 +15,9 @@ PASS
window.getComputedStyle(gridWithHorizontalRectangle).getPropertyValue('grid
PASS
window.getComputedStyle(gridWithVerticalRectangle).getPropertyValue('grid-template-areas')
is "\"a a\" \"a a\" \"a a\""
Test grid-template-areas: initial
PASS
window.getComputedStyle(element).getPropertyValue('grid-template-areas')
is "\"foobar\""
+PASS
window.getComputedStyle(element).getPropertyValue('grid-template-areas')
is "none"
+PASS
window.getComputedStyle(element).getPropertyValue('grid-template-areas')
is "\"foobar\""
+PASS
window.getComputedStyle(element).getPropertyValue('grid-template-areas')
is "none"
Test grid-template-areas: inherit
PASS
window.getComputedStyle(parentElement).getPropertyValue('grid-template-areas')
is "\"foo bar\""
PASS
window.getComputedStyle(element).getPropertyValue('grid-template-areas')
is "\"foo bar\""
Index: LayoutTests/fast/css-grid-layout/grid-template-areas-get-set.html
diff --git
a/LayoutTests/fast/css-grid-layout/grid-template-areas-get-set.html
b/LayoutTests/fast/css-grid-layout/grid-template-areas-get-set.html
index
64c702e7f14c44766a5bbbcff33391a43a9c1c3f..ab89756add5118fb62e4ad91ce0600d49d0ee4e1
100644
--- a/LayoutTests/fast/css-grid-layout/grid-template-areas-get-set.html
+++ b/LayoutTests/fast/css-grid-layout/grid-template-areas-get-set.html
@@ -91,6 +91,11 @@
element.style.gridTemplateAreas = "'foobar'";

shouldBeEqualToString("window.getComputedStyle(element).getPropertyValue('grid-template-areas')", '"foobar"')
element.style.gridTemplateAreas = "initial";
+
shouldBeEqualToString("window.getComputedStyle(element).getPropertyValue('grid-template-areas')", 'none');
+ element.style.gridTemplateAreas = "'foobar'";
+
shouldBeEqualToString("window.getComputedStyle(element).getPropertyValue('grid-template-areas')", '"foobar"')
+ element.style.gridTemplateAreas = "none";
+
shouldBeEqualToString("window.getComputedStyle(element).getPropertyValue('grid-template-areas')", 'none');
document.body.removeChild(element);

debug("Test grid-template-areas: inherit");
Index: Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/Source/core/css/parser/CSSPropertyParser.cpp
b/Source/core/css/parser/CSSPropertyParser.cpp
index
17a2b6113f22a83f9cdab3c68c21d7250b6f3ed8..b09d42d932671ea83c2b3d8e3715f6bb1d1e58fa
100644
--- a/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/Source/core/css/parser/CSSPropertyParser.cpp
@@ -3715,6 +3715,11 @@ bool
CSSPropertyParser::parseGridTemplateAreasRow(NamedGridAreaMap& gridAreaMap,

PassRefPtrWillBeRawPtr<CSSValue>
CSSPropertyParser::parseGridTemplateAreas()
{
+ if (m_valueList->current() && m_valueList->current()->id ==
CSSValueNone) {
+ m_valueList->next();
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+ }
+
NamedGridAreaMap gridAreaMap;
size_t rowCount = 0;
size_t columnCount = 0;


svi...@igalia.com

unread,
May 5, 2015, 5:33:30 AM5/5/15
to re...@igalia.com, dsin...@chromium.org, le...@chromium.org, jchaf...@chromium.org, blink-...@chromium.org, jfern...@igalia.com, blink-re...@chromium.org, re...@igalia.com, ed+bli...@opera.com, dglazko...@chromium.org, apavlo...@chromium.org, alexis...@intel.com, rob....@samsung.com

dsin...@chromium.org

unread,
May 5, 2015, 10:28:09 AM5/5/15
to re...@igalia.com, jchaf...@chromium.org, le...@chromium.org, svi...@igalia.com, alexis...@intel.com, apavlo...@chromium.org, blink-...@chromium.org, blink-re...@chromium.org, dglazko...@chromium.org, ed+bli...@opera.com, jfern...@igalia.com, re...@igalia.com, rob....@samsung.com, svi...@igalia.com

commi...@chromium.org

unread,
May 5, 2015, 10:28:28 AM5/5/15
to re...@igalia.com, dsin...@chromium.org, jchaf...@chromium.org, le...@chromium.org, svi...@igalia.com, alexis...@intel.com, apavlo...@chromium.org, blink-...@chromium.org, blink-re...@chromium.org, dglazko...@chromium.org, ed+bli...@opera.com, jfern...@igalia.com, re...@igalia.com, rob....@samsung.com, svi...@igalia.com

commi...@chromium.org

unread,
May 5, 2015, 12:23:00 PM5/5/15
to re...@igalia.com, dsin...@chromium.org, jchaf...@chromium.org, le...@chromium.org, svi...@igalia.com, alexis...@intel.com, apavlo...@chromium.org, blink-...@chromium.org, blink-re...@chromium.org, dglazko...@chromium.org, ed+bli...@opera.com, jfern...@igalia.com, re...@igalia.com, rob....@samsung.com, svi...@igalia.com
Reply all
Reply to author
Forward
0 new messages