Index: Source/core/rendering/style/BasicShapes.cpp |
diff --git a/Source/core/rendering/style/BasicShapes.cpp b/Source/core/rendering/style/BasicShapes.cpp |
index 1eed605f29108d86c3f8350de9b9eb4cbe952961..4a8700aca304c31df6775419d65833f6b93ede92 100644 |
--- a/Source/core/rendering/style/BasicShapes.cpp |
+++ b/Source/core/rendering/style/BasicShapes.cpp |
@@ -82,7 +82,7 @@ PassRefPtr<BasicShape> BasicShapeRectangle::blend(const BasicShape* other, doubl |
return result.release(); |
} |
-void BasicShapeCircle::path(Path& path, const FloatRect& boundingBox) |
+void DeprecatedBasicShapeCircle::path(Path& path, const FloatRect& boundingBox) |
{ |
ASSERT(path.isEmpty()); |
float diagonal = sqrtf((boundingBox.width() * boundingBox.width() + boundingBox.height() * boundingBox.height()) / 2); |
@@ -97,19 +97,61 @@ void BasicShapeCircle::path(Path& path, const FloatRect& boundingBox) |
)); |
} |
-PassRefPtr<BasicShape> BasicShapeCircle::blend(const BasicShape* other, double progress) const |
+PassRefPtr<BasicShape> DeprecatedBasicShapeCircle::blend(const BasicShape* other, double progress) const |
{ |
ASSERT(type() == other->type()); |
- const BasicShapeCircle* o = static_cast<const BasicShapeCircle*>(other); |
- RefPtr<BasicShapeCircle> result = BasicShapeCircle::create(); |
+ const DeprecatedBasicShapeCircle* o = static_cast<const DeprecatedBasicShapeCircle*>(other); |
+ RefPtr<DeprecatedBasicShapeCircle> result = DeprecatedBasicShapeCircle::create(); |
result->setCenterX(m_centerX.blend(o->centerX(), progress, ValueRangeAll)); |
result->setCenterY(m_centerY.blend(o->centerY(), progress, ValueRangeAll)); |
result->setRadius(m_radius.blend(o->radius(), progress, ValueRangeNonNegative)); |
return result.release(); |
} |
-void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox) |
+void BasicShapeCircle::path(Path& path, const FloatRect& boundingBox) |
+{ |
+ ASSERT(path.isEmpty()); |
+ // FIXME Complete implementation of path. Bug 124619. |
bemjb
2013/12/07 00:05:32
Again, replace webkit bug with Blink bug #.
|
+ // Compute closest-side and farthest-side from boundingBox. |
+ // Compute top, left, bottom, right from boundingBox. |
+ if (m_radius.type() != BasicShapeRadius::Value) |
+ return; |
+ if (m_centerX.keyword() != BasicShapeCenterCoordinate::None || m_centerY.keyword() != BasicShapeCenterCoordinate::None) |
+ return; |
+ |
+ float diagonal = sqrtf((boundingBox.width() * boundingBox.width() + boundingBox.height() * boundingBox.height()) / 2); |
+ float centerX = floatValueForLength(m_centerX.length(), boundingBox.width()); |
+ float centerY = floatValueForLength(m_centerY.length(), boundingBox.height()); |
+ float radius = floatValueForLength(m_radius.value(), diagonal); |
+ path.addEllipse(FloatRect( |
+ centerX - radius + boundingBox.x(), |
+ centerY - radius + boundingBox.y(), |
+ radius * 2, |
+ radius * 2 |
+ )); |
+} |
+ |
+PassRefPtr<BasicShape> BasicShapeCircle::blend(const BasicShape* other, double progress) const |
+{ |
+ ASSERT(type() == other->type()); |
+ const BasicShapeCircle* o = static_cast<const BasicShapeCircle*>(other); |
+ RefPtr<BasicShapeCircle> result = BasicShapeCircle::create(); |
+ |
+ if (m_radius.type() != BasicShapeRadius::Value || o->radius().type() != BasicShapeRadius::Value) { |
+ result->setCenterX(o->centerX()); |
+ result->setCenterY(o->centerY()); |
+ result->setRadius(o->radius()); |
+ return result; |
+ } |
+ |
+ result->setCenterX(m_centerX.blend(o->centerX(), progress)); |
+ result->setCenterY(m_centerY.blend(o->centerY(), progress)); |
+ result->setRadius(m_radius.blend(o->radius(), progress)); |
+ return result.release(); |
+} |
+ |
+void DeprecatedBasicShapeEllipse::path(Path& path, const FloatRect& boundingBox) |
{ |
ASSERT(path.isEmpty()); |
float centerX = floatValueForLength(m_centerX, boundingBox.width()); |
@@ -124,12 +166,12 @@ void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox) |
)); |
} |
-PassRefPtr<BasicShape> BasicShapeEllipse::blend(const BasicShape* other, double progress) const |
+PassRefPtr<BasicShape> DeprecatedBasicShapeEllipse::blend(const BasicShape* other, double progress) const |
{ |
ASSERT(type() == other->type()); |
- const BasicShapeEllipse* o = static_cast<const BasicShapeEllipse*>(other); |
- RefPtr<BasicShapeEllipse> result = BasicShapeEllipse::create(); |
+ const DeprecatedBasicShapeEllipse* o = static_cast<const DeprecatedBasicShapeEllipse*>(other); |
+ RefPtr<DeprecatedBasicShapeEllipse> result = DeprecatedBasicShapeEllipse::create(); |
result->setCenterX(m_centerX.blend(o->centerX(), progress, ValueRangeAll)); |
result->setCenterY(m_centerY.blend(o->centerY(), progress, ValueRangeAll)); |
result->setRadiusX(m_radiusX.blend(o->radiusX(), progress, ValueRangeNonNegative)); |
@@ -137,6 +179,52 @@ PassRefPtr<BasicShape> BasicShapeEllipse::blend(const BasicShape* other, double |
return result.release(); |
} |
+void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox) |
+{ |
+ ASSERT(path.isEmpty()); |
+ // FIXME Complete implementation of path. Bug 124619. |
bemjb
2013/12/07 00:05:32
Ditto.
|
+ // Compute closest-side and farthest-side from boundingBox. |
+ // Compute top, left, bottom, right from boundingBox. |
+ if (m_radiusX.type() != BasicShapeRadius::Value || m_radiusY.type() != BasicShapeRadius::Value) |
+ return; |
+ if (m_centerX.keyword() != BasicShapeCenterCoordinate::None || m_centerY.keyword() != BasicShapeCenterCoordinate::None) |
+ return; |
+ |
+ float diagonal = sqrtf((boundingBox.width() * boundingBox.width() + boundingBox.height() * boundingBox.height()) / 2); |
+ float centerX = floatValueForLength(m_centerX.length(), boundingBox.width()); |
+ float centerY = floatValueForLength(m_centerY.length(), boundingBox.height()); |
+ float radiusX = floatValueForLength(m_radiusX.value(), diagonal); |
+ float radiusY = floatValueForLength(m_radiusY.value(), diagonal); |
+ path.addEllipse(FloatRect( |
+ centerX - radiusX + boundingBox.x(), |
+ centerY - radiusY + boundingBox.y(), |
+ radiusX * 2, |
+ radiusY * 2 |
+ )); |
+} |
+ |
+PassRefPtr<BasicShape> BasicShapeEllipse::blend(const BasicShape* other, double progress) const |
+{ |
+ ASSERT(type() == other->type()); |
+ const BasicShapeEllipse* o = static_cast<const BasicShapeEllipse*>(other); |
+ RefPtr<BasicShapeEllipse> result = BasicShapeEllipse::create(); |
+ |
+ if (m_radiusX.type() != BasicShapeRadius::Value || o->radiusX().type() != BasicShapeRadius::Value |
+ || m_radiusY.type() != BasicShapeRadius::Value || o->radiusY().type() != BasicShapeRadius::Value) { |
+ result->setCenterX(o->centerX()); |
+ result->setCenterY(o->centerY()); |
+ result->setRadiusX(o->radiusX()); |
+ result->setRadiusY(o->radiusY()); |
+ return result; |
+ } |
+ |
+ result->setCenterX(m_centerX.blend(o->centerX(), progress)); |
+ result->setCenterY(m_centerY.blend(o->centerY(), progress)); |
+ result->setRadiusX(m_radiusX.blend(o->radiusX(), progress)); |
+ result->setRadiusY(m_radiusY.blend(o->radiusY(), progress)); |
+ return result.release(); |
+} |
+ |
void BasicShapePolygon::path(Path& path, const FloatRect& boundingBox) |
{ |
ASSERT(path.isEmpty()); |