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

Side by Side Diff: ui/accessibility/platform/ax_platform_node_mac.mm

Issue 2141013004: Mac a11y: Add Help, TopLevelUIElement, and Window accessibility attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test views without tooltips set. Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ui/accessibility/platform/ax_platform_node_mac.h" 5 #import "ui/accessibility/platform/ax_platform_node_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 NSAccessibilitySubroleAttribute, 298 NSAccessibilitySubroleAttribute,
299 299
300 // Title is required for most elements. Cocoa asks for the value even if it 300 // Title is required for most elements. Cocoa asks for the value even if it
301 // is omitted here, but won't present it to accessibility APIs without this. 301 // is omitted here, but won't present it to accessibility APIs without this.
302 NSAccessibilityTitleAttribute, 302 NSAccessibilityTitleAttribute,
303 303
304 // Attributes which are not required, but are general to all roles. 304 // Attributes which are not required, but are general to all roles.
305 NSAccessibilityRoleDescriptionAttribute, 305 NSAccessibilityRoleDescriptionAttribute,
306 NSAccessibilityEnabledAttribute, 306 NSAccessibilityEnabledAttribute,
307 NSAccessibilityFocusedAttribute, 307 NSAccessibilityFocusedAttribute,
308 NSAccessibilityHelpAttribute,
309 NSAccessibilityTopLevelUIElementAttribute,
310 NSAccessibilityWindowAttribute,
308 ]; 311 ];
309 312
310 // Attributes required for user-editable controls. 313 // Attributes required for user-editable controls.
311 NSArray* const kValueAttributes = @[ NSAccessibilityValueAttribute ]; 314 NSArray* const kValueAttributes = @[ NSAccessibilityValueAttribute ];
312 315
313 // Attributes required for textfields. 316 // Attributes required for textfields.
314 NSArray* const kTextfieldAttributes = @[ 317 NSArray* const kTextfieldAttributes = @[
315 NSAccessibilityInsertionPointLineNumberAttribute, 318 NSAccessibilityInsertionPointLineNumberAttribute,
316 NSAccessibilityNumberOfCharactersAttribute, 319 NSAccessibilityNumberOfCharactersAttribute,
317 NSAccessibilityPlaceholderValueAttribute, 320 NSAccessibilityPlaceholderValueAttribute,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 } 428 }
426 429
427 - (NSValue*)AXFocused { 430 - (NSValue*)AXFocused {
428 if (ui::AXViewState::IsFlagSet(node_->GetData().state, 431 if (ui::AXViewState::IsFlagSet(node_->GetData().state,
429 ui::AX_STATE_FOCUSABLE)) 432 ui::AX_STATE_FOCUSABLE))
430 return [NSNumber numberWithBool:(node_->GetDelegate()->GetFocus() == 433 return [NSNumber numberWithBool:(node_->GetDelegate()->GetFocus() ==
431 node_->GetNativeViewAccessible())]; 434 node_->GetNativeViewAccessible())];
432 return [NSNumber numberWithBool:NO]; 435 return [NSNumber numberWithBool:NO];
433 } 436 }
434 437
438 - (NSString*)AXHelp {
439 return [self getStringAttribute:ui::AX_ATTR_HELP_TEXT];
440 }
441
442 - (NSWindow*)AXTopLevelUIElement {
443 return [self AXWindow];
444 }
445
446 - (NSWindow*)AXWindow {
447 return node_->GetDelegate()->GetTopLevelWidget();
448 }
449
435 // Textfield-specific NSAccessibility attributes. 450 // Textfield-specific NSAccessibility attributes.
436 451
437 - (NSNumber*)AXInsertionPointLineNumber { 452 - (NSNumber*)AXInsertionPointLineNumber {
438 // Multiline is not supported on views. 453 // Multiline is not supported on views.
439 return [NSNumber numberWithInteger:0]; 454 return [NSNumber numberWithInteger:0];
440 } 455 }
441 456
442 - (NSNumber*)AXNumberOfCharacters { 457 - (NSNumber*)AXNumberOfCharacters {
443 return [NSNumber numberWithInteger:[[self AXValue] length]]; 458 return [NSNumber numberWithInteger:[[self AXValue] length]];
444 } 459 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 } 535 }
521 NotifyMacEvent(target, event_type); 536 NotifyMacEvent(target, event_type);
522 } 537 }
523 538
524 int AXPlatformNodeMac::GetIndexInParent() { 539 int AXPlatformNodeMac::GetIndexInParent() {
525 // TODO(dmazzoni): implement this. http://crbug.com/396137 540 // TODO(dmazzoni): implement this. http://crbug.com/396137
526 return -1; 541 return -1;
527 } 542 }
528 543
529 } // namespace ui 544 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698