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

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..d5146e11e4d921aa0015af1fdc4bb6e40051ac04 100644
--- a/third_party/WebKit/Source/core/svg/SVGUseElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGUseElement.cpp
@@ -478,6 +478,21 @@ static bool isDirectReference(const SVGElement& element)
|| isSVGTextElement(element);
}
+bool SVGUseElement::isVisibleGraphicsElementForClipping()
+{
+ Node* n = userAgentShadowRoot()->firstChild();
fs 2016/04/19 10:17:27 This should probably just be using targetGraphicsE
hyunjunekim2 2016/04/27 12:18:40 Merged this function. But occurred to console erro
fs 2016/04/27 14:14:39 Personally I'd be fine with just removing this rep
hyunjunekim2 2016/04/29 12:59:08 Done. Remove it.
+ if (!n || !n->isSVGElement())
+ return false;
+
+ SVGElement& element = toSVGElement(*n);
+
+ const ComputedStyle* style = element.layoutObject() ? element.layoutObject()->style() : nullptr;
+ if (style && style->visibility() != VISIBLE)
+ return false;
+
+ return true;
+}
+
void SVGUseElement::toClipPath(Path& path) const
{
ASSERT(path.isEmpty());
@@ -487,6 +502,10 @@ void SVGUseElement::toClipPath(Path& path) const
if (!element || !element->layoutObject())
return;
+ const ComputedStyle* style = element->layoutObject() ? element->layoutObject()->style() : nullptr;
fs 2016/04/19 10:17:27 element->layoutObject() has already been null-chec
hyunjunekim2 2016/04/27 12:18:40 Done.
+ if (style && style->visibility() != VISIBLE)
fs 2016/04/19 10:17:27 This should be: !style || style->visibility() != V
hyunjunekim2 2016/04/27 12:18:40 Done.
+ return;
+
if (element->isSVGGeometryElement()) {
toSVGGeometryElement(*element).toClipPath(path);
// FIXME: Avoid manual resolution of x/y here. Its potentially harmful.

Powered by Google App Engine
This is Rietveld 408576698