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

Unified Diff: Source/core/rendering/style/BasicShapes.h

Issue 144373002: [CSS Shapes] Basic shapes' computed position should be a horizontal and vertical offset (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add FAIL test for intermediate result Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/BasicShapeFunctions.cpp ('k') | Source/core/rendering/style/BasicShapes.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « Source/core/css/BasicShapeFunctions.cpp ('k') | Source/core/rendering/style/BasicShapes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698