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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 return nil; | 616 return nil; |
617 } | 617 } |
618 } | 618 } |
619 | 619 |
620 - (id)disclosedRows { | 620 - (id)disclosedRows { |
621 // The rows that are considered inside this row. | 621 // The rows that are considered inside this row. |
622 return nil; | 622 return nil; |
623 } | 623 } |
624 | 624 |
625 - (NSString*)dropeffect { | 625 - (NSString*)dropeffect { |
626 return NSStringForStringAttribute( | 626 std::string dropEffect; |
627 browserAccessibility_, ui::AX_ATTR_DROPEFFECT); | 627 if (browserAccessibility_->GetHtmlAttribute("aria-dropeffect", &dropEffect)) |
| 628 return base::SysUTF8ToNSString(dropEffect); |
| 629 |
| 630 return nil; |
628 } | 631 } |
629 | 632 |
630 - (NSNumber*)enabled { | 633 - (NSNumber*)enabled { |
631 return [NSNumber numberWithBool: | 634 return [NSNumber numberWithBool: |
632 GetState(browserAccessibility_, ui::AX_STATE_ENABLED)]; | 635 GetState(browserAccessibility_, ui::AX_STATE_ENABLED)]; |
633 } | 636 } |
634 | 637 |
635 - (NSNumber*)expanded { | 638 - (NSNumber*)expanded { |
636 return [NSNumber numberWithBool: | 639 return [NSNumber numberWithBool: |
637 GetState(browserAccessibility_, ui::AX_STATE_EXPANDED)]; | 640 GetState(browserAccessibility_, ui::AX_STATE_EXPANDED)]; |
638 } | 641 } |
639 | 642 |
640 - (NSNumber*)focused { | 643 - (NSNumber*)focused { |
641 BrowserAccessibilityManager* manager = browserAccessibility_->manager(); | 644 BrowserAccessibilityManager* manager = browserAccessibility_->manager(); |
642 NSNumber* ret = [NSNumber numberWithBool: | 645 NSNumber* ret = [NSNumber numberWithBool: |
643 manager->GetFocus(NULL) == browserAccessibility_]; | 646 manager->GetFocus(NULL) == browserAccessibility_]; |
644 return ret; | 647 return ret; |
645 } | 648 } |
646 | 649 |
647 - (NSNumber*)grabbed { | 650 - (NSNumber*)grabbed { |
648 bool boolValue = browserAccessibility_->GetBoolAttribute(ui::AX_ATTR_GRABBED); | 651 std::string grabbed; |
649 return [NSNumber numberWithBool:boolValue]; | 652 if (browserAccessibility_->GetHtmlAttribute("aria-grabbed", &grabbed) && |
| 653 grabbed == "true") |
| 654 return [NSNumber numberWithBool:YES]; |
| 655 |
| 656 return [NSNumber numberWithBool:NO]; |
650 } | 657 } |
651 | 658 |
652 - (id)header { | 659 - (id)header { |
653 int headerElementId = -1; | 660 int headerElementId = -1; |
654 if ([self internalRole] == ui::AX_ROLE_TABLE || | 661 if ([self internalRole] == ui::AX_ROLE_TABLE || |
655 [self internalRole] == ui::AX_ROLE_GRID) { | 662 [self internalRole] == ui::AX_ROLE_GRID) { |
656 browserAccessibility_->GetIntAttribute( | 663 browserAccessibility_->GetIntAttribute( |
657 ui::AX_ATTR_TABLE_HEADER_ID, &headerElementId); | 664 ui::AX_ATTR_TABLE_HEADER_ID, &headerElementId); |
658 } else if ([self internalRole] == ui::AX_ROLE_COLUMN) { | 665 } else if ([self internalRole] == ui::AX_ROLE_COLUMN) { |
659 browserAccessibility_->GetIntAttribute( | 666 browserAccessibility_->GetIntAttribute( |
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1777 @"AXARIAAtomic", | 1784 @"AXARIAAtomic", |
1778 nil]]; | 1785 nil]]; |
1779 } | 1786 } |
1780 if (browserAccessibility_->HasBoolAttribute( | 1787 if (browserAccessibility_->HasBoolAttribute( |
1781 ui::AX_ATTR_LIVE_BUSY)) { | 1788 ui::AX_ATTR_LIVE_BUSY)) { |
1782 [ret addObjectsFromArray:[NSArray arrayWithObjects: | 1789 [ret addObjectsFromArray:[NSArray arrayWithObjects: |
1783 @"AXARIABusy", | 1790 @"AXARIABusy", |
1784 nil]]; | 1791 nil]]; |
1785 } | 1792 } |
1786 | 1793 |
1787 if (browserAccessibility_->HasStringAttribute( | 1794 std::string dropEffect; |
1788 ui::AX_ATTR_DROPEFFECT)) { | 1795 if (browserAccessibility_->GetHtmlAttribute("aria-dropeffect", &dropEffect)) { |
1789 [ret addObjectsFromArray:[NSArray arrayWithObjects: | 1796 [ret addObjectsFromArray:[NSArray arrayWithObjects: |
1790 @"AXDropEffects", | 1797 @"AXDropEffects", |
1791 nil]]; | 1798 nil]]; |
1792 } | 1799 } |
1793 | 1800 |
1794 // Add aria-grabbed attribute only if it has true. | 1801 std::string grabbed; |
1795 if (browserAccessibility_->HasBoolAttribute(ui::AX_ATTR_GRABBED)) { | 1802 if (browserAccessibility_->GetHtmlAttribute("aria-grabbed", &grabbed)) { |
1796 [ret addObjectsFromArray:[NSArray arrayWithObjects: | 1803 [ret addObjectsFromArray:[NSArray arrayWithObjects: |
1797 @"AXGrabbed", | 1804 @"AXGrabbed", |
1798 nil]]; | 1805 nil]]; |
1799 } | 1806 } |
1800 | 1807 |
1801 // Add expanded attribute only if it has expanded or collapsed state. | 1808 // Add expanded attribute only if it has expanded or collapsed state. |
1802 if (GetState(browserAccessibility_, ui::AX_STATE_EXPANDED) || | 1809 if (GetState(browserAccessibility_, ui::AX_STATE_EXPANDED) || |
1803 GetState(browserAccessibility_, ui::AX_STATE_COLLAPSED)) { | 1810 GetState(browserAccessibility_, ui::AX_STATE_COLLAPSED)) { |
1804 [ret addObjectsFromArray:[NSArray arrayWithObjects: | 1811 [ret addObjectsFromArray:[NSArray arrayWithObjects: |
1805 NSAccessibilityExpandedAttribute, | 1812 NSAccessibilityExpandedAttribute, |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1972 if (!browserAccessibility_) | 1979 if (!browserAccessibility_) |
1973 return [super hash]; | 1980 return [super hash]; |
1974 return browserAccessibility_->GetId(); | 1981 return browserAccessibility_->GetId(); |
1975 } | 1982 } |
1976 | 1983 |
1977 - (BOOL)accessibilityShouldUseUniqueId { | 1984 - (BOOL)accessibilityShouldUseUniqueId { |
1978 return YES; | 1985 return YES; |
1979 } | 1986 } |
1980 | 1987 |
1981 @end | 1988 @end |
OLD | NEW |