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

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

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: Try to fix tests 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/style/BasicShapes.cpp
diff --git a/Source/core/rendering/style/BasicShapes.cpp b/Source/core/rendering/style/BasicShapes.cpp
index ecff010c7263533d657eb695356ba86ac5b7e929..ca2d645a5dc2cf3a352e88ec85484e64406a4fd3 100644
--- a/Source/core/rendering/style/BasicShapes.cpp
+++ b/Source/core/rendering/style/BasicShapes.cpp
@@ -31,12 +31,30 @@
#include "core/rendering/style/BasicShapes.h"
#include "core/css/BasicShapeFunctions.h"
+#include "platform/CalculationValue.h"
#include "platform/LengthFunctions.h"
#include "platform/geometry/FloatRect.h"
#include "platform/graphics/Path.h"
namespace WebCore {
+void BasicShapeCenterCoordinate::updateComputedLength()
+{
+ if (m_direction == TopLeft) {
+ m_computedLength = m_length.isUndefined() ? Length(0, Fixed) : m_length;
+ return;
+ }
+ if (m_length.isUndefined()) {
+ m_computedLength = Length(100, Percent);
+ return;
+ }
+
+ OwnPtr<CalcExpressionLength> lhs = adoptPtr(new CalcExpressionLength(Length(100, Percent)));
+ OwnPtr<CalcExpressionLength> rhs = adoptPtr(new CalcExpressionLength(m_length));
+ OwnPtr<CalcExpressionBinaryOperation> op = adoptPtr(new CalcExpressionBinaryOperation(lhs.release(), rhs.release(), CalcSubtract));
+ m_computedLength = Length(CalculationValue::create(op.release(), ValueRangeAll));
+}
+
bool BasicShape::canBlend(const BasicShape* other) const
{
// FIXME: Support animations between different shapes in the future.
@@ -53,9 +71,7 @@ bool BasicShape::canBlend(const BasicShape* other) const
if (type() == BasicShape::BasicShapeCircleType) {
const BasicShapeCircle* thisCircle = static_cast<const BasicShapeCircle*>(this);
const BasicShapeCircle* otherCircle = static_cast<const BasicShapeCircle*>(other);
- if (!thisCircle->radius().canBlend(otherCircle->radius())
- || !thisCircle->centerX().canBlend(otherCircle->centerX())
- || !thisCircle->centerY().canBlend(otherCircle->centerY()))
+ if (!thisCircle->radius().canBlend(otherCircle->radius()))
return false;
}
@@ -66,9 +82,7 @@ bool BasicShape::canBlend(const BasicShape* other) const
const BasicShapeEllipse* thisEllipse = static_cast<const BasicShapeEllipse*>(this);
const BasicShapeEllipse* otherEllipse = static_cast<const BasicShapeEllipse*>(other);
return (thisEllipse->radiusX().canBlend(otherEllipse->radiusX())
- && thisEllipse->radiusY().canBlend(otherEllipse->radiusY())
- && thisEllipse->centerX().canBlend(otherEllipse->centerX())
- && thisEllipse->centerY().canBlend(otherEllipse->centerY()));
+ && thisEllipse->radiusY().canBlend(otherEllipse->radiusY()));
}
void BasicShapeRectangle::path(Path& path, const FloatRect& boundingBox)
@@ -375,4 +389,5 @@ bool BasicShapeInsetRectangle::operator==(const BasicShape& o) const
const BasicShapeInsetRectangle& other = toBasicShapeInsetRectangle(o);
return m_right == other.m_right && m_top == other.m_top && m_bottom == other.m_bottom && m_left == other.m_left && m_cornerRadiusX == other.m_cornerRadiusX && m_cornerRadiusY == other.m_cornerRadiusY;
}
+
Bear Travis 2014/01/23 22:04:42 Extra newline.
}
« Source/core/rendering/style/BasicShapes.h ('K') | « Source/core/rendering/style/BasicShapes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698