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

Unified Diff: Source/core/html/HTMLOptionElement.cpp

Issue 1034493005: Fire AX notifications on list box options. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@menu_list_more
Patch Set: Update expectations for other test that failed Created 5 years, 9 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
« no previous file with comments | « Source/core/dom/AXObjectCache.h ('k') | Source/core/html/HTMLSelectElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLOptionElement.cpp
diff --git a/Source/core/html/HTMLOptionElement.cpp b/Source/core/html/HTMLOptionElement.cpp
index f14dd4b81dbb1294fd148c9a5c31737391f81659..97a8e40d73dc7ed852dd906916e95f2aabf6f8ea 100644
--- a/Source/core/html/HTMLOptionElement.cpp
+++ b/Source/core/html/HTMLOptionElement.cpp
@@ -29,6 +29,7 @@
#include "bindings/core/v8/ExceptionState.h"
#include "core/HTMLNames.h"
+#include "core/dom/AXObjectCache.h"
#include "core/dom/Document.h"
#include "core/dom/NodeComputedStyle.h"
#include "core/dom/NodeTraversal.h"
@@ -264,8 +265,19 @@ void HTMLOptionElement::setSelectedState(bool selected)
m_isSelected = selected;
pseudoStateChanged(CSSSelector::PseudoChecked);
- if (HTMLSelectElement* select = ownerSelectElement())
+ if (HTMLSelectElement* select = ownerSelectElement()) {
select->invalidateSelectedItems();
+
+ if (AXObjectCache* cache = document().existingAXObjectCache()) {
+ // If there is a layoutObject (most common), fire accessibility notifications
+ // only when it's a listbox (and not a menu list). If there's no layoutObject,
+ // fire them anyway just to be safe (to make sure the AX tree is in sync).
+ if (!select->layoutObject() || select->layoutObject()->isListBox()) {
+ cache->listboxOptionStateChanged(this);
+ cache->listboxSelectedChildrenChanged(select);
+ }
+ }
+ }
}
void HTMLOptionElement::childrenChanged(const ChildrenChange& change)
« no previous file with comments | « Source/core/dom/AXObjectCache.h ('k') | Source/core/html/HTMLSelectElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698