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

Unified Diff: Source/core/html/HTMLNameCollection.cpp

Issue 195813003: Use new is*Element() helper functions further more in HTML code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix bad assertion Created 6 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: Source/core/html/HTMLNameCollection.cpp
diff --git a/Source/core/html/HTMLNameCollection.cpp b/Source/core/html/HTMLNameCollection.cpp
index b20badd2a471b26794d1930f462452f2965acc5e..48def4be81fbe8edbf79dad1c3432ba73485ae8e 100644
--- a/Source/core/html/HTMLNameCollection.cpp
+++ b/Source/core/html/HTMLNameCollection.cpp
@@ -63,11 +63,11 @@ Element* HTMLNameCollection::virtualItemAfter(Element* previous) const
case WindowNamedItems:
// find only images, forms, applets, embeds and objects by name,
// but anything by id
- if (current->hasTagName(imgTag)
- || current->hasTagName(formTag)
- || current->hasTagName(appletTag)
- || current->hasTagName(embedTag)
- || current->hasTagName(objectTag)) {
+ if (isHTMLImageElement(*current)
+ || isHTMLFormElement(*current)
+ || isHTMLAppletElement(*current)
+ || isHTMLEmbedElement(*current)
+ || isHTMLObjectElement(*current)) {
if (current->getNameAttribute() == m_name)
return current;
}
@@ -78,16 +78,16 @@ Element* HTMLNameCollection::virtualItemAfter(Element* previous) const
// find images, forms, applets, embeds, objects and iframes by name,
// applets and object by id, and images by id but only if they have
// a name attribute (this very strange rule matches IE)
- if (current->hasTagName(formTag)
- || current->hasTagName(iframeTag)
- || (current->hasTagName(embedTag) && toHTMLEmbedElement(current)->isExposed())) {
+ if (isHTMLFormElement(*current)
+ || isHTMLIFrameElement(*current)
+ || (isHTMLEmbedElement(*current) && toHTMLEmbedElement(*current).isExposed())) {
if (current->getNameAttribute() == m_name)
return current;
- } else if (current->hasTagName(appletTag)
- || (current->hasTagName(objectTag) && toHTMLObjectElement(current)->isExposed())) {
+ } else if (isHTMLAppletElement(*current)
+ || (isHTMLObjectElement(*current) && toHTMLObjectElement(*current).isExposed())) {
if (current->getNameAttribute() == m_name || current->getIdAttribute() == m_name)
return current;
- } else if (current->hasTagName(imgTag)) {
+ } else if (isHTMLImageElement(*current)) {
if (current->getNameAttribute() == m_name || (current->getIdAttribute() == m_name && current->hasName()))
return current;
}

Powered by Google App Engine
This is Rietveld 408576698