OLD | NEW |
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 28 matching lines...) Expand all Loading... |
39 | 39 |
40 class AnimatableSVGPaint final : public AnimatableValue { | 40 class AnimatableSVGPaint final : public AnimatableValue { |
41 public: | 41 public: |
42 ~AnimatableSVGPaint() override {} | 42 ~AnimatableSVGPaint() override {} |
43 static PassRefPtr<AnimatableSVGPaint> create(SVGPaintType type, | 43 static PassRefPtr<AnimatableSVGPaint> create(SVGPaintType type, |
44 SVGPaintType visitedLinkType, | 44 SVGPaintType visitedLinkType, |
45 const Color& color, | 45 const Color& color, |
46 const Color& visitedLinkColor, | 46 const Color& visitedLinkColor, |
47 const String& uri, | 47 const String& uri, |
48 const String& visitedLinkURI) { | 48 const String& visitedLinkURI) { |
49 return create(type, visitedLinkType, | 49 return adoptRef(new AnimatableSVGPaint( |
50 AnimatableColor::create(color, visitedLinkColor), uri, | 50 type, visitedLinkType, AnimatableColor::create(color, visitedLinkColor), |
51 visitedLinkURI); | 51 uri, visitedLinkURI)); |
52 } | 52 } |
53 static PassRefPtr<AnimatableSVGPaint> create( | |
54 SVGPaintType type, | |
55 SVGPaintType visitedLinkType, | |
56 PassRefPtr<AnimatableColor> color, | |
57 const String& uri, | |
58 const String& visitedLinkURI) { | |
59 return adoptRef(new AnimatableSVGPaint( | |
60 type, visitedLinkType, std::move(color), uri, visitedLinkURI)); | |
61 } | |
62 SVGPaintType paintType() const { return m_type; } | |
63 SVGPaintType visitedLinkPaintType() const { return m_visitedLinkType; } | |
64 Color getColor() const { return m_color->getColor(); } | |
65 Color visitedLinkColor() const { return m_color->visitedLinkColor(); } | |
66 const String& uri() const { return m_uri; } | |
67 const String& visitedLinkURI() const { return m_visitedLinkURI; } | |
68 | |
69 protected: | |
70 PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, | |
71 double fraction) const override; | |
72 bool usesDefaultInterpolationWith(const AnimatableValue*) const override; | |
73 | 53 |
74 private: | 54 private: |
75 AnimatableSVGPaint(SVGPaintType type, | 55 AnimatableSVGPaint(SVGPaintType type, |
76 SVGPaintType visitedLinkType, | 56 SVGPaintType visitedLinkType, |
77 PassRefPtr<AnimatableColor> color, | 57 PassRefPtr<AnimatableColor> color, |
78 const String& uri, | 58 const String& uri, |
79 const String& visitedLinkURI) | 59 const String& visitedLinkURI) |
80 : m_type(type), | 60 : m_type(type), |
81 m_visitedLinkType(visitedLinkType), | 61 m_visitedLinkType(visitedLinkType), |
82 m_color(color), | 62 m_color(color), |
83 m_uri(uri), | 63 m_uri(uri), |
84 m_visitedLinkURI(visitedLinkURI) {} | 64 m_visitedLinkURI(visitedLinkURI) {} |
85 AnimatableType type() const override { return TypeSVGPaint; } | 65 AnimatableType type() const override { return TypeSVGPaint; } |
86 bool equalTo(const AnimatableValue*) const override; | 66 bool equalTo(const AnimatableValue*) const override; |
87 | 67 |
88 SVGPaintType m_type; | 68 SVGPaintType m_type; |
89 SVGPaintType m_visitedLinkType; | 69 SVGPaintType m_visitedLinkType; |
90 // AnimatableColor includes a visited link color. | 70 // AnimatableColor includes a visited link color. |
91 RefPtr<AnimatableColor> m_color; | 71 RefPtr<AnimatableColor> m_color; |
92 String m_uri; | 72 String m_uri; |
93 String m_visitedLinkURI; | 73 String m_visitedLinkURI; |
94 }; | 74 }; |
95 | 75 |
96 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableSVGPaint, isSVGPaint()); | 76 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableSVGPaint, isSVGPaint()); |
97 | 77 |
98 } // namespace blink | 78 } // namespace blink |
99 | 79 |
100 #endif // AnimatableSVGPaint_h | 80 #endif // AnimatableSVGPaint_h |
OLD | NEW |