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

Side by Side Diff: Source/core/svg/SVGBoolean.h

Issue 131253002: [SVG] SVGAnimatedBoolean migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 SVGLengthList_h 31 #ifndef SVGBoolean_h
32 #define SVGLengthList_h 32 #define SVGBoolean_h
33 33
34 #include "bindings/v8/ScriptWrappable.h" 34 #include "core/svg/properties/NewSVGProperty.h"
35 #include "core/svg/SVGLength.h"
36 #include "core/svg/properties/NewSVGListPropertyHelper.h"
37 35
38 namespace WebCore { 36 namespace WebCore {
39 37
40 class SVGLengthListTearOff; 38 class SVGBoolean : public NewSVGPropertyBase {
39 public:
40 // SVGBoolean do not have a tear-off type.
haraken 2014/01/09 11:09:23 do not => does not
kouhei (in TOK) 2014/01/10 08:16:10 Done.
41 // The below typedef is used by NewSVGAnimatedProperty.
42 typedef void TearOffType;
43 typedef bool PrimitiveType;
41 44
42 class SVGLengthList : public NewSVGListPropertyHelper<SVGLengthList, SVGLength> { 45 static PassRefPtr<SVGBoolean> create(bool value = false)
43 public:
44 typedef SVGLengthListTearOff TearOffType;
45
46 static PassRefPtr<SVGLengthList> create(SVGLengthMode mode = LengthModeOther )
47 { 46 {
48 return adoptRef(new SVGLengthList(mode)); 47 return adoptRef(new SVGBoolean(value));
49 } 48 }
50 49
51 ~SVGLengthList(); 50 PassRefPtr<SVGBoolean> clone() const { return create(m_value); }
51 virtual PassRefPtr<NewSVGPropertyBase> cloneForAnimation(const String&) cons t OVERRIDE;
52 52
53 PassRefPtr<SVGLengthList> clone(); 53 virtual String valueAsString() const OVERRIDE;
54
55 void setValueAsString(const String&, ExceptionState&); 54 void setValueAsString(const String&, ExceptionState&);
56 55
57 // NewSVGPropertyBase:
58 virtual PassRefPtr<NewSVGPropertyBase> cloneForAnimation(const String&) cons t OVERRIDE;
59 virtual String valueAsString() const OVERRIDE;
60
61 virtual void add(PassRefPtr<NewSVGPropertyBase>, SVGElement*) OVERRIDE; 56 virtual void add(PassRefPtr<NewSVGPropertyBase>, SVGElement*) OVERRIDE;
62 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> fromValue, PassRefPtr<NewSV GPropertyBase> toValue, PassRefPtr<NewSVGPropertyBase> toAtEndOfDurationValue, S VGElement*) OVERRIDE; 57 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> from, PassRefPtr<NewSVGProp ertyBase> to, PassRefPtr<NewSVGPropertyBase> toAtEndOfDurationValue, SVGElement* ) OVERRIDE;
63 virtual float calculateDistance(PassRefPtr<NewSVGPropertyBase> to, SVGElemen t*) OVERRIDE; 58 virtual float calculateDistance(PassRefPtr<NewSVGPropertyBase> to, SVGElemen t*) OVERRIDE;
64 59
65 static AnimatedPropertyType classType() { return AnimatedLengthList; } 60 bool operator==(const SVGBoolean& other) const { return m_value == other.m_v alue; }
61 bool operator!=(const SVGBoolean& other) const { return !operator==(other); }
62
63 bool value() const { return m_value; }
64 void setValue(bool value) { m_value = value; }
65
66 static AnimatedPropertyType classType() { return AnimatedBoolean; }
66 67
67 private: 68 private:
68 explicit SVGLengthList(SVGLengthMode); 69 SVGBoolean(bool value)
70 : NewSVGPropertyBase(classType())
71 , m_value(value)
72 {
73 }
69 74
70 bool adjustFromToListValues(PassRefPtr<SVGLengthList> fromList, PassRefPtr<S VGLengthList> toList, float percentage, bool isToAnimation, bool resizeAnimatedL istIfNeeded); 75 bool m_value;
76 };
71 77
72 template <typename CharType> 78 inline PassRefPtr<SVGBoolean> toSVGBoolean(PassRefPtr<NewSVGPropertyBase> passBa se)
haraken 2014/01/09 11:09:23 It looks a bit strange that toXXX takes a PassRefP
kouhei (in TOK) 2014/01/10 08:16:10 Discussed offline. Keeping this.
73 void parseInternal(const CharType*& ptr, const CharType* end, ExceptionState &); 79 {
74 80 RefPtr<NewSVGPropertyBase> base = passBase;
75 SVGLengthMode m_mode; 81 ASSERT(base->type() == SVGBoolean::classType());
76 }; 82 return static_pointer_cast<SVGBoolean>(base.release());
83 }
77 84
78 } // namespace WebCore 85 } // namespace WebCore
79 86
80 #endif // SVGLengthList_h 87 #endif // SVGBoolean_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698