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

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: 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/rendering/style/BasicShapes.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/style/BasicShapes.cpp
diff --git a/Source/core/rendering/style/BasicShapes.cpp b/Source/core/rendering/style/BasicShapes.cpp
index 157d462591a1f3ce8b95adf7700b84ba9ff21459..94d0056e10643ef5e7b256b430ed9d4876983b99 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)
« no previous file with comments | « Source/core/rendering/style/BasicShapes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698