OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <execinfo.h> | 5 #include <execinfo.h> |
6 | 6 |
7 #import "content/browser/accessibility/browser_accessibility_cocoa.h" | 7 #import "content/browser/accessibility/browser_accessibility_cocoa.h" |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 return nil; | 384 return nil; |
385 } | 385 } |
386 | 386 |
387 // Returns whether or not this node should be ignored in the | 387 // Returns whether or not this node should be ignored in the |
388 // accessibility tree. | 388 // accessibility tree. |
389 - (BOOL)isIgnored { | 389 - (BOOL)isIgnored { |
390 return [[self role] isEqualToString:NSAccessibilityUnknownRole]; | 390 return [[self role] isEqualToString:NSAccessibilityUnknownRole]; |
391 } | 391 } |
392 | 392 |
393 - (NSString*)invalid { | 393 - (NSString*)invalid { |
394 base::string16 invalidUTF; | 394 int invalidState; |
395 if (!browserAccessibility_->GetHtmlAttribute("aria-invalid", &invalidUTF)) | 395 if (!browserAccessibility_->GetIntAttribute( |
396 return NULL; | 396 ui::AX_ATTR_INVALID_STATE, &invalidState)) |
397 NSString* invalid = base::SysUTF16ToNSString(invalidUTF); | |
398 if ([invalid isEqualToString:@"false"] || | |
399 [invalid isEqualToString:@""]) { | |
400 return @"false"; | 397 return @"false"; |
| 398 |
| 399 switch (invalidState) { |
| 400 case ui::AX_INVALID_STATE_FALSE: |
| 401 return @"false"; |
| 402 case ui::AX_INVALID_STATE_TRUE: |
| 403 return @"true"; |
| 404 case ui::AX_INVALID_STATE_SPELLING: |
| 405 return @"spelling"; |
| 406 case ui::AX_INVALID_STATE_GRAMMAR: |
| 407 return @"grammar"; |
| 408 case ui::AX_INVALID_STATE_OTHER: |
| 409 { |
| 410 std::string ariaInvalidValue; |
| 411 if (browserAccessibility_->GetStringAttribute( |
| 412 ui::AX_ATTR_ARIA_INVALID_VALUE, |
| 413 &ariaInvalidValue)) |
| 414 return base::SysUTF8ToNSString(ariaInvalidValue); |
| 415 // Return @"true" since we cannot be more specific about the value. |
| 416 return @"true"; |
| 417 } |
| 418 default: |
| 419 NOTREACHED(); |
401 } | 420 } |
402 return invalid; | 421 |
| 422 return @"false"; |
403 } | 423 } |
404 | 424 |
405 - (NSString*)placeholder { | 425 - (NSString*)placeholder { |
406 return NSStringForStringAttribute( | 426 return NSStringForStringAttribute( |
407 browserAccessibility_, ui::AX_ATTR_PLACEHOLDER); | 427 browserAccessibility_, ui::AX_ATTR_PLACEHOLDER); |
408 } | 428 } |
409 | 429 |
410 - (void)addLinkedUIElementsFromAttribute:(ui::AXIntListAttribute)attribute | 430 - (void)addLinkedUIElementsFromAttribute:(ui::AXIntListAttribute)attribute |
411 addTo:(NSMutableArray*)outArray { | 431 addTo:(NSMutableArray*)outArray { |
412 const std::vector<int32>& attributeValues = | 432 const std::vector<int32>& attributeValues = |
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1532 return [super hash]; | 1552 return [super hash]; |
1533 return browserAccessibility_->GetId(); | 1553 return browserAccessibility_->GetId(); |
1534 } | 1554 } |
1535 | 1555 |
1536 - (BOOL)accessibilityShouldUseUniqueId { | 1556 - (BOOL)accessibilityShouldUseUniqueId { |
1537 return YES; | 1557 return YES; |
1538 } | 1558 } |
1539 | 1559 |
1540 @end | 1560 @end |
1541 | 1561 |
OLD | NEW |