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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1771703003: Revert of Fix SVGDocument return title that is not a child of the root element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 212b970e674a87cd67e3accccba1cf56fefdac70..64f72e837e40d3a5cb3d7d72c4b4a0cc95adb60d 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -1286,29 +1286,18 @@
void Document::setTitle(const String& title)
{
// Title set by JavaScript -- overrides any title elements.
- if (!m_titleElement) {
- if (isHTMLDocument() || isXHTMLDocument()) {
- HTMLElement* headElement = head();
- if (!headElement)
- return;
- m_titleElement = HTMLTitleElement::create(*this);
- headElement->appendChild(m_titleElement.get());
- } else if (isSVGDocument()) {
- Element* element = documentElement();
- if (!isSVGSVGElement(element))
- return;
- m_titleElement = SVGTitleElement::create(*this);
- element->insertBefore(m_titleElement.get(), element->firstChild());
- }
- } else {
- if (!isHTMLDocument() && !isXHTMLDocument() && !isSVGDocument())
- m_titleElement = nullptr;
+ if (!isHTMLDocument() && !isXHTMLDocument()) {
+ m_titleElement = nullptr;
+ } else if (!m_titleElement) {
+ HTMLElement* headElement = head();
+ if (!headElement)
+ return;
+ m_titleElement = HTMLTitleElement::create(*this);
+ headElement->appendChild(m_titleElement.get());
}
if (isHTMLTitleElement(m_titleElement))
toHTMLTitleElement(m_titleElement)->setText(title);
- else if (isSVGTitleElement(m_titleElement))
- toSVGTitleElement(m_titleElement)->setText(title);
else
updateTitle(title);
}
@@ -1324,25 +1313,6 @@
}
} else {
m_titleElement = titleElement;
- }
-
-
- if (isSVGDocument()) {
- // If the root element that is <svg> element in the svg namespace is not the parent of <title> element,
- // ignore <title> element.
- if (isSVGSVGElement(documentElement()) && documentElement() != m_titleElement->parentNode()) {
- m_titleElement = nullptr;
- return;
- }
-
- // If the root element is not <svg> element in the svg namespace and <title> element is in the svg namespace,
- // or the root element is <svg> element in the svg namespace and <title> element is not in the svg namespace,
- // ignore <title> element.
- if ((!isSVGSVGElement(m_titleElement->parentNode()) && isSVGTitleElement(m_titleElement))
- || (isSVGSVGElement(m_titleElement->parentNode()) && !isSVGTitleElement(m_titleElement))) {
- m_titleElement = nullptr;
- return;
- }
}
if (isHTMLTitleElement(m_titleElement))

Powered by Google App Engine
This is Rietveld 408576698