| Index: Source/core/html/HTMLFormControlElement.cpp
|
| diff --git a/Source/core/html/HTMLFormControlElement.cpp b/Source/core/html/HTMLFormControlElement.cpp
|
| index 6d32513c5af5256724ab13feef1a7162f017a6d3..7b9c1d91cc06ce88eac834ff845fd8417ccdaf7a 100644
|
| --- a/Source/core/html/HTMLFormControlElement.cpp
|
| +++ b/Source/core/html/HTMLFormControlElement.cpp
|
| @@ -28,6 +28,7 @@
|
| #include "core/dom/PostAttachCallbacks.h"
|
| #include "core/events/Event.h"
|
| #include "core/events/ThreadLocalEventNames.h"
|
| +#include "core/html/HTMLDataListElement.h"
|
| #include "core/html/HTMLFieldSetElement.h"
|
| #include "core/html/HTMLFormElement.h"
|
| #include "core/html/HTMLInputElement.h"
|
| @@ -103,7 +104,7 @@ void HTMLFormControlElement::updateAncestorDisabledState() const
|
| {
|
| HTMLFieldSetElement* fieldSetAncestor = 0;
|
| ContainerNode* legendAncestor = 0;
|
| - for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) {
|
| + for (HTMLElement* ancestor = Traversal<HTMLElement>::firstAncestor(*this); ancestor; ancestor = Traversal<HTMLElement>::firstAncestor(*ancestor)) {
|
| if (!legendAncestor && isHTMLLegendElement(*ancestor))
|
| legendAncestor = ancestor;
|
| if (isHTMLFieldSetElement(*ancestor)) {
|
| @@ -357,13 +358,9 @@ short HTMLFormControlElement::tabIndex() const
|
| bool HTMLFormControlElement::recalcWillValidate() const
|
| {
|
| if (m_dataListAncestorState == Unknown) {
|
| - for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) {
|
| - if (isHTMLDataListElement(*ancestor)) {
|
| - m_dataListAncestorState = InsideDataList;
|
| - break;
|
| - }
|
| - }
|
| - if (m_dataListAncestorState == Unknown)
|
| + if (Traversal<HTMLDataListElement>::firstAncestor(*this))
|
| + m_dataListAncestorState = InsideDataList;
|
| + else
|
| m_dataListAncestorState = NotInsideDataList;
|
| }
|
| return m_dataListAncestorState == NotInsideDataList && !isDisabledOrReadOnly();
|
| @@ -484,11 +481,9 @@ bool HTMLFormControlElement::isDefaultButtonForForm() const
|
|
|
| HTMLFormControlElement* HTMLFormControlElement::enclosingFormControlElement(Node* node)
|
| {
|
| - for (; node; node = node->parentNode()) {
|
| - if (node->isElementNode() && toElement(node)->isFormControlElement())
|
| - return toHTMLFormControlElement(node);
|
| - }
|
| - return 0;
|
| + if (!node || isHTMLFormControlElement(*node))
|
| + return toHTMLFormControlElement(node);
|
| + return Traversal<HTMLFormControlElement>::firstAncestor(*node);
|
| }
|
|
|
| String HTMLFormControlElement::nameForAutofill() const
|
|
|