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

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

Issue 2706583002: Fix the way <title> is read under <use> shadow tree (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | 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/SVGElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGElement.cpp b/third_party/WebKit/Source/core/svg/SVGElement.cpp
index ecc8a6083c73aa9a31e3ac08b3ce9b0808453def..683c6475ddd1b53bbd85b76a62862a3aeaa3e1ec 100644
--- a/third_party/WebKit/Source/core/svg/SVGElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGElement.cpp
@@ -203,11 +203,18 @@ String SVGElement::title() const {
}
// If we aren't an instance in a <use> or the <use> title was not found, then
- // find the first <title> child of this element.
- // If a title child was found, return the text contents.
+ // find the first <title> child of this element and return it's text contents.
fs 2017/02/24 09:06:18 Nit: its
if (Element* titleElement = Traversal<SVGTitleElement>::firstChild(*this))
return titleElement->innerText();
-
+ // Else we traverse potential <use> shadow tree to see if it has any <title>
+ // descendants using FlatTreeTraversal.
fs 2017/02/24 09:06:18 I don't think we want to look at _all_ descendants
mrunal 2017/02/25 00:31:18 The example in the bug uses <title> which is neste
fs 2017/02/27 08:57:08 Yes, per the referenced document [1].
+ Node* node = FlatTreeTraversal::firstChild(*this);
+ while (node) {
+ if (isSVGTitleElement(node)) {
+ return toElement(node)->innerText();
+ }
+ node = FlatTreeTraversal::next(*node, this);
+ }
// Otherwise return a null/empty string.
return String();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698