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

Unified Diff: third_party/WebKit/Source/core/css/CSSSyntaxDescriptor.cpp

Issue 2564793002: Add smooth interpolation support for <color> custom properties (Closed)
Patch Set: Rebase 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 492c2ca4aeca77774a13a9e0a876eb6ce8513abc..01fefa3aa9ca7b260ecaf96a38bc530b135ef09d 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"
@@ -211,4 +213,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.push_back(
+ 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.push_back(
+ WTF::makeUnique<CSSValueInterpolationType>(property));
+ return interpolationTypes;
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSyntaxDescriptor.h ('k') | third_party/WebKit/Source/core/css/PropertyRegistration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698