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/CSSSyntaxDescriptor.h" | 5 #include "core/css/CSSSyntaxDescriptor.h" |
6 | 6 |
| 7 #include "core/animation/CSSColorInterpolationType.h" |
| 8 #include "core/animation/CSSValueInterpolationType.h" |
7 #include "core/css/CSSCustomPropertyDeclaration.h" | 9 #include "core/css/CSSCustomPropertyDeclaration.h" |
8 #include "core/css/CSSURIValue.h" | 10 #include "core/css/CSSURIValue.h" |
9 #include "core/css/CSSValueList.h" | 11 #include "core/css/CSSValueList.h" |
10 #include "core/css/CSSVariableReferenceValue.h" | 12 #include "core/css/CSSVariableReferenceValue.h" |
11 #include "core/css/parser/CSSParserIdioms.h" | 13 #include "core/css/parser/CSSParserIdioms.h" |
12 #include "core/css/parser/CSSPropertyParserHelpers.h" | 14 #include "core/css/parser/CSSPropertyParserHelpers.h" |
13 #include "core/css/parser/CSSVariableParser.h" | 15 #include "core/css/parser/CSSVariableParser.h" |
14 #include "core/html/parser/HTMLParserIdioms.h" | 16 #include "core/html/parser/HTMLParserIdioms.h" |
15 | 17 |
16 namespace blink { | 18 namespace blink { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 range.consumeWhitespace(); | 206 range.consumeWhitespace(); |
205 for (const CSSSyntaxComponent& component : m_syntaxComponents) { | 207 for (const CSSSyntaxComponent& component : m_syntaxComponents) { |
206 if (const CSSValue* result = | 208 if (const CSSValue* result = |
207 consumeSyntaxComponent(component, range, context)) | 209 consumeSyntaxComponent(component, range, context)) |
208 return result; | 210 return result; |
209 } | 211 } |
210 return CSSVariableParser::parseRegisteredPropertyValue(range, true, | 212 return CSSVariableParser::parseRegisteredPropertyValue(range, true, |
211 isAnimationTainted); | 213 isAnimationTainted); |
212 } | 214 } |
213 | 215 |
| 216 InterpolationTypes CSSSyntaxDescriptor::createInterpolationTypes( |
| 217 const AtomicString& propertyName) const { |
| 218 PropertyHandle property(propertyName); |
| 219 InterpolationTypes interpolationTypes; |
| 220 for (const CSSSyntaxComponent& component : m_syntaxComponents) { |
| 221 if (component.m_repeatable) { |
| 222 // TODO(alancutter): Support animation of repeatable types. |
| 223 continue; |
| 224 } |
| 225 |
| 226 switch (component.m_type) { |
| 227 case CSSSyntaxType::Color: |
| 228 interpolationTypes.push_back( |
| 229 WTF::makeUnique<CSSColorInterpolationType>(property)); |
| 230 break; |
| 231 case CSSSyntaxType::Length: |
| 232 case CSSSyntaxType::Number: |
| 233 case CSSSyntaxType::Percentage: |
| 234 case CSSSyntaxType::LengthPercentage: |
| 235 case CSSSyntaxType::Image: |
| 236 case CSSSyntaxType::Url: |
| 237 case CSSSyntaxType::Integer: |
| 238 case CSSSyntaxType::Angle: |
| 239 case CSSSyntaxType::Time: |
| 240 case CSSSyntaxType::Resolution: |
| 241 case CSSSyntaxType::TransformFunction: |
| 242 // TODO(alancutter): Support smooth interpolation of these types. |
| 243 break; |
| 244 case CSSSyntaxType::TokenStream: |
| 245 case CSSSyntaxType::Ident: |
| 246 case CSSSyntaxType::CustomIdent: |
| 247 // Uses the CSSValueInterpolationType added below. |
| 248 break; |
| 249 default: |
| 250 NOTREACHED(); |
| 251 break; |
| 252 } |
| 253 } |
| 254 interpolationTypes.push_back( |
| 255 WTF::makeUnique<CSSValueInterpolationType>(property)); |
| 256 return interpolationTypes; |
| 257 } |
| 258 |
214 } // namespace blink | 259 } // namespace blink |
OLD | NEW |