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

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

Issue 1576163002: Move scroll-snap related properties into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing Created 4 years, 11 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 120a49067fe9faafbcad86b71e173da1184f9885..816d91fc0e161728344bbba6368399dea1f37fc3 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -2888,6 +2888,41 @@ static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumePerspective(CSSParserTok
return nullptr;
}
+static PassRefPtrWillBeRawPtr<CSSValueList> consumePositionList(CSSParserTokenRange& range, CSSParserMode cssParserMode)
+{
+ RefPtrWillBeRawPtr<CSSValueList> positions = CSSValueList::createCommaSeparated();
+ do {
+ RefPtrWillBeRawPtr<CSSValue> position = consumePosition(range, cssParserMode, UnitlessQuirk::Forbid);
+ if (!position)
+ return nullptr;
+ positions->append(position);
+ } while (consumeCommaIncludingWhitespace(range));
+ return positions.release();
+}
+
+static PassRefPtrWillBeRawPtr<CSSValue> consumeScrollSnapCoordinate(CSSParserTokenRange& range, CSSParserMode cssParserMode)
+{
+ if (range.peek().id() == CSSValueNone)
+ return consumeIdent(range);
+ return consumePositionList(range, cssParserMode);
+}
+
+static PassRefPtrWillBeRawPtr<CSSValue> consumeScrollSnapPoints(CSSParserTokenRange& range, CSSParserMode cssParserMode)
+{
+ if (range.peek().id() == CSSValueNone)
+ return consumeIdent(range);
+ if (range.peek().functionId() == CSSValueRepeat) {
+ CSSParserTokenRange args = consumeFunction(range);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue = consumeLengthOrPercent(args, cssParserMode, ValueRangeNonNegative);
+ if (args.atEnd() && parsedValue && (parsedValue->isCalculated() || parsedValue->getDoubleValue() > 0)) {
+ RefPtrWillBeRawPtr<CSSFunctionValue> result = CSSFunctionValue::create(CSSValueRepeat);
+ result->append(parsedValue.release());
+ return result.release();
+ }
+ }
+ return nullptr;
+}
+
PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID unresolvedProperty)
{
CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
@@ -3135,6 +3170,11 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
return consumeImage(m_range, m_context);
case CSSPropertyPerspective:
return consumePerspective(m_range, m_context.mode(), unresolvedProperty);
+ case CSSPropertyScrollSnapCoordinate:
+ return consumeScrollSnapCoordinate(m_range, m_context.mode());
+ case CSSPropertyScrollSnapPointsX:
+ case CSSPropertyScrollSnapPointsY:
+ return consumeScrollSnapPoints(m_range, m_context.mode());
default:
return nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698