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

Unified Diff: Source/core/animation/AnimatableSVGPaint.h

Issue 25456002: Web Animations CSS: Support animation of fill and stroke (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address review feedback Created 7 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: Source/core/animation/AnimatableSVGPaint.h
diff --git a/Source/core/animation/AnimatableImage.h b/Source/core/animation/AnimatableSVGPaint.h
similarity index 58%
copy from Source/core/animation/AnimatableImage.h
copy to Source/core/animation/AnimatableSVGPaint.h
index 1e3d311c71290283f387cc4ea1530be1d5732017..14f6aa2e934ebcf4022b717f93a9e582e13cda0d 100644
--- a/Source/core/animation/AnimatableImage.h
+++ b/Source/core/animation/AnimatableSVGPaint.h
@@ -28,46 +28,54 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef AnimatableImage_h
-#define AnimatableImage_h
+#ifndef AnimatableSVGPaint_h
+#define AnimatableSVGPaint_h
+#include "core/animation/AnimatableColor.h"
#include "core/animation/AnimatableValue.h"
-#include "core/css/CSSCrossfadeValue.h"
-#include "core/rendering/style/StyleImage.h"
+#include "core/svg/SVGPaint.h"
namespace WebCore {
-class AnimatableImage : public AnimatableValue {
+class AnimatableSVGPaint : public AnimatableValue {
public:
- virtual ~AnimatableImage() { }
- static PassRefPtr<AnimatableImage> create(StyleImage* image)
+ virtual ~AnimatableSVGPaint() { }
+ static PassRefPtr<AnimatableSVGPaint> create(SVGPaint::SVGPaintType type, const Color& color, const String& uri)
{
- return adoptRef(new AnimatableImage(image));
+ return create(type, AnimatableColorImpl(color), uri);
}
- PassRefPtr<CSSValue> toCSSValue() const { return m_image->cssValue(); }
- StyleImage* toStyleImage() const { return m_image.get(); }
+ static PassRefPtr<AnimatableSVGPaint> create(SVGPaint::SVGPaintType type, const AnimatableColorImpl& color, const String& uri)
+ {
+ return adoptRef(new AnimatableSVGPaint(type, color, uri));
+ }
+ SVGPaint::SVGPaintType paintType() const { return m_type; };
+ Color color() const { return m_color.toColor(); };
+ const String& uri() const { return m_uri; };
protected:
virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE;
virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OVERRIDE;
private:
- AnimatableImage(StyleImage* image)
- : m_image(image)
+ AnimatableSVGPaint(SVGPaint::SVGPaintType type, const AnimatableColorImpl& color, const String& uri)
+ : m_type(type)
+ , m_color(color)
+ , m_uri(uri)
{
- ASSERT(m_image);
}
- virtual AnimatableType type() const OVERRIDE { return TypeImage; }
+ virtual AnimatableType type() const OVERRIDE { return TypeSVGPaint; }
- const RefPtr<StyleImage> m_image;
+ SVGPaint::SVGPaintType m_type;
+ AnimatableColorImpl m_color;
+ String m_uri;
};
-inline const AnimatableImage* toAnimatableImage(const AnimatableValue* value)
+inline const AnimatableSVGPaint* toAnimatableSVGPaint(const AnimatableValue* value)
{
- ASSERT_WITH_SECURITY_IMPLICATION(value && value->isImage());
- return static_cast<const AnimatableImage*>(value);
+ ASSERT_WITH_SECURITY_IMPLICATION(value && value->isSVGPaint());
+ return static_cast<const AnimatableSVGPaint*>(value);
}
} // namespace WebCore
-#endif // AnimatableImage_h
+#endif // AnimatableSVGPaint_h

Powered by Google App Engine
This is Rietveld 408576698