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..f28195ef4af09712a3a54885a4a475e8bb2a5ae5 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,21 @@ 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 (Element* titleElement = |
| + Traversal<SVGTitleElement>::firstChild(*m_targetElementInstance)) |
|
fs
2017/03/01 09:29:05
m_targetElementInstance can be null here, so that
mrunal
2017/03/02 03:37:44
Done.
|
| + return titleElement->innerText(); |
| + |
| + // Otherwise return a null string. |
| + return String(); |
| +} |
| + |
| static void associateCorrespondingElements(SVGElement& targetRoot, |
| SVGElement& instanceRoot) { |
| auto targetRange = Traversal<SVGElement>::inclusiveDescendantsOf(targetRoot); |