OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2011 Adobe Systems Incorporated. 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
10 * disclaimer. | 10 * disclaimer. |
(...skipping 13 matching lines...) Expand all Loading... |
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |
25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | 25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF |
26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
27 * SUCH DAMAGE. | 27 * SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #ifndef CSSBasicShapes_h | 30 #ifndef CSSBasicShapes_h |
31 #define CSSBasicShapes_h | 31 #define CSSBasicShapes_h |
32 | 32 |
33 #include "core/css/CSSPrimitiveValue.h" | 33 #include "core/css/CSSPrimitiveValue.h" |
| 34 #include "core/css/CSSValuePair.h" |
34 #include "platform/graphics/GraphicsTypes.h" | 35 #include "platform/graphics/GraphicsTypes.h" |
35 #include "wtf/RefPtr.h" | 36 #include "wtf/RefPtr.h" |
36 #include "wtf/Vector.h" | 37 #include "wtf/Vector.h" |
37 #include "wtf/text/WTFString.h" | 38 #include "wtf/text/WTFString.h" |
38 | 39 |
39 namespace blink { | 40 namespace blink { |
40 | 41 |
41 class CSSBasicShape : public RefCountedWillBeGarbageCollected<CSSBasicShape> { | 42 class CSSBasicShape : public RefCountedWillBeGarbageCollected<CSSBasicShape> { |
42 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(CSSBasicShape); | 43 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(CSSBasicShape); |
43 public: | 44 public: |
(...skipping 19 matching lines...) Expand all Loading... |
63 CSSBasicShape() { } | 64 CSSBasicShape() { } |
64 }; | 65 }; |
65 | 66 |
66 class CSSBasicShapeCircle final : public CSSBasicShape { | 67 class CSSBasicShapeCircle final : public CSSBasicShape { |
67 public: | 68 public: |
68 static PassRefPtrWillBeRawPtr<CSSBasicShapeCircle> create() { return adoptRe
fWillBeNoop(new CSSBasicShapeCircle); } | 69 static PassRefPtrWillBeRawPtr<CSSBasicShapeCircle> create() { return adoptRe
fWillBeNoop(new CSSBasicShapeCircle); } |
69 | 70 |
70 String cssText() const override; | 71 String cssText() const override; |
71 bool equals(const CSSBasicShape&) const override; | 72 bool equals(const CSSBasicShape&) const override; |
72 | 73 |
73 CSSPrimitiveValue* centerX() const { return m_centerX.get(); } | 74 CSSValue* centerX() const { return m_centerX.get(); } |
74 CSSPrimitiveValue* centerY() const { return m_centerY.get(); } | 75 CSSValue* centerY() const { return m_centerY.get(); } |
75 CSSPrimitiveValue* radius() const { return m_radius.get(); } | 76 CSSPrimitiveValue* radius() const { return m_radius.get(); } |
76 | 77 |
77 void setCenterX(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> centerX) { m_cente
rX = centerX; } | 78 void setCenterX(PassRefPtrWillBeRawPtr<CSSValue> centerX) { m_centerX = cent
erX; } |
78 void setCenterY(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> centerY) { m_cente
rY = centerY; } | 79 void setCenterY(PassRefPtrWillBeRawPtr<CSSValue> centerY) { m_centerY = cent
erY; } |
79 void setRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radius) { m_radius
= radius; } | 80 void setRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radius) { m_radius
= radius; } |
80 | 81 |
81 DECLARE_VIRTUAL_TRACE(); | 82 DECLARE_VIRTUAL_TRACE(); |
82 | 83 |
83 private: | 84 private: |
84 CSSBasicShapeCircle() { } | 85 CSSBasicShapeCircle() { } |
85 | 86 |
86 Type type() const override { return CSSBasicShapeCircleType; } | 87 Type type() const override { return CSSBasicShapeCircleType; } |
87 | 88 |
88 RefPtrWillBeMember<CSSPrimitiveValue> m_centerX; | 89 RefPtrWillBeMember<CSSValue> m_centerX; |
89 RefPtrWillBeMember<CSSPrimitiveValue> m_centerY; | 90 RefPtrWillBeMember<CSSValue> m_centerY; |
90 RefPtrWillBeMember<CSSPrimitiveValue> m_radius; | 91 RefPtrWillBeMember<CSSPrimitiveValue> m_radius; |
91 }; | 92 }; |
92 | 93 |
93 class CSSBasicShapeEllipse final : public CSSBasicShape { | 94 class CSSBasicShapeEllipse final : public CSSBasicShape { |
94 public: | 95 public: |
95 static PassRefPtrWillBeRawPtr<CSSBasicShapeEllipse> create() { return adoptR
efWillBeNoop(new CSSBasicShapeEllipse); } | 96 static PassRefPtrWillBeRawPtr<CSSBasicShapeEllipse> create() { return adoptR
efWillBeNoop(new CSSBasicShapeEllipse); } |
96 | 97 |
97 String cssText() const override; | 98 String cssText() const override; |
98 bool equals(const CSSBasicShape&) const override; | 99 bool equals(const CSSBasicShape&) const override; |
99 | 100 |
100 CSSPrimitiveValue* centerX() const { return m_centerX.get(); } | 101 CSSValue* centerX() const { return m_centerX.get(); } |
101 CSSPrimitiveValue* centerY() const { return m_centerY.get(); } | 102 CSSValue* centerY() const { return m_centerY.get(); } |
102 CSSPrimitiveValue* radiusX() const { return m_radiusX.get(); } | 103 CSSPrimitiveValue* radiusX() const { return m_radiusX.get(); } |
103 CSSPrimitiveValue* radiusY() const { return m_radiusY.get(); } | 104 CSSPrimitiveValue* radiusY() const { return m_radiusY.get(); } |
104 | 105 |
105 void setCenterX(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> centerX) { m_cente
rX = centerX; } | 106 void setCenterX(PassRefPtrWillBeRawPtr<CSSValue> centerX) { m_centerX = cent
erX; } |
106 void setCenterY(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> centerY) { m_cente
rY = centerY; } | 107 void setCenterY(PassRefPtrWillBeRawPtr<CSSValue> centerY) { m_centerY = cent
erY; } |
107 void setRadiusX(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radiusX) { m_radiu
sX = radiusX; } | 108 void setRadiusX(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radiusX) { m_radiu
sX = radiusX; } |
108 void setRadiusY(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radiusY) { m_radiu
sY = radiusY; } | 109 void setRadiusY(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radiusY) { m_radiu
sY = radiusY; } |
109 | 110 |
110 DECLARE_VIRTUAL_TRACE(); | 111 DECLARE_VIRTUAL_TRACE(); |
111 | 112 |
112 private: | 113 private: |
113 CSSBasicShapeEllipse() { } | 114 CSSBasicShapeEllipse() { } |
114 | 115 |
115 Type type() const override { return CSSBasicShapeEllipseType; } | 116 Type type() const override { return CSSBasicShapeEllipseType; } |
116 | 117 |
117 RefPtrWillBeMember<CSSPrimitiveValue> m_centerX; | 118 RefPtrWillBeMember<CSSValue> m_centerX; |
118 RefPtrWillBeMember<CSSPrimitiveValue> m_centerY; | 119 RefPtrWillBeMember<CSSValue> m_centerY; |
119 RefPtrWillBeMember<CSSPrimitiveValue> m_radiusX; | 120 RefPtrWillBeMember<CSSPrimitiveValue> m_radiusX; |
120 RefPtrWillBeMember<CSSPrimitiveValue> m_radiusY; | 121 RefPtrWillBeMember<CSSPrimitiveValue> m_radiusY; |
121 }; | 122 }; |
122 | 123 |
123 class CSSBasicShapePolygon final : public CSSBasicShape { | 124 class CSSBasicShapePolygon final : public CSSBasicShape { |
124 public: | 125 public: |
125 static PassRefPtrWillBeRawPtr<CSSBasicShapePolygon> create() { return adoptR
efWillBeNoop(new CSSBasicShapePolygon); } | 126 static PassRefPtrWillBeRawPtr<CSSBasicShapePolygon> create() { return adoptR
efWillBeNoop(new CSSBasicShapePolygon); } |
126 | 127 |
127 void appendPoint(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> x, PassRefPtrWill
BeRawPtr<CSSPrimitiveValue> y) | 128 void appendPoint(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> x, PassRefPtrWill
BeRawPtr<CSSPrimitiveValue> y) |
128 { | 129 { |
(...skipping 27 matching lines...) Expand all Loading... |
156 | 157 |
157 class CSSBasicShapeInset final : public CSSBasicShape { | 158 class CSSBasicShapeInset final : public CSSBasicShape { |
158 public: | 159 public: |
159 static PassRefPtrWillBeRawPtr<CSSBasicShapeInset> create() { return adoptRef
WillBeNoop(new CSSBasicShapeInset); } | 160 static PassRefPtrWillBeRawPtr<CSSBasicShapeInset> create() { return adoptRef
WillBeNoop(new CSSBasicShapeInset); } |
160 | 161 |
161 CSSPrimitiveValue* top() const { return m_top.get(); } | 162 CSSPrimitiveValue* top() const { return m_top.get(); } |
162 CSSPrimitiveValue* right() const { return m_right.get(); } | 163 CSSPrimitiveValue* right() const { return m_right.get(); } |
163 CSSPrimitiveValue* bottom() const { return m_bottom.get(); } | 164 CSSPrimitiveValue* bottom() const { return m_bottom.get(); } |
164 CSSPrimitiveValue* left() const { return m_left.get(); } | 165 CSSPrimitiveValue* left() const { return m_left.get(); } |
165 | 166 |
166 CSSPrimitiveValue* topLeftRadius() const { return m_topLeftRadius.get(); } | 167 CSSValuePair* topLeftRadius() const { return m_topLeftRadius.get(); } |
167 CSSPrimitiveValue* topRightRadius() const { return m_topRightRadius.get(); } | 168 CSSValuePair* topRightRadius() const { return m_topRightRadius.get(); } |
168 CSSPrimitiveValue* bottomRightRadius() const { return m_bottomRightRadius.ge
t(); } | 169 CSSValuePair* bottomRightRadius() const { return m_bottomRightRadius.get();
} |
169 CSSPrimitiveValue* bottomLeftRadius() const { return m_bottomLeftRadius.get(
); } | 170 CSSValuePair* bottomLeftRadius() const { return m_bottomLeftRadius.get(); } |
170 | 171 |
171 void setTop(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> top) { m_top = top; } | 172 void setTop(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> top) { m_top = top; } |
172 void setRight(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> right) { m_right = r
ight; } | 173 void setRight(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> right) { m_right = r
ight; } |
173 void setBottom(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> bottom) { m_bottom
= bottom; } | 174 void setBottom(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> bottom) { m_bottom
= bottom; } |
174 void setLeft(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> left) { m_left = left
; } | 175 void setLeft(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> left) { m_left = left
; } |
175 | 176 |
176 void updateShapeSize4Values(CSSPrimitiveValue* top, CSSPrimitiveValue* right
, CSSPrimitiveValue* bottom, CSSPrimitiveValue* left) | 177 void updateShapeSize4Values(CSSPrimitiveValue* top, CSSPrimitiveValue* right
, CSSPrimitiveValue* bottom, CSSPrimitiveValue* left) |
177 { | 178 { |
178 setTop(top); | 179 setTop(top); |
179 setRight(right); | 180 setRight(right); |
(...skipping 10 matching lines...) Expand all Loading... |
190 { | 191 { |
191 updateShapeSize4Values(value1, value2, value1, value2); | 192 updateShapeSize4Values(value1, value2, value1, value2); |
192 } | 193 } |
193 | 194 |
194 void updateShapeSize3Values(CSSPrimitiveValue* value1, CSSPrimitiveValue* va
lue2, CSSPrimitiveValue* value3) | 195 void updateShapeSize3Values(CSSPrimitiveValue* value1, CSSPrimitiveValue* va
lue2, CSSPrimitiveValue* value3) |
195 { | 196 { |
196 updateShapeSize4Values(value1, value2, value3, value2); | 197 updateShapeSize4Values(value1, value2, value3, value2); |
197 } | 198 } |
198 | 199 |
199 | 200 |
200 void setTopLeftRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radius) { m_
topLeftRadius = radius; } | 201 void setTopLeftRadius(PassRefPtrWillBeRawPtr<CSSValuePair> radius) { m_topLe
ftRadius = radius; } |
201 void setTopRightRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radius) { m
_topRightRadius = radius; } | 202 void setTopRightRadius(PassRefPtrWillBeRawPtr<CSSValuePair> radius) { m_topR
ightRadius = radius; } |
202 void setBottomRightRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radius)
{ m_bottomRightRadius = radius; } | 203 void setBottomRightRadius(PassRefPtrWillBeRawPtr<CSSValuePair> radius) { m_b
ottomRightRadius = radius; } |
203 void setBottomLeftRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radius) {
m_bottomLeftRadius = radius; } | 204 void setBottomLeftRadius(PassRefPtrWillBeRawPtr<CSSValuePair> radius) { m_bo
ttomLeftRadius = radius; } |
204 | 205 |
205 String cssText() const override; | 206 String cssText() const override; |
206 bool equals(const CSSBasicShape&) const override; | 207 bool equals(const CSSBasicShape&) const override; |
207 | 208 |
208 DECLARE_VIRTUAL_TRACE(); | 209 DECLARE_VIRTUAL_TRACE(); |
209 | 210 |
210 private: | 211 private: |
211 CSSBasicShapeInset() { } | 212 CSSBasicShapeInset() { } |
212 | 213 |
213 Type type() const override { return CSSBasicShapeInsetType; } | 214 Type type() const override { return CSSBasicShapeInsetType; } |
214 | 215 |
215 RefPtrWillBeMember<CSSPrimitiveValue> m_top; | 216 RefPtrWillBeMember<CSSPrimitiveValue> m_top; |
216 RefPtrWillBeMember<CSSPrimitiveValue> m_right; | 217 RefPtrWillBeMember<CSSPrimitiveValue> m_right; |
217 RefPtrWillBeMember<CSSPrimitiveValue> m_bottom; | 218 RefPtrWillBeMember<CSSPrimitiveValue> m_bottom; |
218 RefPtrWillBeMember<CSSPrimitiveValue> m_left; | 219 RefPtrWillBeMember<CSSPrimitiveValue> m_left; |
219 | 220 |
220 RefPtrWillBeMember<CSSPrimitiveValue> m_topLeftRadius; | 221 RefPtrWillBeMember<CSSValuePair> m_topLeftRadius; |
221 RefPtrWillBeMember<CSSPrimitiveValue> m_topRightRadius; | 222 RefPtrWillBeMember<CSSValuePair> m_topRightRadius; |
222 RefPtrWillBeMember<CSSPrimitiveValue> m_bottomRightRadius; | 223 RefPtrWillBeMember<CSSValuePair> m_bottomRightRadius; |
223 RefPtrWillBeMember<CSSPrimitiveValue> m_bottomLeftRadius; | 224 RefPtrWillBeMember<CSSValuePair> m_bottomLeftRadius; |
224 }; | 225 }; |
225 | 226 |
226 DEFINE_TYPE_CASTS(CSSBasicShapeCircle, CSSBasicShape, shape, shape->isCircle(),
shape.isCircle()); | 227 DEFINE_TYPE_CASTS(CSSBasicShapeCircle, CSSBasicShape, shape, shape->isCircle(),
shape.isCircle()); |
227 DEFINE_TYPE_CASTS(CSSBasicShapeEllipse, CSSBasicShape, shape, shape->isEllipse()
, shape.isEllipse()); | 228 DEFINE_TYPE_CASTS(CSSBasicShapeEllipse, CSSBasicShape, shape, shape->isEllipse()
, shape.isEllipse()); |
228 DEFINE_TYPE_CASTS(CSSBasicShapePolygon, CSSBasicShape, shape, shape->isPolygon()
, shape.isPolygon()); | 229 DEFINE_TYPE_CASTS(CSSBasicShapePolygon, CSSBasicShape, shape, shape->isPolygon()
, shape.isPolygon()); |
229 DEFINE_TYPE_CASTS(CSSBasicShapeInset, CSSBasicShape, shape, shape->isInset(), sh
ape.isInset()); | 230 DEFINE_TYPE_CASTS(CSSBasicShapeInset, CSSBasicShape, shape, shape->isInset(), sh
ape.isInset()); |
230 | 231 |
231 } // namespace blink | 232 } // namespace blink |
232 | 233 |
233 #endif // CSSBasicShapes_h | 234 #endif // CSSBasicShapes_h |
OLD | NEW |