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

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

Issue 381473006: Clean up static_cast<const toBasicFoo*> by using toBasicFoo() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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/shapes/Shape.cpp ('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 a41a1d6393c4da9196bea5aebd5eb97055d0a67c..5b2addcc1579ed4837e4761d4683449a0301d4f6 100644
--- a/Source/core/rendering/style/BasicShapes.cpp
+++ b/Source/core/rendering/style/BasicShapes.cpp
@@ -60,15 +60,13 @@ bool BasicShape::canBlend(const BasicShape* other) const
// Just polygons with same number of vertices can be animated.
if (type() == BasicShape::BasicShapePolygonType
- && (static_cast<const BasicShapePolygon*>(this)->values().size() != static_cast<const BasicShapePolygon*>(other)->values().size()
- || static_cast<const BasicShapePolygon*>(this)->windRule() != static_cast<const BasicShapePolygon*>(other)->windRule()))
+ && (toBasicShapePolygon(this)->values().size() != toBasicShapePolygon(other)->values().size()
+ || toBasicShapePolygon(this)->windRule() != toBasicShapePolygon(other)->windRule()))
return false;
// Circles with keywords for radii or center coordinates cannot be animated.
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()))
+ if (!toBasicShapeCircle(this)->radius().canBlend(toBasicShapeCircle(other)->radius()))
return false;
}
@@ -76,10 +74,8 @@ bool BasicShape::canBlend(const BasicShape* other) const
if (type() != BasicShape::BasicShapeEllipseType)
return true;
- 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()));
+ return (toBasicShapeEllipse(this)->radiusX().canBlend(toBasicShapeEllipse(other)->radiusX())
+ && toBasicShapeEllipse(this)->radiusY().canBlend(toBasicShapeEllipse(other)->radiusY()));
}
bool BasicShapeCircle::operator==(const BasicShape& o) const
@@ -120,7 +116,7 @@ void BasicShapeCircle::path(Path& path, const FloatRect& boundingBox)
PassRefPtr<BasicShape> BasicShapeCircle::blend(const BasicShape* other, double progress) const
{
ASSERT(type() == other->type());
- const BasicShapeCircle* o = static_cast<const BasicShapeCircle*>(other);
+ const BasicShapeCircle* o = toBasicShapeCircle(other);
RefPtr<BasicShapeCircle> result = BasicShapeCircle::create();
result->setCenterX(m_centerX.blend(o->centerX(), progress));
@@ -166,7 +162,7 @@ void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox)
PassRefPtr<BasicShape> BasicShapeEllipse::blend(const BasicShape* other, double progress) const
{
ASSERT(type() == other->type());
- const BasicShapeEllipse* o = static_cast<const BasicShapeEllipse*>(other);
+ const BasicShapeEllipse* o = toBasicShapeEllipse(other);
RefPtr<BasicShapeEllipse> result = BasicShapeEllipse::create();
if (m_radiusX.type() != BasicShapeRadius::Value || o->radiusX().type() != BasicShapeRadius::Value
@@ -207,7 +203,7 @@ PassRefPtr<BasicShape> BasicShapePolygon::blend(const BasicShape* other, double
{
ASSERT(other && isSameType(*other));
- const BasicShapePolygon* o = static_cast<const BasicShapePolygon*>(other);
+ const BasicShapePolygon* o = toBasicShapePolygon(other);
ASSERT(m_values.size() == o->values().size());
ASSERT(!(m_values.size() % 2));
« no previous file with comments | « Source/core/rendering/shapes/Shape.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698