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

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

Issue 2706583002: Fix the way <title> is read under <use> shadow tree (Closed)
Patch Set: Add layout test 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
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);

Powered by Google App Engine
This is Rietveld 408576698