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) |