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

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

Issue 1776983003: Move some grid related longhands into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: V3 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 a85fe102ffb1548480b334a6468fd954fd9518a7..1c69d63848bc01752d43190585e4a1c0f9ff46c4 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -3553,6 +3553,46 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeCommaSeparatedBackgroundComponent
return result.release();
}
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeSelfPositionKeyword(CSSParserTokenRange& range)
+{
+ CSSValueID id = range.peek().id();
+ if (id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter
+ || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFlexStart
+ || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight)
+ return consumeIdent(range);
+ return nullptr;
+}
+
+static PassRefPtrWillBeRawPtr<CSSValue> consumeSelfPositionOverflowPosition(CSSParserTokenRange& range)
+{
+ if (identMatches<CSSValueAuto, CSSValueStretch, CSSValueBaseline, CSSValueLastBaseline>(range.peek().id()))
+ return consumeIdent(range);
+
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueSafe>(range);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> selfPosition = consumeSelfPositionKeyword(range);
+ if (!selfPosition)
+ return nullptr;
+ if (!overflowPosition)
+ overflowPosition = consumeIdent<CSSValueUnsafe, CSSValueSafe>(range);
+ if (overflowPosition)
+ return CSSValuePair::create(selfPosition.release(), overflowPosition, CSSValuePair::DropIdenticalValues);
+ return selfPosition.release();
+}
+
+static PassRefPtrWillBeRawPtr<CSSValue> consumeJustifyItems(CSSParserTokenRange& range)
+{
+ CSSParserTokenRange rangeCopy = range;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> legacy = consumeIdent<CSSValueLegacy>(rangeCopy);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> positionKeyword = consumeIdent<CSSValueCenter, CSSValueLeft, CSSValueRight>(rangeCopy);
+ if (!legacy)
+ legacy = consumeIdent<CSSValueLegacy>(rangeCopy);
+ if (legacy && positionKeyword) {
+ range = rangeCopy;
+ return CSSValuePair::create(legacy.release(), positionKeyword.release(), CSSValuePair::DropIdenticalValues);
+ }
+ return consumeSelfPositionOverflowPosition(range);
+}
+
PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID unresolvedProperty)
{
CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
@@ -3907,6 +3947,14 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
case CSSPropertyWebkitMaskRepeatX:
case CSSPropertyWebkitMaskRepeatY:
return nullptr;
+ case CSSPropertyJustifySelf:
+ case CSSPropertyAlignSelf:
+ case CSSPropertyAlignItems:
+ ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
+ return consumeSelfPositionOverflowPosition(m_range);
+ case CSSPropertyJustifyItems:
+ ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
+ return consumeJustifyItems(m_range);
default:
CSSParserValueList valueList(m_range);
if (valueList.size()) {

Powered by Google App Engine
This is Rietveld 408576698