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

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

Issue 198553002: Use new is*Element() helper functions even more in HTML code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
« no previous file with comments | « Source/core/html/HTMLDocument.cpp ('k') | Source/core/html/HTMLEmbedElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLElement.cpp
diff --git a/Source/core/html/HTMLElement.cpp b/Source/core/html/HTMLElement.cpp
index e7ae5b4e4d0de69e9275df70e413f895c87f0b67..1a98cf035b19329dd366f97188a7a7072d8790bd 100644
--- a/Source/core/html/HTMLElement.cpp
+++ b/Source/core/html/HTMLElement.cpp
@@ -633,7 +633,7 @@ void HTMLElement::setTranslate(bool enable)
HTMLFormElement* HTMLElement::findFormAncestor() const
{
for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) {
- if (ancestor->hasTagName(formTag))
+ if (isHTMLFormElement(*ancestor))
return toHTMLFormElement(ancestor);
}
return 0;
@@ -641,7 +641,7 @@ HTMLFormElement* HTMLElement::findFormAncestor() const
static inline bool elementAffectsDirectionality(const Node* node)
{
- return node->isHTMLElement() && (node->hasTagName(bdiTag) || toHTMLElement(node)->hasAttribute(dirAttr));
+ return node->isHTMLElement() && (isHTMLBDIElement(*node) || toHTMLElement(node)->hasAttribute(dirAttr));
}
static void setHasDirAutoFlagRecursively(Node* firstNode, bool flag, Node* lastNode = 0)
@@ -676,7 +676,7 @@ void HTMLElement::childrenChanged(bool changedByParser, Node* beforeChange, Node
bool HTMLElement::hasDirectionAuto() const
{
const AtomicString& direction = fastGetAttribute(dirAttr);
- return (hasTagName(bdiTag) && direction == nullAtom) || equalIgnoringCase(direction, "auto");
+ return (isHTMLBDIElement(*this) && direction == nullAtom) || equalIgnoringCase(direction, "auto");
}
TextDirection HTMLElement::directionalityIfhasDirAutoAttribute(bool& isAuto) const
@@ -692,7 +692,7 @@ TextDirection HTMLElement::directionalityIfhasDirAutoAttribute(bool& isAuto) con
TextDirection HTMLElement::directionality(Node** strongDirectionalityTextNode) const
{
- if (hasTagName(inputTag)) {
+ if (isHTMLInputElement(*this)) {
HTMLInputElement* inputElement = toHTMLInputElement(const_cast<HTMLElement*>(this));
bool hasStrongDirectionality;
TextDirection textDirection = determineDirectionality(inputElement->value(), hasStrongDirectionality);
@@ -704,7 +704,7 @@ TextDirection HTMLElement::directionality(Node** strongDirectionalityTextNode) c
Node* node = firstChild();
while (node) {
// Skip bdi, script, style and text form controls.
- if (equalIgnoringCase(node->nodeName(), "bdi") || node->hasTagName(scriptTag) || node->hasTagName(styleTag)
+ if (equalIgnoringCase(node->nodeName(), "bdi") || isHTMLScriptElement(*node) || isHTMLStyleElement(*node)
|| (node->isElementNode() && toElement(node)->isTextFormControl())) {
node = NodeTraversal::nextSkippingChildren(*node, this);
continue;
« no previous file with comments | « Source/core/html/HTMLDocument.cpp ('k') | Source/core/html/HTMLEmbedElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698