OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/parser/CSSVariableParser.h" | 5 #include "core/css/parser/CSSVariableParser.h" |
6 | 6 |
7 #include "core/css/CSSCustomPropertyDeclaration.h" | 7 #include "core/css/CSSCustomPropertyDeclaration.h" |
8 #include "core/css/parser/CSSParserTokenRange.h" | 8 #include "core/css/parser/CSSParserTokenRange.h" |
9 #include "core/css/parser/CSSParserValues.h" | |
10 | 9 |
11 namespace blink { | 10 namespace blink { |
12 | 11 |
13 bool CSSVariableParser::isValidVariableName(const CSSParserToken& token) | 12 bool CSSVariableParser::isValidVariableName(const CSSParserToken& token) |
14 { | 13 { |
15 if (token.type() != IdentToken) | 14 if (token.type() != IdentToken) |
16 return false; | 15 return false; |
17 | 16 |
18 CSSParserString value = token.value(); | 17 CSSParserString value = token.value(); |
19 return value.length() >= 2 && value[0] == '-' && value[1] == '-'; | 18 return value.length() >= 2 && value[0] == '-' && value[1] == '-'; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 CSSValueID type = classifyVariableRange(range, hasReferences, hasAtApplyRule
); | 131 CSSValueID type = classifyVariableRange(range, hasReferences, hasAtApplyRule
); |
133 | 132 |
134 if (type == CSSValueInvalid) | 133 if (type == CSSValueInvalid) |
135 return nullptr; | 134 return nullptr; |
136 if (type == CSSValueInternalVariableValue) | 135 if (type == CSSValueInternalVariableValue) |
137 return CSSCustomPropertyDeclaration::create(variableName, CSSVariableDat
a::create(range, hasReferences || hasAtApplyRule)); | 136 return CSSCustomPropertyDeclaration::create(variableName, CSSVariableDat
a::create(range, hasReferences || hasAtApplyRule)); |
138 return CSSCustomPropertyDeclaration::create(variableName, type); | 137 return CSSCustomPropertyDeclaration::create(variableName, type); |
139 } | 138 } |
140 | 139 |
141 } // namespace blink | 140 } // namespace blink |
OLD | NEW |