Chromium Code Reviews| 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 89e88c003deed519385b85049414dd464db1d1fd..e7070ec53cdc550064521a2f18ca51d9d7dbe1f8 100644 |
| --- a/third_party/WebKit/Source/core/svg/SVGUseElement.cpp |
| +++ b/third_party/WebKit/Source/core/svg/SVGUseElement.cpp |
| @@ -40,6 +40,7 @@ |
| #include "core/svg/SVGLengthContext.h" |
| #include "core/svg/SVGSVGElement.h" |
| #include "core/svg/SVGSymbolElement.h" |
| +#include "core/svg/SVGTitleElement.h" |
| #include "core/svg/SVGTreeScopeResources.h" |
| #include "core/xml/parser/XMLDocumentParser.h" |
| #include "platform/loader/fetch/FetchRequest.h" |
| @@ -339,6 +340,22 @@ void SVGUseElement::buildPendingResource() { |
| ASSERT(!m_needsShadowTreeRecreation); |
| } |
| +String SVGUseElement::title() const { |
| + // Find the first <title> child in <use> which doesn't cover shadow tree. |
| + if (Element* titleElement = Traversal<SVGTitleElement>::firstChild(*this)) |
| + return titleElement->innerText(); |
| + |
| + // If there is no <title> child in <use>, we lookup first <title> child in |
| + // shadow tree. |
| + if (!m_targetElementInstance) { |
|
fs
2017/03/02 08:45:07
Reverse condition.
mrunal
2017/03/02 23:49:07
Oops..I mistakenly replaced the other way I was pl
|
| + if (Element* titleElement = |
| + Traversal<SVGTitleElement>::firstChild(*m_targetElementInstance)) |
| + return titleElement->innerText(); |
| + } |
| + // Otherwise return a null string. |
| + return String(); |
| +} |
| + |
| static void associateCorrespondingElements(SVGElement& targetRoot, |
| SVGElement& instanceRoot) { |
| auto targetRange = Traversal<SVGElement>::inclusiveDescendantsOf(targetRoot); |