| 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/CSSVariableReferenceValue.h" | 8 #include "core/css/CSSVariableReferenceValue.h" |
| 9 #include "core/css/parser/CSSParserTokenRange.h" | 9 #include "core/css/parser/CSSParserTokenRange.h" |
| 10 | 10 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 return CSSCustomPropertyDeclaration::Create( | 147 return CSSCustomPropertyDeclaration::Create( |
| 148 variable_name, | 148 variable_name, |
| 149 CSSVariableData::Create(range, is_animation_tainted, | 149 CSSVariableData::Create(range, is_animation_tainted, |
| 150 has_references || has_at_apply_rule)); | 150 has_references || has_at_apply_rule)); |
| 151 } | 151 } |
| 152 return CSSCustomPropertyDeclaration::Create(variable_name, type); | 152 return CSSCustomPropertyDeclaration::Create(variable_name, type); |
| 153 } | 153 } |
| 154 | 154 |
| 155 CSSVariableReferenceValue* CSSVariableParser::ParseRegisteredPropertyValue( | 155 CSSVariableReferenceValue* CSSVariableParser::ParseRegisteredPropertyValue( |
| 156 CSSParserTokenRange range, | 156 CSSParserTokenRange range, |
| 157 const CSSParserContext& context, |
| 157 bool require_var_reference, | 158 bool require_var_reference, |
| 158 bool is_animation_tainted) { | 159 bool is_animation_tainted) { |
| 159 if (range.AtEnd()) | 160 if (range.AtEnd()) |
| 160 return nullptr; | 161 return nullptr; |
| 161 | 162 |
| 162 bool has_references; | 163 bool has_references; |
| 163 bool has_at_apply_rule; | 164 bool has_at_apply_rule; |
| 164 CSSValueID type = | 165 CSSValueID type = |
| 165 ClassifyVariableRange(range, has_references, has_at_apply_rule); | 166 ClassifyVariableRange(range, has_references, has_at_apply_rule); |
| 166 | 167 |
| 167 if (type != CSSValueInternalVariableValue) | 168 if (type != CSSValueInternalVariableValue) |
| 168 return nullptr; // Invalid or a css-wide keyword | 169 return nullptr; // Invalid or a css-wide keyword |
| 169 if (require_var_reference && !has_references) | 170 if (require_var_reference && !has_references) |
| 170 return nullptr; | 171 return nullptr; |
| 171 // TODO(timloh): Should this be hasReferences || hasAtApplyRule? | 172 // TODO(timloh): Should this be hasReferences || hasAtApplyRule? |
| 172 return CSSVariableReferenceValue::Create( | 173 return CSSVariableReferenceValue::Create( |
| 173 CSSVariableData::Create(range, is_animation_tainted, has_references)); | 174 CSSVariableData::Create(range, is_animation_tainted, has_references), |
| 175 context); |
| 174 } | 176 } |
| 175 | 177 |
| 176 } // namespace blink | 178 } // namespace blink |
| OLD | NEW |