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

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

Issue 1839973003: If the <use> is hidden and the child of it is visible, should clip the non-resource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « third_party/WebKit/Source/core/svg/SVGUseElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGUseElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698