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

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: V4 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 6f247e4fabba6906dbe62ae6d183200e54bd65fe..06195b1cd7fa0688a0c29caaf432bc9f45abb21e 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -3269,6 +3269,53 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeJustifyItems(CSSParserTokenRange&
return consumeSelfPositionOverflowPosition(range);
}
+static PassRefPtrWillBeRawPtr<CSSCustomIdentValue> consumeValidCustomIdentValue(CSSParserTokenRange& range)
+{
+ if (isCSSWideKeyword(range.peek().id()) || range.peek().id() == CSSValueAuto || range.peek().id() == CSSValueSpan)
Timothy Loh 2016/03/16 04:24:25 isCSSWideKeyword should be in consumeCustomIdent,
rwlbuis 2016/03/16 17:02:02 Sure, I moved that here: https://codereview.chromi
+ 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 = consumeValidCustomIdentValue(range);
+ spanValue = consumeIdent<CSSValueSpan>(range);
+ } else if ((spanValue = consumeIdent<CSSValueSpan>(range))) {
+ numericValue = consumeInteger(range);
+ gridLineName = consumeValidCustomIdentValue(range);
+ if (!numericValue)
+ numericValue = consumeInteger(range);
+ } else if ((gridLineName = consumeValidCustomIdentValue(range))) {
+ numericValue = consumeInteger(range);
+ spanValue = consumeIdent<CSSValueSpan>(range);
+ if (!spanValue && !numericValue)
+ return gridLineName.release();
+ } else {
+ return nullptr;
+ }
+
+ // Negative numbers are not allowed for span (but are for <integer>).
Timothy Loh 2016/03/16 04:24:26 Comment is misleading since <integer> is a type de
rwlbuis 2016/03/16 20:23:42 Done.
+ if (numericValue && ((spanValue && numericValue->getIntValue() < 0) || (numericValue->getIntValue() == 0)))
+ return nullptr;
+
+ 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);
@@ -3631,6 +3678,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