| Index: Source/core/rendering/style/BasicShapes.h
|
| diff --git a/Source/core/rendering/style/BasicShapes.h b/Source/core/rendering/style/BasicShapes.h
|
| index 254089c2e5e52fd3748549bfd6d98b793b61a2f4..109f8fee9eabf031ac28a01524d597913ebef260 100644
|
| --- a/Source/core/rendering/style/BasicShapes.h
|
| +++ b/Source/core/rendering/style/BasicShapes.h
|
| @@ -47,11 +47,12 @@ public:
|
| virtual ~BasicShape() { }
|
|
|
| enum Type {
|
| - BasicShapeRectangleType = 1,
|
| - BasicShapeCircleType = 2,
|
| - BasicShapeEllipseType = 3,
|
| - BasicShapePolygonType = 4,
|
| - BasicShapeInsetRectangleType = 5
|
| + BasicShapeRectangleType,
|
| + DeprecatedBasicShapeCircleType,
|
| + BasicShapeEllipseType,
|
| + BasicShapePolygonType,
|
| + BasicShapeInsetRectangleType,
|
| + BasicShapeCircleType
|
| };
|
|
|
| bool canBlend(const BasicShape*) const;
|
| @@ -122,10 +123,98 @@ private:
|
|
|
| DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeRectangle);
|
|
|
| +class BasicShapeCenterCoordinate {
|
| +public:
|
| + enum Keyword {
|
| + None,
|
| + Top,
|
| + Right,
|
| + Bottom,
|
| + Left
|
| + };
|
| + BasicShapeCenterCoordinate() : m_keyword(None), m_length(Undefined) { }
|
| + explicit BasicShapeCenterCoordinate(Length length) : m_keyword(None), m_length(length) { }
|
| + BasicShapeCenterCoordinate(Keyword keyword, Length length) : m_keyword(keyword), m_length(length) { }
|
| + BasicShapeCenterCoordinate(const BasicShapeCenterCoordinate& other) : m_keyword(other.keyword()), m_length(other.length()) { }
|
| + bool operator==(const BasicShapeCenterCoordinate& other) const { return m_keyword == other.m_keyword && m_length == other.m_length; }
|
| +
|
| + Keyword keyword() const { return m_keyword; }
|
| + const Length& length() const { return m_length; }
|
| +
|
| + BasicShapeCenterCoordinate blend(const BasicShapeCenterCoordinate& other, double progress) const
|
| + {
|
| + if (m_keyword != None || other.keyword() != None)
|
| + return BasicShapeCenterCoordinate(other);
|
| +
|
| + return BasicShapeCenterCoordinate(m_length.blend(other.length(), progress, ValueRangeAll));
|
| + }
|
| +
|
| +private:
|
| + Keyword m_keyword;
|
| + Length m_length;
|
| +};
|
| +
|
| +class BasicShapeRadius {
|
| +public:
|
| + enum Type {
|
| + Value,
|
| + ClosestSide,
|
| + FarthestSide
|
| + };
|
| + BasicShapeRadius() : m_value(Undefined), m_type(ClosestSide) { }
|
| + explicit BasicShapeRadius(Length v) : m_value(v), m_type(Value) { }
|
| + explicit BasicShapeRadius(Type t) : m_value(Undefined), m_type(t) { }
|
| + BasicShapeRadius(const BasicShapeRadius& other) : m_value(other.value()), m_type(other.type()) { }
|
| + bool operator==(const BasicShapeRadius& other) const { return m_type == other.m_type && m_value == other.m_value; }
|
| +
|
| + const Length& value() const { return m_value; }
|
| + Type type() const { return m_type; }
|
| +
|
| + BasicShapeRadius blend(const BasicShapeRadius& other, double progress) const
|
| + {
|
| + if (m_type != Value || other.type() != Value)
|
| + return BasicShapeRadius(other);
|
| +
|
| + return BasicShapeRadius(m_value.blend(other.value(), progress, ValueRangeAll));
|
| + }
|
| +
|
| +private:
|
| + Length m_value;
|
| + Type m_type;
|
| +
|
| +};
|
| +
|
| class BasicShapeCircle : public BasicShape {
|
| public:
|
| static PassRefPtr<BasicShapeCircle> create() { return adoptRef(new BasicShapeCircle); }
|
|
|
| + const BasicShapeCenterCoordinate& centerX() const { return m_centerX; }
|
| + const BasicShapeCenterCoordinate& centerY() const { return m_centerY; }
|
| + const BasicShapeRadius& radius() const { return m_radius; }
|
| +
|
| + void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; }
|
| + void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; }
|
| + void setRadius(BasicShapeRadius radius) { m_radius = radius; }
|
| +
|
| + virtual void path(Path&, const FloatRect&) OVERRIDE;
|
| + virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
|
| + virtual bool operator==(const BasicShape&) const OVERRIDE;
|
| +
|
| + virtual Type type() const { return BasicShapeCircleType; }
|
| +private:
|
| + BasicShapeCircle() { }
|
| +
|
| + BasicShapeCenterCoordinate m_centerX;
|
| + BasicShapeCenterCoordinate m_centerY;
|
| + BasicShapeRadius m_radius;
|
| +};
|
| +
|
| +DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeCircle);
|
| +
|
| +class DeprecatedBasicShapeCircle : public BasicShape {
|
| +public:
|
| + static PassRefPtr<DeprecatedBasicShapeCircle> create() { return adoptRef(new DeprecatedBasicShapeCircle); }
|
| +
|
| Length centerX() const { return m_centerX; }
|
| Length centerY() const { return m_centerY; }
|
| Length radius() const { return m_radius; }
|
| @@ -138,16 +227,16 @@ public:
|
| virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
|
| virtual bool operator==(const BasicShape&) const OVERRIDE;
|
|
|
| - virtual Type type() const { return BasicShapeCircleType; }
|
| + virtual Type type() const { return DeprecatedBasicShapeCircleType; }
|
| private:
|
| - BasicShapeCircle() { }
|
| + DeprecatedBasicShapeCircle() { }
|
|
|
| Length m_centerX;
|
| Length m_centerY;
|
| Length m_radius;
|
| };
|
|
|
| -DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeCircle);
|
| +DEFINE_BASICSHAPE_TYPE_CASTS(DeprecatedBasicShapeCircle);
|
|
|
| class BasicShapeEllipse : public BasicShape {
|
| public:
|
|
|