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