| 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/animation/CSSValueInterpolationType.h" | 7 #include "core/animation/CSSValueInterpolationType.h" |
| 8 #include "core/css/CSSSyntaxDescriptor.h" | 8 #include "core/css/CSSSyntaxDescriptor.h" |
| 9 #include "core/css/CSSValueList.h" | 9 #include "core/css/CSSValueList.h" |
| 10 #include "core/css/CSSVariableReferenceValue.h" | 10 #include "core/css/CSSVariableReferenceValue.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 if (!computationallyIndependent(*initial)) { | 118 if (!computationallyIndependent(*initial)) { |
| 119 exceptionState.throwDOMException( | 119 exceptionState.throwDOMException( |
| 120 SyntaxError, | 120 SyntaxError, |
| 121 "The initial value provided is not computationally independent."); | 121 "The initial value provided is not computationally independent."); |
| 122 return; | 122 return; |
| 123 } | 123 } |
| 124 RefPtr<CSSVariableData> initialVariableData = CSSVariableData::create( | 124 RefPtr<CSSVariableData> initialVariableData = CSSVariableData::create( |
| 125 tokenizer.tokenRange(), isAnimationTainted, false); | 125 tokenizer.tokenRange(), isAnimationTainted, false); |
| 126 registry.registerProperty( | 126 registry.registerProperty( |
| 127 atomicName, syntaxDescriptor, descriptor.inherits(), initial, | 127 atomicName, syntaxDescriptor, descriptor.inherits(), initial, |
| 128 initialVariableData.release(), std::move(interpolationTypes)); | 128 std::move(initialVariableData), std::move(interpolationTypes)); |
| 129 } else { | 129 } else { |
| 130 if (!syntaxDescriptor.isTokenStream()) { | 130 if (!syntaxDescriptor.isTokenStream()) { |
| 131 exceptionState.throwDOMException( | 131 exceptionState.throwDOMException( |
| 132 SyntaxError, | 132 SyntaxError, |
| 133 "An initial value must be provided if the syntax is not '*'"); | 133 "An initial value must be provided if the syntax is not '*'"); |
| 134 return; | 134 return; |
| 135 } | 135 } |
| 136 registry.registerProperty(atomicName, syntaxDescriptor, | 136 registry.registerProperty(atomicName, syntaxDescriptor, |
| 137 descriptor.inherits(), nullptr, nullptr, | 137 descriptor.inherits(), nullptr, nullptr, |
| 138 std::move(interpolationTypes)); | 138 std::move(interpolationTypes)); |
| 139 } | 139 } |
| 140 | 140 |
| 141 // TODO(timloh): Invalidate only elements with this custom property set | 141 // TODO(timloh): Invalidate only elements with this custom property set |
| 142 document->setNeedsStyleRecalc(SubtreeStyleChange, | 142 document->setNeedsStyleRecalc(SubtreeStyleChange, |
| 143 StyleChangeReasonForTracing::create( | 143 StyleChangeReasonForTracing::create( |
| 144 StyleChangeReason::PropertyRegistration)); | 144 StyleChangeReason::PropertyRegistration)); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace blink | 147 } // namespace blink |
| OLD | NEW |