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" |
11 #include "core/css/PropertyDescriptor.h" | 11 #include "core/css/PropertyDescriptor.h" |
12 #include "core/css/PropertyRegistry.h" | 12 #include "core/css/PropertyRegistry.h" |
13 #include "core/css/parser/CSSParserContext.h" | |
13 #include "core/css/parser/CSSTokenizer.h" | 14 #include "core/css/parser/CSSTokenizer.h" |
14 #include "core/css/parser/CSSVariableParser.h" | 15 #include "core/css/parser/CSSVariableParser.h" |
15 #include "core/dom/Document.h" | 16 #include "core/dom/Document.h" |
16 #include "core/dom/ExceptionCode.h" | 17 #include "core/dom/ExceptionCode.h" |
17 #include "core/dom/StyleChangeReason.h" | 18 #include "core/dom/StyleChangeReason.h" |
18 | 19 |
19 namespace blink { | 20 namespace blink { |
20 | 21 |
21 static bool computationallyIndependent(const CSSValue& value) { | 22 static bool computationallyIndependent(const CSSValue& value) { |
22 DCHECK(!value.isCSSWideKeyword()); | 23 DCHECK(!value.isCSSWideKeyword()); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 "The syntax provided is not a valid custom property syntax."); | 101 "The syntax provided is not a valid custom property syntax."); |
101 return; | 102 return; |
102 } | 103 } |
103 | 104 |
104 InterpolationTypes interpolationTypes = | 105 InterpolationTypes interpolationTypes = |
105 interpolationTypesForSyntax(atomicName, syntaxDescriptor); | 106 interpolationTypesForSyntax(atomicName, syntaxDescriptor); |
106 | 107 |
107 if (descriptor.hasInitialValue()) { | 108 if (descriptor.hasInitialValue()) { |
108 CSSTokenizer tokenizer(descriptor.initialValue()); | 109 CSSTokenizer tokenizer(descriptor.initialValue()); |
109 bool isAnimationTainted = false; | 110 bool isAnimationTainted = false; |
110 const CSSValue* initial = | 111 const CSSValue* initial = syntaxDescriptor.parse( |
111 syntaxDescriptor.parse(tokenizer.tokenRange(), isAnimationTainted); | 112 tokenizer.tokenRange(), strictCSSParserContext(), isAnimationTainted); |
Timothy Loh
2017/01/16 00:33:36
This is probably not right, I think we need a prop
fs
2017/01/16 13:18:01
Thanks, fixed.
| |
112 if (!initial) { | 113 if (!initial) { |
113 exceptionState.throwDOMException( | 114 exceptionState.throwDOMException( |
114 SyntaxError, | 115 SyntaxError, |
115 "The initial value provided does not parse for the given syntax."); | 116 "The initial value provided does not parse for the given syntax."); |
116 return; | 117 return; |
117 } | 118 } |
118 if (!computationallyIndependent(*initial)) { | 119 if (!computationallyIndependent(*initial)) { |
119 exceptionState.throwDOMException( | 120 exceptionState.throwDOMException( |
120 SyntaxError, | 121 SyntaxError, |
121 "The initial value provided is not computationally independent."); | 122 "The initial value provided is not computationally independent."); |
(...skipping 16 matching lines...) Expand all Loading... | |
138 std::move(interpolationTypes)); | 139 std::move(interpolationTypes)); |
139 } | 140 } |
140 | 141 |
141 // TODO(timloh): Invalidate only elements with this custom property set | 142 // TODO(timloh): Invalidate only elements with this custom property set |
142 document->setNeedsStyleRecalc(SubtreeStyleChange, | 143 document->setNeedsStyleRecalc(SubtreeStyleChange, |
143 StyleChangeReasonForTracing::create( | 144 StyleChangeReasonForTracing::create( |
144 StyleChangeReason::PropertyRegistration)); | 145 StyleChangeReason::PropertyRegistration)); |
145 } | 146 } |
146 | 147 |
147 } // namespace blink | 148 } // namespace blink |
OLD | NEW |