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

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

Issue 1322123003: Add composite() method to InterpolationType interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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: Source/core/animation/InterpolationType.h
diff --git a/Source/core/animation/InterpolationType.h b/Source/core/animation/InterpolationType.h
index 5724720984875bbe595e7990e1768aa032527d27..b500552f2cfffc982ad49dbae81d83b5c7a2c7ed 100644
--- a/Source/core/animation/InterpolationType.h
+++ b/Source/core/animation/InterpolationType.h
@@ -10,6 +10,7 @@
#include "core/animation/NonInterpolableValue.h"
#include "core/animation/PrimitiveInterpolation.h"
#include "core/animation/StringKeyframe.h"
+#include "core/animation/UnderlyingValue.h"
#include "platform/heap/Handle.h"
#include "wtf/Allocator.h"
@@ -47,12 +48,7 @@ public:
OwnPtr<InterpolationValue> endValue = maybeConvertSingle(endKeyframe, state, conversionCheckers);
if (!endValue)
return nullptr;
- ASSERT(!startValue->nonInterpolableValue());
- ASSERT(!endValue->nonInterpolableValue());
- return PairwisePrimitiveInterpolation::create(*this,
- startValue->mutableComponent().interpolableValue.release(),
- endValue->mutableComponent().interpolableValue.release(),
- nullptr);
+ return mergeSingleConversions(*startValue, *endValue);
}
virtual PassOwnPtr<InterpolationValue> maybeConvertSingle(const CSSPropertySpecificKeyframe& keyframe, const StyleResolverState* state, ConversionCheckers& conversionCheckers) const
@@ -69,6 +65,13 @@ public:
virtual PassOwnPtr<InterpolationValue> maybeConvertUnderlyingValue(const StyleResolverState&) const = 0;
+ virtual void composite(UnderlyingValue& underlyingValue, double underlyingFraction, const InterpolationValue& value) const
+ {
+ ASSERT(!underlyingValue->nonInterpolableValue());
+ ASSERT(!value.nonInterpolableValue());
+ underlyingValue.mutableComponent().interpolableValue->scaleAndAdd(underlyingFraction, value.interpolableValue());
+ }
+
virtual void apply(const InterpolableValue&, const NonInterpolableValue*, StyleResolverState&) const = 0;
// Implement reference equality checking via pointer equality checking as these are singletons
@@ -85,6 +88,16 @@ protected:
virtual PassOwnPtr<InterpolationValue> maybeConvertInherit(const StyleResolverState* state, ConversionCheckers& conversionCheckers) const { ASSERT_NOT_REACHED(); return nullptr; }
virtual PassOwnPtr<InterpolationValue> maybeConvertValue(const CSSValue& value, const StyleResolverState* state, ConversionCheckers& conversionCheckers) const { ASSERT_NOT_REACHED(); return nullptr; }
+ virtual PassOwnPtr<PairwisePrimitiveInterpolation> mergeSingleConversions(InterpolationValue& startValue, InterpolationValue& endValue) const
+ {
+ ASSERT(!startValue.nonInterpolableValue());
+ ASSERT(!endValue.nonInterpolableValue());
+ return PairwisePrimitiveInterpolation::create(*this,
+ startValue.mutableComponent().interpolableValue.release(),
+ endValue.mutableComponent().interpolableValue.release(),
+ nullptr);
+ }
+
const CSSPropertyID m_property;
};
« no previous file with comments | « Source/core/animation/InterpolableValue.h ('k') | Source/core/animation/InvalidatableStyleInterpolation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698