Chromium Code Reviews| Index: Source/core/css/parser/CSSPropertyParser.cpp | 
| diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp | 
| index a7170fdd2247855c091cedce0ce9daf81274f9ac..058f381eea74c870768dd74c1df56854e3c96940 100644 | 
| --- a/Source/core/css/parser/CSSPropertyParser.cpp | 
| +++ b/Source/core/css/parser/CSSPropertyParser.cpp | 
| @@ -727,7 +727,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import | 
| return result; | 
| } | 
| case CSSPropertyObjectPosition: | 
| - parsedValue = parseObjectPosition(); | 
| + parsedValue = parsePosition(); | 
| break; | 
| case CSSPropertyListStyleImage: // <uri> | none | inherit | 
| case CSSPropertyBorderImageSource: | 
| @@ -1495,6 +1495,17 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import | 
| validPrimitive = false; | 
| break; | 
| + case CSSPropertyScrollSnapPointsX: | 
| + case CSSPropertyScrollSnapPointsY: | 
| + parsedValue = parseScrollSnapPoints(); | 
| + break; | 
| + case CSSPropertyScrollSnapCoordinate: | 
| + parsedValue = parseScrollSnapCoordinate(); | 
| + break; | 
| + case CSSPropertyScrollSnapDestination: | 
| + parsedValue = parsePosition(); | 
| + break; | 
| + | 
| default: | 
| return parseSVGValue(propId, important); | 
| } | 
| @@ -2008,6 +2019,44 @@ bool CSSPropertyParser::parse4Values(CSSPropertyID propId, const CSSPropertyID * | 
| return true; | 
| } | 
| +PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollSnapPoints() | 
| +{ | 
| + CSSParserValue* value = m_valueList->current(); | 
| + | 
| + if (value->id == CSSValueNone) { | 
| + m_valueList->next(); | 
| + return cssValuePool().createIdentifierValue(CSSValueNone); | 
| + } | 
| + | 
| + if (value->unit == CSSParserValue::Function && value->function->id == CSSValueRepeat) { | 
| + // The spec defines the following grammar: repeat( <length>) | 
| + CSSParserValueList* arguments = value->function->args.get(); | 
| + if (!arguments || arguments->size() != 1) | 
| + return nullptr; | 
| + | 
| + CSSParserValue* repeatValue = arguments->valueAt(0); | 
| + if (!validUnit(repeatValue, FNonNeg | FLength | FPercent)) | 
| + return nullptr; | 
| + | 
| + RefPtrWillBeRawPtr<CSSFunctionValue> result = CSSFunctionValue::create(CSSValueRepeat); | 
| + result->append(parseValidPrimitive(repeatValue->id, repeatValue)); | 
| + m_valueList->next(); | 
| + return result.release(); | 
| + } | 
| + | 
| + return nullptr; | 
| +} | 
| + | 
| +PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollSnapCoordinate() | 
| +{ | 
| + if (m_valueList->current()->id == CSSValueNone) { | 
| + m_valueList->next(); | 
| + return cssValuePool().createIdentifierValue(CSSValueNone); | 
| + } | 
| + | 
| + return parsePositionList(m_valueList); | 
| +} | 
| + | 
| PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parsePage() | 
| { | 
| CSSParserValue* value = m_valueList->current(); | 
| @@ -5554,7 +5603,7 @@ bool CSSPropertyParser::parseFlex(CSSParserValueList* args, bool important) | 
| return true; | 
| } | 
| -PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseObjectPosition() | 
| +PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parsePosition() | 
| { | 
| RefPtrWillBeRawPtr<CSSValue> xValue = nullptr; | 
| RefPtrWillBeRawPtr<CSSValue> yValue = nullptr; | 
| @@ -5564,6 +5613,27 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseObjectPosition() | 
| return createPrimitiveValuePair(toCSSPrimitiveValue(xValue.get()), toCSSPrimitiveValue(yValue.get()), Pair::KeepIdenticalValues); | 
| } | 
| +// Parses a list of comma separated positions. i.e., <position># | 
| +PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parsePositionList(CSSParserValueList* args) | 
| +{ | 
| + RefPtrWillBeRawPtr<CSSValueList> positions = CSSValueList::createCommaSeparated(); | 
| + for (CSSParserValue* argument = args->current(); argument; argument = args->next()) { | 
| 
 
Timothy Loh
2015/06/04 03:58:26
I think this won't do exactly what you want (I thi
 
majidvp
2015/06/04 22:41:40
Done.
 
 | 
| + RefPtrWillBeRawPtr<CSSValue> xValue = nullptr; | 
| + RefPtrWillBeRawPtr<CSSValue> yValue = nullptr; | 
| + // parseFillPosition below should consume arguments until it reaches | 
| + // a comma or end of the list | 
| + parseFillPosition(args, xValue, yValue); | 
| + | 
| + if (!xValue || !yValue) | 
| + return nullptr; | 
| + | 
| + RefPtrWillBeRawPtr<CSSValue> position = createPrimitiveValuePair(toCSSPrimitiveValue(xValue.get()), toCSSPrimitiveValue(yValue.get()), Pair::KeepIdenticalValues); | 
| + positions->append(position); | 
| + } | 
| + | 
| + return positions.release(); | 
| +} | 
| + | 
| class BorderImageParseContext { | 
| STACK_ALLOCATED(); | 
| public: | 
| @@ -7155,6 +7225,7 @@ PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseFilter() | 
| return list.release(); | 
| } | 
| + | 
| PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseTransformOrigin() | 
| { | 
| CSSParserValue* value = m_valueList->current(); |