OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 */ | 20 */ |
21 | 21 |
22 #ifndef SVGAngle_h | 22 #ifndef SVGAngle_h |
23 #define SVGAngle_h | 23 #define SVGAngle_h |
24 | 24 |
25 #include "core/svg/SVGEnumeration.h" | 25 #include "core/svg/SVGEnumeration.h" |
26 #include "core/svg/properties/SVGPropertyHelper.h" | 26 #include "core/svg/properties/SVGPropertyHelper.h" |
| 27 #include "platform/heap/Handle.h" |
27 | 28 |
28 namespace blink { | 29 namespace blink { |
29 | 30 |
30 class SVGAngle; | 31 class SVGAngle; |
31 class SVGAngleTearOff; | 32 class SVGAngleTearOff; |
32 | 33 |
33 enum SVGMarkerOrientType { | 34 enum SVGMarkerOrientType { |
34 SVGMarkerOrientUnknown = 0, | 35 SVGMarkerOrientUnknown = 0, |
35 SVGMarkerOrientAuto, | 36 SVGMarkerOrientAuto, |
36 SVGMarkerOrientAngle, | 37 SVGMarkerOrientAngle, |
37 SVGMarkerOrientAutoStartReverse | 38 SVGMarkerOrientAutoStartReverse |
38 }; | 39 }; |
39 template<> const SVGEnumerationStringEntries& getStaticStringEntries<SVGMarkerOr
ientType>(); | 40 template<> const SVGEnumerationStringEntries& getStaticStringEntries<SVGMarkerOr
ientType>(); |
40 template<> unsigned short getMaxExposedEnumValue<SVGMarkerOrientType>(); | 41 template<> unsigned short getMaxExposedEnumValue<SVGMarkerOrientType>(); |
41 | 42 |
42 class SVGMarkerOrientEnumeration : public SVGEnumeration<SVGMarkerOrientType> { | 43 class SVGMarkerOrientEnumeration : public SVGEnumeration<SVGMarkerOrientType> { |
43 public: | 44 public: |
44 static PassRefPtr<SVGMarkerOrientEnumeration> create(SVGAngle* angle) | 45 static PassRefPtrWillBeRawPtr<SVGMarkerOrientEnumeration> create(SVGAngle* a
ngle) |
45 { | 46 { |
46 return adoptRef(new SVGMarkerOrientEnumeration(angle)); | 47 return adoptRefWillBeNoop(new SVGMarkerOrientEnumeration(angle)); |
47 } | 48 } |
48 | 49 |
49 virtual ~SVGMarkerOrientEnumeration(); | 50 virtual ~SVGMarkerOrientEnumeration(); |
50 | 51 |
51 virtual void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) overr
ide; | 52 virtual void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) overr
ide; |
52 virtual void calculateAnimatedValue(SVGAnimationElement*, float, unsigned, P
assRefPtr<SVGPropertyBase>, PassRefPtr<SVGPropertyBase>, PassRefPtr<SVGPropertyB
ase>, SVGElement*) override; | 53 virtual void calculateAnimatedValue(SVGAnimationElement*, float, unsigned, P
assRefPtrWillBeRawPtr<SVGPropertyBase>, PassRefPtrWillBeRawPtr<SVGPropertyBase>,
PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) override; |
53 virtual float calculateDistance(PassRefPtr<SVGPropertyBase>, SVGElement*) ov
erride; | 54 virtual float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVG
Element*) override; |
| 55 |
| 56 virtual void trace(Visitor*) override; |
54 | 57 |
55 private: | 58 private: |
56 SVGMarkerOrientEnumeration(SVGAngle*); | 59 SVGMarkerOrientEnumeration(SVGAngle*); |
57 | 60 |
58 virtual void notifyChange() override; | 61 virtual void notifyChange() override; |
59 | 62 |
60 // FIXME: oilpan: This is kept as raw-ptr to avoid reference cycles. Should
be Member in oilpan. | 63 RawPtrWillBeMember<SVGAngle> m_angle; |
61 SVGAngle* m_angle; | |
62 }; | 64 }; |
63 | 65 |
64 class SVGAngle : public SVGPropertyHelper<SVGAngle> { | 66 class SVGAngle : public SVGPropertyHelper<SVGAngle> { |
65 public: | 67 public: |
66 typedef SVGAngleTearOff TearOffType; | 68 typedef SVGAngleTearOff TearOffType; |
67 | 69 |
68 enum SVGAngleType { | 70 enum SVGAngleType { |
69 SVG_ANGLETYPE_UNKNOWN = 0, | 71 SVG_ANGLETYPE_UNKNOWN = 0, |
70 SVG_ANGLETYPE_UNSPECIFIED = 1, | 72 SVG_ANGLETYPE_UNSPECIFIED = 1, |
71 SVG_ANGLETYPE_DEG = 2, | 73 SVG_ANGLETYPE_DEG = 2, |
72 SVG_ANGLETYPE_RAD = 3, | 74 SVG_ANGLETYPE_RAD = 3, |
73 SVG_ANGLETYPE_GRAD = 4, | 75 SVG_ANGLETYPE_GRAD = 4, |
74 SVG_ANGLETYPE_TURN = 5 | 76 SVG_ANGLETYPE_TURN = 5 |
75 }; | 77 }; |
76 | 78 |
77 static PassRefPtr<SVGAngle> create() | 79 static PassRefPtrWillBeRawPtr<SVGAngle> create() |
78 { | 80 { |
79 return adoptRef(new SVGAngle()); | 81 return adoptRefWillBeNoop(new SVGAngle()); |
80 } | 82 } |
81 | 83 |
82 virtual ~SVGAngle(); | 84 virtual ~SVGAngle(); |
83 | 85 |
84 SVGAngleType unitType() const { return m_unitType; } | 86 SVGAngleType unitType() const { return m_unitType; } |
85 | 87 |
86 void setValue(float); | 88 void setValue(float); |
87 float value() const; | 89 float value() const; |
88 | 90 |
89 void setValueInSpecifiedUnits(float valueInSpecifiedUnits) { m_valueInSpecif
iedUnits = valueInSpecifiedUnits; } | 91 void setValueInSpecifiedUnits(float valueInSpecifiedUnits) { m_valueInSpecif
iedUnits = valueInSpecifiedUnits; } |
90 float valueInSpecifiedUnits() const { return m_valueInSpecifiedUnits; } | 92 float valueInSpecifiedUnits() const { return m_valueInSpecifiedUnits; } |
91 | 93 |
92 void newValueSpecifiedUnits(SVGAngleType unitType, float valueInSpecifiedUni
ts); | 94 void newValueSpecifiedUnits(SVGAngleType unitType, float valueInSpecifiedUni
ts); |
93 void convertToSpecifiedUnits(SVGAngleType unitType, ExceptionState&); | 95 void convertToSpecifiedUnits(SVGAngleType unitType, ExceptionState&); |
94 | 96 |
95 SVGEnumeration<SVGMarkerOrientType>* orientType() { return m_orientType.get(
); } | 97 SVGEnumeration<SVGMarkerOrientType>* orientType() { return m_orientType.get(
); } |
96 const SVGEnumeration<SVGMarkerOrientType>* orientType() const { return m_ori
entType.get(); } | 98 const SVGEnumeration<SVGMarkerOrientType>* orientType() const { return m_ori
entType.get(); } |
97 void orientTypeChanged(); | 99 void orientTypeChanged(); |
98 | 100 |
99 // SVGPropertyBase: | 101 // SVGPropertyBase: |
100 | 102 |
101 PassRefPtr<SVGAngle> clone() const; | 103 PassRefPtrWillBeRawPtr<SVGAngle> clone() const; |
102 | 104 |
103 virtual String valueAsString() const override; | 105 virtual String valueAsString() const override; |
104 void setValueAsString(const String&, ExceptionState&); | 106 void setValueAsString(const String&, ExceptionState&); |
105 | 107 |
106 virtual void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) overr
ide; | 108 virtual void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) overr
ide; |
107 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage,
unsigned repeatCount, PassRefPtr<SVGPropertyBase> from, PassRefPtr<SVGPropertyBa
se> to, PassRefPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement* contextE
lement) override; | 109 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage,
unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> from, PassRefPtrWi
llBeRawPtr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEndO
fDurationValue, SVGElement* contextElement) override; |
108 virtual float calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElement*
contextElement) override; | 110 virtual float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to,
SVGElement* contextElement) override; |
109 | 111 |
110 static AnimatedPropertyType classType() { return AnimatedAngle; } | 112 static AnimatedPropertyType classType() { return AnimatedAngle; } |
111 | 113 |
| 114 virtual void trace(Visitor*) override; |
| 115 |
112 private: | 116 private: |
113 SVGAngle(); | 117 SVGAngle(); |
114 SVGAngle(SVGAngleType, float, SVGMarkerOrientType); | 118 SVGAngle(SVGAngleType, float, SVGMarkerOrientType); |
115 | 119 |
116 void assign(const SVGAngle&); | 120 void assign(const SVGAngle&); |
117 | 121 |
118 SVGAngleType m_unitType; | 122 SVGAngleType m_unitType; |
119 float m_valueInSpecifiedUnits; | 123 float m_valueInSpecifiedUnits; |
120 RefPtr<SVGMarkerOrientEnumeration> m_orientType; | 124 RefPtrWillBeMember<SVGMarkerOrientEnumeration> m_orientType; |
121 }; | 125 }; |
122 | 126 |
123 inline PassRefPtr<SVGAngle> toSVGAngle(PassRefPtr<SVGPropertyBase> passBase) | 127 inline PassRefPtrWillBeRawPtr<SVGAngle> toSVGAngle(PassRefPtrWillBeRawPtr<SVGPro
pertyBase> passBase) |
124 { | 128 { |
125 RefPtr<SVGPropertyBase> base = passBase; | 129 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase; |
126 ASSERT(base->type() == SVGAngle::classType()); | 130 ASSERT(base->type() == SVGAngle::classType()); |
127 return static_pointer_cast<SVGAngle>(base.release()); | 131 return static_pointer_cast<SVGAngle>(base.release()); |
128 } | 132 } |
129 | 133 |
130 } // namespace blink | 134 } // namespace blink |
131 | 135 |
132 #endif // SVGAngle_h | 136 #endif // SVGAngle_h |
OLD | NEW |