| 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" | |
| 9 #include "core/css/CSSCustomPropertyDeclaration.h" | 7 #include "core/css/CSSCustomPropertyDeclaration.h" |
| 10 #include "core/css/CSSURIValue.h" | 8 #include "core/css/CSSURIValue.h" |
| 11 #include "core/css/CSSValueList.h" | 9 #include "core/css/CSSValueList.h" |
| 12 #include "core/css/CSSVariableReferenceValue.h" | 10 #include "core/css/CSSVariableReferenceValue.h" |
| 13 #include "core/css/parser/CSSParserIdioms.h" | 11 #include "core/css/parser/CSSParserIdioms.h" |
| 14 #include "core/css/parser/CSSPropertyParserHelpers.h" | 12 #include "core/css/parser/CSSPropertyParserHelpers.h" |
| 15 #include "core/css/parser/CSSVariableParser.h" | 13 #include "core/css/parser/CSSVariableParser.h" |
| 16 #include "core/html/parser/HTMLParserIdioms.h" | 14 #include "core/html/parser/HTMLParserIdioms.h" |
| 17 | 15 |
| 18 namespace blink { | 16 namespace blink { |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 range.consumeWhitespace(); | 204 range.consumeWhitespace(); |
| 207 for (const CSSSyntaxComponent& component : m_syntaxComponents) { | 205 for (const CSSSyntaxComponent& component : m_syntaxComponents) { |
| 208 if (const CSSValue* result = | 206 if (const CSSValue* result = |
| 209 consumeSyntaxComponent(component, range, context)) | 207 consumeSyntaxComponent(component, range, context)) |
| 210 return result; | 208 return result; |
| 211 } | 209 } |
| 212 return CSSVariableParser::parseRegisteredPropertyValue(range, true, | 210 return CSSVariableParser::parseRegisteredPropertyValue(range, true, |
| 213 isAnimationTainted); | 211 isAnimationTainted); |
| 214 } | 212 } |
| 215 | 213 |
| 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.append( | |
| 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.append( | |
| 255 WTF::makeUnique<CSSValueInterpolationType>(property)); | |
| 256 return interpolationTypes; | |
| 257 } | |
| 258 | |
| 259 } // namespace blink | 214 } // namespace blink |
| OLD | NEW |