Index: Source/core/rendering/style/BasicShapes.h |
diff --git a/Source/core/rendering/style/BasicShapes.h b/Source/core/rendering/style/BasicShapes.h |
index 683ec381fcf1d5c69ceb76f214ac4e493e59167f..1ac84ca9a62f5f8599a56cee5c11cbad13fe6f7a 100644 |
--- a/Source/core/rendering/style/BasicShapes.h |
+++ b/Source/core/rendering/style/BasicShapes.h |
@@ -129,39 +129,48 @@ DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeRectangle); |
class BasicShapeCenterCoordinate { |
public: |
- enum Keyword { |
- None, |
- Top, |
- Right, |
- Bottom, |
- Left |
+ enum Direction { |
+ TopLeft, |
+ BottomRight |
}; |
- 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; } |
+ BasicShapeCenterCoordinate() |
+ : m_direction(TopLeft) |
+ , m_length(Undefined) |
+ { |
+ updateComputedLength(); |
+ } |
- Keyword keyword() const { return m_keyword; } |
- const Length& length() const { return m_length; } |
+ BasicShapeCenterCoordinate(Direction direction, Length length) |
+ : m_direction(direction) |
+ , m_length(length) |
+ { |
+ updateComputedLength(); |
+ } |
- bool canBlend(const BasicShapeCenterCoordinate& other) const |
+ BasicShapeCenterCoordinate(const BasicShapeCenterCoordinate& other) |
+ : m_direction(other.direction()) |
+ , m_length(other.length()) |
+ , m_computedLength(other.m_computedLength) |
{ |
- // FIXME determine how to interpolate between keywords. See issue 330248. |
- return m_keyword == None && other.keyword() == None; |
} |
+ bool operator==(const BasicShapeCenterCoordinate& other) const { return m_direction == other.m_direction && m_length == other.m_length && m_computedLength == other.m_computedLength; } |
+ |
+ Direction direction() const { return m_direction; } |
+ const Length& length() const { return m_length; } |
+ const Length& computedLength() const { return m_computedLength; } |
+ |
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)); |
+ return BasicShapeCenterCoordinate(TopLeft, m_computedLength.blend(other.m_computedLength, progress, ValueRangeAll)); |
} |
private: |
- Keyword m_keyword; |
+ Direction m_direction; |
Length m_length; |
+ Length m_computedLength; |
+ |
+ void updateComputedLength(); |
}; |
class BasicShapeRadius { |