Index: third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp |
diff --git a/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp b/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp |
index 9676ad9ddce2b7ee4894c6e2e4d40f6a32c96037..50d3926738224b68a61044cfc0fcd874c4b0a8be 100644 |
--- a/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp |
+++ b/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp |
@@ -26,7 +26,9 @@ |
#include "modules/accessibility/AXMenuListOption.h" |
#include "SkMatrix44.h" |
+#include "base/debug/stack_trace.h" |
#include "core/dom/AccessibleNode.h" |
+#include "core/html/HTMLSelectElement.h" |
#include "modules/accessibility/AXMenuListPopup.h" |
#include "modules/accessibility/AXObjectCacheImpl.h" |
@@ -36,7 +38,13 @@ using namespace HTMLNames; |
AXMenuListOption::AXMenuListOption(HTMLOptionElement* element, |
AXObjectCacheImpl& ax_object_cache) |
- : AXMockObject(ax_object_cache), element_(element) {} |
+ : AXMockObject(ax_object_cache), element_(element) { |
+ LOG(INFO) << "this " << this << "; element " << element |
+ << " textContent:" << element->textContent().Utf8().data() |
+ << "; trace: "; |
+ base::debug::StackTrace trace; |
+ trace.Print(); |
+} |
AXMenuListOption::~AXMenuListOption() { |
DCHECK(!element_); |
@@ -63,6 +71,33 @@ Element* AXMenuListOption::ActionElement() const { |
return element_; |
} |
+AXObject* AXMenuListOption::ComputeParent() const { |
+ LOG(INFO) << "ComputeParent for MenuListOption " << this; |
+ Node* node = GetNode(); |
+ if (!node) { |
+ LOG(INFO) << "!node"; |
+ return nullptr; |
+ } |
+ HTMLSelectElement* select = toHTMLOptionElement(node)->OwnerSelectElement(); |
+ if (!select) { |
+ LOG(INFO) << "!select"; |
+ return nullptr; |
+ } |
+ LOG(INFO) << "Found select"; |
+ AXObject* select_ax_object = AxObjectCache().GetOrCreate(select); |
+ if (select_ax_object->HasChildren()) { |
+ const auto& child_objects = select_ax_object->Children(); |
+ DCHECK(!child_objects.IsEmpty()); |
+ DCHECK_EQ(child_objects.size(), 1UL); |
+ DCHECK(child_objects[0]->IsMenuListPopup()); |
+ ToAXMenuListPopup(child_objects[0].Get())->UpdateChildrenIfNecessary(); |
+ } else { |
+ select_ax_object->UpdateChildrenIfNecessary(); |
+ } |
+ LOG(INFO) << "Returning parent_.Get(): " << parent_.Get(); |
+ return parent_.Get(); |
+} |
+ |
bool AXMenuListOption::IsEnabled() const { |
// isDisabledFormControl() returns true if the parent <select> element is |
// disabled, which we don't want. |