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

Unified Diff: ui/accessibility/platform/ax_platform_node_mac.mm

Issue 2210763002: MacViews a11y: Sync VoiceOver cursor with keyboard focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits. Created 4 years, 2 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: ui/accessibility/platform/ax_platform_node_mac.mm
diff --git a/ui/accessibility/platform/ax_platform_node_mac.mm b/ui/accessibility/platform/ax_platform_node_mac.mm
index 88ab503003939c38fe2445d8d7efe90d2dd0a465..be9eb9e3679d2214a2f36a34f17e09f50335b97b 100644
--- a/ui/accessibility/platform/ax_platform_node_mac.mm
+++ b/ui/accessibility/platform/ax_platform_node_mac.mm
@@ -199,6 +199,7 @@ RoleMap BuildSubroleMap() {
EventMap BuildEventMap() {
const EventMapEntry events[] = {
+ {ui::AX_EVENT_FOCUS, NSAccessibilityFocusedUIElementChangedNotification},
{ui::AX_EVENT_TEXT_CHANGED, NSAccessibilityTitleChangedNotification},
{ui::AX_EVENT_VALUE_CHANGED, NSAccessibilityValueChangedNotification},
{ui::AX_EVENT_TEXT_SELECTION_CHANGED,
@@ -212,7 +213,7 @@ EventMap BuildEventMap() {
return event_map;
}
-void NotifyMacEvent(NSView* target, ui::AXEvent event_type) {
+void NotifyMacEvent(AXPlatformNodeCocoa* target, ui::AXEvent event_type) {
NSAccessibilityPostNotification(
target, [AXPlatformNodeCocoa nativeNotificationFromAXEvent:event_type]);
}
@@ -255,6 +256,10 @@ void NotifyMacEvent(NSView* target, ui::AXEvent event_type) {
}
- (void)detach {
+ if (!node_)
+ return;
+ NSAccessibilityPostNotification(
+ self, NSAccessibilityUIElementDestroyedNotification);
node_ = nil;
}
@@ -285,6 +290,14 @@ void NotifyMacEvent(NSView* target, ui::AXEvent event_type) {
return NSAccessibilityUnignoredAncestor(self);
}
+- (BOOL)accessibilityNotifiesWhenDestroyed {
+ return YES;
+}
+
+- (id)accessibilityFocusedUIElement {
+ return node_->GetDelegate()->GetFocus();
+}
+
- (NSArray*)accessibilityActionNames {
return nil;
}
@@ -553,22 +566,21 @@ gfx::NativeViewAccessible AXPlatformNodeMac::GetNativeViewAccessible() {
}
void AXPlatformNodeMac::NotifyAccessibilityEvent(ui::AXEvent event_type) {
- NSView* target = GetDelegate()->GetTargetForNativeAccessibilityEvent();
-
+ GetNativeViewAccessible();
// Add mappings between ui::AXEvent and NSAccessibility notifications using
// the EventMap above. This switch contains exceptions to those mappings.
switch (event_type) {
case ui::AX_EVENT_TEXT_CHANGED:
// If the view is a user-editable textfield, this should change the value.
if (GetData().role == ui::AX_ROLE_TEXT_FIELD) {
- NotifyMacEvent(target, ui::AX_EVENT_VALUE_CHANGED);
+ NotifyMacEvent(native_node_, ui::AX_EVENT_VALUE_CHANGED);
return;
}
break;
default:
break;
}
- NotifyMacEvent(target, event_type);
+ NotifyMacEvent(native_node_, event_type);
}
int AXPlatformNodeMac::GetIndexInParent() {
« no previous file with comments | « content/browser/accessibility/browser_accessibility_cocoa.mm ('k') | ui/views/cocoa/bridged_content_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698