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

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

Issue 1394343003: Web Animations: Remove CSS dependence from InterpolationType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_specialCase0and1
Patch Set: NIVs Created 5 years, 2 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/InterpolationType.h
diff --git a/third_party/WebKit/Source/core/animation/InterpolationType.h b/third_party/WebKit/Source/core/animation/InterpolationType.h
index 1a3c02e74248802417957f8df2d765db19ebc580..7a9304ec5610581da672650cada0e2bbfc17ce47 100644
--- a/third_party/WebKit/Source/core/animation/InterpolationType.h
+++ b/third_party/WebKit/Source/core/animation/InterpolationType.h
@@ -5,18 +5,17 @@
#ifndef InterpolationType_h
#define InterpolationType_h
-#include "core/animation/InterpolableValue.h"
#include "core/animation/InterpolationValue.h"
-#include "core/animation/NonInterpolableValue.h"
+#include "core/animation/Keyframe.h"
#include "core/animation/PrimitiveInterpolation.h"
-#include "core/animation/StringKeyframe.h"
+#include "core/animation/PropertyHandle.h"
#include "core/animation/UnderlyingValue.h"
#include "platform/heap/Handle.h"
#include "wtf/Allocator.h"
namespace blink {
-class StyleResolverState;
+class InterpolationEnvironment;
// A singleton that:
// - Converts from animation keyframe(s) to interpolation compatible representations: maybeConvertPairwise() and maybeConvertSingle()
@@ -25,7 +24,7 @@ class InterpolationType {
WTF_MAKE_FAST_ALLOCATED(InterpolationType);
WTF_MAKE_NONCOPYABLE(InterpolationType);
public:
- CSSPropertyID property() const { return m_property; }
+ PropertyHandle property() const { return m_property; }
// Represents logic for determining whether a conversion decision is no longer valid given the current environment.
class ConversionChecker {
@@ -33,7 +32,7 @@ public:
WTF_MAKE_NONCOPYABLE(ConversionChecker);
public:
virtual ~ConversionChecker() { }
- virtual bool isValid(const StyleResolverState&, const UnderlyingValue&) const = 0;
+ virtual bool isValid(const InterpolationEnvironment&, const UnderlyingValue&) const = 0;
const InterpolationType& type() const { return m_type; }
DEFINE_INLINE_VIRTUAL_TRACE() { }
protected:
@@ -44,30 +43,20 @@ public:
};
using ConversionCheckers = Vector<OwnPtr<ConversionChecker>>;
- virtual PassOwnPtr<PairwisePrimitiveInterpolation> maybeConvertPairwise(const CSSPropertySpecificKeyframe& startKeyframe, const CSSPropertySpecificKeyframe& endKeyframe, const StyleResolverState* state, const UnderlyingValue& underlyingValue, ConversionCheckers& conversionCheckers) const
+ virtual PassOwnPtr<PairwisePrimitiveInterpolation> maybeConvertPairwise(const PropertySpecificKeyframe& startKeyframe, const PropertySpecificKeyframe& endKeyframe, const InterpolationEnvironment* environment, const UnderlyingValue& underlyingValue, ConversionCheckers& conversionCheckers) const
{
- OwnPtr<InterpolationValue> startValue = maybeConvertSingle(startKeyframe, state, underlyingValue, conversionCheckers);
+ OwnPtr<InterpolationValue> startValue = maybeConvertSingle(startKeyframe, environment, underlyingValue, conversionCheckers);
if (!startValue)
return nullptr;
- OwnPtr<InterpolationValue> endValue = maybeConvertSingle(endKeyframe, state, underlyingValue, conversionCheckers);
+ OwnPtr<InterpolationValue> endValue = maybeConvertSingle(endKeyframe, environment, underlyingValue, conversionCheckers);
if (!endValue)
return nullptr;
return mergeSingleConversions(*startValue, *endValue);
}
- virtual PassOwnPtr<InterpolationValue> maybeConvertSingle(const CSSPropertySpecificKeyframe& keyframe, const StyleResolverState* state, const UnderlyingValue& underlyingValue, ConversionCheckers& conversionCheckers) const
- {
- const CSSValue* value = keyframe.value();
- if (!value)
- return maybeConvertNeutral(underlyingValue, conversionCheckers);
- if (value->isInitialValue() || (value->isUnsetValue() && !CSSPropertyMetadata::isInheritedProperty(m_property)))
- return maybeConvertInitial();
- if (value->isInheritedValue() || (value->isUnsetValue() && CSSPropertyMetadata::isInheritedProperty(m_property)))
- return maybeConvertInherit(state, conversionCheckers);
- return maybeConvertValue(*value, state, conversionCheckers);
- }
+ virtual PassOwnPtr<InterpolationValue> maybeConvertSingle(const PropertySpecificKeyframe&, const InterpolationEnvironment*, const UnderlyingValue&, ConversionCheckers&) const = 0;
- virtual PassOwnPtr<InterpolationValue> maybeConvertUnderlyingValue(const StyleResolverState&) const = 0;
+ virtual PassOwnPtr<InterpolationValue> maybeConvertUnderlyingValue(const InterpolationEnvironment&) const = 0;
virtual void composite(UnderlyingValue& underlyingValue, double underlyingFraction, const InterpolationValue& value) const
{
@@ -76,22 +65,17 @@ public:
underlyingValue.mutableComponent().interpolableValue->scaleAndAdd(underlyingFraction, value.interpolableValue());
}
- virtual void apply(const InterpolableValue&, const NonInterpolableValue*, StyleResolverState&) const = 0;
+ virtual void apply(const InterpolableValue&, const NonInterpolableValue*, InterpolationEnvironment&) const = 0;
// Implement reference equality checking via pointer equality checking as these are singletons.
bool operator==(const InterpolationType& other) const { return this == &other; }
bool operator!=(const InterpolationType& other) const { return this != &other; }
protected:
- InterpolationType(CSSPropertyID property)
+ InterpolationType(PropertyHandle property)
: m_property(property)
{ }
- virtual PassOwnPtr<InterpolationValue> maybeConvertNeutral(const UnderlyingValue&, ConversionCheckers&) const { ASSERT_NOT_REACHED(); return nullptr; }
- virtual PassOwnPtr<InterpolationValue> maybeConvertInitial() const { ASSERT_NOT_REACHED(); return nullptr; }
- virtual PassOwnPtr<InterpolationValue> maybeConvertInherit(const StyleResolverState*, 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());
@@ -102,7 +86,7 @@ protected:
nullptr);
}
- const CSSPropertyID m_property;
+ const PropertyHandle m_property;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698