| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 CSSParserTokenRange range) { | 122 CSSParserTokenRange range) { |
| 123 bool hasReferences; | 123 bool hasReferences; |
| 124 bool hasAtApplyRule; | 124 bool hasAtApplyRule; |
| 125 CSSValueID type = classifyVariableRange(range, hasReferences, hasAtApplyRule); | 125 CSSValueID type = classifyVariableRange(range, hasReferences, hasAtApplyRule); |
| 126 return type == CSSValueInternalVariableValue && hasReferences && | 126 return type == CSSValueInternalVariableValue && hasReferences && |
| 127 !hasAtApplyRule; | 127 !hasAtApplyRule; |
| 128 } | 128 } |
| 129 | 129 |
| 130 CSSCustomPropertyDeclaration* CSSVariableParser::parseDeclarationValue( | 130 CSSCustomPropertyDeclaration* CSSVariableParser::parseDeclarationValue( |
| 131 const AtomicString& variableName, | 131 const AtomicString& variableName, |
| 132 CSSParserTokenRange range) { | 132 CSSParserTokenRange range, |
| 133 bool isAnimationTainted) { |
| 133 if (range.atEnd()) | 134 if (range.atEnd()) |
| 134 return nullptr; | 135 return nullptr; |
| 135 | 136 |
| 136 bool hasReferences; | 137 bool hasReferences; |
| 137 bool hasAtApplyRule; | 138 bool hasAtApplyRule; |
| 138 CSSValueID type = classifyVariableRange(range, hasReferences, hasAtApplyRule); | 139 CSSValueID type = classifyVariableRange(range, hasReferences, hasAtApplyRule); |
| 139 | 140 |
| 140 if (type == CSSValueInvalid) | 141 if (type == CSSValueInvalid) |
| 141 return nullptr; | 142 return nullptr; |
| 142 if (type == CSSValueInternalVariableValue) | 143 if (type == CSSValueInternalVariableValue) { |
| 143 return CSSCustomPropertyDeclaration::create( | 144 return CSSCustomPropertyDeclaration::create( |
| 144 variableName, | 145 variableName, CSSVariableData::create(range, isAnimationTainted, |
| 145 CSSVariableData::create(range, hasReferences || hasAtApplyRule)); | 146 hasReferences || hasAtApplyRule)); |
| 147 } |
| 146 return CSSCustomPropertyDeclaration::create(variableName, type); | 148 return CSSCustomPropertyDeclaration::create(variableName, type); |
| 147 } | 149 } |
| 148 | 150 |
| 149 CSSVariableReferenceValue* CSSVariableParser::parseRegisteredPropertyValue( | 151 CSSVariableReferenceValue* CSSVariableParser::parseRegisteredPropertyValue( |
| 150 CSSParserTokenRange range, | 152 CSSParserTokenRange range, |
| 151 bool requireVarReference) { | 153 bool requireVarReference, |
| 154 bool isAnimationTainted) { |
| 152 if (range.atEnd()) | 155 if (range.atEnd()) |
| 153 return nullptr; | 156 return nullptr; |
| 154 | 157 |
| 155 bool hasReferences; | 158 bool hasReferences; |
| 156 bool hasAtApplyRule; | 159 bool hasAtApplyRule; |
| 157 CSSValueID type = classifyVariableRange(range, hasReferences, hasAtApplyRule); | 160 CSSValueID type = classifyVariableRange(range, hasReferences, hasAtApplyRule); |
| 158 | 161 |
| 159 if (type != CSSValueInternalVariableValue) | 162 if (type != CSSValueInternalVariableValue) |
| 160 return nullptr; // Invalid or a css-wide keyword | 163 return nullptr; // Invalid or a css-wide keyword |
| 161 if (requireVarReference && !hasReferences) | 164 if (requireVarReference && !hasReferences) |
| 162 return nullptr; | 165 return nullptr; |
| 163 // TODO(timloh): Should this be hasReferences || hasAtApplyRule? | 166 // TODO(timloh): Should this be hasReferences || hasAtApplyRule? |
| 164 return CSSVariableReferenceValue::create( | 167 return CSSVariableReferenceValue::create( |
| 165 CSSVariableData::create(range, hasReferences)); | 168 CSSVariableData::create(range, isAnimationTainted, hasReferences)); |
| 166 } | 169 } |
| 167 | 170 |
| 168 } // namespace blink | 171 } // namespace blink |
| OLD | NEW |