Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: third_party/WebKit/Source/core/css/CSSSyntaxDescriptor.cpp

Issue 2564793002: Add smooth interpolation support for <color> custom properties (Closed)
Patch Set: <color> Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/CSSParserContext.h" 13 #include "core/css/parser/CSSParserContext.h"
12 #include "core/css/parser/CSSParserIdioms.h" 14 #include "core/css/parser/CSSParserIdioms.h"
13 #include "core/css/parser/CSSPropertyParserHelpers.h" 15 #include "core/css/parser/CSSPropertyParserHelpers.h"
14 #include "core/css/parser/CSSVariableParser.h" 16 #include "core/css/parser/CSSVariableParser.h"
15 #include "core/html/parser/HTMLParserIdioms.h" 17 #include "core/html/parser/HTMLParserIdioms.h"
16 18
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 205 }
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 = consumeSyntaxComponent(component, range)) 208 if (const CSSValue* result = consumeSyntaxComponent(component, range))
207 return result; 209 return result;
208 } 210 }
209 return CSSVariableParser::parseRegisteredPropertyValue(range, true, 211 return CSSVariableParser::parseRegisteredPropertyValue(range, true,
210 isAnimationTainted); 212 isAnimationTainted);
211 } 213 }
212 214
215 InterpolationTypes CSSSyntaxDescriptor::createInterpolationTypes(
216 const AtomicString& propertyName) const {
217 PropertyHandle property(propertyName);
218 InterpolationTypes interpolationTypes;
219 for (const CSSSyntaxComponent& component : m_syntaxComponents) {
220 if (component.m_repeatable) {
221 // TODO(alancutter): Support animation of repeatable types.
222 continue;
223 }
224
225 switch (component.m_type) {
226 case CSSSyntaxType::Color:
227 interpolationTypes.append(
228 WTF::makeUnique<CSSColorInterpolationType>(property));
229 break;
230 case CSSSyntaxType::Length:
231 case CSSSyntaxType::Number:
232 case CSSSyntaxType::Percentage:
233 case CSSSyntaxType::LengthPercentage:
234 case CSSSyntaxType::Image:
235 case CSSSyntaxType::Url:
236 case CSSSyntaxType::Integer:
237 case CSSSyntaxType::Angle:
238 case CSSSyntaxType::Time:
239 case CSSSyntaxType::Resolution:
240 case CSSSyntaxType::TransformFunction:
241 // TODO(alancutter): Support smooth interpolation of these types.
242 break;
243 case CSSSyntaxType::TokenStream:
244 case CSSSyntaxType::Ident:
245 case CSSSyntaxType::CustomIdent:
246 // Uses the CSSValueInterpolationType added below.
247 break;
248 default:
249 NOTREACHED();
250 break;
251 }
252 }
253 interpolationTypes.append(
254 WTF::makeUnique<CSSValueInterpolationType>(property));
255 return interpolationTypes;
256 }
257
213 } // namespace blink 258 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698