| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/css/properties/CSSPropertyAPIQuotes.h" | 5 #include "core/css/properties/CSSPropertyAPIQuotes.h" |
| 6 | 6 |
| 7 #include "core/css/CSSStringValue.h" | 7 #include "core/css/CSSStringValue.h" |
| 8 #include "core/css/CSSValueList.h" | 8 #include "core/css/CSSValueList.h" |
| 9 #include "core/css/parser/CSSParserContext.h" | 9 #include "core/css/parser/CSSParserContext.h" |
| 10 #include "core/css/parser/CSSPropertyParserHelpers.h" | 10 #include "core/css/parser/CSSPropertyParserHelpers.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 const CSSValue* CSSPropertyAPIQuotes::parseSingleValue( | 14 const CSSValue* CSSPropertyAPIQuotes::parseSingleValue( |
| 15 CSSParserTokenRange& range, | 15 CSSParserTokenRange& range, |
| 16 const CSSParserContext* context) { | 16 const CSSParserContext& context) { |
| 17 if (range.peek().id() == CSSValueNone) | 17 if (range.peek().id() == CSSValueNone) |
| 18 return CSSPropertyParserHelpers::consumeIdent(range); | 18 return CSSPropertyParserHelpers::consumeIdent(range); |
| 19 CSSValueList* values = CSSValueList::createSpaceSeparated(); | 19 CSSValueList* values = CSSValueList::createSpaceSeparated(); |
| 20 while (!range.atEnd()) { | 20 while (!range.atEnd()) { |
| 21 CSSStringValue* parsedValue = | 21 CSSStringValue* parsedValue = |
| 22 CSSPropertyParserHelpers::consumeString(range); | 22 CSSPropertyParserHelpers::consumeString(range); |
| 23 if (!parsedValue) | 23 if (!parsedValue) |
| 24 return nullptr; | 24 return nullptr; |
| 25 values->append(*parsedValue); | 25 values->append(*parsedValue); |
| 26 } | 26 } |
| 27 if (values->length() && values->length() % 2 == 0) | 27 if (values->length() && values->length() % 2 == 0) |
| 28 return values; | 28 return values; |
| 29 return nullptr; | 29 return nullptr; |
| 30 } | 30 } |
| 31 | 31 |
| 32 } // namespace blink | 32 } // namespace blink |
| OLD | NEW |