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

Unified Diff: Source/core/animation/InvalidatableStyleInterpolation.h

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/Interpolation.cpp ('k') | Source/core/animation/InvalidatableStyleInterpolation.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/InvalidatableStyleInterpolation.h
diff --git a/Source/core/animation/InvalidatableStyleInterpolation.h b/Source/core/animation/InvalidatableStyleInterpolation.h
new file mode 100644
index 0000000000000000000000000000000000000000..807a3b8d2af45374562bc22d0a4d34414d4e99b5
--- /dev/null
+++ b/Source/core/animation/InvalidatableStyleInterpolation.h
@@ -0,0 +1,64 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef InvalidatableStyleInterpolation_h
+#define InvalidatableStyleInterpolation_h
+
+#include "core/animation/AnimationType.h"
+#include "core/animation/AnimationValue.h"
+#include "core/animation/PrimitiveInterpolation.h"
+#include "core/animation/StyleInterpolation.h"
+
+namespace blink {
+
+// TODO(alancutter): This class will replace *StyleInterpolation, SVGInterpolation, Interpolation.
+// For now it needs to distinguish itself during the refactor and temporarily has an ugly name.
+// TODO(alancutter): Make this class generic for any animation environment so it can be reused for SVG animations.
+class CORE_EXPORT InvalidatableStyleInterpolation : public StyleInterpolation {
+public:
+ static PassRefPtrWillBeRawPtr<InvalidatableStyleInterpolation> create(
+ const Vector<const AnimationType*>& animationTypes,
+ const CSSPropertySpecificKeyframe& startKeyframe,
+ const CSSPropertySpecificKeyframe& endKeyframe)
+ {
+ return adoptRefWillBeNoop(new InvalidatableStyleInterpolation(animationTypes, startKeyframe, endKeyframe));
+ }
+
+ virtual void interpolate(int iteration, double fraction);
+ virtual void apply(StyleResolverState&) const;
+
+ virtual bool isInvalidatableStyleInterpolation() const { return true; }
+
+ DEFINE_INLINE_VIRTUAL_TRACE()
+ {
+ StyleInterpolation::trace(visitor);
+ visitor->trace(m_cachedConversion);
+ visitor->trace(m_cachedValue);
+ }
+
+private:
+ InvalidatableStyleInterpolation(
+ const Vector<const AnimationType*>& animationTypes,
+ const CSSPropertySpecificKeyframe& startKeyframe,
+ const CSSPropertySpecificKeyframe& endKeyframe);
+
+ void ensureValidInterpolation(const StyleResolverState&) const;
+ bool isCacheValid(const StyleResolverState&) const;
+ bool maybeCachePairwiseConversion(const StyleResolverState*) const;
+ PassOwnPtrWillBeRawPtr<FlipPrimitiveInterpolation::Side> convertSingleKeyframe(const CSSPropertySpecificKeyframe&, const StyleResolverState&) const;
+
+ const Vector<const AnimationType*>& m_animationTypes;
+ const CSSPropertySpecificKeyframe& m_startKeyframe;
+ const CSSPropertySpecificKeyframe& m_endKeyframe;
+ double m_currentFraction;
+ mutable OwnPtrWillBeMember<PrimitiveInterpolation> m_cachedConversion;
+ mutable AnimationType::ConversionCheckers m_conversionCheckers;
+ mutable AnimationValue m_cachedValue;
+};
+
+DEFINE_TYPE_CASTS(InvalidatableStyleInterpolation, Interpolation, value, value->isInvalidatableStyleInterpolation(), value.isInvalidatableStyleInterpolation());
+
+} // namespace blink
+
+#endif // InvalidatableStyleInterpolation_h
« no previous file with comments | « Source/core/animation/Interpolation.cpp ('k') | Source/core/animation/InvalidatableStyleInterpolation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698