| Index: Source/core/accessibility/AXNodeObject.cpp
|
| diff --git a/Source/core/accessibility/AXNodeObject.cpp b/Source/core/accessibility/AXNodeObject.cpp
|
| index 76381e162810bd626d81db51b243b4e1d33209e3..f7d4c591bb43089dbfe32702dd8dc14bb73edfd0 100644
|
| --- a/Source/core/accessibility/AXNodeObject.cpp
|
| +++ b/Source/core/accessibility/AXNodeObject.cpp
|
| @@ -1467,13 +1467,10 @@ HTMLLabelElement* AXNodeObject::labelElementContainer() const
|
| if (isControl())
|
| return 0;
|
|
|
| - // find if this has a parent that is a label
|
| - for (Node* parentNode = node(); parentNode; parentNode = parentNode->parentNode()) {
|
| - if (isHTMLLabelElement(*parentNode))
|
| - return toHTMLLabelElement(parentNode);
|
| - }
|
| -
|
| - return 0;
|
| + // find if this has a ancestor that is a label
|
| + if (isHTMLLabelElement(*node()))
|
| + return toHTMLLabelElement(node());
|
| + return Traversal<HTMLLabelElement>::firstAncestor(*node());
|
| }
|
|
|
| void AXNodeObject::setFocused(bool on)
|
|
|