Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Unified Diff: third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp

Issue 2893683002: Selection follows focus/activedescendant in single selection containers (Closed)
Patch Set: Last test to fix we hope Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698