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

Unified Diff: content/browser/accessibility/browser_accessibility_manager_win.cc

Issue 1899823002: Uses the activedescendant_changed event received from Blink to fire the right focus event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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: content/browser/accessibility/browser_accessibility_manager_win.cc
diff --git a/content/browser/accessibility/browser_accessibility_manager_win.cc b/content/browser/accessibility/browser_accessibility_manager_win.cc
index eb9a2e4db2101e7eec5e037241d0f0230fbb19f2..57beb91e694c9d47070bec05cfe258a1eadd4fa3 100644
--- a/content/browser/accessibility/browser_accessibility_manager_win.cc
+++ b/content/browser/accessibility/browser_accessibility_manager_win.cc
@@ -137,6 +137,9 @@ void BrowserAccessibilityManagerWin::UserIsReloading() {
void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent(
ui::AXEvent event_type,
BrowserAccessibility* node) {
+ if (!node)
+ return;
+
BrowserAccessibilityDelegate* root_delegate = GetDelegateFromRootManager();
if (!root_delegate || !root_delegate->AccessibilityGetAcceleratedWidget()) {
DLOG(WARNING) << "Not firing AX event because of no root_delegate or hwnd";
@@ -165,9 +168,13 @@ void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent(
LONG event_id = EVENT_MIN;
switch (event_type) {
- case ui::AX_EVENT_ACTIVEDESCENDANTCHANGED:
+ case ui::AX_EVENT_ACTIVEDESCENDANTCHANGED: {
event_id = IA2_EVENT_ACTIVE_DESCENDANT_CHANGED;
+ BrowserAccessibility* active_descendant = GetActiveDescendantFocus(node);
+ if (active_descendant != node)
+ FireFocusEvent(active_descendant);
break;
+ }
case ui::AX_EVENT_ALERT:
event_id = EVENT_SYSTEM_ALERT;
break;
@@ -217,9 +224,6 @@ void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent(
break;
}
- if (!node)
- return;
-
if (event_id != EVENT_MIN)
MaybeCallNotifyWinEvent(event_id, node);
@@ -246,6 +250,7 @@ bool BrowserAccessibilityManagerWin::CanFireEvents() {
void BrowserAccessibilityManagerWin::FireFocusEvent(
BrowserAccessibility* node) {
+ DCHECK(node);
// On Windows, we always fire a FOCUS event on the root of a frame before
// firing a focus event within that frame.
if (node->manager() != last_focused_manager_ &&

Powered by Google App Engine
This is Rietveld 408576698