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/CSSStyleSheet.h" |
8 #include "core/css/CSSSyntaxDescriptor.h" | 9 #include "core/css/CSSSyntaxDescriptor.h" |
9 #include "core/css/CSSValueList.h" | 10 #include "core/css/CSSValueList.h" |
10 #include "core/css/CSSVariableReferenceValue.h" | 11 #include "core/css/CSSVariableReferenceValue.h" |
11 #include "core/css/PropertyDescriptor.h" | 12 #include "core/css/PropertyDescriptor.h" |
12 #include "core/css/PropertyRegistry.h" | 13 #include "core/css/PropertyRegistry.h" |
| 14 #include "core/css/StyleSheetContents.h" |
| 15 #include "core/css/parser/CSSParserContext.h" |
13 #include "core/css/parser/CSSTokenizer.h" | 16 #include "core/css/parser/CSSTokenizer.h" |
14 #include "core/css/parser/CSSVariableParser.h" | 17 #include "core/css/parser/CSSVariableParser.h" |
15 #include "core/css/resolver/StyleBuilderConverter.h" | 18 #include "core/css/resolver/StyleBuilderConverter.h" |
16 #include "core/dom/Document.h" | 19 #include "core/dom/Document.h" |
17 #include "core/dom/ExceptionCode.h" | 20 #include "core/dom/ExceptionCode.h" |
18 #include "core/dom/StyleChangeReason.h" | 21 #include "core/dom/StyleChangeReason.h" |
19 | 22 |
20 namespace blink { | 23 namespace blink { |
21 | 24 |
22 static bool computationallyIndependent(const CSSValue& value) { | 25 static bool computationallyIndependent(const CSSValue& value) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 "The syntax provided is not a valid custom property syntax."); | 104 "The syntax provided is not a valid custom property syntax."); |
102 return; | 105 return; |
103 } | 106 } |
104 | 107 |
105 InterpolationTypes interpolationTypes = | 108 InterpolationTypes interpolationTypes = |
106 interpolationTypesForSyntax(atomicName, syntaxDescriptor); | 109 interpolationTypesForSyntax(atomicName, syntaxDescriptor); |
107 | 110 |
108 if (descriptor.hasInitialValue()) { | 111 if (descriptor.hasInitialValue()) { |
109 CSSTokenizer tokenizer(descriptor.initialValue()); | 112 CSSTokenizer tokenizer(descriptor.initialValue()); |
110 bool isAnimationTainted = false; | 113 bool isAnimationTainted = false; |
111 const CSSValue* initial = | 114 const CSSValue* initial = syntaxDescriptor.parse( |
112 syntaxDescriptor.parse(tokenizer.tokenRange(), isAnimationTainted); | 115 tokenizer.tokenRange(), |
| 116 document->elementSheet().contents()->parserContext(), |
| 117 isAnimationTainted); |
113 if (!initial) { | 118 if (!initial) { |
114 exceptionState.throwDOMException( | 119 exceptionState.throwDOMException( |
115 SyntaxError, | 120 SyntaxError, |
116 "The initial value provided does not parse for the given syntax."); | 121 "The initial value provided does not parse for the given syntax."); |
117 return; | 122 return; |
118 } | 123 } |
119 if (!computationallyIndependent(*initial)) { | 124 if (!computationallyIndependent(*initial)) { |
120 exceptionState.throwDOMException( | 125 exceptionState.throwDOMException( |
121 SyntaxError, | 126 SyntaxError, |
122 "The initial value provided is not computationally independent."); | 127 "The initial value provided is not computationally independent."); |
(...skipping 18 matching lines...) Expand all Loading... |
141 std::move(interpolationTypes)); | 146 std::move(interpolationTypes)); |
142 } | 147 } |
143 | 148 |
144 // TODO(timloh): Invalidate only elements with this custom property set | 149 // TODO(timloh): Invalidate only elements with this custom property set |
145 document->setNeedsStyleRecalc(SubtreeStyleChange, | 150 document->setNeedsStyleRecalc(SubtreeStyleChange, |
146 StyleChangeReasonForTracing::create( | 151 StyleChangeReasonForTracing::create( |
147 StyleChangeReason::PropertyRegistration)); | 152 StyleChangeReason::PropertyRegistration)); |
148 } | 153 } |
149 | 154 |
150 } // namespace blink | 155 } // namespace blink |
OLD | NEW |