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

Side by Side Diff: Source/core/rendering/style/BasicShapes.h

Issue 135563002: Update remaining rendering classes to use OVERRIDE / FINAL when needed (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) 2012 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2012 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 { 76 {
77 } 77 }
78 78
79 private: 79 private:
80 LayoutBox m_layoutBox; 80 LayoutBox m_layoutBox;
81 }; 81 };
82 82
83 #define DEFINE_BASICSHAPE_TYPE_CASTS(thisType) \ 83 #define DEFINE_BASICSHAPE_TYPE_CASTS(thisType) \
84 DEFINE_TYPE_CASTS(thisType, BasicShape, value, value->type() == BasicShape:: thisType##Type, value.type() == BasicShape::thisType##Type) 84 DEFINE_TYPE_CASTS(thisType, BasicShape, value, value->type() == BasicShape:: thisType##Type, value.type() == BasicShape::thisType##Type)
85 85
86 class BasicShapeRectangle : public BasicShape { 86 class BasicShapeRectangle FINAL : public BasicShape {
87 public: 87 public:
88 static PassRefPtr<BasicShapeRectangle> create() { return adoptRef(new BasicS hapeRectangle); } 88 static PassRefPtr<BasicShapeRectangle> create() { return adoptRef(new BasicS hapeRectangle); }
89 89
90 Length x() const { return m_x; } 90 Length x() const { return m_x; }
91 Length y() const { return m_y; } 91 Length y() const { return m_y; }
92 Length width() const { return m_width; } 92 Length width() const { return m_width; }
93 Length height() const { return m_height; } 93 Length height() const { return m_height; }
94 Length cornerRadiusX() const { return m_cornerRadiusX; } 94 Length cornerRadiusX() const { return m_cornerRadiusX; }
95 Length cornerRadiusY() const { return m_cornerRadiusY; } 95 Length cornerRadiusY() const { return m_cornerRadiusY; }
96 96
97 void setX(Length x) { m_x = x; } 97 void setX(Length x) { m_x = x; }
98 void setY(Length y) { m_y = y; } 98 void setY(Length y) { m_y = y; }
99 void setWidth(Length width) { m_width = width; } 99 void setWidth(Length width) { m_width = width; }
100 void setHeight(Length height) { m_height = height; } 100 void setHeight(Length height) { m_height = height; }
101 void setCornerRadiusX(Length radiusX) 101 void setCornerRadiusX(Length radiusX)
102 { 102 {
103 m_cornerRadiusX = radiusX; 103 m_cornerRadiusX = radiusX;
104 } 104 }
105 void setCornerRadiusY(Length radiusY) 105 void setCornerRadiusY(Length radiusY)
106 { 106 {
107 m_cornerRadiusY = radiusY; 107 m_cornerRadiusY = radiusY;
108 } 108 }
109 109
110 virtual void path(Path&, const FloatRect&) OVERRIDE; 110 virtual void path(Path&, const FloatRect&) OVERRIDE;
111 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI DE; 111 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI DE;
112 virtual bool operator==(const BasicShape&) const OVERRIDE; 112 virtual bool operator==(const BasicShape&) const OVERRIDE;
113 113
114 virtual Type type() const { return BasicShapeRectangleType; } 114 virtual Type type() const OVERRIDE { return BasicShapeRectangleType; }
115 private: 115 private:
116 BasicShapeRectangle() { } 116 BasicShapeRectangle() { }
117 117
118 Length m_y; 118 Length m_y;
119 Length m_x; 119 Length m_x;
120 Length m_width; 120 Length m_width;
121 Length m_height; 121 Length m_height;
122 Length m_cornerRadiusX; 122 Length m_cornerRadiusX;
123 Length m_cornerRadiusY; 123 Length m_cornerRadiusY;
124 }; 124 };
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 return BasicShapeRadius(m_value.blend(other.value(), progress, ValueRang eAll)); 192 return BasicShapeRadius(m_value.blend(other.value(), progress, ValueRang eAll));
193 } 193 }
194 194
195 private: 195 private:
196 Length m_value; 196 Length m_value;
197 Type m_type; 197 Type m_type;
198 198
199 }; 199 };
200 200
201 class BasicShapeCircle : public BasicShape { 201 class BasicShapeCircle FINAL : public BasicShape {
202 public: 202 public:
203 static PassRefPtr<BasicShapeCircle> create() { return adoptRef(new BasicShap eCircle); } 203 static PassRefPtr<BasicShapeCircle> create() { return adoptRef(new BasicShap eCircle); }
204 204
205 const BasicShapeCenterCoordinate& centerX() const { return m_centerX; } 205 const BasicShapeCenterCoordinate& centerX() const { return m_centerX; }
206 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; } 206 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; }
207 const BasicShapeRadius& radius() const { return m_radius; } 207 const BasicShapeRadius& radius() const { return m_radius; }
208 208
209 float floatValueForRadiusInBox(FloatSize) const; 209 float floatValueForRadiusInBox(FloatSize) const;
210 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; } 210 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; }
211 void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; } 211 void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; }
212 void setRadius(BasicShapeRadius radius) { m_radius = radius; } 212 void setRadius(BasicShapeRadius radius) { m_radius = radius; }
213 213
214 virtual void path(Path&, const FloatRect&) OVERRIDE; 214 virtual void path(Path&, const FloatRect&) OVERRIDE;
215 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI DE; 215 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI DE;
216 virtual bool operator==(const BasicShape&) const OVERRIDE; 216 virtual bool operator==(const BasicShape&) const OVERRIDE;
217 217
218 virtual Type type() const { return BasicShapeCircleType; } 218 virtual Type type() const OVERRIDE { return BasicShapeCircleType; }
219 private: 219 private:
220 BasicShapeCircle() { } 220 BasicShapeCircle() { }
221 221
222 BasicShapeCenterCoordinate m_centerX; 222 BasicShapeCenterCoordinate m_centerX;
223 BasicShapeCenterCoordinate m_centerY; 223 BasicShapeCenterCoordinate m_centerY;
224 BasicShapeRadius m_radius; 224 BasicShapeRadius m_radius;
225 }; 225 };
226 226
227 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeCircle); 227 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeCircle);
228 228
229 class DeprecatedBasicShapeCircle : public BasicShape { 229 class DeprecatedBasicShapeCircle FINAL : public BasicShape {
230 public: 230 public:
231 static PassRefPtr<DeprecatedBasicShapeCircle> create() { return adoptRef(new DeprecatedBasicShapeCircle); } 231 static PassRefPtr<DeprecatedBasicShapeCircle> create() { return adoptRef(new DeprecatedBasicShapeCircle); }
232 232
233 Length centerX() const { return m_centerX; } 233 Length centerX() const { return m_centerX; }
234 Length centerY() const { return m_centerY; } 234 Length centerY() const { return m_centerY; }
235 Length radius() const { return m_radius; } 235 Length radius() const { return m_radius; }
236 236
237 void setCenterX(Length centerX) { m_centerX = centerX; } 237 void setCenterX(Length centerX) { m_centerX = centerX; }
238 void setCenterY(Length centerY) { m_centerY = centerY; } 238 void setCenterY(Length centerY) { m_centerY = centerY; }
239 void setRadius(Length radius) { m_radius = radius; } 239 void setRadius(Length radius) { m_radius = radius; }
240 240
241 virtual void path(Path&, const FloatRect&) OVERRIDE; 241 virtual void path(Path&, const FloatRect&) OVERRIDE;
242 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI DE; 242 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI DE;
243 virtual bool operator==(const BasicShape&) const OVERRIDE; 243 virtual bool operator==(const BasicShape&) const OVERRIDE;
244 244
245 virtual Type type() const { return DeprecatedBasicShapeCircleType; } 245 virtual Type type() const OVERRIDE { return DeprecatedBasicShapeCircleType; }
246 private: 246 private:
247 DeprecatedBasicShapeCircle() { } 247 DeprecatedBasicShapeCircle() { }
248 248
249 Length m_centerX; 249 Length m_centerX;
250 Length m_centerY; 250 Length m_centerY;
251 Length m_radius; 251 Length m_radius;
252 }; 252 };
253 253
254 DEFINE_BASICSHAPE_TYPE_CASTS(DeprecatedBasicShapeCircle); 254 DEFINE_BASICSHAPE_TYPE_CASTS(DeprecatedBasicShapeCircle);
255 255
256 class BasicShapeEllipse : public BasicShape { 256 class BasicShapeEllipse FINAL : public BasicShape {
257 public: 257 public:
258 static PassRefPtr<BasicShapeEllipse> create() { return adoptRef(new BasicSha peEllipse); } 258 static PassRefPtr<BasicShapeEllipse> create() { return adoptRef(new BasicSha peEllipse); }
259 259
260 const BasicShapeCenterCoordinate& centerX() const { return m_centerX; } 260 const BasicShapeCenterCoordinate& centerX() const { return m_centerX; }
261 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; } 261 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; }
262 const BasicShapeRadius& radiusX() const { return m_radiusX; } 262 const BasicShapeRadius& radiusX() const { return m_radiusX; }
263 const BasicShapeRadius& radiusY() const { return m_radiusY; } 263 const BasicShapeRadius& radiusY() const { return m_radiusY; }
264 float floatValueForRadiusInBox(const BasicShapeRadius&, float center, float boxWidthOrHeight) const; 264 float floatValueForRadiusInBox(const BasicShapeRadius&, float center, float boxWidthOrHeight) const;
265 265
266 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; } 266 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; }
267 void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; } 267 void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; }
268 void setRadiusX(BasicShapeRadius radiusX) { m_radiusX = radiusX; } 268 void setRadiusX(BasicShapeRadius radiusX) { m_radiusX = radiusX; }
269 void setRadiusY(BasicShapeRadius radiusY) { m_radiusY = radiusY; } 269 void setRadiusY(BasicShapeRadius radiusY) { m_radiusY = radiusY; }
270 270
271 virtual void path(Path&, const FloatRect&) OVERRIDE; 271 virtual void path(Path&, const FloatRect&) OVERRIDE;
272 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI DE; 272 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI DE;
273 virtual bool operator==(const BasicShape&) const OVERRIDE; 273 virtual bool operator==(const BasicShape&) const OVERRIDE;
274 274
275 virtual Type type() const { return BasicShapeEllipseType; } 275 virtual Type type() const OVERRIDE { return BasicShapeEllipseType; }
276 private: 276 private:
277 BasicShapeEllipse() { } 277 BasicShapeEllipse() { }
278 278
279 BasicShapeCenterCoordinate m_centerX; 279 BasicShapeCenterCoordinate m_centerX;
280 BasicShapeCenterCoordinate m_centerY; 280 BasicShapeCenterCoordinate m_centerY;
281 BasicShapeRadius m_radiusX; 281 BasicShapeRadius m_radiusX;
282 BasicShapeRadius m_radiusY; 282 BasicShapeRadius m_radiusY;
283 }; 283 };
284 284
285 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeEllipse); 285 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeEllipse);
286 286
287 class DeprecatedBasicShapeEllipse : public BasicShape { 287 class DeprecatedBasicShapeEllipse FINAL : public BasicShape {
288 public: 288 public:
289 static PassRefPtr<DeprecatedBasicShapeEllipse> create() { return adoptRef(ne w DeprecatedBasicShapeEllipse); } 289 static PassRefPtr<DeprecatedBasicShapeEllipse> create() { return adoptRef(ne w DeprecatedBasicShapeEllipse); }
290 290
291 Length centerX() const { return m_centerX; } 291 Length centerX() const { return m_centerX; }
292 Length centerY() const { return m_centerY; } 292 Length centerY() const { return m_centerY; }
293 Length radiusX() const { return m_radiusX; } 293 Length radiusX() const { return m_radiusX; }
294 Length radiusY() const { return m_radiusY; } 294 Length radiusY() const { return m_radiusY; }
295 295
296 void setCenterX(Length centerX) { m_centerX = centerX; } 296 void setCenterX(Length centerX) { m_centerX = centerX; }
297 void setCenterY(Length centerY) { m_centerY = centerY; } 297 void setCenterY(Length centerY) { m_centerY = centerY; }
298 void setRadiusX(Length radiusX) { m_radiusX = radiusX; } 298 void setRadiusX(Length radiusX) { m_radiusX = radiusX; }
299 void setRadiusY(Length radiusY) { m_radiusY = radiusY; } 299 void setRadiusY(Length radiusY) { m_radiusY = radiusY; }
300 300
301 virtual void path(Path&, const FloatRect&) OVERRIDE; 301 virtual void path(Path&, const FloatRect&) OVERRIDE;
302 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI DE; 302 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI DE;
303 virtual bool operator==(const BasicShape&) const OVERRIDE; 303 virtual bool operator==(const BasicShape&) const OVERRIDE;
304 304
305 virtual Type type() const { return DeprecatedBasicShapeEllipseType; } 305 virtual Type type() const OVERRIDE { return DeprecatedBasicShapeEllipseType; }
306 private: 306 private:
307 DeprecatedBasicShapeEllipse() { } 307 DeprecatedBasicShapeEllipse() { }
308 308
309 Length m_centerX; 309 Length m_centerX;
310 Length m_centerY; 310 Length m_centerY;
311 Length m_radiusX; 311 Length m_radiusX;
312 Length m_radiusY; 312 Length m_radiusY;
313 }; 313 };
314 314
315 DEFINE_BASICSHAPE_TYPE_CASTS(DeprecatedBasicShapeEllipse); 315 DEFINE_BASICSHAPE_TYPE_CASTS(DeprecatedBasicShapeEllipse);
316 316
317 class BasicShapePolygon : public BasicShape { 317 class BasicShapePolygon FINAL : public BasicShape {
318 public: 318 public:
319 static PassRefPtr<BasicShapePolygon> create() { return adoptRef(new BasicSha pePolygon); } 319 static PassRefPtr<BasicShapePolygon> create() { return adoptRef(new BasicSha pePolygon); }
320 320
321 const Vector<Length>& values() const { return m_values; } 321 const Vector<Length>& values() const { return m_values; }
322 Length getXAt(unsigned i) const { return m_values.at(2 * i); } 322 Length getXAt(unsigned i) const { return m_values.at(2 * i); }
323 Length getYAt(unsigned i) const { return m_values.at(2 * i + 1); } 323 Length getYAt(unsigned i) const { return m_values.at(2 * i + 1); }
324 324
325 void setWindRule(WindRule windRule) { m_windRule = windRule; } 325 void setWindRule(WindRule windRule) { m_windRule = windRule; }
326 void appendPoint(Length x, Length y) { m_values.append(x); m_values.append(y ); } 326 void appendPoint(Length x, Length y) { m_values.append(x); m_values.append(y ); }
327 327
328 virtual void path(Path&, const FloatRect&) OVERRIDE; 328 virtual void path(Path&, const FloatRect&) OVERRIDE;
329 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI DE; 329 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI DE;
330 virtual bool operator==(const BasicShape&) const OVERRIDE; 330 virtual bool operator==(const BasicShape&) const OVERRIDE;
331 331
332 virtual WindRule windRule() const { return m_windRule; } 332 virtual WindRule windRule() const OVERRIDE { return m_windRule; }
333 333
334 virtual Type type() const { return BasicShapePolygonType; } 334 virtual Type type() const OVERRIDE { return BasicShapePolygonType; }
335 private: 335 private:
336 BasicShapePolygon() 336 BasicShapePolygon()
337 : m_windRule(RULE_NONZERO) 337 : m_windRule(RULE_NONZERO)
338 { } 338 { }
339 339
340 WindRule m_windRule; 340 WindRule m_windRule;
341 Vector<Length> m_values; 341 Vector<Length> m_values;
342 }; 342 };
343 343
344 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapePolygon); 344 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapePolygon);
345 345
346 class BasicShapeInsetRectangle : public BasicShape { 346 class BasicShapeInsetRectangle FINAL : public BasicShape {
347 public: 347 public:
348 static PassRefPtr<BasicShapeInsetRectangle> create() { return adoptRef(new B asicShapeInsetRectangle); } 348 static PassRefPtr<BasicShapeInsetRectangle> create() { return adoptRef(new B asicShapeInsetRectangle); }
349 349
350 Length top() const { return m_top; } 350 Length top() const { return m_top; }
351 Length right() const { return m_right; } 351 Length right() const { return m_right; }
352 Length bottom() const { return m_bottom; } 352 Length bottom() const { return m_bottom; }
353 Length left() const { return m_left; } 353 Length left() const { return m_left; }
354 Length cornerRadiusX() const { return m_cornerRadiusX; } 354 Length cornerRadiusX() const { return m_cornerRadiusX; }
355 Length cornerRadiusY() const { return m_cornerRadiusY; } 355 Length cornerRadiusY() const { return m_cornerRadiusY; }
356 356
357 void setTop(Length top) { m_top = top; } 357 void setTop(Length top) { m_top = top; }
358 void setRight(Length right) { m_right = right; } 358 void setRight(Length right) { m_right = right; }
359 void setBottom(Length bottom) { m_bottom = bottom; } 359 void setBottom(Length bottom) { m_bottom = bottom; }
360 void setLeft(Length left) { m_left = left; } 360 void setLeft(Length left) { m_left = left; }
361 void setCornerRadiusX(Length radiusX) 361 void setCornerRadiusX(Length radiusX)
362 { 362 {
363 m_cornerRadiusX = radiusX; 363 m_cornerRadiusX = radiusX;
364 } 364 }
365 void setCornerRadiusY(Length radiusY) 365 void setCornerRadiusY(Length radiusY)
366 { 366 {
367 m_cornerRadiusY = radiusY; 367 m_cornerRadiusY = radiusY;
368 } 368 }
369 369
370 virtual void path(Path&, const FloatRect&) OVERRIDE; 370 virtual void path(Path&, const FloatRect&) OVERRIDE;
371 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI DE; 371 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI DE;
372 virtual bool operator==(const BasicShape&) const OVERRIDE; 372 virtual bool operator==(const BasicShape&) const OVERRIDE;
373 373
374 virtual Type type() const { return BasicShapeInsetRectangleType; } 374 virtual Type type() const OVERRIDE { return BasicShapeInsetRectangleType; }
375 private: 375 private:
376 BasicShapeInsetRectangle() { } 376 BasicShapeInsetRectangle() { }
377 377
378 Length m_right; 378 Length m_right;
379 Length m_top; 379 Length m_top;
380 Length m_bottom; 380 Length m_bottom;
381 Length m_left; 381 Length m_left;
382 Length m_cornerRadiusX; 382 Length m_cornerRadiusX;
383 Length m_cornerRadiusY; 383 Length m_cornerRadiusY;
384 }; 384 };
385 385
386 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeInsetRectangle); 386 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeInsetRectangle);
387 387
388 } 388 }
389 #endif 389 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/shapes/RectangleShape.h ('k') | Source/core/rendering/style/ContentData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698