summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrob.buis <rob.buis@samsung.com>2016-03-16 19:32:37 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-17 02:34:12 +0000
commitf4fd3e2d624ded5f0c038ed0da633b68061090cf (patch)
tree4810f4cc4f7d355fab7b27145dbe911d1c05f6ec
parentae515892399182af86611de7a55d017bdd29ec3c (diff)
downloadchromium_src-f4fd3e2d624ded5f0c038ed0da633b68061090cf.zip
chromium_src-f4fd3e2d624ded5f0c038ed0da633b68061090cf.tar.gz
chromium_src-f4fd3e2d624ded5f0c038ed0da633b68061090cf.tar.bz2
Move some grid-column/grid-row related longhands into CSSPropertyParser
Move the following grid-column/grid-row related longhands from LegacyCSSPropertyParser into CSSPropertyParser: grid-column-start, grid-column-end, grid-row-start, grid-row-end BUG=499780 Review URL: https://codereview.chromium.org/1798863005 Cr-Commit-Position: refs/heads/master@{#381645}
-rw-r--r--third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-end-after-get-set-expected.txt30
-rw-r--r--third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-end-after-get-set.html30
-rw-r--r--third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp54
-rw-r--r--third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp8
4 files changed, 114 insertions, 8 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-end-after-get-set-expected.txt b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-end-after-get-set-expected.txt
index 5d53b48..5b5678f 100644
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-end-after-get-set-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-end-after-get-set-expected.txt
@@ -76,6 +76,36 @@ PASS getComputedStyle(gridItemWithArea, '').getPropertyValue('grid-column-end')
PASS getComputedStyle(gridItemWithArea, '').getPropertyValue('grid-row') is "auto / thirdArea"
PASS getComputedStyle(gridItemWithArea, '').getPropertyValue('grid-row-start') is "auto"
PASS getComputedStyle(gridItemWithArea, '').getPropertyValue('grid-row-end') is "thirdArea"
+PASS getComputedStyle(gridItemWithCSSWideKeyword, '').getPropertyValue('grid-column') is "auto / auto"
+PASS getComputedStyle(gridItemWithCSSWideKeyword, '').getPropertyValue('grid-column-start') is "auto"
+PASS getComputedStyle(gridItemWithCSSWideKeyword, '').getPropertyValue('grid-column-end') is "auto"
+PASS getComputedStyle(gridItemWithCSSWideKeyword, '').getPropertyValue('grid-row') is "auto / auto"
+PASS getComputedStyle(gridItemWithCSSWideKeyword, '').getPropertyValue('grid-row-start') is "auto"
+PASS getComputedStyle(gridItemWithCSSWideKeyword, '').getPropertyValue('grid-row-end') is "auto"
+PASS getComputedStyle(gridItemWithCSSWideKeyword2, '').getPropertyValue('grid-column') is "auto / auto"
+PASS getComputedStyle(gridItemWithCSSWideKeyword2, '').getPropertyValue('grid-column-start') is "auto"
+PASS getComputedStyle(gridItemWithCSSWideKeyword2, '').getPropertyValue('grid-column-end') is "auto"
+PASS getComputedStyle(gridItemWithCSSWideKeyword2, '').getPropertyValue('grid-row') is "auto / auto"
+PASS getComputedStyle(gridItemWithCSSWideKeyword2, '').getPropertyValue('grid-row-start') is "auto"
+PASS getComputedStyle(gridItemWithCSSWideKeyword2, '').getPropertyValue('grid-row-end') is "auto"
+PASS getComputedStyle(gridItemWithSpanAuto, '').getPropertyValue('grid-column') is "auto / auto"
+PASS getComputedStyle(gridItemWithSpanAuto, '').getPropertyValue('grid-column-start') is "auto"
+PASS getComputedStyle(gridItemWithSpanAuto, '').getPropertyValue('grid-column-end') is "auto"
+PASS getComputedStyle(gridItemWithSpanAuto, '').getPropertyValue('grid-row') is "auto / auto"
+PASS getComputedStyle(gridItemWithSpanAuto, '').getPropertyValue('grid-row-start') is "auto"
+PASS getComputedStyle(gridItemWithSpanAuto, '').getPropertyValue('grid-row-end') is "auto"
+PASS getComputedStyle(gridItemWithOneAuto, '').getPropertyValue('grid-column') is "auto / auto"
+PASS getComputedStyle(gridItemWithOneAuto, '').getPropertyValue('grid-column-start') is "auto"
+PASS getComputedStyle(gridItemWithOneAuto, '').getPropertyValue('grid-column-end') is "auto"
+PASS getComputedStyle(gridItemWithOneAuto, '').getPropertyValue('grid-row') is "auto / auto"
+PASS getComputedStyle(gridItemWithOneAuto, '').getPropertyValue('grid-row-start') is "auto"
+PASS getComputedStyle(gridItemWithOneAuto, '').getPropertyValue('grid-row-end') is "auto"
+PASS getComputedStyle(gridItemWithSpanAutoOne, '').getPropertyValue('grid-column') is "auto / auto"
+PASS getComputedStyle(gridItemWithSpanAutoOne, '').getPropertyValue('grid-column-start') is "auto"
+PASS getComputedStyle(gridItemWithSpanAutoOne, '').getPropertyValue('grid-column-end') is "auto"
+PASS getComputedStyle(gridItemWithSpanAutoOne, '').getPropertyValue('grid-row') is "auto / auto"
+PASS getComputedStyle(gridItemWithSpanAutoOne, '').getPropertyValue('grid-row-start') is "auto"
+PASS getComputedStyle(gridItemWithSpanAutoOne, '').getPropertyValue('grid-row-end') is "auto"
Test the initial value
PASS getComputedStyle(element, '').getPropertyValue('grid-column-end') is 'auto'
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-end-after-get-set.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-end-after-get-set.html
index ab8ec15..6ea1ff1 100644
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-end-after-get-set.html
+++ b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-end-after-get-set.html
@@ -52,6 +52,26 @@
grid-column-end: firstArea;
grid-row-end: thirdArea;
}
+.gridItemWithCSSWideKeyword {
+ grid-column-end: 2 inherit;
+ grid-row-end: 2 initial;
+}
+.gridItemWithCSSWideKeyword2 {
+ grid-column-end: 2 unset;
+ grid-row-end: 2 default;
+}
+.gridItemWithSpanAuto {
+ grid-column-end: span auto;
+ grid-row-end: auto span;
+}
+.gridItemWithOneAuto {
+ grid-column-end: 1 auto;
+ grid-row-end: auto 1;
+}
+.gridItemWithSpanAutoOne {
+ grid-column-end: span 1 auto;
+ grid-row-end: span auto 1;
+}
</style>
<script src="resources/grid-item-column-row-parsing-utils.js"></script>
<script src="../../resources/js-test.js"></script>
@@ -71,6 +91,11 @@
<div class="gridItemWithSpanCustomIdent" id="gridItemWithSpanCustomIdentElement"></div>
<div class="gridItemWithSpanNumberCustomIdent" id="gridItemWithSpanNumberCustomIdentElement"></div>
<div class="gridItemWithArea" id="gridItemWithArea"></div>
+ <div class="gridItemWithCSSWideKeyword" id="gridItemWithCSSWideKeyword"></div>
+ <div class="gridItemWithCSSWideKeyword2" id="gridItemWithCSSWideKeyword2"></div>
+ <div class="gridItemWithSpanAuto" id="gridItemWithSpanAuto"></div>
+ <div class="gridItemWithOneAuto" id="gridItemWithOneAuto"></div>
+ <div class="gridItemWithSpanAutoOne" id="gridItemWithSpanAutoOne"></div>
</div>
<script>
description('Test that setting and getting grid-column-end and grid-row-end works as expected');
@@ -88,6 +113,11 @@
testColumnRowCSSParsing("gridItemWithSpanCustomIdentElement", "auto / span 1 first", "auto / span 1 last");
testColumnRowCSSParsing("gridItemWithSpanNumberCustomIdentElement", "auto / span 2 first", "auto / span 3 last");
testColumnRowCSSParsing("gridItemWithArea", "auto / firstArea", "auto / thirdArea");
+ testColumnRowCSSParsing("gridItemWithCSSWideKeyword", "auto / auto", "auto / auto");
+ testColumnRowCSSParsing("gridItemWithCSSWideKeyword2", "auto / auto", "auto / auto");
+ testColumnRowCSSParsing("gridItemWithSpanAuto", "auto / auto", "auto / auto");
+ testColumnRowCSSParsing("gridItemWithOneAuto", "auto / auto", "auto / auto");
+ testColumnRowCSSParsing("gridItemWithSpanAutoOne", "auto / auto", "auto / auto");
debug("");
debug("Test the initial value");
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index 9776003..dc0d3df 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -3278,6 +3278,54 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeJustifyItems(CSSParserTokenRange&
return consumeSelfPositionOverflowPosition(range);
}
+static PassRefPtrWillBeRawPtr<CSSCustomIdentValue> consumeCustomIdentForGridLine(CSSParserTokenRange& range)
+{
+ if (range.peek().id() == CSSValueAuto || range.peek().id() == CSSValueSpan)
+ return nullptr;
+ return consumeCustomIdent(range);
+}
+
+static PassRefPtrWillBeRawPtr<CSSValue> consumeGridLine(CSSParserTokenRange& range)
+{
+ if (range.peek().id() == CSSValueAuto)
+ return consumeIdent(range);
+
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> spanValue = nullptr;
+ RefPtrWillBeRawPtr<CSSCustomIdentValue> gridLineName = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> numericValue = consumeInteger(range);
+ if (numericValue) {
+ gridLineName = consumeCustomIdentForGridLine(range);
+ spanValue = consumeIdent<CSSValueSpan>(range);
+ } else if ((spanValue = consumeIdent<CSSValueSpan>(range))) {
+ numericValue = consumeInteger(range);
+ gridLineName = consumeCustomIdentForGridLine(range);
+ if (!numericValue)
+ numericValue = consumeInteger(range);
+ } else if ((gridLineName = consumeCustomIdentForGridLine(range))) {
+ numericValue = consumeInteger(range);
+ spanValue = consumeIdent<CSSValueSpan>(range);
+ if (!spanValue && !numericValue)
+ return gridLineName.release();
+ } else {
+ return nullptr;
+ }
+
+ if (spanValue && numericValue && numericValue->getIntValue() < 0)
+ return nullptr; // Negative numbers are not allowed for span.
+ if (numericValue && numericValue->getIntValue() == 0)
+ return nullptr; // An <integer> value of zero makes the declaration invalid.
+
+ RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
+ if (spanValue)
+ values->append(spanValue.release());
+ if (numericValue)
+ values->append(numericValue.release());
+ if (gridLineName)
+ values->append(gridLineName.release());
+ ASSERT(values->length());
+ return values.release();
+}
+
PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID unresolvedProperty)
{
CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
@@ -3640,6 +3688,12 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
case CSSPropertyJustifyItems:
ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
return consumeJustifyItems(m_range);
+ case CSSPropertyGridColumnEnd:
+ case CSSPropertyGridColumnStart:
+ case CSSPropertyGridRowEnd:
+ case CSSPropertyGridRowStart:
+ ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
+ return consumeGridLine(m_range);
default:
CSSParserValueList valueList(m_range);
if (valueList.size()) {
diff --git a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
index 95365c5..246205b 100644
--- a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
@@ -276,14 +276,6 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::legacyParseValue(CSSProperty
parsedValue = parseGridTrackList();
break;
- case CSSPropertyGridColumnEnd:
- case CSSPropertyGridColumnStart:
- case CSSPropertyGridRowEnd:
- case CSSPropertyGridRowStart:
- ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
- parsedValue = parseGridPosition();
- break;
-
case CSSPropertyGridTemplateAreas:
ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
parsedValue = parseGridTemplateAreas();