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

Unified Diff: Source/core/page/animation/CSSPropertyAnimation.cpp

Issue 23581008: Revert r154797: "Move isValid/isCurrentColor from Color to StyleColor" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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/page/animation/CSSPropertyAnimation.cpp
diff --git a/Source/core/page/animation/CSSPropertyAnimation.cpp b/Source/core/page/animation/CSSPropertyAnimation.cpp
index 4b8e0c619b861aaa0fc499d42be2e484e2ec0c0d..8fabfc00a7f0604fdd6cbb71d2ad3b707aca8891 100644
--- a/Source/core/page/animation/CSSPropertyAnimation.cpp
+++ b/Source/core/page/animation/CSSPropertyAnimation.cpp
@@ -69,11 +69,9 @@ static inline float blendFunc(const AnimationBase*, float from, float to, double
return narrowPrecisionToFloat(from + (to - from) * progress);
}
-static inline Color blendFunc(const AnimationBase* animation, const StyleColor& from, const StyleColor& to, double progress)
+static inline Color blendFunc(const AnimationBase*, const Color& from, const Color& to, double progress)
{
- Color fromColor = animation->renderer()->resolveColor(from);
- Color toColor = animation->renderer()->resolveColor(to);
- return blend(fromColor, toColor, progress);
+ return blend(from, to, progress);
}
static inline Length blendFunc(const AnimationBase*, const Length& from, const Length& to, double progress)
@@ -110,14 +108,11 @@ static inline PassOwnPtr<ShadowData> blendFunc(const AnimationBase* anim, const
if (from->style() != to->style())
return to->clone();
- Color fromColor = anim->renderer()->resolveColor(from->color());
- Color toColor = anim->renderer()->resolveColor(to->color());
-
return ShadowData::create(blend(from->location(), to->location(), progress),
blend(from->blur(), to->blur(), progress),
blend(from->spread(), to->spread(), progress),
blendFunc(anim, from->style(), to->style(), progress),
- blend(fromColor, toColor, progress));
+ blend(from->color(), to->color(), progress));
}
static inline TransformOperations blendFunc(const AnimationBase* anim, const TransformOperations& from, const TransformOperations& to, double progress)
@@ -452,21 +447,21 @@ public:
}
};
-class PropertyWrapperColor : public PropertyWrapperGetter<StyleColor> {
+class PropertyWrapperColor : public PropertyWrapperGetter<Color> {
public:
- PropertyWrapperColor(CSSPropertyID prop, StyleColor (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const StyleColor&))
- : PropertyWrapperGetter<StyleColor>(prop, getter)
+ PropertyWrapperColor(CSSPropertyID prop, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
+ : PropertyWrapperGetter<Color>(prop, getter)
, m_setter(setter)
{
}
virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
{
- (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<StyleColor>::m_getter)(), (b->*PropertyWrapperGetter<StyleColor>::m_getter)(), progress));
+ (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<Color>::m_getter)(), (b->*PropertyWrapperGetter<Color>::m_getter)(), progress));
}
protected:
- void (RenderStyle::*m_setter)(const StyleColor&);
+ void (RenderStyle::*m_setter)(const Color&);
};
class PropertyWrapperAcceleratedOpacity : public PropertyWrapper<float> {
@@ -656,7 +651,7 @@ private:
class PropertyWrapperMaybeInvalidColor : public AnimationPropertyWrapperBase {
public:
- PropertyWrapperMaybeInvalidColor(CSSPropertyID prop, StyleColor (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const StyleColor&))
+ PropertyWrapperMaybeInvalidColor(CSSPropertyID prop, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
: AnimationPropertyWrapperBase(prop)
, m_getter(getter)
, m_setter(setter)
@@ -665,8 +660,8 @@ public:
virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
{
- StyleColor fromColor = (a->*m_getter)();
- StyleColor toColor = (b->*m_getter)();
+ Color fromColor = (a->*m_getter)();
+ Color toColor = (b->*m_getter)();
if (!fromColor.isValid() && !toColor.isValid())
return true;
@@ -681,8 +676,8 @@ public:
virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
{
- StyleColor fromColor = (a->*m_getter)();
- StyleColor toColor = (b->*m_getter)();
+ Color fromColor = (a->*m_getter)();
+ Color toColor = (b->*m_getter)();
if (!fromColor.isValid() && !toColor.isValid())
return;
@@ -695,23 +690,23 @@ public:
}
private:
- StyleColor (RenderStyle::*m_getter)() const;
- void (RenderStyle::*m_setter)(const StyleColor&);
+ Color (RenderStyle::*m_getter)() const;
+ void (RenderStyle::*m_setter)(const Color&);
};
enum MaybeInvalidColorTag { MaybeInvalidColor };
class PropertyWrapperVisitedAffectedColor : public AnimationPropertyWrapperBase {
public:
- PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, StyleColor (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const StyleColor&),
- StyleColor (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const StyleColor&))
+ PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&),
+ Color (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
: AnimationPropertyWrapperBase(prop)
, m_wrapper(adoptPtr(new PropertyWrapperColor(prop, getter, setter)))
, m_visitedWrapper(adoptPtr(new PropertyWrapperColor(prop, visitedGetter, visitedSetter)))
{
}
- PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, MaybeInvalidColorTag, StyleColor (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const StyleColor&),
- StyleColor (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const StyleColor&))
+ PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, MaybeInvalidColorTag, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&),
+ Color (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
: AnimationPropertyWrapperBase(prop)
, m_wrapper(adoptPtr(new PropertyWrapperMaybeInvalidColor(prop, getter, setter)))
, m_visitedWrapper(adoptPtr(new PropertyWrapperMaybeInvalidColor(prop, visitedGetter, visitedSetter)))
@@ -963,7 +958,7 @@ public:
class PropertyWrapperSVGPaint : public AnimationPropertyWrapperBase {
public:
- PropertyWrapperSVGPaint(CSSPropertyID prop, const SVGPaint::SVGPaintType& (RenderStyle::*paintTypeGetter)() const, StyleColor (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const StyleColor&))
+ PropertyWrapperSVGPaint(CSSPropertyID prop, const SVGPaint::SVGPaintType& (RenderStyle::*paintTypeGetter)() const, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
: AnimationPropertyWrapperBase(prop)
, m_paintTypeGetter(paintTypeGetter)
, m_getter(getter)
@@ -976,20 +971,20 @@ public:
if ((a->*m_paintTypeGetter)() != (b->*m_paintTypeGetter)())
return false;
- // We only support animations between SVGPaints that are pure StyleColor values.
+ // We only support animations between SVGPaints that are pure Color values.
// For everything else we must return true for this method, otherwise
// we will try to animate between values forever.
if ((a->*m_paintTypeGetter)() == SVGPaint::SVG_PAINTTYPE_RGBCOLOR) {
- StyleColor fromColor = (a->*m_getter)();
- StyleColor toColor = (b->*m_getter)();
+ Color fromColor = (a->*m_getter)();
+ Color toColor = (b->*m_getter)();
if (!fromColor.isValid() && !toColor.isValid())
return true;
if (!fromColor.isValid())
- fromColor = StyleColor();
+ fromColor = Color();
if (!toColor.isValid())
- toColor = StyleColor();
+ toColor = Color();
return fromColor == toColor;
}
@@ -1002,23 +997,23 @@ public:
|| (b->*m_paintTypeGetter)() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR)
return;
- StyleColor fromColor = (a->*m_getter)();
- StyleColor toColor = (b->*m_getter)();
+ Color fromColor = (a->*m_getter)();
+ Color toColor = (b->*m_getter)();
if (!fromColor.isValid() && !toColor.isValid())
return;
if (!fromColor.isValid())
- fromColor = StyleColor();
+ fromColor = Color();
if (!toColor.isValid())
- toColor = StyleColor();
+ toColor = Color();
(dst->*m_setter)(blendFunc(anim, fromColor, toColor, progress));
}
private:
const SVGPaint::SVGPaintType& (RenderStyle::*m_paintTypeGetter)() const;
- StyleColor (RenderStyle::*m_getter)() const;
- void (RenderStyle::*m_setter)(const StyleColor&);
+ Color (RenderStyle::*m_getter)() const;
+ void (RenderStyle::*m_setter)(const Color&);
};
static void addShorthandProperties()

Powered by Google App Engine
This is Rietveld 408576698