Commit 4a9ec9b2 authored by shans@chromium.org's avatar shans@chromium.org

Remove CompositableValue. This should have happened as part of 194673002.

BUG=

Review URL: https://codereview.chromium.org/204183002

git-svn-id: svn://svn.chromium.org/blink/trunk@169519 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 5c97e304
...@@ -31,13 +31,12 @@ ...@@ -31,13 +31,12 @@
#ifndef AnimatableValue_h #ifndef AnimatableValue_h
#define AnimatableValue_h #define AnimatableValue_h
#include "core/animation/AnimationEffect.h"
#include "core/css/CSSValue.h" #include "core/css/CSSValue.h"
#include "wtf/RefCounted.h" #include "wtf/RefCounted.h"
namespace WebCore { namespace WebCore {
class AnimatableValue : public AnimationEffect::CompositableValue { class AnimatableValue : public RefCounted<AnimatableValue> {
public: public:
virtual ~AnimatableValue() { } virtual ~AnimatableValue() { }
...@@ -61,10 +60,6 @@ public: ...@@ -61,10 +60,6 @@ public:
return equals(&value); return equals(&value);
} }
virtual bool dependsOnUnderlyingValue() const OVERRIDE FINAL { return false; }
virtual PassRefPtr<AnimatableValue> compositeOnto(const AnimatableValue*) const OVERRIDE FINAL { return takeConstRef(this); }
virtual bool isAnimatableValue() const { return true; }
bool isClipPathOperation() const { return type() == TypeClipPathOperation; } bool isClipPathOperation() const { return type() == TypeClipPathOperation; }
bool isColor() const { return type() == TypeColor; } bool isColor() const { return type() == TypeColor; }
bool isDouble() const { return type() == TypeDouble; } bool isDouble() const { return type() == TypeDouble; }
...@@ -142,8 +137,6 @@ private: ...@@ -142,8 +137,6 @@ private:
#define DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(thisType, predicate) \ #define DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(thisType, predicate) \
DEFINE_TYPE_CASTS(thisType, AnimatableValue, value, value->predicate, value.predicate) DEFINE_TYPE_CASTS(thisType, AnimatableValue, value, value->predicate, value.predicate)
DEFINE_TYPE_CASTS(AnimatableValue, AnimationEffect::CompositableValue, value, value->isAnimatableValue(), value.isAnimatableValue());
} // namespace WebCore } // namespace WebCore
#endif // AnimatableValue_h #endif // AnimatableValue_h
...@@ -48,21 +48,8 @@ public: ...@@ -48,21 +48,8 @@ public:
CompositeReplace, CompositeReplace,
CompositeAdd, CompositeAdd,
}; };
// Encapsulates the value which results from applying a set of composition operations onto an
// underlying value. It is used to represent the output of the effect phase of the Web
// Animations model.
class CompositableValue : public RefCounted<CompositableValue> {
public:
virtual ~CompositableValue() { }
virtual bool dependsOnUnderlyingValue() const = 0;
virtual PassRefPtr<AnimatableValue> compositeOnto(const AnimatableValue*) const = 0;
virtual bool isAnimatableValue() const { return false; }
};
virtual ~AnimationEffect() { } virtual ~AnimationEffect() { }
typedef HashMap<CSSPropertyID, RefPtr<CompositableValue> > CompositableValueMap;
typedef Vector<std::pair<CSSPropertyID, RefPtr<CompositableValue> > > CompositableValueList;
virtual PassOwnPtr<Vector<RefPtr<Interpolation> > > sample(int iteration, double fraction) const = 0; virtual PassOwnPtr<Vector<RefPtr<Interpolation> > > sample(int iteration, double fraction) const = 0;
virtual bool affects(CSSPropertyID) { return false; }; virtual bool affects(CSSPropertyID) { return false; };
......
...@@ -405,13 +405,12 @@ void CompositorAnimationsImpl::addKeyframesToCurve(blink::WebAnimationCurve& cur ...@@ -405,13 +405,12 @@ void CompositorAnimationsImpl::addKeyframesToCurve(blink::WebAnimationCurve& cur
} }
} }
ASSERT(!keyframes[i]->value()->dependsOnUnderlyingValue()); const AnimatableValue* value = keyframes[i]->value();
RefPtr<AnimatableValue> value = keyframes[i]->value()->compositeOnto(0);
switch (curve.type()) { switch (curve.type()) {
case blink::WebAnimationCurve::AnimationCurveTypeFilter: { case blink::WebAnimationCurve::AnimationCurveTypeFilter: {
OwnPtr<blink::WebFilterOperations> ops = adoptPtr(blink::Platform::current()->compositorSupport()->createFilterOperations()); OwnPtr<blink::WebFilterOperations> ops = adoptPtr(blink::Platform::current()->compositorSupport()->createFilterOperations());
bool converted = toWebFilterOperations(toAnimatableFilterOperations(value.get())->operations(), ops.get()); bool converted = toWebFilterOperations(toAnimatableFilterOperations(value)->operations(), ops.get());
ASSERT_UNUSED(converted, converted); ASSERT_UNUSED(converted, converted);
blink::WebFilterKeyframe filterKeyframe(keyframes[i]->offset(), ops.release()); blink::WebFilterKeyframe filterKeyframe(keyframes[i]->offset(), ops.release());
...@@ -420,14 +419,14 @@ void CompositorAnimationsImpl::addKeyframesToCurve(blink::WebAnimationCurve& cur ...@@ -420,14 +419,14 @@ void CompositorAnimationsImpl::addKeyframesToCurve(blink::WebAnimationCurve& cur
break; break;
} }
case blink::WebAnimationCurve::AnimationCurveTypeFloat: { case blink::WebAnimationCurve::AnimationCurveTypeFloat: {
blink::WebFloatKeyframe floatKeyframe(keyframes[i]->offset(), toAnimatableDouble(value.get())->toDouble()); blink::WebFloatKeyframe floatKeyframe(keyframes[i]->offset(), toAnimatableDouble(value)->toDouble());
blink::WebFloatAnimationCurve* floatCurve = static_cast<blink::WebFloatAnimationCurve*>(&curve); blink::WebFloatAnimationCurve* floatCurve = static_cast<blink::WebFloatAnimationCurve*>(&curve);
addKeyframeWithTimingFunction(*floatCurve, floatKeyframe, keyframeTimingFunction); addKeyframeWithTimingFunction(*floatCurve, floatKeyframe, keyframeTimingFunction);
break; break;
} }
case blink::WebAnimationCurve::AnimationCurveTypeTransform: { case blink::WebAnimationCurve::AnimationCurveTypeTransform: {
OwnPtr<blink::WebTransformOperations> ops = adoptPtr(blink::Platform::current()->compositorSupport()->createTransformOperations()); OwnPtr<blink::WebTransformOperations> ops = adoptPtr(blink::Platform::current()->compositorSupport()->createTransformOperations());
toWebTransformOperations(toAnimatableTransform(value.get())->transformOperations(), ops.get()); toWebTransformOperations(toAnimatableTransform(value)->transformOperations(), ops.get());
blink::WebTransformKeyframe transformKeyframe(keyframes[i]->offset(), ops.release()); blink::WebTransformKeyframe transformKeyframe(keyframes[i]->offset(), ops.release());
blink::WebTransformAnimationCurve* transformCurve = static_cast<blink::WebTransformAnimationCurve*>(&curve); blink::WebTransformAnimationCurve* transformCurve = static_cast<blink::WebTransformAnimationCurve*>(&curve);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "core/animation/Interpolation.h" #include "core/animation/Interpolation.h"
#include "core/css/resolver/AnimatedStyleBuilder.h" #include "core/css/resolver/AnimatedStyleBuilder.h"
#include "core/css/resolver/StyleResolverState.h"
namespace WebCore { namespace WebCore {
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef Interpolation_h #ifndef Interpolation_h
#define Interpolation_h #define Interpolation_h
#include "CSSPropertyNames.h"
#include "core/animation/InterpolableValue.h" #include "core/animation/InterpolableValue.h"
#include "wtf/RefCounted.h" #include "wtf/RefCounted.h"
......
...@@ -34,62 +34,6 @@ ...@@ -34,62 +34,6 @@
#include "core/animation/TimedItem.h" #include "core/animation/TimedItem.h"
#include "wtf/text/StringHash.h" #include "wtf/text/StringHash.h"
namespace {
using namespace WebCore;
class AddCompositableValue FINAL : public AnimationEffect::CompositableValue {
public:
static PassRefPtr<AddCompositableValue> create(const AnimatableValue* value)
{
return adoptRef(new AddCompositableValue(value));
}
virtual bool dependsOnUnderlyingValue() const OVERRIDE
{
return true;
}
virtual PassRefPtr<AnimatableValue> compositeOnto(const AnimatableValue* underlyingValue) const OVERRIDE
{
return AnimatableValue::add(underlyingValue, m_value.get());
}
private:
AddCompositableValue(const AnimatableValue* value)
: m_value(const_cast<AnimatableValue*>(value))
{
}
RefPtr<AnimatableValue> m_value;
};
class BlendedCompositableValue FINAL : public AnimationEffect::CompositableValue {
public:
static PassRefPtr<BlendedCompositableValue> create(const AnimationEffect::CompositableValue* before, const AnimationEffect::CompositableValue* after, double fraction)
{
return adoptRef(new BlendedCompositableValue(before, after, fraction));
}
virtual bool dependsOnUnderlyingValue() const OVERRIDE
{
return m_dependsOnUnderlyingValue;
}
virtual PassRefPtr<AnimatableValue> compositeOnto(const AnimatableValue* underlyingValue) const OVERRIDE
{
return AnimatableValue::interpolate(m_before->compositeOnto(underlyingValue).get(), m_after->compositeOnto(underlyingValue).get(), m_fraction);
}
private:
BlendedCompositableValue(const AnimationEffect::CompositableValue* before, const AnimationEffect::CompositableValue* after, double fraction)
: m_before(const_cast<AnimationEffect::CompositableValue*>(before))
, m_after(const_cast<AnimationEffect::CompositableValue*>(after))
, m_fraction(fraction)
, m_dependsOnUnderlyingValue(before->dependsOnUnderlyingValue() || after->dependsOnUnderlyingValue())
{ }
RefPtr<AnimationEffect::CompositableValue> m_before;
RefPtr<AnimationEffect::CompositableValue> m_after;
double m_fraction;
bool m_dependsOnUnderlyingValue;
};
} // namespace
namespace WebCore { namespace WebCore {
Keyframe::Keyframe() Keyframe::Keyframe()
...@@ -281,22 +225,20 @@ void KeyframeEffectModel::ensureInterpolationEffect() const ...@@ -281,22 +225,20 @@ void KeyframeEffectModel::ensureInterpolationEffect() const
for (KeyframeGroupMap::const_iterator iter = m_keyframeGroups->begin(); iter != m_keyframeGroups->end(); ++iter) { for (KeyframeGroupMap::const_iterator iter = m_keyframeGroups->begin(); iter != m_keyframeGroups->end(); ++iter) {
const PropertySpecificKeyframeVector& keyframes = iter->value->keyframes(); const PropertySpecificKeyframeVector& keyframes = iter->value->keyframes();
ASSERT(keyframes[0]->value()->isAnimatableValue());
const AnimatableValue* start; const AnimatableValue* start;
const AnimatableValue* end = toAnimatableValue(keyframes[0]->value()); const AnimatableValue* end = keyframes[0]->value();
for (size_t i = 0; i < keyframes.size() - 1; i++) { for (size_t i = 0; i < keyframes.size() - 1; i++) {
ASSERT(keyframes[i + 1]->value()->isAnimatableValue());
start = end; start = end;
end = toAnimatableValue(keyframes[i + 1]->value()); end = keyframes[i + 1]->value();
double applyFrom = i ? keyframes[i]->offset() : (-std::numeric_limits<double>::infinity()); double applyFrom = i ? keyframes[i]->offset() : (-std::numeric_limits<double>::infinity());
double applyTo = i == keyframes.size() - 2 ? std::numeric_limits<double>::infinity() : keyframes[i+1]->offset(); double applyTo = i == keyframes.size() - 2 ? std::numeric_limits<double>::infinity() : keyframes[i + 1]->offset();
if (applyTo == 1) if (applyTo == 1)
applyTo = std::numeric_limits<double>::infinity(); applyTo = std::numeric_limits<double>::infinity();
m_interpolationEffect->addInterpolation( m_interpolationEffect->addInterpolation(
LegacyStyleInterpolation::create( LegacyStyleInterpolation::create(
AnimatableValue::takeConstRef(start), AnimatableValue::takeConstRef(start),
AnimatableValue::takeConstRef(end), iter->key), AnimatableValue::takeConstRef(end), iter->key),
keyframes[i]->easing(), keyframes[i]->offset(), keyframes[i+1]->offset(), applyFrom, applyTo); keyframes[i]->easing(), keyframes[i]->offset(), keyframes[i + 1]->offset(), applyFrom, applyTo);
} }
} }
} }
...@@ -304,13 +246,12 @@ void KeyframeEffectModel::ensureInterpolationEffect() const ...@@ -304,13 +246,12 @@ void KeyframeEffectModel::ensureInterpolationEffect() const
KeyframeEffectModel::PropertySpecificKeyframe::PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, const AnimatableValue* value, CompositeOperation composite) KeyframeEffectModel::PropertySpecificKeyframe::PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, const AnimatableValue* value, CompositeOperation composite)
: m_offset(offset) : m_offset(offset)
, m_easing(easing) , m_easing(easing)
, m_value(composite == AnimationEffect::CompositeReplace ?
AnimatableValue::takeConstRef(value) :
static_cast<PassRefPtr<CompositableValue> >(AddCompositableValue::create(value)))
{ {
ASSERT(composite == AnimationEffect::CompositeReplace);
m_value = AnimatableValue::takeConstRef(value);
} }
KeyframeEffectModel::PropertySpecificKeyframe::PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, PassRefPtr<CompositableValue> value) KeyframeEffectModel::PropertySpecificKeyframe::PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, PassRefPtr<AnimatableValue> value)
: m_offset(offset) : m_offset(offset)
, m_easing(easing) , m_easing(easing)
, m_value(value) , m_value(value)
...@@ -320,7 +261,7 @@ KeyframeEffectModel::PropertySpecificKeyframe::PropertySpecificKeyframe(double o ...@@ -320,7 +261,7 @@ KeyframeEffectModel::PropertySpecificKeyframe::PropertySpecificKeyframe(double o
PassOwnPtr<KeyframeEffectModel::PropertySpecificKeyframe> KeyframeEffectModel::PropertySpecificKeyframe::cloneWithOffset(double offset) const PassOwnPtr<KeyframeEffectModel::PropertySpecificKeyframe> KeyframeEffectModel::PropertySpecificKeyframe::cloneWithOffset(double offset) const
{ {
return adoptPtr(new PropertySpecificKeyframe(offset, m_easing, PassRefPtr<CompositableValue>(m_value))); return adoptPtr(new PropertySpecificKeyframe(offset, m_easing, m_value));
} }
......
...@@ -116,14 +116,14 @@ public: ...@@ -116,14 +116,14 @@ public:
PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, const AnimatableValue*, CompositeOperation); PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, const AnimatableValue*, CompositeOperation);
double offset() const { return m_offset; } double offset() const { return m_offset; }
TimingFunction* easing() const { return m_easing.get(); } TimingFunction* easing() const { return m_easing.get(); }
const CompositableValue* value() const { return m_value.get(); } const AnimatableValue* value() const { return m_value.get(); }
PassOwnPtr<PropertySpecificKeyframe> cloneWithOffset(double offset) const; PassOwnPtr<PropertySpecificKeyframe> cloneWithOffset(double offset) const;
private: private:
// Used by cloneWithOffset(). // Used by cloneWithOffset().
PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, PassRefPtr<CompositableValue>); PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, PassRefPtr<AnimatableValue>);
double m_offset; double m_offset;
RefPtr<TimingFunction> m_easing; RefPtr<TimingFunction> m_easing;
RefPtr<CompositableValue> m_value; RefPtr<AnimatableValue> m_value;
}; };
class PropertySpecificKeyframeGroup { class PropertySpecificKeyframeGroup {
......
...@@ -51,7 +51,7 @@ class StyleResolver; ...@@ -51,7 +51,7 @@ class StyleResolver;
class StyleRuleKeyframes; class StyleRuleKeyframes;
// This class stores the CSS Animations/Transitions information we use during a style recalc. // This class stores the CSS Animations/Transitions information we use during a style recalc.
// This includes updates to animations/transitions as well as the CompositableValueMaps to be applied. // This includes updates to animations/transitions as well as the Interpolations to be applied.
class CSSAnimationUpdate FINAL { class CSSAnimationUpdate FINAL {
public: public:
void startAnimation(AtomicString& animationName, const HashSet<RefPtr<InertAnimation> >& animations) void startAnimation(AtomicString& animationName, const HashSet<RefPtr<InertAnimation> >& animations)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment