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

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

Issue 103413006: Implement parsing of the new ellipse shape syntax. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase after CSSParser rename 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
« no previous file with comments | « Source/core/rendering/shapes/Shape.cpp ('k') | Source/core/rendering/style/BasicShapes.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 class FloatRect; 42 class FloatRect;
43 class Path; 43 class Path;
44 44
45 class BasicShape : public RefCounted<BasicShape> { 45 class BasicShape : public RefCounted<BasicShape> {
46 public: 46 public:
47 virtual ~BasicShape() { } 47 virtual ~BasicShape() { }
48 48
49 enum Type { 49 enum Type {
50 BasicShapeRectangleType, 50 BasicShapeRectangleType,
51 DeprecatedBasicShapeCircleType, 51 DeprecatedBasicShapeCircleType,
52 DeprecatedBasicShapeEllipseType,
52 BasicShapeEllipseType, 53 BasicShapeEllipseType,
53 BasicShapePolygonType, 54 BasicShapePolygonType,
54 BasicShapeInsetRectangleType, 55 BasicShapeInsetRectangleType,
55 BasicShapeCircleType 56 BasicShapeCircleType
56 }; 57 };
57 58
58 bool canBlend(const BasicShape*) const; 59 bool canBlend(const BasicShape*) const;
59 bool isSameType(const BasicShape& other) const { return type() == other.type (); } 60 bool isSameType(const BasicShape& other) const { return type() == other.type (); }
60 61
61 virtual void path(Path&, const FloatRect&) = 0; 62 virtual void path(Path&, const FloatRect&) = 0;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 Length m_centerY; 236 Length m_centerY;
236 Length m_radius; 237 Length m_radius;
237 }; 238 };
238 239
239 DEFINE_BASICSHAPE_TYPE_CASTS(DeprecatedBasicShapeCircle); 240 DEFINE_BASICSHAPE_TYPE_CASTS(DeprecatedBasicShapeCircle);
240 241
241 class BasicShapeEllipse : public BasicShape { 242 class BasicShapeEllipse : public BasicShape {
242 public: 243 public:
243 static PassRefPtr<BasicShapeEllipse> create() { return adoptRef(new BasicSha peEllipse); } 244 static PassRefPtr<BasicShapeEllipse> create() { return adoptRef(new BasicSha peEllipse); }
244 245
246 const BasicShapeCenterCoordinate& centerX() const { return m_centerX; }
247 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; }
248 const BasicShapeRadius& radiusX() const { return m_radiusX; }
249 const BasicShapeRadius& radiusY() const { return m_radiusY; }
250
251 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; }
252 void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; }
253 void setRadiusX(BasicShapeRadius radiusX) { m_radiusX = radiusX; }
254 void setRadiusY(BasicShapeRadius radiusY) { m_radiusY = radiusY; }
255
256 virtual void path(Path&, const FloatRect&) OVERRIDE;
257 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI DE;
258 virtual bool operator==(const BasicShape&) const OVERRIDE;
259
260 virtual Type type() const { return BasicShapeEllipseType; }
261 private:
262 BasicShapeEllipse() { }
263
264 BasicShapeCenterCoordinate m_centerX;
265 BasicShapeCenterCoordinate m_centerY;
266 BasicShapeRadius m_radiusX;
267 BasicShapeRadius m_radiusY;
268 };
269
270 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeEllipse);
271
272 class DeprecatedBasicShapeEllipse : public BasicShape {
273 public:
274 static PassRefPtr<DeprecatedBasicShapeEllipse> create() { return adoptRef(ne w DeprecatedBasicShapeEllipse); }
275
245 Length centerX() const { return m_centerX; } 276 Length centerX() const { return m_centerX; }
246 Length centerY() const { return m_centerY; } 277 Length centerY() const { return m_centerY; }
247 Length radiusX() const { return m_radiusX; } 278 Length radiusX() const { return m_radiusX; }
248 Length radiusY() const { return m_radiusY; } 279 Length radiusY() const { return m_radiusY; }
249 280
250 void setCenterX(Length centerX) { m_centerX = centerX; } 281 void setCenterX(Length centerX) { m_centerX = centerX; }
251 void setCenterY(Length centerY) { m_centerY = centerY; } 282 void setCenterY(Length centerY) { m_centerY = centerY; }
252 void setRadiusX(Length radiusX) { m_radiusX = radiusX; } 283 void setRadiusX(Length radiusX) { m_radiusX = radiusX; }
253 void setRadiusY(Length radiusY) { m_radiusY = radiusY; } 284 void setRadiusY(Length radiusY) { m_radiusY = radiusY; }
254 285
255 virtual void path(Path&, const FloatRect&) OVERRIDE; 286 virtual void path(Path&, const FloatRect&) OVERRIDE;
256 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI DE; 287 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI DE;
257 virtual bool operator==(const BasicShape&) const OVERRIDE; 288 virtual bool operator==(const BasicShape&) const OVERRIDE;
258 289
259 virtual Type type() const { return BasicShapeEllipseType; } 290 virtual Type type() const { return DeprecatedBasicShapeEllipseType; }
260 private: 291 private:
261 BasicShapeEllipse() { } 292 DeprecatedBasicShapeEllipse() { }
262 293
263 Length m_centerX; 294 Length m_centerX;
264 Length m_centerY; 295 Length m_centerY;
265 Length m_radiusX; 296 Length m_radiusX;
266 Length m_radiusY; 297 Length m_radiusY;
267 }; 298 };
268 299
269 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeEllipse); 300 DEFINE_BASICSHAPE_TYPE_CASTS(DeprecatedBasicShapeEllipse);
270 301
271 class BasicShapePolygon : public BasicShape { 302 class BasicShapePolygon : public BasicShape {
272 public: 303 public:
273 static PassRefPtr<BasicShapePolygon> create() { return adoptRef(new BasicSha pePolygon); } 304 static PassRefPtr<BasicShapePolygon> create() { return adoptRef(new BasicSha pePolygon); }
274 305
275 const Vector<Length>& values() const { return m_values; } 306 const Vector<Length>& values() const { return m_values; }
276 Length getXAt(unsigned i) const { return m_values.at(2 * i); } 307 Length getXAt(unsigned i) const { return m_values.at(2 * i); }
277 Length getYAt(unsigned i) const { return m_values.at(2 * i + 1); } 308 Length getYAt(unsigned i) const { return m_values.at(2 * i + 1); }
278 309
279 void setWindRule(WindRule windRule) { m_windRule = windRule; } 310 void setWindRule(WindRule windRule) { m_windRule = windRule; }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 Length m_bottom; 365 Length m_bottom;
335 Length m_left; 366 Length m_left;
336 Length m_cornerRadiusX; 367 Length m_cornerRadiusX;
337 Length m_cornerRadiusY; 368 Length m_cornerRadiusY;
338 }; 369 };
339 370
340 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeInsetRectangle); 371 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeInsetRectangle);
341 372
342 } 373 }
343 #endif 374 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/shapes/Shape.cpp ('k') | Source/core/rendering/style/BasicShapes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698