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

Unified Diff: Source/core/rendering/svg/RenderSVGResourceClipper.cpp

Issue 23063002: Add toSVGClipPathElement(), and use it (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 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/svg/RenderSVGResourceClipper.h ('k') | Source/core/svg/SVGClipPathElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/svg/RenderSVGResourceClipper.cpp
diff --git a/Source/core/rendering/svg/RenderSVGResourceClipper.cpp b/Source/core/rendering/svg/RenderSVGResourceClipper.cpp
index 92a96dd39496417cc3831ae5ff8a3b8e389470fc..9da09f9d9f0c299df32978dd0d74385de5bcab12 100644
--- a/Source/core/rendering/svg/RenderSVGResourceClipper.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourceClipper.cpp
@@ -127,7 +127,7 @@ bool RenderSVGResourceClipper::pathOnlyClipping(GraphicsContext* context, const
}
}
// Only one visible shape/path was found. Directly continue clipping and transform the content to userspace if necessary.
- if (static_cast<SVGClipPathElement*>(node())->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
+ if (toSVGClipPathElement(node())->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
AffineTransform transform;
transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
@@ -152,7 +152,7 @@ bool RenderSVGResourceClipper::applyClippingToContext(RenderObject* object, cons
m_clipper.set(object, new ClipperData);
bool shouldCreateClipData = false;
- AffineTransform animatedLocalTransform = static_cast<SVGClipPathElement*>(node())->animatedLocalTransform();
+ AffineTransform animatedLocalTransform = toSVGClipPathElement(node())->animatedLocalTransform();
ClipperData* clipperData = m_clipper.get(object);
if (!clipperData->clipMaskImage) {
if (pathOnlyClipping(context, animatedLocalTransform, objectBoundingBox))
@@ -208,8 +208,7 @@ bool RenderSVGResourceClipper::drawContentIntoMaskImage(ClipperData* clipperData
ASSERT(maskContext);
AffineTransform maskContentTransformation;
- SVGClipPathElement* clipPath = static_cast<SVGClipPathElement*>(node());
- if (clipPath->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
+ if (toSVGClipPathElement(node())->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
maskContentTransformation.translate(objectBoundingBox.x(), objectBoundingBox.y());
maskContentTransformation.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
maskContext->concatCTM(maskContentTransformation);
@@ -277,7 +276,7 @@ void RenderSVGResourceClipper::calculateClipContentRepaintRect()
continue;
m_clipBoundaries.unite(renderer->localToParentTransform().mapRect(renderer->repaintRectInLocalCoordinates()));
}
- m_clipBoundaries = static_cast<SVGClipPathElement*>(node())->animatedLocalTransform().mapRect(m_clipBoundaries);
+ m_clipBoundaries = toSVGClipPathElement(node())->animatedLocalTransform().mapRect(m_clipBoundaries);
}
bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundingBox, const FloatPoint& nodeAtPoint)
@@ -286,7 +285,7 @@ bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin
if (!SVGRenderSupport::pointInClippingArea(this, point))
return false;
- SVGClipPathElement* clipPathElement = static_cast<SVGClipPathElement*>(node());
+ SVGClipPathElement* clipPathElement = toSVGClipPathElement(node());
if (clipPathElement->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
AffineTransform transform;
transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
@@ -320,7 +319,7 @@ FloatRect RenderSVGResourceClipper::resourceBoundingBox(RenderObject* object)
if (m_clipBoundaries.isEmpty())
calculateClipContentRepaintRect();
- if (static_cast<SVGClipPathElement*>(node())->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
+ if (toSVGClipPathElement(node())->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
FloatRect objectBoundingBox = object->objectBoundingBox();
AffineTransform transform;
transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResourceClipper.h ('k') | Source/core/svg/SVGClipPathElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698