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

Side by Side Diff: Source/core/animation/AnimatableRepeatable.h

Issue 26247003: Web Animations CSS: Support animation of background-position and background-image (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 AnimatableSVGLength_h 31 #ifndef AnimatableRepeatable_h
32 #define AnimatableSVGLength_h 32 #define AnimatableRepeatable_h
33 33
34 #include "core/animation/AnimatableValue.h" 34 #include "core/animation/AnimatableValue.h"
35 #include "core/svg/SVGLength.h" 35 #include "wtf/Vector.h"
36 36
37 namespace WebCore { 37 namespace WebCore {
38 38
39 class AnimatableSVGLength: public AnimatableValue { 39 class AnimatableRepeatable : public AnimatableValue {
Steve Block 2013/10/08 23:21:49 'Repeatable' seems like the wrong name - it should
alancutter (OOO until 2018) 2013/10/09 07:20:55 Repeatable refers to the way this value interpolat
40 public: 40 public:
41 virtual ~AnimatableSVGLength() { } 41 virtual ~AnimatableRepeatable() { }
42 42
43 static PassRefPtr<AnimatableSVGLength> create(const SVGLength& length) 43 // This will consume the vector passed into it.
44 static PassRefPtr<AnimatableRepeatable> create(Vector<RefPtr<AnimatableValue > >& values)
44 { 45 {
45 return adoptRef(new AnimatableSVGLength(length)); 46 return adoptRef(new AnimatableRepeatable(values));
46 } 47 }
47 48
48 const SVGLength& toSVGLength() const 49 const Vector<RefPtr<AnimatableValue> >& values() const { return m_values; }
50
51 private:
52 AnimatableRepeatable(Vector<RefPtr<AnimatableValue> >& values)
49 { 53 {
50 return m_length; 54 ASSERT(!values.isEmpty());
dstockwell 2013/10/08 22:57:31 why?
alancutter (OOO until 2018) 2013/10/09 07:20:55 Removed non-zero length constraint.
55 m_values.swap(values);
51 } 56 }
52 57
53 protected:
54 virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, do uble fraction) const OVERRIDE; 58 virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, do uble fraction) const OVERRIDE;
55 virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OV ERRIDE; 59 virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OV ERRIDE;
56 60
57 private: 61 virtual AnimatableType type() const OVERRIDE { return TypeRepeatable; }
58 AnimatableSVGLength(const SVGLength& length)
59 : m_length(length)
60 {
61 }
62
63 virtual AnimatableType type() const { return TypeSVGLength; }
64 virtual bool equalTo(const AnimatableValue*) const OVERRIDE; 62 virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
65 63
66 SVGLength m_length; 64 Vector<RefPtr<AnimatableValue> > m_values;
67 }; 65 };
68 66
69 inline const AnimatableSVGLength* toAnimatableSVGLength(const AnimatableValue* v alue) 67 inline const AnimatableRepeatable* toAnimatableRepeatable(const AnimatableValue* value)
70 { 68 {
71 ASSERT_WITH_SECURITY_IMPLICATION(value && value->isSVGLength()); 69 ASSERT_WITH_SECURITY_IMPLICATION(value && value->isRepeatable());
72 return static_cast<const AnimatableSVGLength*>(value); 70 return static_cast<const AnimatableRepeatable*>(value);
73 } 71 }
74 72
75 } // namespace WebCore 73 } // namespace WebCore
76 74
77 #endif // AnimatableSVGLength_h 75 #endif // AnimatableRepeatable_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698