diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/animation/AnimatableColor.h')
-rw-r--r-- | chromium/third_party/WebKit/Source/core/animation/AnimatableColor.h | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/chromium/third_party/WebKit/Source/core/animation/AnimatableColor.h b/chromium/third_party/WebKit/Source/core/animation/AnimatableColor.h index 63db66783ff..57c8fd3cfeb 100644 --- a/chromium/third_party/WebKit/Source/core/animation/AnimatableColor.h +++ b/chromium/third_party/WebKit/Source/core/animation/AnimatableColor.h @@ -32,7 +32,7 @@ #define AnimatableColor_h #include "core/animation/AnimatableValue.h" -#include "core/platform/graphics/Color.h" +#include "platform/graphics/Color.h" namespace WebCore { @@ -43,6 +43,7 @@ public: Color toColor() const; AnimatableColorImpl interpolateTo(const AnimatableColorImpl&, double fraction) const; AnimatableColorImpl addWith(const AnimatableColorImpl&) const; + bool operator==(const AnimatableColorImpl&) const; private: float m_alpha; @@ -51,30 +52,33 @@ private: float m_blue; }; +// This class handles both the regular and 'visted link' colors for a given +// property. Currently it is used for all properties, even those which do not +// support a separate 'visited link' color (eg SVG properties). This is correct +// but inefficient. class AnimatableColor : public AnimatableValue { public: static PassRefPtr<AnimatableColor> create(const AnimatableColorImpl&, const AnimatableColorImpl& visitedLinkColor); - virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE; - virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OVERRIDE; Color color() const { return m_color.toColor(); } Color visitedLinkColor() const { return m_visitedLinkColor.toColor(); } +protected: + virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE; + virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OVERRIDE; + private: AnimatableColor(const AnimatableColorImpl& color, const AnimatableColorImpl& visitedLinkColor) - : AnimatableValue(TypeColor) - , m_color(color) + : m_color(color) , m_visitedLinkColor(visitedLinkColor) { } + virtual AnimatableType type() const OVERRIDE { return TypeColor; } + virtual bool equalTo(const AnimatableValue*) const OVERRIDE; const AnimatableColorImpl m_color; const AnimatableColorImpl m_visitedLinkColor; }; -inline const AnimatableColor* toAnimatableColor(const AnimatableValue* value) -{ - ASSERT_WITH_SECURITY_IMPLICATION(value && value->isColor()); - return static_cast<const AnimatableColor*>(value); -} +DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableColor, isColor()); } // namespace WebCore |