Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp

Issue 1798863005: Move some grid-column/grid-row related longhands into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Standalone change Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index e0a05b757b005d31c4171d971ad23248b85df81b..64556f907b0d4dafe21c76de2e6c01b47503ef65 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -3283,6 +3283,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);
@@ -3645,6 +3693,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()) {

Powered by Google App Engine
This is Rietveld 408576698