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

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

Issue 19028005: Introduce isHTMLTitleElement and toHTMLTitleElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 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
« no previous file with comments | « no previous file | Source/core/editing/ReplaceSelectionCommand.cpp » ('j') | Source/core/html/HTMLTitleElement.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 4f90cc27c71cdb9948743132bf283cee3caa1777..be553539dc4d15ef7f128893ad51bdb710e9c498 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -1323,9 +1323,9 @@ void Document::setTitle(const String& title)
updateTitle(StringWithDirection(title, LTR));
if (m_titleElement) {
- ASSERT(m_titleElement->hasTagName(titleTag));
- if (m_titleElement->hasTagName(titleTag))
- static_cast<HTMLTitleElement*>(m_titleElement.get())->setText(title);
+ ASSERT(isHTMLTitleElement(m_titleElement.get()));
+ if (isHTMLTitleElement(m_titleElement.get()))
+ toHTMLTitleElement(m_titleElement.get())->setText(title);
}
}
@@ -1351,12 +1351,13 @@ void Document::removeTitle(Element* titleElement)
// Update title based on first title element in the head, if one exists.
if (HTMLElement* headElement = head()) {
- for (Node* e = headElement->firstChild(); e; e = e->nextSibling())
- if (e->hasTagName(titleTag)) {
- HTMLTitleElement* titleElement = static_cast<HTMLTitleElement*>(e);
+ for (Node* e = headElement->firstChild(); e; e = e->nextSibling()) {
+ if (isHTMLTitleElement(e)) {
+ HTMLTitleElement* titleElement = toHTMLTitleElement(e);
setTitleElement(titleElement->textWithDirection(), titleElement);
break;
}
+ }
}
if (!m_titleElement)
« no previous file with comments | « no previous file | Source/core/editing/ReplaceSelectionCommand.cpp » ('j') | Source/core/html/HTMLTitleElement.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698