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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/CSSSyntaxDescriptor.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSSyntaxDescriptor.cpp b/third_party/WebKit/Source/core/css/CSSSyntaxDescriptor.cpp
index 4dc999a0e4e6225c021bcea2f32c943897b21be5..b70b68fc8cac8e64e5b53588121bb6e57da6930a 100644
--- a/third_party/WebKit/Source/core/css/CSSSyntaxDescriptor.cpp
+++ b/third_party/WebKit/Source/core/css/CSSSyntaxDescriptor.cpp
@@ -4,6 +4,8 @@
#include "core/css/CSSSyntaxDescriptor.h"
+#include "core/animation/CSSColorInterpolationType.h"
+#include "core/animation/CSSValueInterpolationType.h"
#include "core/css/CSSCustomPropertyDeclaration.h"
#include "core/css/CSSURIValue.h"
#include "core/css/CSSValueList.h"
@@ -210,4 +212,47 @@ const CSSValue* CSSSyntaxDescriptor::parse(CSSParserTokenRange range,
isAnimationTainted);
}
+InterpolationTypes CSSSyntaxDescriptor::createInterpolationTypes(
+ const AtomicString& propertyName) const {
+ PropertyHandle property(propertyName);
+ InterpolationTypes interpolationTypes;
+ for (const CSSSyntaxComponent& component : m_syntaxComponents) {
+ if (component.m_repeatable) {
+ // TODO(alancutter): Support animation of repeatable types.
+ continue;
+ }
+
+ switch (component.m_type) {
+ case CSSSyntaxType::Color:
+ interpolationTypes.append(
+ WTF::makeUnique<CSSColorInterpolationType>(property));
+ break;
+ case CSSSyntaxType::Length:
+ case CSSSyntaxType::Number:
+ case CSSSyntaxType::Percentage:
+ case CSSSyntaxType::LengthPercentage:
+ case CSSSyntaxType::Image:
+ case CSSSyntaxType::Url:
+ case CSSSyntaxType::Integer:
+ case CSSSyntaxType::Angle:
+ case CSSSyntaxType::Time:
+ case CSSSyntaxType::Resolution:
+ case CSSSyntaxType::TransformFunction:
+ // TODO(alancutter): Support smooth interpolation of these types.
+ break;
+ case CSSSyntaxType::TokenStream:
+ case CSSSyntaxType::Ident:
+ case CSSSyntaxType::CustomIdent:
+ // Uses the CSSValueInterpolationType added below.
+ break;
+ default:
+ NOTREACHED();
+ break;
+ }
+ }
+ interpolationTypes.append(
+ WTF::makeUnique<CSSValueInterpolationType>(property));
+ return interpolationTypes;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698