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

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

Issue 2341633006: MacViews/a11y: Allow accessibility clients to update the selected text. (Closed)
Patch Set: Review comments. 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 be9eb9e3679d2214a2f36a34f17e09f50335b97b..86556fee19dc93725cdd9fad5726d9e591e2e7dc 100644
--- a/ui/accessibility/platform/ax_platform_node_mac.mm
+++ b/ui/accessibility/platform/ax_platform_node_mac.mm
@@ -378,11 +378,9 @@ void NotifyMacEvent(AXPlatformNodeCocoa* target, ui::AXEvent event_type) {
return NO;
}
- if ([attributeName isEqualToString:NSAccessibilityValueAttribute])
+ if ([attributeName isEqualToString:NSAccessibilityValueAttribute] ||
+ [attributeName isEqualToString:NSAccessibilitySelectedTextAttribute])
return node_->GetDelegate()->CanSetStringValue();
- // TODO(patricialor): Implement and merge with conditional for value above.
- if ([attributeName isEqualToString:NSAccessibilitySelectedTextAttribute])
- return NO;
if ([attributeName isEqualToString:NSAccessibilityFocusedAttribute]) {
if (ui::AXViewState::IsFlagSet(node_->GetData().state,
@@ -397,8 +395,13 @@ void NotifyMacEvent(AXPlatformNodeCocoa* target, ui::AXEvent event_type) {
- (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute {
if ([attribute isEqualToString:NSAccessibilityValueAttribute] &&
- [value isKindOfClass:[NSString class]])
- node_->GetDelegate()->SetStringValue(base::SysNSStringToUTF16(value));
+ [value isKindOfClass:[NSString class]]) {
+ node_->GetDelegate()->SetStringValue(base::SysNSStringToUTF16(value), true);
+ } else if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute] &&
+ [value isKindOfClass:[NSString class]]) {
+ node_->GetDelegate()->SetStringValue(base::SysNSStringToUTF16(value),
+ false);
+ }
// TODO(patricialor): Plumb through all the other writable attributes as
// specified in accessibilityIsAttributeSettable.
« no previous file with comments | « ui/accessibility/platform/ax_platform_node_delegate.h ('k') | ui/accessibility/platform/ax_platform_node_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698