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 CSSValueID id = range.peek().id(); | 17 CSSValueID id = range.peek().id(); |
18 if (id == CSSValueNone) | 18 if (id == CSSValueNone) |
19 return CSSPropertyParserHelpers::consumeIdent(range); | 19 return CSSPropertyParserHelpers::consumeIdent(range); |
20 | 20 |
21 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 21 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
22 if (id == CSSValueStrict || id == CSSValueContent) { | 22 if (id == CSSValueStrict || id == CSSValueContent) { |
23 list->append(*CSSPropertyParserHelpers::consumeIdent(range)); | 23 list->append(*CSSPropertyParserHelpers::consumeIdent(range)); |
24 return list; | 24 return list; |
25 } | 25 } |
26 while (true) { | 26 while (true) { |
27 CSSIdentifierValue* ident = CSSPropertyParserHelpers::consumeIdent< | 27 CSSIdentifierValue* ident = CSSPropertyParserHelpers::consumeIdent< |
28 CSSValuePaint, CSSValueLayout, CSSValueStyle, CSSValueSize>(range); | 28 CSSValuePaint, CSSValueLayout, CSSValueStyle, CSSValueSize>(range); |
29 if (!ident) | 29 if (!ident) |
30 break; | 30 break; |
31 if (list->hasValue(*ident)) | 31 if (list->hasValue(*ident)) |
32 return nullptr; | 32 return nullptr; |
33 list->append(*ident); | 33 list->append(*ident); |
34 } | 34 } |
35 | 35 |
36 if (!list->length()) | 36 if (!list->length()) |
37 return nullptr; | 37 return nullptr; |
38 return list; | 38 return list; |
39 } | 39 } |
40 | 40 |
41 } // namespace blink | 41 } // namespace blink |
OLD | NEW |