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

Unified Diff: Source/core/animation/StringKeyframe.cpp

Issue 1153943003: Add foundation for removing AnimatableValues from StyleInterpolation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review changes Created 5 years, 6 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
« no previous file with comments | « Source/core/animation/PrimitiveInterpolation.h ('k') | Source/core/core.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/StringKeyframe.cpp
diff --git a/Source/core/animation/StringKeyframe.cpp b/Source/core/animation/StringKeyframe.cpp
index 76e4fcf7843944e1b8c7d0418a1923e5d4df1720..e1d5a182b70e3bcb59956def3ee05f0e181a8ce3 100644
--- a/Source/core/animation/StringKeyframe.cpp
+++ b/Source/core/animation/StringKeyframe.cpp
@@ -6,6 +6,8 @@
#include "core/animation/StringKeyframe.h"
#include "core/animation/AngleSVGInterpolation.h"
+#include "core/animation/AnimationType.h"
+#include "core/animation/CSSValueAnimationType.h"
#include "core/animation/ColorStyleInterpolation.h"
#include "core/animation/CompositorAnimations.h"
#include "core/animation/ConstantStyleInterpolation.h"
@@ -17,6 +19,7 @@
#include "core/animation/ImageStyleInterpolation.h"
#include "core/animation/IntegerOptionalIntegerSVGInterpolation.h"
#include "core/animation/IntegerSVGInterpolation.h"
+#include "core/animation/InvalidatableStyleInterpolation.h"
#include "core/animation/LegacyStyleInterpolation.h"
#include "core/animation/LengthBoxStyleInterpolation.h"
#include "core/animation/LengthPairStyleInterpolation.h"
@@ -150,11 +153,34 @@ InterpolationRange setRange(CSSPropertyID id)
}
}
+const Vector<const AnimationType*>* applicableTypesForProperty(CSSPropertyID property)
+{
+ using ApplicableTypesMap = HashMap<CSSPropertyID, const Vector<const AnimationType*>*>;
+ DEFINE_STATIC_LOCAL(ApplicableTypesMap, applicableTypesMap, ());
+ auto entry = applicableTypesMap.find(property);
+ if (entry != applicableTypesMap.end())
+ return entry->value;
+
+ // TODO(alancutter): Support all animatable CSS properties here so we can stop falling back to the old StyleInterpolation implementation.
+ if (CSSPropertyMetadata::isAnimatableProperty(property))
+ return nullptr;
+
+ auto applicableTypes = new Vector<const AnimationType*>();
+ applicableTypes->append(new CSSValueAnimationType(property));
+ applicableTypesMap.add(property, applicableTypes);
+ return applicableTypes;
+}
+
} // namespace
PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyframe::maybeCreateInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const
{
CSSPropertyID property = propertyHandle.cssProperty();
+ const Vector<const AnimationType*>* applicableTypes = applicableTypesForProperty(property);
+ if (applicableTypes)
+ return InvalidatableStyleInterpolation::create(*applicableTypes, *this, toCSSPropertySpecificKeyframe(end));
+
+ // TODO(alancutter): Remove the remainder of this function.
// FIXME: Refactor this into a generic piece that lives in InterpolationEffect, and a template parameter specific converter.
CSSValue* fromCSSValue = m_value.get();
@@ -178,7 +204,6 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
return nullptr;
}
- // FIXME: Generate this giant switch statement.
switch (property) {
case CSSPropertyLineHeight:
if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyleInterpolation::canCreateFrom(*toCSSValue))
« no previous file with comments | « Source/core/animation/PrimitiveInterpolation.h ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698