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 24 matching lines...) Expand all Loading... | |
35 #include "wtf/RefPtr.h" | 35 #include "wtf/RefPtr.h" |
36 #include "wtf/Vector.h" | 36 #include "wtf/Vector.h" |
37 #include "wtf/text/WTFString.h" | 37 #include "wtf/text/WTFString.h" |
38 | 38 |
39 namespace WebCore { | 39 namespace WebCore { |
40 | 40 |
41 class CSSBasicShape : public RefCounted<CSSBasicShape> { | 41 class CSSBasicShape : public RefCounted<CSSBasicShape> { |
42 public: | 42 public: |
43 enum Type { | 43 enum Type { |
44 CSSBasicShapeRectangleType = 1, | 44 CSSBasicShapeRectangleType = 1, |
45 CSSBasicShapeCircleType = 2, | 45 CSSDeprecatedBasicShapeCircleType = 2, |
46 CSSBasicShapeEllipseType = 3, | 46 CSSDeprecatedBasicShapeEllipseType = 3, |
47 CSSBasicShapePolygonType = 4, | 47 CSSBasicShapeEllipseType = 4, |
48 CSSBasicShapeInsetRectangleType = 5 | 48 CSSBasicShapePolygonType = 5, |
49 CSSBasicShapeInsetRectangleType = 6, | |
50 CSSBasicShapeCircleType = 7 | |
bemjb
2013/12/07 00:05:32
Should you remove the explicit numbers in this pat
| |
49 }; | 51 }; |
50 | 52 |
51 virtual Type type() const = 0; | 53 virtual Type type() const = 0; |
52 virtual String cssText() const = 0; | 54 virtual String cssText() const = 0; |
53 virtual bool equals(const CSSBasicShape&) const = 0; | 55 virtual bool equals(const CSSBasicShape&) const = 0; |
54 | 56 |
55 virtual String serializeResolvingVariables(const HashMap<AtomicString, Strin g>&) const = 0; | 57 virtual String serializeResolvingVariables(const HashMap<AtomicString, Strin g>&) const = 0; |
56 virtual bool hasVariableReference() const = 0; | 58 virtual bool hasVariableReference() const = 0; |
57 | 59 |
58 public: | 60 public: |
59 virtual ~CSSBasicShape() { } | 61 virtual ~CSSBasicShape() { } |
60 | 62 |
61 protected: | 63 protected: |
62 CSSBasicShape() { } | 64 CSSBasicShape() { } |
65 | |
66 RefPtr<CSSPrimitiveValue> m_box; | |
63 }; | 67 }; |
64 | 68 |
65 class CSSBasicShapeRectangle : public CSSBasicShape { | 69 class CSSBasicShapeRectangle : public CSSBasicShape { |
66 public: | 70 public: |
67 static PassRefPtr<CSSBasicShapeRectangle> create() { return adoptRef(new CSS BasicShapeRectangle); } | 71 static PassRefPtr<CSSBasicShapeRectangle> create() { return adoptRef(new CSS BasicShapeRectangle); } |
68 | 72 |
69 CSSPrimitiveValue* x() const { return m_x.get(); } | 73 CSSPrimitiveValue* x() const { return m_x.get(); } |
70 CSSPrimitiveValue* y() const { return m_y.get(); } | 74 CSSPrimitiveValue* y() const { return m_y.get(); } |
71 CSSPrimitiveValue* width() const { return m_width.get(); } | 75 CSSPrimitiveValue* width() const { return m_width.get(); } |
72 CSSPrimitiveValue* height() const { return m_height.get(); } | 76 CSSPrimitiveValue* height() const { return m_height.get(); } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 RefPtr<CSSPrimitiveValue> m_bottom; | 135 RefPtr<CSSPrimitiveValue> m_bottom; |
132 RefPtr<CSSPrimitiveValue> m_left; | 136 RefPtr<CSSPrimitiveValue> m_left; |
133 RefPtr<CSSPrimitiveValue> m_radiusX; | 137 RefPtr<CSSPrimitiveValue> m_radiusX; |
134 RefPtr<CSSPrimitiveValue> m_radiusY; | 138 RefPtr<CSSPrimitiveValue> m_radiusY; |
135 }; | 139 }; |
136 | 140 |
137 class CSSBasicShapeCircle : public CSSBasicShape { | 141 class CSSBasicShapeCircle : public CSSBasicShape { |
138 public: | 142 public: |
139 static PassRefPtr<CSSBasicShapeCircle> create() { return adoptRef(new CSSBas icShapeCircle); } | 143 static PassRefPtr<CSSBasicShapeCircle> create() { return adoptRef(new CSSBas icShapeCircle); } |
140 | 144 |
145 virtual Type type() const OVERRIDE { return CSSBasicShapeCircleType; } | |
146 virtual String cssText() const; | |
147 virtual bool equals(const CSSBasicShape&) const; | |
148 | |
141 CSSPrimitiveValue* centerX() const { return m_centerX.get(); } | 149 CSSPrimitiveValue* centerX() const { return m_centerX.get(); } |
142 CSSPrimitiveValue* centerY() const { return m_centerY.get(); } | 150 CSSPrimitiveValue* centerY() const { return m_centerY.get(); } |
143 CSSPrimitiveValue* radius() const { return m_radius.get(); } | 151 CSSPrimitiveValue* radius() const { return m_radius.get(); } |
152 | |
153 void setCenterX(PassRefPtr<CSSPrimitiveValue> centerX) { m_centerX = centerX ; } | |
154 void setCenterY(PassRefPtr<CSSPrimitiveValue> centerY) { m_centerY = centerY ; } | |
155 void setRadius(PassRefPtr<CSSPrimitiveValue> radius) { m_radius = radius; } | |
156 | |
157 virtual String serializeResolvingVariables(const HashMap<AtomicString, Strin g>&) const; | |
158 virtual bool hasVariableReference() const; | |
159 | |
160 private: | |
161 CSSBasicShapeCircle() { } | |
162 | |
163 RefPtr<CSSPrimitiveValue> m_centerX; | |
164 RefPtr<CSSPrimitiveValue> m_centerY; | |
165 RefPtr<CSSPrimitiveValue> m_radius; | |
166 }; | |
167 | |
168 class CSSDeprecatedBasicShapeCircle : public CSSBasicShape { | |
169 public: | |
170 static PassRefPtr<CSSDeprecatedBasicShapeCircle> create() { return adoptRef( new CSSDeprecatedBasicShapeCircle); } | |
171 | |
172 CSSPrimitiveValue* centerX() const { return m_centerX.get(); } | |
173 CSSPrimitiveValue* centerY() const { return m_centerY.get(); } | |
174 CSSPrimitiveValue* radius() const { return m_radius.get(); } | |
144 | 175 |
145 void setCenterX(PassRefPtr<CSSPrimitiveValue> centerX) { m_centerX = centerX ; } | 176 void setCenterX(PassRefPtr<CSSPrimitiveValue> centerX) { m_centerX = centerX ; } |
146 void setCenterY(PassRefPtr<CSSPrimitiveValue> centerY) { m_centerY = centerY ; } | 177 void setCenterY(PassRefPtr<CSSPrimitiveValue> centerY) { m_centerY = centerY ; } |
147 void setRadius(PassRefPtr<CSSPrimitiveValue> radius) { m_radius = radius; } | 178 void setRadius(PassRefPtr<CSSPrimitiveValue> radius) { m_radius = radius; } |
148 | 179 |
149 virtual Type type() const { return CSSBasicShapeCircleType; } | 180 virtual Type type() const OVERRIDE { return CSSDeprecatedBasicShapeCircleTyp e; } |
181 | |
150 virtual String cssText() const; | 182 virtual String cssText() const; |
151 virtual bool equals(const CSSBasicShape&) const; | 183 virtual bool equals(const CSSBasicShape&) const; |
152 | 184 |
153 virtual String serializeResolvingVariables(const HashMap<AtomicString, Strin g>&) const; | 185 virtual String serializeResolvingVariables(const HashMap<AtomicString, Strin g>&) const; |
154 virtual bool hasVariableReference() const; | 186 virtual bool hasVariableReference() const; |
155 | 187 |
156 private: | 188 private: |
157 CSSBasicShapeCircle() { } | 189 CSSDeprecatedBasicShapeCircle() { } |
158 | 190 |
159 RefPtr<CSSPrimitiveValue> m_centerY; | 191 RefPtr<CSSPrimitiveValue> m_centerY; |
160 RefPtr<CSSPrimitiveValue> m_centerX; | 192 RefPtr<CSSPrimitiveValue> m_centerX; |
161 RefPtr<CSSPrimitiveValue> m_radius; | 193 RefPtr<CSSPrimitiveValue> m_radius; |
162 }; | 194 }; |
163 | 195 |
164 class CSSBasicShapeEllipse : public CSSBasicShape { | 196 class CSSBasicShapeEllipse : public CSSBasicShape { |
165 public: | 197 public: |
166 static PassRefPtr<CSSBasicShapeEllipse> create() { return adoptRef(new CSSBa sicShapeEllipse); } | 198 static PassRefPtr<CSSBasicShapeEllipse> create() { return adoptRef(new CSSBa sicShapeEllipse); } |
167 | 199 |
200 virtual Type type() const OVERRIDE { return CSSBasicShapeEllipseType; } | |
201 virtual String cssText() const; | |
202 virtual bool equals(const CSSBasicShape&) const; | |
203 | |
168 CSSPrimitiveValue* centerX() const { return m_centerX.get(); } | 204 CSSPrimitiveValue* centerX() const { return m_centerX.get(); } |
169 CSSPrimitiveValue* centerY() const { return m_centerY.get(); } | 205 CSSPrimitiveValue* centerY() const { return m_centerY.get(); } |
170 CSSPrimitiveValue* radiusX() const { return m_radiusX.get(); } | 206 CSSPrimitiveValue* radiusX() const { return m_radiusX.get(); } |
171 CSSPrimitiveValue* radiusY() const { return m_radiusY.get(); } | 207 CSSPrimitiveValue* radiusY() const { return m_radiusY.get(); } |
172 | 208 |
173 void setCenterX(PassRefPtr<CSSPrimitiveValue> centerX) { m_centerX = centerX ; } | 209 void setCenterX(PassRefPtr<CSSPrimitiveValue> centerX) { m_centerX = centerX ; } |
174 void setCenterY(PassRefPtr<CSSPrimitiveValue> centerY) { m_centerY = centerY ; } | 210 void setCenterY(PassRefPtr<CSSPrimitiveValue> centerY) { m_centerY = centerY ; } |
175 void setRadiusX(PassRefPtr<CSSPrimitiveValue> radiusX) { m_radiusX = radiusX ; } | 211 void setRadiusX(PassRefPtr<CSSPrimitiveValue> radiusX) { m_radiusX = radiusX ; } |
176 void setRadiusY(PassRefPtr<CSSPrimitiveValue> radiusY) { m_radiusY = radiusY ; } | 212 void setRadiusY(PassRefPtr<CSSPrimitiveValue> radiusY) { m_radiusY = radiusY ; } |
177 | 213 |
178 virtual Type type() const { return CSSBasicShapeEllipseType; } | 214 virtual String serializeResolvingVariables(const HashMap<AtomicString, Strin g>&) const; |
215 virtual bool hasVariableReference() const; | |
216 | |
217 private: | |
218 CSSBasicShapeEllipse() { } | |
219 | |
220 RefPtr<CSSPrimitiveValue> m_centerX; | |
221 RefPtr<CSSPrimitiveValue> m_centerY; | |
222 RefPtr<CSSPrimitiveValue> m_radiusX; | |
223 RefPtr<CSSPrimitiveValue> m_radiusY; | |
224 }; | |
225 | |
226 class CSSDeprecatedBasicShapeEllipse : public CSSBasicShape { | |
227 public: | |
228 static PassRefPtr<CSSDeprecatedBasicShapeEllipse> create() { return adoptRef (new CSSDeprecatedBasicShapeEllipse); } | |
229 | |
230 CSSPrimitiveValue* centerX() const { return m_centerX.get(); } | |
231 CSSPrimitiveValue* centerY() const { return m_centerY.get(); } | |
232 CSSPrimitiveValue* radiusX() const { return m_radiusX.get(); } | |
233 CSSPrimitiveValue* radiusY() const { return m_radiusY.get(); } | |
234 | |
235 void setCenterX(PassRefPtr<CSSPrimitiveValue> centerX) { m_centerX = centerX ; } | |
236 void setCenterY(PassRefPtr<CSSPrimitiveValue> centerY) { m_centerY = centerY ; } | |
237 void setRadiusX(PassRefPtr<CSSPrimitiveValue> radiusX) { m_radiusX = radiusX ; } | |
238 void setRadiusY(PassRefPtr<CSSPrimitiveValue> radiusY) { m_radiusY = radiusY ; } | |
239 | |
240 virtual Type type() const { return CSSDeprecatedBasicShapeEllipseType; } | |
179 virtual String cssText() const; | 241 virtual String cssText() const; |
180 virtual bool equals(const CSSBasicShape&) const; | 242 virtual bool equals(const CSSBasicShape&) const; |
181 | 243 |
182 virtual String serializeResolvingVariables(const HashMap<AtomicString, Strin g>&) const; | 244 virtual String serializeResolvingVariables(const HashMap<AtomicString, Strin g>&) const; |
183 virtual bool hasVariableReference() const; | 245 virtual bool hasVariableReference() const; |
184 | 246 |
185 private: | 247 private: |
186 CSSBasicShapeEllipse() { } | 248 CSSDeprecatedBasicShapeEllipse() { } |
187 | 249 |
188 RefPtr<CSSPrimitiveValue> m_centerX; | 250 RefPtr<CSSPrimitiveValue> m_centerX; |
189 RefPtr<CSSPrimitiveValue> m_centerY; | 251 RefPtr<CSSPrimitiveValue> m_centerY; |
190 RefPtr<CSSPrimitiveValue> m_radiusX; | 252 RefPtr<CSSPrimitiveValue> m_radiusX; |
191 RefPtr<CSSPrimitiveValue> m_radiusY; | 253 RefPtr<CSSPrimitiveValue> m_radiusY; |
192 }; | 254 }; |
193 | 255 |
194 class CSSBasicShapePolygon : public CSSBasicShape { | 256 class CSSBasicShapePolygon : public CSSBasicShape { |
195 public: | 257 public: |
196 static PassRefPtr<CSSBasicShapePolygon> create() { return adoptRef(new CSSBa sicShapePolygon); } | 258 static PassRefPtr<CSSBasicShapePolygon> create() { return adoptRef(new CSSBa sicShapePolygon); } |
(...skipping 23 matching lines...) Expand all Loading... | |
220 { | 282 { |
221 } | 283 } |
222 | 284 |
223 Vector<RefPtr<CSSPrimitiveValue> > m_values; | 285 Vector<RefPtr<CSSPrimitiveValue> > m_values; |
224 WindRule m_windRule; | 286 WindRule m_windRule; |
225 }; | 287 }; |
226 | 288 |
227 } // namespace WebCore | 289 } // namespace WebCore |
228 | 290 |
229 #endif // CSSBasicShapes_h | 291 #endif // CSSBasicShapes_h |
OLD | NEW |