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

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

Issue 272573003: Add hack so VoiceOver speaks updates to injected live regions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
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 266f8fb90c854a3faa73c04a5a11b402478fcdd3..98d91ed1379c6b20abac41dc78a3810151a4b25e 100644
--- a/content/browser/accessibility/browser_accessibility_manager_mac.mm
+++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm
@@ -6,6 +6,7 @@
#import "base/logging.h"
#import "content/browser/accessibility/browser_accessibility_cocoa.h"
+#import "content/browser/accessibility/browser_accessibility_mac.h"
#include "content/common/accessibility_messages.h"
namespace content {
@@ -25,7 +26,8 @@ BrowserAccessibilityManagerMac::BrowserAccessibilityManagerMac(
BrowserAccessibilityDelegate* delegate,
BrowserAccessibilityFactory* factory)
: BrowserAccessibilityManager(initial_tree, delegate, factory),
- parent_view_(parent_view) {
+ parent_view_(parent_view),
+ created_live_region_(false) {
}
// static
@@ -142,4 +144,27 @@ void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent(
NSAccessibilityPostNotification(native_node, event_id);
}
+void BrowserAccessibilityManagerMac::OnNodeCreationFinished(ui::AXNode* node) {
+ BrowserAccessibility* obj = GetFromAXNode(node);
+ if (obj && obj->HasStringAttribute(ui::AX_ATTR_LIVE_STATUS))
+ created_live_region_ = true;
+}
+
+void BrowserAccessibilityManagerMac::OnUpdateFinished() {
+ 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. (Live regions that are there from
+ // the initial page load work fine.) By recreating the NSAccessibility
David Tseng 2014/05/08 17:07:02 Doesn't this code get triggered on initial load as
dmazzoni 2014/05/08 21:02:05 True. I updated the comment.
+ // 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());
+ root->RecreateNativeObject();
+ NotifyAccessibilityEvent(ui::AX_EVENT_CHILDREN_CHANGED, root);
+
+ created_live_region_ = false;
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698