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

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

Issue 192293002: Use new is*Element() helper functions in DOM code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add is*Element(PassRefPtr) helper 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/dom/Node.cpp
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index 22126126934831487fd1b1e50acf5e63428ded4e..e9bc233244a9d18a553660c21ee1db883ec4ea84 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -1188,7 +1188,7 @@ Element *Node::enclosingBlockFlowElement() const
n = n->parentNode();
if (!n)
break;
- if (n->isBlockFlowElement() || n->hasTagName(bodyTag))
+ if (n->isBlockFlowElement() || isHTMLBodyElement(*n))
return toElement(n);
}
return 0;
@@ -1197,7 +1197,7 @@ Element *Node::enclosingBlockFlowElement() const
bool Node::isRootEditableElement() const
{
return rendererIsEditable() && isElementNode() && (!parentNode() || !parentNode()->rendererIsEditable()
- || !parentNode()->isElementNode() || hasTagName(bodyTag));
+ || !parentNode()->isElementNode() || isHTMLBodyElement((*this)));
}
Element* Node::rootEditableElement(EditableType editableType) const
@@ -1216,7 +1216,7 @@ Element* Node::rootEditableElement() const
for (Node* n = const_cast<Node*>(this); n && n->rendererIsEditable(); n = n->parentNode()) {
if (n->isElementNode())
result = toElement(n);
- if (n->hasTagName(bodyTag))
+ if (isHTMLBodyElement(*n))
break;
}
return result;
@@ -1452,7 +1452,7 @@ static void appendTextContent(const Node* node, bool convertBRsToNewlines, bool&
break;
case Node::ELEMENT_NODE:
- if (node->hasTagName(brTag) && convertBRsToNewlines) {
+ if (isHTMLBRElement(*node) && convertBRsToNewlines) {
isNullString = false;
content.append('\n');
break;
@@ -1813,7 +1813,7 @@ void Node::showTreeAndMark(const Node* markedNode1, const char* markedLabel1, co
{
const Node* rootNode;
const Node* node = this;
- while (node->parentOrShadowHostNode() && !node->hasTagName(bodyTag))
+ while (node->parentOrShadowHostNode() && !isHTMLBodyElement(*node))
node = node->parentOrShadowHostNode();
rootNode = node;
@@ -1880,7 +1880,7 @@ Node* Node::enclosingLinkEventParentOrSelf()
// For imagemaps, the enclosing link node is the associated area element not the image itself.
// So we don't let images be the enclosingLinkNode, even though isLink sometimes returns true
// for them.
- if (node->isLink() && !node->hasTagName(imgTag))
+ if (node->isLink() && !isHTMLImageElement(*node))
return node;
}

Powered by Google App Engine
This is Rietveld 408576698