Index: Source/core/accessibility/AXNodeObject.cpp |
diff --git a/Source/core/accessibility/AXNodeObject.cpp b/Source/core/accessibility/AXNodeObject.cpp |
index 932711060a11db06ce160fa875015e169d91e8f5..ffb7bdea232c666899cc822006b56aed7ce28680 100644 |
--- a/Source/core/accessibility/AXNodeObject.cpp |
+++ b/Source/core/accessibility/AXNodeObject.cpp |
@@ -351,12 +351,7 @@ HTMLLabelElement* AXNodeObject::labelForElement(Element* element) const |
return label; |
} |
- for (Element* parent = element->parentElement(); parent; parent = parent->parentElement()) { |
- if (isHTMLLabelElement(*parent)) |
- return toHTMLLabelElement(parent); |
- } |
- |
- return 0; |
+ return Traversal<HTMLLabelElement>::firstAncestor(*element); |
} |
AXObject* AXNodeObject::menuButtonForMenu() const |