Index: third_party/WebKit/Source/core/svg/SVGUseElement.cpp |
diff --git a/third_party/WebKit/Source/core/svg/SVGUseElement.cpp b/third_party/WebKit/Source/core/svg/SVGUseElement.cpp |
index 195d5f7d130ff011e876479e8236841c07a110b3..017d880a15181b5d25ce740295e63620fefffc00 100644 |
--- a/third_party/WebKit/Source/core/svg/SVGUseElement.cpp |
+++ b/third_party/WebKit/Source/core/svg/SVGUseElement.cpp |
@@ -482,9 +482,9 @@ void SVGUseElement::toClipPath(Path& path) const |
{ |
ASSERT(path.isEmpty()); |
- const SVGGraphicsElement* element = targetGraphicsElementForClipping(); |
+ const SVGGraphicsElement* element = visibleTargetGraphicsElementForClipping(); |
- if (!element || !element->layoutObject()) |
+ if (!element) |
return; |
if (element->isSVGGeometryElement()) { |
@@ -496,7 +496,7 @@ void SVGUseElement::toClipPath(Path& path) const |
} |
} |
-SVGGraphicsElement* SVGUseElement::targetGraphicsElementForClipping() const |
+SVGGraphicsElement* SVGUseElement::visibleTargetGraphicsElementForClipping() const |
{ |
Node* n = userAgentShadowRoot()->firstChild(); |
if (!n || !n->isSVGElement()) |
@@ -507,13 +507,19 @@ SVGGraphicsElement* SVGUseElement::targetGraphicsElementForClipping() const |
if (!element.isSVGGraphicsElement()) |
return nullptr; |
+ if (!element.layoutObject()) |
+ return nullptr; |
+ |
+ const ComputedStyle* style = element.layoutObject()->style(); |
+ if (!style || style->visibility() != VISIBLE) |
+ return nullptr; |
+ |
// Spec: "If a <use> element is a child of a clipPath element, it must directly |
// reference <path>, <text> or basic shapes elements. Indirect references are an |
// error and the clipPath element must be ignored." |
// http://dev.w3.org/fxtf/css-masking-1/#the-clip-path |
if (!isDirectReference(element)) { |
// Spec: Indirect references are an error (14.3.5) |
- document().accessSVGExtensions().reportError("Not allowed to use indirect reference in <clip-path>"); |
return nullptr; |
} |