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

Unified Diff: Source/core/svg/SVGUseElement.cpp

Issue 440713002: Use SVGElement as parameter for isDirectReference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: V2 Created 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGUseElement.cpp
diff --git a/Source/core/svg/SVGUseElement.cpp b/Source/core/svg/SVGUseElement.cpp
index 9add18cb5de691d856a3c36bf9374acf567075c7..f8d52943212fd9714d67c9abbe50193cd04d70b5 100644
--- a/Source/core/svg/SVGUseElement.cpp
+++ b/Source/core/svg/SVGUseElement.cpp
@@ -406,15 +406,15 @@ RenderObject* SVGUseElement::createRenderer(RenderStyle*)
return new RenderSVGTransformableContainer(this);
}
-static bool isDirectReference(const Node& node)
+static bool isDirectReference(const SVGElement& element)
{
- return isSVGPathElement(node)
- || isSVGRectElement(node)
- || isSVGCircleElement(node)
- || isSVGEllipseElement(node)
- || isSVGPolygonElement(node)
- || isSVGPolylineElement(node)
- || isSVGTextElement(node);
+ return isSVGPathElement(element)
+ || isSVGRectElement(element)
+ || isSVGCircleElement(element)
+ || isSVGEllipseElement(element)
+ || isSVGPolygonElement(element)
+ || isSVGPolylineElement(element)
+ || isSVGTextElement(element);
}
void SVGUseElement::toClipPath(Path& path)
@@ -422,15 +422,16 @@ void SVGUseElement::toClipPath(Path& path)
ASSERT(path.isEmpty());
Node* n = userAgentShadowRoot()->firstChild();
- if (!n)
+ if (!n || !n->isSVGElement())
return;
+ SVGElement& element = toSVGElement(*n);
- if (n->isSVGElement() && toSVGElement(n)->isSVGGraphicsElement()) {
- if (!isDirectReference(*n)) {
+ if (element.isSVGGraphicsElement()) {
+ if (!isDirectReference(element)) {
// Spec: Indirect references are an error (14.3.5)
document().accessSVGExtensions().reportError("Not allowed to use indirect reference in <clip-path>");
} else {
- toSVGGraphicsElement(n)->toClipPath(path);
+ toSVGGraphicsElement(element).toClipPath(path);
// FIXME: Avoid manual resolution of x/y here. Its potentially harmful.
SVGLengthContext lengthContext(this);
path.translate(FloatSize(m_x->currentValue()->value(lengthContext), m_y->currentValue()->value(lengthContext)));
@@ -442,8 +443,8 @@ void SVGUseElement::toClipPath(Path& path)
RenderObject* SVGUseElement::rendererClipChild() const
{
if (Node* n = userAgentShadowRoot()->firstChild()) {
- if (n->isSVGElement() && isDirectReference(*n))
- return toSVGElement(n)->renderer();
+ if (n->isSVGElement() && isDirectReference(toSVGElement(*n)))
+ return n->renderer();
}
return 0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698