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

Unified Diff: content/browser/accessibility/browser_accessibility_manager_mac.mm

Issue 2173563005: Newly created live regions should fire a private notification on the Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed legacy code. Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/accessibility/browser_accessibility_manager_mac.mm
diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm
index b2dff5cf91602e237a02682f2ad1f5baf62a74f6..77fd886fa339d58d0c3f103a65dde6665034ef01 100644
--- a/content/browser/accessibility/browser_accessibility_manager_mac.mm
+++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm
@@ -65,6 +65,8 @@ NSString* const NSAccessibilityLoadCompleteNotification =
@"AXLoadComplete";
NSString* const NSAccessibilityInvalidStatusChangedNotification =
@"AXInvalidStatusChanged";
+NSString* const NSAccessibilityLiveRegionCreatedNotification =
+ @"AXLiveRegionCreated";
NSString* const NSAccessibilityLiveRegionChangedNotification =
@"AXLiveRegionChanged";
NSString* const NSAccessibilityExpandedChanged =
@@ -261,7 +263,9 @@ void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent(
return;
}
break;
- // TODO(nektar): Need to add an event for live region created.
+ case ui::AX_EVENT_ALERT:
+ mac_notification = NSAccessibilityLiveRegionCreatedNotification;
+ break;
case ui::AX_EVENT_LIVE_REGION_CHANGED:
mac_notification = NSAccessibilityLiveRegionChangedNotification;
break;
@@ -284,7 +288,6 @@ void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent(
break;
// These events are not used on Mac for now.
- case ui::AX_EVENT_ALERT:
case ui::AX_EVENT_TEXT_CHANGED:
case ui::AX_EVENT_CHILDREN_CHANGED:
case ui::AX_EVENT_MENU_LIST_VALUE_CHANGED:
@@ -373,7 +376,6 @@ void BrowserAccessibilityManagerMac::OnAtomicUpdateFinished(
BrowserAccessibilityManager::OnAtomicUpdateFinished(
tree, root_changed, changes);
- bool created_live_region = false;
for (size_t i = 0; i < changes.size(); ++i) {
if (changes[i].type != NODE_CREATED && changes[i].type != SUBTREE_CREATED)
continue;
@@ -382,28 +384,10 @@ void BrowserAccessibilityManagerMac::OnAtomicUpdateFinished(
DCHECK(changed_node);
BrowserAccessibility* obj = GetFromAXNode(changed_node);
if (obj && obj->HasStringAttribute(ui::AX_ATTR_LIVE_STATUS)) {
- created_live_region = true;
- break;
+ NotifyAccessibilityEvent(BrowserAccessibilityEvent::FromTreeChange,
+ ui::AX_EVENT_ALERT, obj);
}
}
-
- if (!created_live_region)
- return;
-
- // This code is to work around a bug in VoiceOver, where a new live
- // region that gets added is ignored. VoiceOver seems to only scan the
- // page for live regions once. By recreating the NSAccessibility
- // object for the root of the tree, we force VoiceOver to clear out its
- // internal state and find newly-added live regions this time.
- BrowserAccessibilityMac* root =
- static_cast<BrowserAccessibilityMac*>(GetRoot());
- if (root) {
- root->RecreateNativeObject();
- NotifyAccessibilityEvent(
- BrowserAccessibilityEvent::FromTreeChange,
- ui::AX_EVENT_CHILDREN_CHANGED,
- root);
- }
}
NSDictionary* BrowserAccessibilityManagerMac::
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698