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

Side by Side Diff: content/browser/accessibility/browser_accessibility_manager_mac.mm

Issue 1925473002: Add verbose logging for native accessibility events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@load_complete
Patch Set: address all feedback Created 4 years, 7 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_mac.h" 5 #include "content/browser/accessibility/browser_accessibility_manager_mac.h"
6 6
7 #import "base/mac/mac_util.h" 7 #import "base/mac/mac_util.h"
8 #import "base/mac/sdk_forward_declarations.h" 8 #import "base/mac/sdk_forward_declarations.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // information about the number of selected items will never be reported. 134 // information about the number of selected items will never be reported.
135 BrowserAccessibility* node = BrowserAccessibilityManager::GetFocus(); 135 BrowserAccessibility* node = BrowserAccessibilityManager::GetFocus();
136 if (node && node->GetRole() == ui::AX_ROLE_LIST_BOX) 136 if (node && node->GetRole() == ui::AX_ROLE_LIST_BOX)
137 return node; 137 return node;
138 138
139 // For other roles, follow the active descendant. 139 // For other roles, follow the active descendant.
140 return GetActiveDescendantFocus(node); 140 return GetActiveDescendantFocus(node);
141 } 141 }
142 142
143 void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent( 143 void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent(
144 BrowserAccessibilityEvent::Source source,
144 ui::AXEvent event_type, 145 ui::AXEvent event_type,
145 BrowserAccessibility* node) { 146 BrowserAccessibility* node) {
146 if (!node->IsNative()) 147 if (!node->IsNative())
147 return; 148 return;
148 149
149 if (event_type == ui::AX_EVENT_FOCUS) { 150 if (event_type == ui::AX_EVENT_FOCUS) {
150 BrowserAccessibility* active_descendant = GetActiveDescendantFocus(node); 151 BrowserAccessibility* active_descendant = GetActiveDescendantFocus(node);
151 if (active_descendant) 152 if (active_descendant)
152 node = active_descendant; 153 node = active_descendant;
153 154
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 387
387 // This code is to work around a bug in VoiceOver, where a new live 388 // This code is to work around a bug in VoiceOver, where a new live
388 // region that gets added is ignored. VoiceOver seems to only scan the 389 // region that gets added is ignored. VoiceOver seems to only scan the
389 // page for live regions once. By recreating the NSAccessibility 390 // page for live regions once. By recreating the NSAccessibility
390 // object for the root of the tree, we force VoiceOver to clear out its 391 // object for the root of the tree, we force VoiceOver to clear out its
391 // internal state and find newly-added live regions this time. 392 // internal state and find newly-added live regions this time.
392 BrowserAccessibilityMac* root = 393 BrowserAccessibilityMac* root =
393 static_cast<BrowserAccessibilityMac*>(GetRoot()); 394 static_cast<BrowserAccessibilityMac*>(GetRoot());
394 if (root) { 395 if (root) {
395 root->RecreateNativeObject(); 396 root->RecreateNativeObject();
396 NotifyAccessibilityEvent(ui::AX_EVENT_CHILDREN_CHANGED, root); 397 NotifyAccessibilityEvent(
398 BrowserAccessibilityEvent::FromTreeChange,
399 ui::AX_EVENT_CHILDREN_CHANGED,
400 root);
397 } 401 }
398 } 402 }
399 403
400 NSDictionary* BrowserAccessibilityManagerMac:: 404 NSDictionary* BrowserAccessibilityManagerMac::
401 GetUserInfoForSelectedTextChangedNotification() { 405 GetUserInfoForSelectedTextChangedNotification() {
402 NSMutableDictionary* user_info = [[[NSMutableDictionary alloc] init] 406 NSMutableDictionary* user_info = [[[NSMutableDictionary alloc] init]
403 autorelease]; 407 autorelease];
404 [user_info setObject:@YES forKey:NSAccessibilityTextStateSyncKey]; 408 [user_info setObject:@YES forKey:NSAccessibilityTextStateSyncKey];
405 [user_info setObject:@(AXTextStateChangeTypeUnknown) 409 [user_info setObject:@(AXTextStateChangeTypeUnknown)
406 forKey:NSAccessibilityTextStateChangeTypeKey]; 410 forKey:NSAccessibilityTextStateChangeTypeKey];
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 } 456 }
453 457
454 return @{ 458 return @{
455 NSAccessibilityTextStateChangeTypeKey : @(AXTextStateChangeTypeEdit), 459 NSAccessibilityTextStateChangeTypeKey : @(AXTextStateChangeTypeEdit),
456 NSAccessibilityTextChangeValues : changes, 460 NSAccessibilityTextChangeValues : changes,
457 NSAccessibilityTextChangeElement : native_node 461 NSAccessibilityTextChangeElement : native_node
458 }; 462 };
459 } 463 }
460 464
461 } // namespace content 465 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698