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

Unified Diff: third_party/WebKit/Source/core/animation/CSSInterpolationTypesMap.cpp

Issue 2654783004: Store PropertyRegistry::Registrations on CSSInterpolationTypes for registered custom properties (Closed)
Patch Set: Rebased Created 3 years, 10 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/animation/CSSInterpolationTypesMap.cpp
diff --git a/third_party/WebKit/Source/core/animation/CSSInterpolationTypesMap.cpp b/third_party/WebKit/Source/core/animation/CSSInterpolationTypesMap.cpp
index e4c36037b8a09a549070237521588db6913a8d12..e77d94e5ff6899fa982a9ca767d95bfd40806908 100644
--- a/third_party/WebKit/Source/core/animation/CSSInterpolationTypesMap.cpp
+++ b/third_party/WebKit/Source/core/animation/CSSInterpolationTypesMap.cpp
@@ -4,6 +4,7 @@
#include "core/animation/CSSInterpolationTypesMap.h"
+#include <memory>
#include "core/animation/CSSBasicShapeInterpolationType.h"
#include "core/animation/CSSBorderImageLengthBoxInterpolationType.h"
#include "core/animation/CSSClipInterpolationType.h"
@@ -34,9 +35,9 @@
#include "core/animation/CSSValueInterpolationType.h"
#include "core/animation/CSSVisibilityInterpolationType.h"
#include "core/css/CSSPropertyMetadata.h"
+#include "core/css/CSSSyntaxDescriptor.h"
#include "core/css/PropertyRegistry.h"
#include "wtf/PtrUtil.h"
-#include <memory>
namespace blink {
@@ -325,4 +326,49 @@ size_t CSSInterpolationTypesMap::version() const {
return m_registry ? m_registry->registrationCount() : 0;
}
+CSSInterpolationTypes
+CSSInterpolationTypesMap::createCSSInterpolationTypesForSyntax(
+ const AtomicString& propertyName,
+ const CSSSyntaxDescriptor& descriptor) {
+ PropertyHandle property(propertyName);
+ CSSInterpolationTypes result;
+ for (const CSSSyntaxComponent& component : descriptor.components()) {
+ if (component.m_repeatable) {
+ // TODO(alancutter): Support animation of repeatable types.
+ continue;
+ }
+
+ switch (component.m_type) {
+ case CSSSyntaxType::Color:
+ result.push_back(WTF::makeUnique<CSSColorInterpolationType>(property));
+ break;
+ case CSSSyntaxType::Length:
+ result.push_back(WTF::makeUnique<CSSLengthInterpolationType>(property));
+ break;
+ 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;
+ }
+ }
+ result.push_back(WTF::makeUnique<CSSValueInterpolationType>(property));
+ return result;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698