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

Unified Diff: Source/core/accessibility/AXNodeObject.cpp

Issue 405973004: Optimize / clean up hasTagName() call sites (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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/accessibility/AXRenderObject.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/accessibility/AXNodeObject.cpp
diff --git a/Source/core/accessibility/AXNodeObject.cpp b/Source/core/accessibility/AXNodeObject.cpp
index f2de5ec4bc439f66ffaf71ed2c7e6a5968fff4f5..deb434addae80c4c2d784ea5176c84904b04a363 100644
--- a/Source/core/accessibility/AXNodeObject.cpp
+++ b/Source/core/accessibility/AXNodeObject.cpp
@@ -37,6 +37,7 @@
#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLLabelElement.h"
#include "core/html/HTMLLegendElement.h"
+#include "core/html/HTMLPlugInElement.h"
#include "core/html/HTMLSelectElement.h"
#include "core/html/HTMLTextAreaElement.h"
#include "core/rendering/RenderObject.h"
@@ -224,7 +225,7 @@ AccessibilityRole AXNodeObject::determineAccessibilityRole()
return GroupRole;
if (isHTMLAnchorElement(*node()) && isClickable())
return LinkRole;
- if (node()->hasTagName(iframeTag))
+ if (isHTMLIFrameElement(*node()))
return IframeRole;
if (isEmbeddedObject())
return EmbeddedObjectRole;
@@ -477,9 +478,7 @@ bool AXNodeObject::isControl() const
bool AXNodeObject::isEmbeddedObject() const
{
- return node()
- && (node()->hasTagName(objectTag) || node()->hasTagName(embedTag)
- || node()->hasTagName(appletTag));
+ return isHTMLPlugInElement(node());
}
bool AXNodeObject::isFieldset() const
@@ -814,27 +813,31 @@ int AXNodeObject::headingLevel() const
// headings can be in block flow and non-block flow
Node* node = this->node();
if (!node)
- return false;
+ return 0;
if (ariaRoleAttribute() == HeadingRole)
return getAttribute(aria_levelAttr).toInt();
- if (node->hasTagName(h1Tag))
+ if (!node->isHTMLElement())
+ return 0;
+
+ HTMLElement& element = toHTMLElement(*node);
+ if (element.hasTagName(h1Tag))
return 1;
- if (node->hasTagName(h2Tag))
+ if (element.hasTagName(h2Tag))
return 2;
- if (node->hasTagName(h3Tag))
+ if (element.hasTagName(h3Tag))
return 3;
- if (node->hasTagName(h4Tag))
+ if (element.hasTagName(h4Tag))
return 4;
- if (node->hasTagName(h5Tag))
+ if (element.hasTagName(h5Tag))
return 5;
- if (node->hasTagName(h6Tag))
+ if (element.hasTagName(h6Tag))
return 6;
return 0;
« no previous file with comments | « no previous file | Source/core/accessibility/AXRenderObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698