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

Unified Diff: Source/modules/accessibility/AXObjectCacheImpl.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: Rebase 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
Index: Source/modules/accessibility/AXObjectCacheImpl.cpp
diff --git a/Source/modules/accessibility/AXObjectCacheImpl.cpp b/Source/modules/accessibility/AXObjectCacheImpl.cpp
index 47e682327e3cefda1c7c49d26d45ac68e9ec2e56..f5d5952bd8b057b1a634ec5820be6b986ba7ed59 100644
--- a/Source/modules/accessibility/AXObjectCacheImpl.cpp
+++ b/Source/modules/accessibility/AXObjectCacheImpl.cpp
@@ -39,6 +39,8 @@
#include "core/html/HTMLImageElement.h"
#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLLabelElement.h"
+#include "core/html/HTMLOptionElement.h"
+#include "core/html/HTMLSelectElement.h"
#include "core/layout/LayoutListBox.h"
#include "core/layout/LayoutMenuList.h"
#include "core/layout/LayoutProgress.h"
@@ -778,18 +780,23 @@ void AXObjectCacheImpl::checkedStateChanged(Node* node)
postNotification(node, AXObjectCacheImpl::AXCheckedStateChanged, true);
}
-void AXObjectCacheImpl::selectedChildrenChanged(Node* node)
+void AXObjectCacheImpl::listboxOptionStateChanged(HTMLOptionElement* option)
{
- // postToElement is false so that you can pass in any child of an element and it will go up the parent tree
- // to find the container which should send out the notification.
- postNotification(node, AXSelectedChildrenChanged, false);
+ postNotification(option, AXCheckedStateChanged);
}
-void AXObjectCacheImpl::selectedChildrenChanged(LayoutObject* layoutObject)
+void AXObjectCacheImpl::listboxSelectedChildrenChanged(HTMLSelectElement* select)
{
- // postToElement is false so that you can pass in any child of an element and it will go up the parent tree
- // to find the container which should send out the notification.
- postNotification(layoutObject, AXSelectedChildrenChanged, false);
+ postNotification(select, AXSelectedChildrenChanged);
+}
+
+void AXObjectCacheImpl::listboxActiveIndexChanged(HTMLSelectElement* select)
+{
+ AXObject* obj = get(select);
+ if (!obj || !obj->isAXListBox())
+ return;
+
+ static_cast<AXListBox*>(obj)->activeIndexChanged();
}
void AXObjectCacheImpl::handleScrollbarUpdate(FrameView* view)
@@ -824,6 +831,19 @@ void AXObjectCacheImpl::handleAriaExpandedChange(Node* node)
obj->handleAriaExpandedChanged();
}
+void AXObjectCacheImpl::handleAriaSelectedChanged(Node* node)
+{
+ AXObject* obj = get(node);
+ if (!obj)
+ return;
+
+ postNotification(obj, AXCheckedStateChanged);
+
+ AXObject* listbox = obj->parentObjectUnignored();
+ if (listbox->roleValue() == ListBoxRole)
+ postNotification(listbox, AXSelectedChildrenChanged);
+}
+
void AXObjectCacheImpl::handleActiveDescendantChanged(Node* node)
{
if (AXObject* obj = getOrCreate(node))
@@ -860,7 +880,7 @@ void AXObjectCacheImpl::handleAttributeChanged(const QualifiedName& attrName, El
else if (attrName == aria_checkedAttr)
checkedStateChanged(element);
else if (attrName == aria_selectedAttr)
- selectedChildrenChanged(element);
+ handleAriaSelectedChanged(element);
else if (attrName == aria_expandedAttr)
handleAriaExpandedChange(element);
else if (attrName == aria_hiddenAttr)

Powered by Google App Engine
This is Rietveld 408576698