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

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
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..3f5c2f49bad809c4ccd303985faa0f4a234fc0f1 100644
--- a/third_party/WebKit/Source/core/svg/SVGUseElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGUseElement.cpp
@@ -482,7 +482,7 @@ void SVGUseElement::toClipPath(Path& path) const
{
ASSERT(path.isEmpty());
- const SVGGraphicsElement* element = targetGraphicsElementForClipping();
+ const SVGGraphicsElement* element = visibleTargetGraphicsElementForClipping();
if (!element || !element->layoutObject())
fs 2016/04/27 14:14:40 You should move the second part of this condition
hyunjunekim2 2016/04/29 12:59:09 Done. Moved to visibleTargetGraphicsElementForClip
return;
@@ -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,6 +507,10 @@ SVGGraphicsElement* SVGUseElement::targetGraphicsElementForClipping() const
if (!element.isSVGGraphicsElement())
return nullptr;
+ const ComputedStyle* style = element.layoutObject() ? element.layoutObject()->style() : nullptr;
+ 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."

Powered by Google App Engine
This is Rietveld 408576698