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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef AnimatableImage_h 31 #ifndef AnimatableSVGPaint_h
32 #define AnimatableImage_h 32 #define AnimatableSVGPaint_h
33 33
34 #include "core/animation/AnimatableColor.h"
34 #include "core/animation/AnimatableValue.h" 35 #include "core/animation/AnimatableValue.h"
35 #include "core/css/CSSCrossfadeValue.h" 36 #include "core/svg/SVGPaint.h"
36 #include "core/rendering/style/StyleImage.h"
37 37
38 namespace WebCore { 38 namespace WebCore {
39 39
40 class AnimatableImage : public AnimatableValue { 40 class AnimatableSVGPaint : public AnimatableValue {
41 public: 41 public:
42 virtual ~AnimatableImage() { } 42 virtual ~AnimatableSVGPaint() { }
43 static PassRefPtr<AnimatableImage> create(StyleImage* image) 43 static PassRefPtr<AnimatableSVGPaint> create(SVGPaint::SVGPaintType type, co nst Color& color, const String& uri)
44 { 44 {
45 return adoptRef(new AnimatableImage(image)); 45 return create(type, AnimatableColorImpl(color), uri);
46 } 46 }
47 PassRefPtr<CSSValue> toCSSValue() const { return m_image->cssValue(); } 47 static PassRefPtr<AnimatableSVGPaint> create(SVGPaint::SVGPaintType type, co nst AnimatableColorImpl& color, const String& uri)
48 StyleImage* toStyleImage() const { return m_image.get(); } 48 {
49 return adoptRef(new AnimatableSVGPaint(type, color, uri));
50 }
51 SVGPaint::SVGPaintType paintType() const { return m_type; };
52 Color color() const { return m_color.toColor(); };
53 const String& uri() const { return m_uri; };
49 54
50 protected: 55 protected:
51 virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, do uble fraction) const OVERRIDE; 56 virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, do uble fraction) const OVERRIDE;
52 virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OV ERRIDE; 57 virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OV ERRIDE;
53 58
54 private: 59 private:
55 AnimatableImage(StyleImage* image) 60 AnimatableSVGPaint(SVGPaint::SVGPaintType type, const AnimatableColorImpl& c olor, const String& uri)
56 : m_image(image) 61 : m_type(type)
62 , m_color(color)
63 , m_uri(uri)
57 { 64 {
58 ASSERT(m_image);
59 } 65 }
60 virtual AnimatableType type() const OVERRIDE { return TypeImage; } 66 virtual AnimatableType type() const OVERRIDE { return TypeSVGPaint; }
61 67
62 const RefPtr<StyleImage> m_image; 68 SVGPaint::SVGPaintType m_type;
69 AnimatableColorImpl m_color;
70 String m_uri;
63 }; 71 };
64 72
65 inline const AnimatableImage* toAnimatableImage(const AnimatableValue* value) 73 inline const AnimatableSVGPaint* toAnimatableSVGPaint(const AnimatableValue* val ue)
66 { 74 {
67 ASSERT_WITH_SECURITY_IMPLICATION(value && value->isImage()); 75 ASSERT_WITH_SECURITY_IMPLICATION(value && value->isSVGPaint());
68 return static_cast<const AnimatableImage*>(value); 76 return static_cast<const AnimatableSVGPaint*>(value);
69 } 77 }
70 78
71 } // namespace WebCore 79 } // namespace WebCore
72 80
73 #endif // AnimatableImage_h 81 #endif // AnimatableSVGPaint_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698