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

Unified Diff: third_party/WebKit/Source/core/animation/LegacyStyleInterpolation.h

Issue 2617703004: Combine {Legacy,}StyleInterpolation (Closed)
Patch Set: 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/animation/LegacyStyleInterpolation.h
diff --git a/third_party/WebKit/Source/core/animation/LegacyStyleInterpolation.h b/third_party/WebKit/Source/core/animation/LegacyStyleInterpolation.h
index 0a0d294e5e37197e2ab7a1733e6225c5a484b156..ef9d80c5d4bd48cc2f84b20fadb267d74d49ad8b 100644
--- a/third_party/WebKit/Source/core/animation/LegacyStyleInterpolation.h
+++ b/third_party/WebKit/Source/core/animation/LegacyStyleInterpolation.h
@@ -16,39 +16,7 @@ namespace blink {
class StyleResolverState;
-class CORE_EXPORT StyleInterpolation : public Interpolation {
- public:
- // 1) convert m_cachedValue into an X
- // 2) shove X into StyleResolverState
- // X can be:
- // (1) a CSSValue (and applied via StyleBuilder::applyProperty)
- // (2) an AnimatableValue (and applied via
- // AnimatedStyleBuilder::applyProperty)
- // (3) a custom value that is inserted directly into the StyleResolverState.
- virtual void apply(StyleResolverState&) const = 0;
-
- bool isStyleInterpolation() const final { return true; }
-
- CSSPropertyID id() const { return m_id; }
-
- PropertyHandle getProperty() const final { return PropertyHandle(id()); }
-
- protected:
- CSSPropertyID m_id;
-
- StyleInterpolation(std::unique_ptr<InterpolableValue> start,
- std::unique_ptr<InterpolableValue> end,
- CSSPropertyID id)
- : Interpolation(std::move(start), std::move(end)), m_id(id) {}
-};
-
-DEFINE_TYPE_CASTS(StyleInterpolation,
- Interpolation,
- value,
- value->isStyleInterpolation(),
- value.isStyleInterpolation());
-
-class LegacyStyleInterpolation : public StyleInterpolation {
+class CORE_EXPORT LegacyStyleInterpolation : public Interpolation {
public:
static PassRefPtr<LegacyStyleInterpolation> create(
PassRefPtr<AnimatableValue> start,
@@ -59,20 +27,34 @@ class LegacyStyleInterpolation : public StyleInterpolation {
InterpolableAnimatableValue::create(std::move(end)), id));
}
- void apply(StyleResolverState& state) const override {
+ // 1) convert m_cachedValue into an X
+ // 2) shove X into StyleResolverState
+ // X can be:
+ // (1) a CSSValue (and applied via StyleBuilder::applyProperty)
+ // (2) an AnimatableValue (and applied via
+ // AnimatedStyleBuilder::applyProperty)
+ // (3) a custom value that is inserted directly into the StyleResolverState.
+ void apply(StyleResolverState& state) const {
AnimatedStyleBuilder::applyProperty(m_id, state, currentValue().get());
}
bool isLegacyStyleInterpolation() const final { return true; }
+
PassRefPtr<AnimatableValue> currentValue() const {
return toInterpolableAnimatableValue(m_cachedValue.get())->value();
}
+ CSSPropertyID id() const { return m_id; }
+
+ PropertyHandle getProperty() const final { return PropertyHandle(id()); }
+
private:
+ CSSPropertyID m_id;
+
LegacyStyleInterpolation(std::unique_ptr<InterpolableValue> start,
std::unique_ptr<InterpolableValue> end,
CSSPropertyID id)
- : StyleInterpolation(std::move(start), std::move(end), id) {}
+ : Interpolation(std::move(start), std::move(end)), m_id(id) {}
};
DEFINE_TYPE_CASTS(LegacyStyleInterpolation,

Powered by Google App Engine
This is Rietveld 408576698