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

Side by Side Diff: Source/core/css/CSSBasicShapes.h

Issue 1317523002: Changed Pair to be a CSSValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@add_const_to_primvalue
Patch Set: Fixed some callsites from bad rebase Created 5 years, 3 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
OLDNEW
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
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 23 matching lines...) Expand all
67 RefPtrWillBeMember<CSSPrimitiveValue> m_referenceBox; 68 RefPtrWillBeMember<CSSPrimitiveValue> m_referenceBox;
68 }; 69 };
69 70
70 class CSSBasicShapeCircle final : public CSSBasicShape { 71 class CSSBasicShapeCircle final : public CSSBasicShape {
71 public: 72 public:
72 static PassRefPtrWillBeRawPtr<CSSBasicShapeCircle> create() { return adoptRe fWillBeNoop(new CSSBasicShapeCircle); } 73 static PassRefPtrWillBeRawPtr<CSSBasicShapeCircle> create() { return adoptRe fWillBeNoop(new CSSBasicShapeCircle); }
73 74
74 String cssText() const override; 75 String cssText() const override;
75 bool equals(const CSSBasicShape&) const override; 76 bool equals(const CSSBasicShape&) const override;
76 77
77 CSSPrimitiveValue* centerX() const { return m_centerX.get(); } 78 CSSValue* centerX() const { return m_centerX.get(); }
78 CSSPrimitiveValue* centerY() const { return m_centerY.get(); } 79 CSSValue* centerY() const { return m_centerY.get(); }
79 CSSPrimitiveValue* radius() const { return m_radius.get(); } 80 CSSPrimitiveValue* radius() const { return m_radius.get(); }
80 81
81 void setCenterX(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> centerX) { m_cente rX = centerX; } 82 void setCenterX(PassRefPtrWillBeRawPtr<CSSValue> centerX) { m_centerX = cent erX; }
82 void setCenterY(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> centerY) { m_cente rY = centerY; } 83 void setCenterY(PassRefPtrWillBeRawPtr<CSSValue> centerY) { m_centerY = cent erY; }
83 void setRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radius) { m_radius = radius; } 84 void setRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radius) { m_radius = radius; }
84 85
85 DECLARE_VIRTUAL_TRACE(); 86 DECLARE_VIRTUAL_TRACE();
86 87
87 private: 88 private:
88 CSSBasicShapeCircle() { } 89 CSSBasicShapeCircle() { }
89 90
90 Type type() const override { return CSSBasicShapeCircleType; } 91 Type type() const override { return CSSBasicShapeCircleType; }
91 92
92 RefPtrWillBeMember<CSSPrimitiveValue> m_centerX; 93 RefPtrWillBeMember<CSSValue> m_centerX;
93 RefPtrWillBeMember<CSSPrimitiveValue> m_centerY; 94 RefPtrWillBeMember<CSSValue> m_centerY;
94 RefPtrWillBeMember<CSSPrimitiveValue> m_radius; 95 RefPtrWillBeMember<CSSPrimitiveValue> m_radius;
95 }; 96 };
96 97
97 class CSSBasicShapeEllipse final : public CSSBasicShape { 98 class CSSBasicShapeEllipse final : public CSSBasicShape {
98 public: 99 public:
99 static PassRefPtrWillBeRawPtr<CSSBasicShapeEllipse> create() { return adoptR efWillBeNoop(new CSSBasicShapeEllipse); } 100 static PassRefPtrWillBeRawPtr<CSSBasicShapeEllipse> create() { return adoptR efWillBeNoop(new CSSBasicShapeEllipse); }
100 101
101 String cssText() const override; 102 String cssText() const override;
102 bool equals(const CSSBasicShape&) const override; 103 bool equals(const CSSBasicShape&) const override;
103 104
104 CSSPrimitiveValue* centerX() const { return m_centerX.get(); } 105 CSSValue* centerX() const { return m_centerX.get(); }
105 CSSPrimitiveValue* centerY() const { return m_centerY.get(); } 106 CSSValue* centerY() const { return m_centerY.get(); }
106 CSSPrimitiveValue* radiusX() const { return m_radiusX.get(); } 107 CSSPrimitiveValue* radiusX() const { return m_radiusX.get(); }
107 CSSPrimitiveValue* radiusY() const { return m_radiusY.get(); } 108 CSSPrimitiveValue* radiusY() const { return m_radiusY.get(); }
108 109
109 void setCenterX(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> centerX) { m_cente rX = centerX; } 110 void setCenterX(PassRefPtrWillBeRawPtr<CSSValue> centerX) { m_centerX = cent erX; }
110 void setCenterY(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> centerY) { m_cente rY = centerY; } 111 void setCenterY(PassRefPtrWillBeRawPtr<CSSValue> centerY) { m_centerY = cent erY; }
111 void setRadiusX(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radiusX) { m_radiu sX = radiusX; } 112 void setRadiusX(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radiusX) { m_radiu sX = radiusX; }
112 void setRadiusY(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radiusY) { m_radiu sY = radiusY; } 113 void setRadiusY(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radiusY) { m_radiu sY = radiusY; }
113 114
114 DECLARE_VIRTUAL_TRACE(); 115 DECLARE_VIRTUAL_TRACE();
115 116
116 private: 117 private:
117 CSSBasicShapeEllipse() { } 118 CSSBasicShapeEllipse() { }
118 119
119 Type type() const override { return CSSBasicShapeEllipseType; } 120 Type type() const override { return CSSBasicShapeEllipseType; }
120 121
121 RefPtrWillBeMember<CSSPrimitiveValue> m_centerX; 122 RefPtrWillBeMember<CSSValue> m_centerX;
122 RefPtrWillBeMember<CSSPrimitiveValue> m_centerY; 123 RefPtrWillBeMember<CSSValue> m_centerY;
123 RefPtrWillBeMember<CSSPrimitiveValue> m_radiusX; 124 RefPtrWillBeMember<CSSPrimitiveValue> m_radiusX;
124 RefPtrWillBeMember<CSSPrimitiveValue> m_radiusY; 125 RefPtrWillBeMember<CSSPrimitiveValue> m_radiusY;
125 }; 126 };
126 127
127 class CSSBasicShapePolygon final : public CSSBasicShape { 128 class CSSBasicShapePolygon final : public CSSBasicShape {
128 public: 129 public:
129 static PassRefPtrWillBeRawPtr<CSSBasicShapePolygon> create() { return adoptR efWillBeNoop(new CSSBasicShapePolygon); } 130 static PassRefPtrWillBeRawPtr<CSSBasicShapePolygon> create() { return adoptR efWillBeNoop(new CSSBasicShapePolygon); }
130 131
131 void appendPoint(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> x, PassRefPtrWill BeRawPtr<CSSPrimitiveValue> y) 132 void appendPoint(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> x, PassRefPtrWill BeRawPtr<CSSPrimitiveValue> y)
132 { 133 {
(...skipping 27 matching lines...) Expand all
160 161
161 class CSSBasicShapeInset final : public CSSBasicShape { 162 class CSSBasicShapeInset final : public CSSBasicShape {
162 public: 163 public:
163 static PassRefPtrWillBeRawPtr<CSSBasicShapeInset> create() { return adoptRef WillBeNoop(new CSSBasicShapeInset); } 164 static PassRefPtrWillBeRawPtr<CSSBasicShapeInset> create() { return adoptRef WillBeNoop(new CSSBasicShapeInset); }
164 165
165 CSSPrimitiveValue* top() const { return m_top.get(); } 166 CSSPrimitiveValue* top() const { return m_top.get(); }
166 CSSPrimitiveValue* right() const { return m_right.get(); } 167 CSSPrimitiveValue* right() const { return m_right.get(); }
167 CSSPrimitiveValue* bottom() const { return m_bottom.get(); } 168 CSSPrimitiveValue* bottom() const { return m_bottom.get(); }
168 CSSPrimitiveValue* left() const { return m_left.get(); } 169 CSSPrimitiveValue* left() const { return m_left.get(); }
169 170
170 CSSPrimitiveValue* topLeftRadius() const { return m_topLeftRadius.get(); } 171 CSSValuePair* topLeftRadius() const { return m_topLeftRadius.get(); }
171 CSSPrimitiveValue* topRightRadius() const { return m_topRightRadius.get(); } 172 CSSValuePair* topRightRadius() const { return m_topRightRadius.get(); }
172 CSSPrimitiveValue* bottomRightRadius() const { return m_bottomRightRadius.ge t(); } 173 CSSValuePair* bottomRightRadius() const { return m_bottomRightRadius.get(); }
173 CSSPrimitiveValue* bottomLeftRadius() const { return m_bottomLeftRadius.get( ); } 174 CSSValuePair* bottomLeftRadius() const { return m_bottomLeftRadius.get(); }
174 175
175 void setTop(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> top) { m_top = top; } 176 void setTop(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> top) { m_top = top; }
176 void setRight(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> right) { m_right = r ight; } 177 void setRight(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> right) { m_right = r ight; }
177 void setBottom(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> bottom) { m_bottom = bottom; } 178 void setBottom(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> bottom) { m_bottom = bottom; }
178 void setLeft(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> left) { m_left = left ; } 179 void setLeft(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> left) { m_left = left ; }
179 180
180 void updateShapeSize4Values(CSSPrimitiveValue* top, CSSPrimitiveValue* right , CSSPrimitiveValue* bottom, CSSPrimitiveValue* left) 181 void updateShapeSize4Values(CSSPrimitiveValue* top, CSSPrimitiveValue* right , CSSPrimitiveValue* bottom, CSSPrimitiveValue* left)
181 { 182 {
182 setTop(top); 183 setTop(top);
183 setRight(right); 184 setRight(right);
(...skipping 10 matching lines...) Expand all
194 { 195 {
195 updateShapeSize4Values(value1, value2, value1, value2); 196 updateShapeSize4Values(value1, value2, value1, value2);
196 } 197 }
197 198
198 void updateShapeSize3Values(CSSPrimitiveValue* value1, CSSPrimitiveValue* va lue2, CSSPrimitiveValue* value3) 199 void updateShapeSize3Values(CSSPrimitiveValue* value1, CSSPrimitiveValue* va lue2, CSSPrimitiveValue* value3)
199 { 200 {
200 updateShapeSize4Values(value1, value2, value3, value2); 201 updateShapeSize4Values(value1, value2, value3, value2);
201 } 202 }
202 203
203 204
204 void setTopLeftRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radius) { m_ topLeftRadius = radius; } 205 void setTopLeftRadius(PassRefPtrWillBeRawPtr<CSSValuePair> radius) { m_topLe ftRadius = radius; }
205 void setTopRightRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radius) { m _topRightRadius = radius; } 206 void setTopRightRadius(PassRefPtrWillBeRawPtr<CSSValuePair> radius) { m_topR ightRadius = radius; }
206 void setBottomRightRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radius) { m_bottomRightRadius = radius; } 207 void setBottomRightRadius(PassRefPtrWillBeRawPtr<CSSValuePair> radius) { m_b ottomRightRadius = radius; }
207 void setBottomLeftRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radius) { m_bottomLeftRadius = radius; } 208 void setBottomLeftRadius(PassRefPtrWillBeRawPtr<CSSValuePair> radius) { m_bo ttomLeftRadius = radius; }
208 209
209 String cssText() const override; 210 String cssText() const override;
210 bool equals(const CSSBasicShape&) const override; 211 bool equals(const CSSBasicShape&) const override;
211 212
212 DECLARE_VIRTUAL_TRACE(); 213 DECLARE_VIRTUAL_TRACE();
213 214
214 private: 215 private:
215 CSSBasicShapeInset() { } 216 CSSBasicShapeInset() { }
216 217
217 Type type() const override { return CSSBasicShapeInsetType; } 218 Type type() const override { return CSSBasicShapeInsetType; }
218 219
219 RefPtrWillBeMember<CSSPrimitiveValue> m_top; 220 RefPtrWillBeMember<CSSPrimitiveValue> m_top;
220 RefPtrWillBeMember<CSSPrimitiveValue> m_right; 221 RefPtrWillBeMember<CSSPrimitiveValue> m_right;
221 RefPtrWillBeMember<CSSPrimitiveValue> m_bottom; 222 RefPtrWillBeMember<CSSPrimitiveValue> m_bottom;
222 RefPtrWillBeMember<CSSPrimitiveValue> m_left; 223 RefPtrWillBeMember<CSSPrimitiveValue> m_left;
223 224
224 RefPtrWillBeMember<CSSPrimitiveValue> m_topLeftRadius; 225 RefPtrWillBeMember<CSSValuePair> m_topLeftRadius;
225 RefPtrWillBeMember<CSSPrimitiveValue> m_topRightRadius; 226 RefPtrWillBeMember<CSSValuePair> m_topRightRadius;
226 RefPtrWillBeMember<CSSPrimitiveValue> m_bottomRightRadius; 227 RefPtrWillBeMember<CSSValuePair> m_bottomRightRadius;
227 RefPtrWillBeMember<CSSPrimitiveValue> m_bottomLeftRadius; 228 RefPtrWillBeMember<CSSValuePair> m_bottomLeftRadius;
228 }; 229 };
229 230
230 DEFINE_TYPE_CASTS(CSSBasicShapeCircle, CSSBasicShape, shape, shape->isCircle(), shape.isCircle()); 231 DEFINE_TYPE_CASTS(CSSBasicShapeCircle, CSSBasicShape, shape, shape->isCircle(), shape.isCircle());
231 DEFINE_TYPE_CASTS(CSSBasicShapeEllipse, CSSBasicShape, shape, shape->isEllipse() , shape.isEllipse()); 232 DEFINE_TYPE_CASTS(CSSBasicShapeEllipse, CSSBasicShape, shape, shape->isEllipse() , shape.isEllipse());
232 DEFINE_TYPE_CASTS(CSSBasicShapePolygon, CSSBasicShape, shape, shape->isPolygon() , shape.isPolygon()); 233 DEFINE_TYPE_CASTS(CSSBasicShapePolygon, CSSBasicShape, shape, shape->isPolygon() , shape.isPolygon());
233 DEFINE_TYPE_CASTS(CSSBasicShapeInset, CSSBasicShape, shape, shape->isInset(), sh ape.isInset()); 234 DEFINE_TYPE_CASTS(CSSBasicShapeInset, CSSBasicShape, shape, shape->isInset(), sh ape.isInset());
234 235
235 } // namespace blink 236 } // namespace blink
236 237
237 #endif // CSSBasicShapes_h 238 #endif // CSSBasicShapes_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698