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

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

Issue 425383002: Move highestAncestorOrSelf() from Node to NodeTraversal (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 | « Source/core/editing/ApplyStyleCommand.cpp ('k') | Source/core/html/HTMLFormElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/FormAssociatedElement.cpp
diff --git a/Source/core/html/FormAssociatedElement.cpp b/Source/core/html/FormAssociatedElement.cpp
index 2c5387d834add4b597c46924351338ce8a92c27b..a90baefd96867beda2abc5fbcba399f93d6060da 100644
--- a/Source/core/html/FormAssociatedElement.cpp
+++ b/Source/core/html/FormAssociatedElement.cpp
@@ -27,6 +27,7 @@
#include "core/HTMLNames.h"
#include "core/dom/IdTargetObserver.h"
+#include "core/dom/NodeTraversal.h"
#include "core/html/HTMLFormControlElement.h"
#include "core/html/HTMLFormElement.h"
#include "core/html/HTMLObjectElement.h"
@@ -83,7 +84,7 @@ void FormAssociatedElement::didMoveToNewDocument(Document& oldDocument)
void FormAssociatedElement::insertedInto(ContainerNode* insertionPoint)
{
- if (!m_formWasSetByParser || insertionPoint->highestAncestorOrSelf() != m_form->highestAncestorOrSelf())
+ if (!m_formWasSetByParser || NodeTraversal::highestAncestorOrSelf(*insertionPoint) != NodeTraversal::highestAncestorOrSelf(*m_form.get()))
resetFormOwner();
if (!insertionPoint->inDocument())
@@ -101,7 +102,7 @@ void FormAssociatedElement::removedFrom(ContainerNode* insertionPoint)
setFormAttributeTargetObserver(nullptr);
// If the form and element are both in the same tree, preserve the connection to the form.
// Otherwise, null out our form and remove ourselves from the form's list of elements.
- if (m_form && element->highestAncestorOrSelf() != m_form->highestAncestorOrSelf())
+ if (m_form && NodeTraversal::highestAncestorOrSelf(*element) != NodeTraversal::highestAncestorOrSelf(*m_form.get()))
resetFormOwner();
}
@@ -128,7 +129,7 @@ HTMLFormElement* FormAssociatedElement::findAssociatedForm(const HTMLElement* el
void FormAssociatedElement::formRemovedFromTree(const Node& formRoot)
{
ASSERT(m_form);
- if (toHTMLElement(this)->highestAncestorOrSelf() == formRoot)
+ if (NodeTraversal::highestAncestorOrSelf(toHTMLElement(*this)) == formRoot)
return;
resetFormOwner();
}
« no previous file with comments | « Source/core/editing/ApplyStyleCommand.cpp ('k') | Source/core/html/HTMLFormElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698