| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/PropertyRegistration.h" | 5 #include "core/css/PropertyRegistration.h" |
| 6 | 6 |
| 7 #include "core/css/CSSSyntaxDescriptor.h" | 7 #include "core/css/CSSSyntaxDescriptor.h" |
| 8 #include "core/css/CSSValueList.h" | 8 #include "core/css/CSSValueList.h" |
| 9 #include "core/css/CSSVariableReferenceValue.h" | 9 #include "core/css/CSSVariableReferenceValue.h" |
| 10 #include "core/css/PropertyDescriptor.h" | 10 #include "core/css/PropertyDescriptor.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 CSSSyntaxDescriptor syntaxDescriptor(descriptor.syntax()); | 83 CSSSyntaxDescriptor syntaxDescriptor(descriptor.syntax()); |
| 84 if (!syntaxDescriptor.isValid()) { | 84 if (!syntaxDescriptor.isValid()) { |
| 85 exceptionState.throwDOMException( | 85 exceptionState.throwDOMException( |
| 86 SyntaxError, | 86 SyntaxError, |
| 87 "The syntax provided is not a valid custom property syntax."); | 87 "The syntax provided is not a valid custom property syntax."); |
| 88 return; | 88 return; |
| 89 } | 89 } |
| 90 | 90 |
| 91 if (descriptor.hasInitialValue()) { | 91 if (descriptor.hasInitialValue()) { |
| 92 CSSTokenizer::Scope scope(descriptor.initialValue()); | 92 CSSTokenizer::Scope scope(descriptor.initialValue()); |
| 93 const CSSValue* initial = syntaxDescriptor.parse(scope.tokenRange()); | 93 bool isAnimationTainted = false; |
| 94 const CSSValue* initial = |
| 95 syntaxDescriptor.parse(scope.tokenRange(), isAnimationTainted); |
| 94 if (!initial) { | 96 if (!initial) { |
| 95 exceptionState.throwDOMException( | 97 exceptionState.throwDOMException( |
| 96 SyntaxError, | 98 SyntaxError, |
| 97 "The initial value provided does not parse for the given syntax."); | 99 "The initial value provided does not parse for the given syntax."); |
| 98 return; | 100 return; |
| 99 } | 101 } |
| 100 if (!computationallyIndependent(*initial)) { | 102 if (!computationallyIndependent(*initial)) { |
| 101 exceptionState.throwDOMException( | 103 exceptionState.throwDOMException( |
| 102 SyntaxError, | 104 SyntaxError, |
| 103 "The initial value provided is not computationally independent."); | 105 "The initial value provided is not computationally independent."); |
| 104 return; | 106 return; |
| 105 } | 107 } |
| 106 RefPtr<CSSVariableData> initialVariableData = | 108 RefPtr<CSSVariableData> initialVariableData = |
| 107 CSSVariableData::create(scope.tokenRange(), false); | 109 CSSVariableData::create(scope.tokenRange(), isAnimationTainted, false); |
| 108 registry.registerProperty(atomicName, syntaxDescriptor, | 110 registry.registerProperty(atomicName, syntaxDescriptor, |
| 109 descriptor.inherits(), initial, | 111 descriptor.inherits(), initial, |
| 110 initialVariableData.release()); | 112 initialVariableData.release()); |
| 111 } else { | 113 } else { |
| 112 if (!syntaxDescriptor.isTokenStream()) { | 114 if (!syntaxDescriptor.isTokenStream()) { |
| 113 exceptionState.throwDOMException( | 115 exceptionState.throwDOMException( |
| 114 SyntaxError, | 116 SyntaxError, |
| 115 "An initial value must be provided if the syntax is not '*'"); | 117 "An initial value must be provided if the syntax is not '*'"); |
| 116 return; | 118 return; |
| 117 } | 119 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 140 return; | 142 return; |
| 141 } | 143 } |
| 142 registry.unregisterProperty(atomicProperty); | 144 registry.unregisterProperty(atomicProperty); |
| 143 | 145 |
| 144 document->setNeedsStyleRecalc(SubtreeStyleChange, | 146 document->setNeedsStyleRecalc(SubtreeStyleChange, |
| 145 StyleChangeReasonForTracing::create( | 147 StyleChangeReasonForTracing::create( |
| 146 StyleChangeReason::PropertyUnregistration)); | 148 StyleChangeReason::PropertyUnregistration)); |
| 147 } | 149 } |
| 148 | 150 |
| 149 } // namespace blink | 151 } // namespace blink |
| OLD | NEW |