| 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/CSSPropertyAPIContain.h" | 5 #include "core/css/properties/CSSPropertyAPIContain.h" |
| 6 | 6 |
| 7 #include "core/css/CSSIdentifierValue.h" | 7 #include "core/css/CSSIdentifierValue.h" |
| 8 #include "core/css/CSSValueList.h" | 8 #include "core/css/CSSValueList.h" |
| 9 #include "core/css/parser/CSSPropertyParserHelpers.h" | 9 #include "core/css/parser/CSSPropertyParserHelpers.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 // none | strict | content | [ layout || style || paint || size ] | 13 // none | strict | content | [ layout || style || paint || size ] |
| 14 const CSSValue* CSSPropertyAPIContain::parseSingleValue( | 14 const CSSValue* CSSPropertyAPIContain::parseSingleValue( |
| 15 CSSParserTokenRange& range, | 15 CSSParserTokenRange& range, |
| 16 const CSSParserContext& context) { | 16 const CSSParserContext& context, |
| 17 CSSPropertyID) { |
| 17 CSSValueID id = range.Peek().Id(); | 18 CSSValueID id = range.Peek().Id(); |
| 18 if (id == CSSValueNone) | 19 if (id == CSSValueNone) |
| 19 return CSSPropertyParserHelpers::ConsumeIdent(range); | 20 return CSSPropertyParserHelpers::ConsumeIdent(range); |
| 20 | 21 |
| 21 CSSValueList* list = CSSValueList::CreateSpaceSeparated(); | 22 CSSValueList* list = CSSValueList::CreateSpaceSeparated(); |
| 22 if (id == CSSValueStrict || id == CSSValueContent) { | 23 if (id == CSSValueStrict || id == CSSValueContent) { |
| 23 list->Append(*CSSPropertyParserHelpers::ConsumeIdent(range)); | 24 list->Append(*CSSPropertyParserHelpers::ConsumeIdent(range)); |
| 24 return list; | 25 return list; |
| 25 } | 26 } |
| 26 while (true) { | 27 while (true) { |
| 27 CSSIdentifierValue* ident = CSSPropertyParserHelpers::ConsumeIdent< | 28 CSSIdentifierValue* ident = CSSPropertyParserHelpers::ConsumeIdent< |
| 28 CSSValuePaint, CSSValueLayout, CSSValueStyle, CSSValueSize>(range); | 29 CSSValuePaint, CSSValueLayout, CSSValueStyle, CSSValueSize>(range); |
| 29 if (!ident) | 30 if (!ident) |
| 30 break; | 31 break; |
| 31 if (list->HasValue(*ident)) | 32 if (list->HasValue(*ident)) |
| 32 return nullptr; | 33 return nullptr; |
| 33 list->Append(*ident); | 34 list->Append(*ident); |
| 34 } | 35 } |
| 35 | 36 |
| 36 if (!list->length()) | 37 if (!list->length()) |
| 37 return nullptr; | 38 return nullptr; |
| 38 return list; | 39 return list; |
| 39 } | 40 } |
| 40 | 41 |
| 41 } // namespace blink | 42 } // namespace blink |
| OLD | NEW |