Commit 78bc1e4a authored by ch.dumez@samsung.com's avatar ch.dumez@samsung.com

Drop slower Node::hasTagName(QualifiedName) overload

Drop slower Node::hasTagName(QualifiedName) overload. It is only used by
SiblingTraversalStrategies at this point. The objective is to encourage
future callers to use the faster alternatives:
- HTMLElement::hasTagName(HTMLQualifiedName) / SVGElement::hasTagName(SVGQualifiedName)
- Node::hasTagName(HTMLQualifiedName) / Node::hasTagName(SVGQualifiedName)
- Element::hasTagName(QualifiedName)

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/415823002

git-svn-id: svn://svn.chromium.org/blink/trunk@179165 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 4263444d
...@@ -168,7 +168,7 @@ inline bool ShadowDOMSiblingTraversalStrategy::isFirstOfType(Element& element, c ...@@ -168,7 +168,7 @@ inline bool ShadowDOMSiblingTraversalStrategy::isFirstOfType(Element& element, c
ASSERT(element == toElement(m_siblings[m_nth])); ASSERT(element == toElement(m_siblings[m_nth]));
for (int i = m_nth - 1; i >= 0; --i) { for (int i = m_nth - 1; i >= 0; --i) {
if (m_siblings[i]->hasTagName(type)) if (m_siblings[i]->isElementNode() && toElement(m_siblings[i])->hasTagName(type))
return false; return false;
} }
...@@ -180,7 +180,7 @@ inline bool ShadowDOMSiblingTraversalStrategy::isLastOfType(Element& element, co ...@@ -180,7 +180,7 @@ inline bool ShadowDOMSiblingTraversalStrategy::isLastOfType(Element& element, co
ASSERT(element == toElement(m_siblings[m_nth])); ASSERT(element == toElement(m_siblings[m_nth]));
for (size_t i = m_nth + 1; i < m_siblings.size(); ++i) { for (size_t i = m_nth + 1; i < m_siblings.size(); ++i) {
if (m_siblings[i]->hasTagName(type)) if (m_siblings[i]->isElementNode() && toElement(m_siblings[i])->hasTagName(type))
return false; return false;
} }
...@@ -219,7 +219,7 @@ inline int ShadowDOMSiblingTraversalStrategy::countElementsOfTypeBefore(Element& ...@@ -219,7 +219,7 @@ inline int ShadowDOMSiblingTraversalStrategy::countElementsOfTypeBefore(Element&
int count = 0; int count = 0;
for (int i = m_nth - 1; i >= 0; --i) { for (int i = m_nth - 1; i >= 0; --i) {
if (m_siblings[i]->hasTagName(type)) if (m_siblings[i]->isElementNode() && toElement(m_siblings[i])->hasTagName(type))
++count; ++count;
} }
...@@ -232,7 +232,7 @@ inline int ShadowDOMSiblingTraversalStrategy::countElementsOfTypeAfter(Element& ...@@ -232,7 +232,7 @@ inline int ShadowDOMSiblingTraversalStrategy::countElementsOfTypeAfter(Element&
int count = 0; int count = 0;
for (size_t i = m_nth + 1; i < m_siblings.size(); ++i) { for (size_t i = m_nth + 1; i < m_siblings.size(); ++i) {
if (m_siblings[i]->hasTagName(type)) if (m_siblings[i]->isElementNode() && toElement(m_siblings[i])->hasTagName(type))
return ++count; return ++count;
} }
......
...@@ -685,11 +685,6 @@ inline bool isDisabledFormControl(const Node* node) ...@@ -685,11 +685,6 @@ inline bool isDisabledFormControl(const Node* node)
return node->isElementNode() && toElement(node)->isDisabledFormControl(); return node->isElementNode() && toElement(node)->isDisabledFormControl();
} }
inline bool Node::hasTagName(const QualifiedName& name) const
{
return isElementNode() && toElement(this)->hasTagName(name);
}
inline Element* Node::parentElement() const inline Element* Node::parentElement() const
{ {
ContainerNode* parent = parentNode(); ContainerNode* parent = parentNode();
......
...@@ -171,7 +171,6 @@ public: ...@@ -171,7 +171,6 @@ public:
// DOM methods & attributes for Node // DOM methods & attributes for Node
bool hasTagName(const QualifiedName&) const;
bool hasTagName(const HTMLQualifiedName&) const; bool hasTagName(const HTMLQualifiedName&) const;
bool hasTagName(const SVGQualifiedName&) const; bool hasTagName(const SVGQualifiedName&) const;
virtual String nodeName() const = 0; virtual String nodeName() const = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment