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 43739e3bac62863722cea5cdbfa49ecbb9077c11..a4353de322f57ae95c800afa59aca59869ecfffd 100644 |
--- a/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp |
+++ b/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp |
@@ -27,6 +27,7 @@ |
#include "SkMatrix44.h" |
#include "core/dom/AccessibleNode.h" |
+#include "core/html/HTMLSelectElement.h" |
#include "modules/accessibility/AXMenuListPopup.h" |
#include "modules/accessibility/AXObjectCacheImpl.h" |
@@ -97,7 +98,21 @@ void AXMenuListOption::SetSelected(bool b) { |
element_->SetSelected(b); |
} |
+bool AXMenuListOption::CanSetFocusAttribute() const { |
+ return CanSetSelectedAttribute(); |
+} |
+ |
bool AXMenuListOption::CanSetSelectedAttribute() const { |
+ if (!isHTMLOptionElement(GetNode())) |
+ return false; |
+ |
+ if (toHTMLOptionElement(GetNode())->IsDisabledFormControl()) |
+ return false; |
+ |
+ HTMLSelectElement* select_element = ParentSelectNode(); |
+ if (!select_element || select_element->IsDisabledFormControl()) |
+ return false; |
+ |
return IsEnabled(); |
} |
@@ -160,6 +175,16 @@ String AXMenuListOption::TextAlternative(bool recursive, |
return text_alternative; |
} |
+HTMLSelectElement* AXMenuListOption::ParentSelectNode() const { |
+ if (!GetNode()) |
+ return 0; |
+ |
+ if (isHTMLOptionElement(GetNode())) |
+ return toHTMLOptionElement(GetNode())->OwnerSelectElement(); |
+ |
+ return 0; |
+} |
+ |
DEFINE_TRACE(AXMenuListOption) { |
visitor->Trace(element_); |
AXMockObject::Trace(visitor); |