Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 371 if ([attributeName isEqualToString:NSAccessibilitySelectedAttribute] || | 371 if ([attributeName isEqualToString:NSAccessibilitySelectedAttribute] || |
| 372 [attributeName | 372 [attributeName |
| 373 isEqualToString:NSAccessibilitySelectedChildrenAttribute] || | 373 isEqualToString:NSAccessibilitySelectedChildrenAttribute] || |
| 374 [attributeName | 374 [attributeName |
| 375 isEqualToString:NSAccessibilitySelectedTextRangeAttribute] || | 375 isEqualToString:NSAccessibilitySelectedTextRangeAttribute] || |
| 376 [attributeName | 376 [attributeName |
| 377 isEqualToString:NSAccessibilityVisibleCharacterRangeAttribute]) { | 377 isEqualToString:NSAccessibilityVisibleCharacterRangeAttribute]) { |
| 378 return NO; | 378 return NO; |
| 379 } | 379 } |
| 380 | 380 |
| 381 if ([attributeName isEqualToString:NSAccessibilityValueAttribute]) | 381 if ([attributeName isEqualToString:NSAccessibilityValueAttribute] || |
| 382 [attributeName isEqualToString:NSAccessibilitySelectedTextAttribute]) | |
| 382 return node_->GetDelegate()->CanSetStringValue(); | 383 return node_->GetDelegate()->CanSetStringValue(); |
| 383 // TODO(patricialor): Implement and merge with conditional for value above. | |
| 384 if ([attributeName isEqualToString:NSAccessibilitySelectedTextAttribute]) | |
| 385 return NO; | |
| 386 | 384 |
| 387 if ([attributeName isEqualToString:NSAccessibilityFocusedAttribute]) { | 385 if ([attributeName isEqualToString:NSAccessibilityFocusedAttribute]) { |
| 388 if (ui::AXViewState::IsFlagSet(node_->GetData().state, | 386 if (ui::AXViewState::IsFlagSet(node_->GetData().state, |
| 389 ui::AX_STATE_FOCUSABLE)) | 387 ui::AX_STATE_FOCUSABLE)) |
| 390 return NO; | 388 return NO; |
| 391 } | 389 } |
| 392 | 390 |
| 393 // TODO(patricialor): Add callbacks for updating the above attributes except | 391 // TODO(patricialor): Add callbacks for updating the above attributes except |
| 394 // NSAccessibilityValueAttribute and return YES. | 392 // NSAccessibilityValueAttribute and return YES. |
| 395 return NO; | 393 return NO; |
| 396 } | 394 } |
| 397 | 395 |
| 398 - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { | 396 - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { |
| 399 if ([attribute isEqualToString:NSAccessibilityValueAttribute] && | 397 if ([attribute isEqualToString:NSAccessibilityValueAttribute] && |
| 400 [value isKindOfClass:[NSString class]]) | 398 [value isKindOfClass:[NSString class]]) |
|
tapted
2016/10/20 05:54:59
perhaps at the top of the function,
if (![value
Patti Lor
2016/10/24 04:31:48
This doesn't work for all attributes - e.g., NSAcc
tapted
2016/10/24 06:11:57
Acknowledged.
| |
| 401 node_->GetDelegate()->SetStringValue(base::SysNSStringToUTF16(value)); | 399 node_->GetDelegate()->SetStringValue(base::SysNSStringToUTF16(value), |
| 400 false); | |
|
tapted
2016/10/20 05:54:59
now that the body spans 2 lines, the `if` (and els
Patti Lor
2016/10/24 04:31:48
Done.
| |
| 401 else if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute] && | |
| 402 [value isKindOfClass:[NSString class]]) | |
| 403 node_->GetDelegate()->SetStringValue(base::SysNSStringToUTF16(value), true); | |
| 402 | 404 |
| 403 // TODO(patricialor): Plumb through all the other writable attributes as | 405 // TODO(patricialor): Plumb through all the other writable attributes as |
| 404 // specified in accessibilityIsAttributeSettable. | 406 // specified in accessibilityIsAttributeSettable. |
| 405 } | 407 } |
| 406 | 408 |
| 407 - (id)accessibilityAttributeValue:(NSString*)attribute { | 409 - (id)accessibilityAttributeValue:(NSString*)attribute { |
| 408 SEL selector = NSSelectorFromString(attribute); | 410 SEL selector = NSSelectorFromString(attribute); |
| 409 if ([self respondsToSelector:selector]) | 411 if ([self respondsToSelector:selector]) |
| 410 return [self performSelector:selector]; | 412 return [self performSelector:selector]; |
| 411 return nil; | 413 return nil; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 582 } | 584 } |
| 583 NotifyMacEvent(native_node_, event_type); | 585 NotifyMacEvent(native_node_, event_type); |
| 584 } | 586 } |
| 585 | 587 |
| 586 int AXPlatformNodeMac::GetIndexInParent() { | 588 int AXPlatformNodeMac::GetIndexInParent() { |
| 587 // TODO(dmazzoni): implement this. http://crbug.com/396137 | 589 // TODO(dmazzoni): implement this. http://crbug.com/396137 |
| 588 return -1; | 590 return -1; |
| 589 } | 591 } |
| 590 | 592 |
| 591 } // namespace ui | 593 } // namespace ui |
| OLD | NEW |