OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/CSSParserImpl.h" | 5 #include "core/css/parser/CSSParserImpl.h" |
6 | 6 |
7 #include "core/css/CSSCustomIdentValue.h" | 7 #include "core/css/CSSCustomIdentValue.h" |
8 #include "core/css/CSSCustomPropertyDeclaration.h" | 8 #include "core/css/CSSCustomPropertyDeclaration.h" |
9 #include "core/css/CSSKeyframesRule.h" | 9 #include "core/css/CSSKeyframesRule.h" |
10 #include "core/css/CSSStyleSheet.h" | 10 #include "core/css/CSSStyleSheet.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 bool important, | 74 bool important, |
75 const CSSParserContext& context, | 75 const CSSParserContext& context, |
76 bool isAnimationTainted) { | 76 bool isAnimationTainted) { |
77 CSSParserImpl parser(context); | 77 CSSParserImpl parser(context); |
78 CSSTokenizer tokenizer(value); | 78 CSSTokenizer tokenizer(value); |
79 parser.consumeVariableValue(tokenizer.tokenRange(), propertyName, important, | 79 parser.consumeVariableValue(tokenizer.tokenRange(), propertyName, important, |
80 isAnimationTainted); | 80 isAnimationTainted); |
81 bool didParse = false; | 81 bool didParse = false; |
82 bool didChange = false; | 82 bool didChange = false; |
83 if (!parser.m_parsedProperties.isEmpty()) { | 83 if (!parser.m_parsedProperties.isEmpty()) { |
84 if (registry) { | 84 const CSSCustomPropertyDeclaration* parsedDeclaration = |
| 85 toCSSCustomPropertyDeclaration(parser.m_parsedProperties[0].value()); |
| 86 if (parsedDeclaration->value() && registry) { |
85 const PropertyRegistry::Registration* registration = | 87 const PropertyRegistry::Registration* registration = |
86 registry->registration(propertyName); | 88 registry->registration(propertyName); |
87 // TODO(timloh): This is a bit wasteful, we parse the registered property | 89 // TODO(timloh): This is a bit wasteful, we parse the registered property |
88 // to validate but throw away the result. | 90 // to validate but throw away the result. |
89 if (registration && | 91 if (registration && |
90 !registration->syntax().parse(tokenizer.tokenRange(), | 92 !registration->syntax().parse(tokenizer.tokenRange(), |
91 isAnimationTainted)) { | 93 isAnimationTainted)) { |
92 return MutableStylePropertySet::SetResult{didParse, didChange}; | 94 return MutableStylePropertySet::SetResult{didParse, didChange}; |
93 } | 95 } |
94 } | 96 } |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 else | 979 else |
978 return nullptr; // Parser error, invalid value in keyframe selector | 980 return nullptr; // Parser error, invalid value in keyframe selector |
979 if (range.atEnd()) | 981 if (range.atEnd()) |
980 return result; | 982 return result; |
981 if (range.consume().type() != CommaToken) | 983 if (range.consume().type() != CommaToken) |
982 return nullptr; // Parser error | 984 return nullptr; // Parser error |
983 } | 985 } |
984 } | 986 } |
985 | 987 |
986 } // namespace blink | 988 } // namespace blink |
OLD | NEW |