Chromium Code Reviews| 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(); |
| } |