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

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: Only recreate if it already exists 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
« no previous file with comments | « content/browser/accessibility/browser_accessibility_manager_mac.h ('k') | 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 fba13beadabc3c5180c7ef2cce061a26f3f024d0..53d776bc287536c0c13f608cb3846c9b6f07ae56 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
@@ -154,4 +156,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::OnTreeUpdateFinished() {
+ 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());
+ root->RecreateNativeObject();
+ NotifyAccessibilityEvent(ui::AX_EVENT_CHILDREN_CHANGED, root);
+
+ created_live_region_ = false;
+}
+
} // namespace content
« no previous file with comments | « content/browser/accessibility/browser_accessibility_manager_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698