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

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: Removed extraneous focus events. 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 506e20a015a0746479c3c9dc633dee62ecc0141d..75b6f83604c7fccc1e554286332e712151bd2d60 100644
--- a/content/browser/accessibility/browser_accessibility_manager_win.cc
+++ b/content/browser/accessibility/browser_accessibility_manager_win.cc
@@ -138,6 +138,9 @@ void BrowserAccessibilityManagerWin::UserIsReloading() {
void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent(
ui::AXEvent event_type,
BrowserAccessibility* node) {
+ if (!node)
dmazzoni 2016/04/26 20:24:24 How about DCHECK(node)? This should never be calle
+ return;
+
BrowserAccessibilityDelegate* root_delegate = GetDelegateFromRootManager();
if (!root_delegate || !root_delegate->AccessibilityGetAcceleratedWidget()) {
DLOG(WARNING) << "Not firing AX event because of no root_delegate or hwnd";
@@ -166,9 +169,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)
+ FireFocusEvent(active_descendant);
dmazzoni 2016/04/26 20:24:24 Same - I think this shouldn't be needed.
break;
+ }
case ui::AX_EVENT_ALERT:
event_id = EVENT_SYSTEM_ALERT;
break;
@@ -218,9 +225,6 @@ void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent(
break;
}
- if (!node)
- return;
-
if (event_id != EVENT_MIN)
MaybeCallNotifyWinEvent(event_id, node);
@@ -247,6 +251,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