Chromium Code Reviews| 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..8d11f4bbd581973fc6c90048315c827cb2ab931f 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 (parsedValue && (parsedValue->isCalculated() || parsedValue->getDoubleValue() > 0)) { |
|
Timothy Loh
2016/01/12 05:19:01
missing args.atEnd() check
|
| + 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; |
| } |