summaryrefslogtreecommitdiffstats
path: root/views/accessibility/view_accessibility.cc
diff options
context:
space:
mode:
authordtseng@chromium.org <dtseng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-18 23:53:41 +0000
committerdtseng@chromium.org <dtseng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-18 23:53:41 +0000
commit9870326b1412b1f3804eed8d9b6402ac60ddf8f0 (patch)
tree46225afad011decdd6b138dba35836636dee33db /views/accessibility/view_accessibility.cc
parent23b060ece7a2db1ef5b4802d4903f93edb538ae3 (diff)
downloadchromium_src-9870326b1412b1f3804eed8d9b6402ac60ddf8f0.zip
chromium_src-9870326b1412b1f3804eed8d9b6402ac60ddf8f0.tar.gz
chromium_src-9870326b1412b1f3804eed8d9b6402ac60ddf8f0.tar.bz2
Keep a cache of all views that have sent notifications. This ensures that AccessibleObjectFromEvent works properly.
BUG=9601 TEST=none Review URL: http://codereview.chromium.org/2823009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50302 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/accessibility/view_accessibility.cc')
-rw-r--r--views/accessibility/view_accessibility.cc38
1 files changed, 36 insertions, 2 deletions
diff --git a/views/accessibility/view_accessibility.cc b/views/accessibility/view_accessibility.cc
index 67aaaf2..2dad53d 100644
--- a/views/accessibility/view_accessibility.cc
+++ b/views/accessibility/view_accessibility.cc
@@ -290,9 +290,24 @@ STDMETHODIMP ViewAccessibility::get_accChild(VARIANT var_child,
// Check to see if child is out-of-bounds.
if (IsValidChild((var_child.lVal - 1), view_)) {
child_view = view_->GetChildViewAt(var_child.lVal - 1);
+
+ // Parents handle leaf IAccessible's.
+ if (child_view && child_view->GetChildViewCount() == 0)
+ return S_FALSE;
} else {
- // Child is located elsewhere in the hierarchy, get ID and adjust for MSAA.
- child_view = view_->GetViewByID(static_cast<int>(var_child.lVal));
+ // Child is located elsewhere in this view's subtree.
+ // Positive child id's are 1-based indexes so you can iterate over all
+ // children, and negative values are direct references to objects.
+ // Note that we return full IAccessible's for leafs that have
+ // negative child id's.
+ if (var_child.lVal > 0) {
+ child_view = view_->GetViewByID(static_cast<int>(var_child.lVal));
+ } else {
+ // Retrieve it from our cache of views that have fired events.
+ views::WidgetWin* view_widget =
+ static_cast<views::WidgetWin*>(view_->GetWidget());
+ child_view = view_widget->GetAccessibilityViewEventAt(var_child.lVal);
+ }
}
if (!child_view) {
@@ -756,6 +771,25 @@ STDMETHODIMP ViewAccessibility::put_accValue(VARIANT var_id, BSTR put_val) {
return E_NOTIMPL;
}
+int32 ViewAccessibility::MSAAEvent(AccessibilityTypes::Event event) {
+ switch (event) {
+ case AccessibilityTypes::EVENT_FOCUS:
+ return EVENT_OBJECT_FOCUS;
+ case AccessibilityTypes::EVENT_MENUSTART:
+ return EVENT_SYSTEM_MENUSTART;
+ case AccessibilityTypes::EVENT_MENUEND:
+ return EVENT_SYSTEM_MENUEND;
+ case AccessibilityTypes::EVENT_MENUPOPUPSTART:
+ return EVENT_SYSTEM_MENUPOPUPSTART;
+ case AccessibilityTypes::EVENT_MENUPOPUPEND:
+ return EVENT_SYSTEM_MENUPOPUPEND;
+ default:
+ // Not supported or invalid event.
+ NOTREACHED();
+ return -1;
+ }
+}
+
int32 ViewAccessibility::MSAARole(AccessibilityTypes::Role role) {
switch (role) {
case AccessibilityTypes::ROLE_APPLICATION: