Index: Source/core/svg/SVGUseElement.cpp |
diff --git a/Source/core/svg/SVGUseElement.cpp b/Source/core/svg/SVGUseElement.cpp |
index e7cc3c9764d4a14e751ec64036114680d44ae057..d00a57c18045302a5014855237afa858b6c65336 100644 |
--- a/Source/core/svg/SVGUseElement.cpp |
+++ b/Source/core/svg/SVGUseElement.cpp |
@@ -440,35 +440,28 @@ static bool isDirectReference(const SVGElement& element) |
|| isSVGTextElement(element); |
} |
-void SVGUseElement::toClipPath(Path& path) |
+ |
+ |
+SVGGeometryElement* SVGUseElement::layoutObjectClipChild(Path& path) const |
{ |
ASSERT(path.isEmpty()); |
- Node* n = userAgentShadowRoot()->firstChild(); |
- if (!n || !n->isSVGElement()) |
- return; |
- SVGElement& element = toSVGElement(*n); |
- |
- if (element.isSVGGraphicsElement()) { |
- if (!isDirectReference(element)) { |
+ if (Node* n = userAgentShadowRoot()->firstChild()) { |
+ if (n->isSVGElement() && isDirectReference(toSVGElement(*n))) { |
+ SVGElement* element = toSVGElement(n); |
+ if (element->isSVGGeometryElement()) { |
+ toSVGGeometryElement(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))); |
+ path.transform(calculateAnimatedLocalTransform()); |
+ return toSVGGeometryElement(element); |
+ } |
+ } else { |
// Spec: Indirect references are an error (14.3.5) |
document().accessSVGExtensions().reportError("Not allowed to use indirect reference in <clip-path>"); |
- } else { |
- 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))); |
- path.transform(calculateAnimatedLocalTransform()); |
} |
} |
-} |
- |
-LayoutObject* SVGUseElement::layoutObjectClipChild() const |
-{ |
- if (Node* n = userAgentShadowRoot()->firstChild()) { |
- if (n->isSVGElement() && isDirectReference(toSVGElement(*n))) |
- return n->layoutObject(); |
- } |
return nullptr; |
} |