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

Side by Side 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: Fixed menu-list-open Layout test. Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/accessibility/browser_accessibility_manager_win.h" 5 #include "content/browser/accessibility/browser_accessibility_manager_win.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 void BrowserAccessibilityManagerWin::UserIsReloading() { 97 void BrowserAccessibilityManagerWin::UserIsReloading() {
98 if (GetRoot()) { 98 if (GetRoot()) {
99 (new BrowserAccessibilityEventWin( 99 (new BrowserAccessibilityEventWin(
100 BrowserAccessibilityEvent::FromRenderFrameHost, 100 BrowserAccessibilityEvent::FromRenderFrameHost,
101 ui::AX_EVENT_NONE, 101 ui::AX_EVENT_NONE,
102 IA2_EVENT_DOCUMENT_RELOAD, 102 IA2_EVENT_DOCUMENT_RELOAD,
103 GetRoot()))->Fire(); 103 GetRoot()))->Fire();
104 } 104 }
105 } 105 }
106 106
107 BrowserAccessibility* BrowserAccessibilityManagerWin::GetFocus() {
108 BrowserAccessibility* focus = BrowserAccessibilityManager::GetFocus();
109 return GetActiveDescendant(focus);
110 }
111
107 void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( 112 void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent(
108 BrowserAccessibilityEvent::Source source, 113 BrowserAccessibilityEvent::Source source,
109 ui::AXEvent event_type, 114 ui::AXEvent event_type,
110 BrowserAccessibility* node) { 115 BrowserAccessibility* node) {
111 bool can_fire_events = CanFireEvents(); 116 bool can_fire_events = CanFireEvents();
112 117
113 // TODO(dmazzoni): A better fix would be to always have a HWND. 118 // TODO(dmazzoni): A better fix would be to always have a HWND.
114 // http://crbug.com/521877 119 // http://crbug.com/521877
115 if (event_type == ui::AX_EVENT_LOAD_COMPLETE && can_fire_events) 120 if (event_type == ui::AX_EVENT_LOAD_COMPLETE && can_fire_events)
116 load_complete_pending_ = false; 121 load_complete_pending_ = false;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 BrowserAccessibilityDelegate* root_delegate = GetDelegateFromRootManager(); 229 BrowserAccessibilityDelegate* root_delegate = GetDelegateFromRootManager();
225 if (!root_delegate) 230 if (!root_delegate)
226 return false; 231 return false;
227 HWND hwnd = root_delegate->AccessibilityGetAcceleratedWidget(); 232 HWND hwnd = root_delegate->AccessibilityGetAcceleratedWidget();
228 return hwnd != nullptr; 233 return hwnd != nullptr;
229 } 234 }
230 235
231 void BrowserAccessibilityManagerWin::FireFocusEvent( 236 void BrowserAccessibilityManagerWin::FireFocusEvent(
232 BrowserAccessibilityEvent::Source source, 237 BrowserAccessibilityEvent::Source source,
233 BrowserAccessibility* node) { 238 BrowserAccessibility* node) {
239 DCHECK(node);
234 // On Windows, we always fire a FOCUS event on the root of a frame before 240 // On Windows, we always fire a FOCUS event on the root of a frame before
235 // firing a focus event within that frame. 241 // firing a focus event within that frame.
236 if (node->manager() != last_focused_manager_ && 242 if (node->manager() != last_focused_manager_ &&
237 node != node->manager()->GetRoot()) { 243 node != node->manager()->GetRoot()) {
238 BrowserAccessibilityEvent::Create(source, 244 BrowserAccessibilityEvent::Create(source,
239 ui::AX_EVENT_FOCUS, 245 ui::AX_EVENT_FOCUS,
240 node->manager()->GetRoot())->Fire(); 246 node->manager()->GetRoot())->Fire();
241 } 247 }
242 248
243 BrowserAccessibilityManager::FireFocusEvent(source, node); 249 BrowserAccessibilityManager::FireFocusEvent(source, node);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 327
322 void BrowserAccessibilityManagerWin::TrackScrollingObject( 328 void BrowserAccessibilityManagerWin::TrackScrollingObject(
323 BrowserAccessibilityWin* node) { 329 BrowserAccessibilityWin* node) {
324 if (tracked_scroll_object_) 330 if (tracked_scroll_object_)
325 tracked_scroll_object_->Release(); 331 tracked_scroll_object_->Release();
326 tracked_scroll_object_ = node; 332 tracked_scroll_object_ = node;
327 tracked_scroll_object_->AddRef(); 333 tracked_scroll_object_->AddRef();
328 } 334 }
329 335
330 } // namespace content 336 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698