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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 - (NSArray*)columns { | 545 - (NSArray*)columns { |
546 NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease]; | 546 NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease]; |
547 for (BrowserAccessibilityCocoa* child in [self children]) { | 547 for (BrowserAccessibilityCocoa* child in [self children]) { |
548 if ([[child role] isEqualToString:NSAccessibilityColumnRole]) | 548 if ([[child role] isEqualToString:NSAccessibilityColumnRole]) |
549 [ret addObject:child]; | 549 [ret addObject:child]; |
550 } | 550 } |
551 return ret; | 551 return ret; |
552 } | 552 } |
553 | 553 |
554 - (NSString*)description { | 554 - (NSString*)description { |
555 std::string description; | 555 // Mac OS X wants static text exposed in AXValue. |
556 if (browserAccessibility_->GetStringAttribute( | 556 if ([self shouldExposeNameInAXValue]) |
557 ui::AX_ATTR_DESCRIPTION, &description)) { | 557 return @""; |
558 return base::SysUTF8ToNSString(description); | 558 |
| 559 // If the name came from a single related element and it's present in the |
| 560 // tree, it will be exposed in AXTitleUIElement. |
| 561 std::vector<int32> labelledby_ids = |
| 562 browserAccessibility_->GetIntListAttribute(ui::AX_ATTR_LABELLEDBY_IDS); |
| 563 ui::AXNameFrom nameFrom = static_cast<ui::AXNameFrom>( |
| 564 browserAccessibility_->GetIntAttribute(ui::AX_ATTR_NAME_FROM)); |
| 565 if (nameFrom == ui::AX_NAME_FROM_RELATED_ELEMENT && |
| 566 labelledby_ids.size() == 1 && |
| 567 browserAccessibility_->manager()->GetFromID(labelledby_ids[0])) { |
| 568 return @""; |
559 } | 569 } |
560 | 570 |
561 // If the role is anything other than an image, or if there's | 571 std::string name = browserAccessibility_->GetStringAttribute( |
562 // a title or title UI element, just return an empty string. | 572 ui::AX_ATTR_NAME); |
563 if (![[self role] isEqualToString:NSAccessibilityImageRole]) | 573 if (!name.empty()) { |
564 return @""; | 574 // On Mac OS X, the accessible name of an object is exposed as its |
565 if (browserAccessibility_->HasStringAttribute( | 575 // title if it comes from visible text, and as its description |
566 ui::AX_ATTR_NAME)) { | 576 // otherwise, but never both. |
567 return @""; | 577 if (nameFrom == ui::AX_NAME_FROM_CONTENTS || |
| 578 nameFrom == ui::AX_NAME_FROM_RELATED_ELEMENT || |
| 579 nameFrom == ui::AX_NAME_FROM_VALUE) { |
| 580 return @""; |
| 581 } else { |
| 582 return base::SysUTF8ToNSString(name); |
| 583 } |
568 } | 584 } |
569 if ([self titleUIElement]) | |
570 return @""; | |
571 | 585 |
572 // The remaining case is an image where there's no other title. | 586 // Given an image where there's no other title, return the base part |
573 // Return the base part of the filename as the description. | 587 // of the filename as the description. |
574 std::string url; | 588 if ([[self role] isEqualToString:NSAccessibilityImageRole]) { |
575 if (browserAccessibility_->GetStringAttribute( | 589 if (browserAccessibility_->HasStringAttribute(ui::AX_ATTR_NAME)) |
576 ui::AX_ATTR_URL, &url)) { | 590 return @""; |
577 // Given a url like http://foo.com/bar/baz.png, just return the | 591 if ([self titleUIElement]) |
578 // base name, e.g., "baz.png". | 592 return @""; |
579 size_t leftIndex = url.rfind('/'); | 593 |
580 std::string basename = | 594 std::string url; |
581 leftIndex != std::string::npos ? url.substr(leftIndex) : url; | 595 if (browserAccessibility_->GetStringAttribute( |
582 return base::SysUTF8ToNSString(basename); | 596 ui::AX_ATTR_URL, &url)) { |
| 597 // Given a url like http://foo.com/bar/baz.png, just return the |
| 598 // base name, e.g., "baz.png". |
| 599 size_t leftIndex = url.rfind('/'); |
| 600 std::string basename = |
| 601 leftIndex != std::string::npos ? url.substr(leftIndex) : url; |
| 602 return base::SysUTF8ToNSString(basename); |
| 603 } |
| 604 } |
| 605 |
| 606 // If it's focusable but didn't have any other name or value, compute a name |
| 607 // from its descendants. |
| 608 std::string value = browserAccessibility_->GetStringAttribute( |
| 609 ui::AX_ATTR_VALUE); |
| 610 if (browserAccessibility_->HasState(ui::AX_STATE_FOCUSABLE) && |
| 611 !browserAccessibility_->IsControl() && |
| 612 value.empty() && |
| 613 [self internalRole] != ui::AX_ROLE_DATE_TIME && |
| 614 [self internalRole] != ui::AX_ROLE_WEB_AREA && |
| 615 [self internalRole] != ui::AX_ROLE_ROOT_WEB_AREA) { |
| 616 return base::SysUTF8ToNSString( |
| 617 browserAccessibility_->ComputeAccessibleNameFromDescendants()); |
583 } | 618 } |
584 | 619 |
585 return @""; | 620 return @""; |
586 } | 621 } |
587 | 622 |
588 - (NSNumber*)disclosing { | 623 - (NSNumber*)disclosing { |
589 if ([self internalRole] == ui::AX_ROLE_TREE_ITEM) { | 624 if ([self internalRole] == ui::AX_ROLE_TREE_ITEM) { |
590 return [NSNumber numberWithBool: | 625 return [NSNumber numberWithBool: |
591 GetState(browserAccessibility_, ui::AX_STATE_EXPANDED)]; | 626 GetState(browserAccessibility_, ui::AX_STATE_EXPANDED)]; |
592 } else { | 627 } else { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 BrowserAccessibility* headerObject = | 707 BrowserAccessibility* headerObject = |
673 browserAccessibility_->manager()->GetFromID(headerElementId); | 708 browserAccessibility_->manager()->GetFromID(headerElementId); |
674 if (headerObject) | 709 if (headerObject) |
675 return headerObject->ToBrowserAccessibilityCocoa(); | 710 return headerObject->ToBrowserAccessibilityCocoa(); |
676 } | 711 } |
677 return nil; | 712 return nil; |
678 } | 713 } |
679 | 714 |
680 - (NSString*)help { | 715 - (NSString*)help { |
681 return NSStringForStringAttribute( | 716 return NSStringForStringAttribute( |
682 browserAccessibility_, ui::AX_ATTR_HELP); | 717 browserAccessibility_, ui::AX_ATTR_DESCRIPTION); |
683 } | 718 } |
684 | 719 |
685 - (NSNumber*)index { | 720 - (NSNumber*)index { |
686 if ([self internalRole] == ui::AX_ROLE_COLUMN) { | 721 if ([self internalRole] == ui::AX_ROLE_COLUMN) { |
687 int columnIndex = browserAccessibility_->GetIntAttribute( | 722 int columnIndex = browserAccessibility_->GetIntAttribute( |
688 ui::AX_ATTR_TABLE_COLUMN_INDEX); | 723 ui::AX_ATTR_TABLE_COLUMN_INDEX); |
689 return [NSNumber numberWithInt:columnIndex]; | 724 return [NSNumber numberWithInt:columnIndex]; |
690 } else if ([self internalRole] == ui::AX_ROLE_ROW) { | 725 } else if ([self internalRole] == ui::AX_ROLE_ROW) { |
691 int rowIndex = browserAccessibility_->GetIntAttribute( | 726 int rowIndex = browserAccessibility_->GetIntAttribute( |
692 ui::AX_ATTR_TABLE_ROW_INDEX); | 727 ui::AX_ATTR_TABLE_ROW_INDEX); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 return @"true"; | 763 return @"true"; |
729 } | 764 } |
730 default: | 765 default: |
731 NOTREACHED(); | 766 NOTREACHED(); |
732 } | 767 } |
733 | 768 |
734 return @"false"; | 769 return @"false"; |
735 } | 770 } |
736 | 771 |
737 - (NSString*)placeholderValue { | 772 - (NSString*)placeholderValue { |
| 773 ui::AXNameFrom nameFrom = static_cast<ui::AXNameFrom>( |
| 774 browserAccessibility_->GetIntAttribute(ui::AX_ATTR_NAME_FROM)); |
| 775 if (nameFrom == ui::AX_NAME_FROM_PLACEHOLDER) { |
| 776 return NSStringForStringAttribute( |
| 777 browserAccessibility_, ui::AX_ATTR_NAME); |
| 778 } |
| 779 |
| 780 ui::AXDescriptionFrom descriptionFrom = static_cast<ui::AXDescriptionFrom>( |
| 781 browserAccessibility_->GetIntAttribute(ui::AX_ATTR_DESCRIPTION_FROM)); |
| 782 if (descriptionFrom == ui::AX_DESCRIPTION_FROM_PLACEHOLDER) { |
| 783 return NSStringForStringAttribute( |
| 784 browserAccessibility_, ui::AX_ATTR_DESCRIPTION); |
| 785 } |
| 786 |
738 return NSStringForStringAttribute( | 787 return NSStringForStringAttribute( |
739 browserAccessibility_, ui::AX_ATTR_PLACEHOLDER); | 788 browserAccessibility_, ui::AX_ATTR_PLACEHOLDER); |
740 } | 789 } |
741 | 790 |
742 - (void)addLinkedUIElementsFromAttribute:(ui::AXIntListAttribute)attribute | 791 - (void)addLinkedUIElementsFromAttribute:(ui::AXIntListAttribute)attribute |
743 addTo:(NSMutableArray*)outArray { | 792 addTo:(NSMutableArray*)outArray { |
744 const std::vector<int32>& attributeValues = | 793 const std::vector<int32>& attributeValues = |
745 browserAccessibility_->GetIntListAttribute(attribute); | 794 browserAccessibility_->GetIntListAttribute(attribute); |
746 for (size_t i = 0; i < attributeValues.size(); ++i) { | 795 for (size_t i = 0; i < attributeValues.size(); ++i) { |
747 BrowserAccessibility* element = | 796 BrowserAccessibility* element = |
748 browserAccessibility_->manager()->GetFromID(attributeValues[i]); | 797 browserAccessibility_->manager()->GetFromID(attributeValues[i]); |
749 if (element) | 798 if (element) |
750 [outArray addObject:element->ToBrowserAccessibilityCocoa()]; | 799 [outArray addObject:element->ToBrowserAccessibilityCocoa()]; |
751 } | 800 } |
752 } | 801 } |
753 | 802 |
754 - (NSArray*)linkedUIElements { | 803 - (NSArray*)linkedUIElements { |
755 NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease]; | 804 NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease]; |
756 [self addLinkedUIElementsFromAttribute:ui::AX_ATTR_OWNS_IDS addTo:ret]; | |
757 [self addLinkedUIElementsFromAttribute:ui::AX_ATTR_CONTROLS_IDS addTo:ret]; | 805 [self addLinkedUIElementsFromAttribute:ui::AX_ATTR_CONTROLS_IDS addTo:ret]; |
758 [self addLinkedUIElementsFromAttribute:ui::AX_ATTR_FLOWTO_IDS addTo:ret]; | 806 [self addLinkedUIElementsFromAttribute:ui::AX_ATTR_FLOWTO_IDS addTo:ret]; |
759 if ([ret count] == 0) | 807 if ([ret count] == 0) |
760 return nil; | 808 return nil; |
761 return ret; | 809 return ret; |
762 } | 810 } |
763 | 811 |
764 - (NSNumber*)loaded { | 812 - (NSNumber*)loaded { |
765 return [NSNumber numberWithBool:YES]; | 813 return [NSNumber numberWithBool:YES]; |
766 } | 814 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 - (NSNumber*)required { | 878 - (NSNumber*)required { |
831 return [NSNumber numberWithBool: | 879 return [NSNumber numberWithBool: |
832 GetState(browserAccessibility_, ui::AX_STATE_REQUIRED)]; | 880 GetState(browserAccessibility_, ui::AX_STATE_REQUIRED)]; |
833 } | 881 } |
834 | 882 |
835 // Returns an enum indicating the role from browserAccessibility_. | 883 // Returns an enum indicating the role from browserAccessibility_. |
836 - (ui::AXRole)internalRole { | 884 - (ui::AXRole)internalRole { |
837 return static_cast<ui::AXRole>(browserAccessibility_->GetRole()); | 885 return static_cast<ui::AXRole>(browserAccessibility_->GetRole()); |
838 } | 886 } |
839 | 887 |
| 888 // Returns true if this should expose its accessible name in AXValue. |
| 889 - (bool)shouldExposeNameInAXValue { |
| 890 switch ([self internalRole]) { |
| 891 case ui::AX_ROLE_LIST_BOX_OPTION: |
| 892 case ui::AX_ROLE_LIST_MARKER: |
| 893 case ui::AX_ROLE_MENU_LIST_OPTION: |
| 894 case ui::AX_ROLE_STATIC_TEXT: |
| 895 return true; |
| 896 default: |
| 897 return false; |
| 898 } |
| 899 } |
| 900 |
840 - (content::BrowserAccessibilityDelegate*)delegate { | 901 - (content::BrowserAccessibilityDelegate*)delegate { |
841 return browserAccessibility_->manager() ? | 902 return browserAccessibility_->manager() ? |
842 browserAccessibility_->manager()->delegate() : | 903 browserAccessibility_->manager()->delegate() : |
843 nil; | 904 nil; |
844 } | 905 } |
845 | 906 |
846 - (content::BrowserAccessibility*)browserAccessibility { | 907 - (content::BrowserAccessibility*)browserAccessibility { |
847 return browserAccessibility_; | 908 return browserAccessibility_; |
848 } | 909 } |
849 | 910 |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 for (uint i=0; i < [[self children] count]; ++i) { | 1231 for (uint i=0; i < [[self children] count]; ++i) { |
1171 NSArray* tabChildren = [[[self children] objectAtIndex:i] tabs]; | 1232 NSArray* tabChildren = [[[self children] objectAtIndex:i] tabs]; |
1172 if ([tabChildren count] > 0) | 1233 if ([tabChildren count] > 0) |
1173 [tabSubtree addObjectsFromArray:tabChildren]; | 1234 [tabSubtree addObjectsFromArray:tabChildren]; |
1174 } | 1235 } |
1175 | 1236 |
1176 return tabSubtree; | 1237 return tabSubtree; |
1177 } | 1238 } |
1178 | 1239 |
1179 - (NSString*)title { | 1240 - (NSString*)title { |
1180 return NSStringForStringAttribute( | 1241 // Mac OS X wants static text exposed in AXValue. |
1181 browserAccessibility_, ui::AX_ATTR_NAME); | 1242 if ([self shouldExposeNameInAXValue]) |
| 1243 return @""; |
| 1244 |
| 1245 // If the name came from a single related element and it's present in the |
| 1246 // tree, it will be exposed in AXTitleUIElement. |
| 1247 std::vector<int32> labelledby_ids = |
| 1248 browserAccessibility_->GetIntListAttribute(ui::AX_ATTR_LABELLEDBY_IDS); |
| 1249 ui::AXNameFrom nameFrom = static_cast<ui::AXNameFrom>( |
| 1250 browserAccessibility_->GetIntAttribute(ui::AX_ATTR_NAME_FROM)); |
| 1251 if (nameFrom == ui::AX_NAME_FROM_RELATED_ELEMENT && |
| 1252 labelledby_ids.size() == 1 && |
| 1253 browserAccessibility_->manager()->GetFromID(labelledby_ids[0])) { |
| 1254 return @""; |
| 1255 } |
| 1256 |
| 1257 // On Mac OS X, the accessible name of an object is exposed as its |
| 1258 // title if it comes from visible text, and as its description |
| 1259 // otherwise, but never both. |
| 1260 if (nameFrom == ui::AX_NAME_FROM_CONTENTS || |
| 1261 nameFrom == ui::AX_NAME_FROM_RELATED_ELEMENT || |
| 1262 nameFrom == ui::AX_NAME_FROM_VALUE) { |
| 1263 return NSStringForStringAttribute( |
| 1264 browserAccessibility_, ui::AX_ATTR_NAME); |
| 1265 } |
| 1266 |
| 1267 return nil; |
1182 } | 1268 } |
1183 | 1269 |
1184 - (id)titleUIElement { | 1270 - (id)titleUIElement { |
1185 int titleElementId; | |
1186 if (browserAccessibility_->GetIntAttribute( | |
1187 ui::AX_ATTR_TITLE_UI_ELEMENT, &titleElementId)) { | |
1188 BrowserAccessibility* titleElement = | |
1189 browserAccessibility_->manager()->GetFromID(titleElementId); | |
1190 if (titleElement) | |
1191 return titleElement->ToBrowserAccessibilityCocoa(); | |
1192 } | |
1193 std::vector<int32> labelledby_ids = | 1271 std::vector<int32> labelledby_ids = |
1194 browserAccessibility_->GetIntListAttribute(ui::AX_ATTR_LABELLEDBY_IDS); | 1272 browserAccessibility_->GetIntListAttribute(ui::AX_ATTR_LABELLEDBY_IDS); |
1195 if (labelledby_ids.size() == 1) { | 1273 ui::AXNameFrom nameFrom = static_cast<ui::AXNameFrom>( |
| 1274 browserAccessibility_->GetIntAttribute(ui::AX_ATTR_NAME_FROM)); |
| 1275 if (nameFrom == ui::AX_NAME_FROM_RELATED_ELEMENT && |
| 1276 labelledby_ids.size() == 1) { |
1196 BrowserAccessibility* titleElement = | 1277 BrowserAccessibility* titleElement = |
1197 browserAccessibility_->manager()->GetFromID(labelledby_ids[0]); | 1278 browserAccessibility_->manager()->GetFromID(labelledby_ids[0]); |
1198 if (titleElement) | 1279 if (titleElement) |
1199 return titleElement->ToBrowserAccessibilityCocoa(); | 1280 return titleElement->ToBrowserAccessibilityCocoa(); |
1200 } | 1281 } |
1201 | 1282 |
1202 return nil; | 1283 return nil; |
1203 } | 1284 } |
1204 | 1285 |
1205 - (NSURL*)url { | 1286 - (NSURL*)url { |
1206 std::string url; | 1287 std::string url; |
1207 if ([[self role] isEqualToString:@"AXWebArea"]) | 1288 if ([[self role] isEqualToString:@"AXWebArea"]) |
1208 url = browserAccessibility_->manager()->GetTreeData().url; | 1289 url = browserAccessibility_->manager()->GetTreeData().url; |
1209 else | 1290 else |
1210 url = browserAccessibility_->GetStringAttribute(ui::AX_ATTR_URL); | 1291 url = browserAccessibility_->GetStringAttribute(ui::AX_ATTR_URL); |
1211 | 1292 |
1212 if (url.empty()) | 1293 if (url.empty()) |
1213 return nil; | 1294 return nil; |
1214 | 1295 |
1215 return [NSURL URLWithString:(base::SysUTF8ToNSString(url))]; | 1296 return [NSURL URLWithString:(base::SysUTF8ToNSString(url))]; |
1216 } | 1297 } |
1217 | 1298 |
1218 - (id)value { | 1299 - (id)value { |
1219 // WebCore uses an attachmentView to get the below behavior. | |
1220 // We do not have any native views backing this object, so need | |
1221 // to approximate Cocoa ax behavior best as we can. | |
1222 NSString* role = [self role]; | 1300 NSString* role = [self role]; |
1223 if ([role isEqualToString:@"AXHeading"]) { | 1301 if ([self shouldExposeNameInAXValue]) { |
| 1302 return NSStringForStringAttribute( |
| 1303 browserAccessibility_, ui::AX_ATTR_NAME); |
| 1304 } else if ([role isEqualToString:@"AXHeading"]) { |
1224 int level = 0; | 1305 int level = 0; |
1225 if (browserAccessibility_->GetIntAttribute( | 1306 if (browserAccessibility_->GetIntAttribute( |
1226 ui::AX_ATTR_HIERARCHICAL_LEVEL, &level)) { | 1307 ui::AX_ATTR_HIERARCHICAL_LEVEL, &level)) { |
1227 return [NSNumber numberWithInt:level]; | 1308 return [NSNumber numberWithInt:level]; |
1228 } | 1309 } |
1229 } else if ([role isEqualToString:NSAccessibilityButtonRole]) { | 1310 } else if ([role isEqualToString:NSAccessibilityButtonRole]) { |
1230 // AXValue does not make sense for pure buttons. | 1311 // AXValue does not make sense for pure buttons. |
1231 return @""; | 1312 return @""; |
1232 } else if ([self internalRole] == ui::AX_ROLE_TOGGLE_BUTTON) { | 1313 } else if ([self internalRole] == ui::AX_ROLE_TOGGLE_BUTTON) { |
1233 int value = 0; | 1314 int value = 0; |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1828 [ret addObjectsFromArray:[NSArray arrayWithObjects: | 1909 [ret addObjectsFromArray:[NSArray arrayWithObjects: |
1829 NSAccessibilityPlaceholderValueAttribute, nil]]; | 1910 NSAccessibilityPlaceholderValueAttribute, nil]]; |
1830 } | 1911 } |
1831 | 1912 |
1832 if (GetState(browserAccessibility_, ui::AX_STATE_REQUIRED)) { | 1913 if (GetState(browserAccessibility_, ui::AX_STATE_REQUIRED)) { |
1833 [ret addObjectsFromArray:[NSArray arrayWithObjects: | 1914 [ret addObjectsFromArray:[NSArray arrayWithObjects: |
1834 @"AXRequired", nil]]; | 1915 @"AXRequired", nil]]; |
1835 } | 1916 } |
1836 | 1917 |
1837 // Title UI Element. | 1918 // Title UI Element. |
1838 if (browserAccessibility_->HasIntAttribute(ui::AX_ATTR_TITLE_UI_ELEMENT) || | 1919 if (browserAccessibility_->HasIntListAttribute(ui::AX_ATTR_LABELLEDBY_IDS) && |
1839 (browserAccessibility_->HasIntListAttribute(ui::AX_ATTR_LABELLEDBY_IDS) && | 1920 browserAccessibility_->GetIntListAttribute(ui::AX_ATTR_LABELLEDBY_IDS) |
1840 browserAccessibility_->GetIntListAttribute(ui::AX_ATTR_LABELLEDBY_IDS) | 1921 .size() > 0) { |
1841 .size() == 1)) { | |
1842 [ret addObjectsFromArray:[NSArray arrayWithObjects: | 1922 [ret addObjectsFromArray:[NSArray arrayWithObjects: |
1843 NSAccessibilityTitleUIElementAttribute, | 1923 NSAccessibilityTitleUIElementAttribute, |
1844 nil]]; | 1924 nil]]; |
1845 } | 1925 } |
1846 // TODO(aboxhall): expose NSAccessibilityServesAsTitleForUIElementsAttribute | 1926 // TODO(aboxhall): expose NSAccessibilityServesAsTitleForUIElementsAttribute |
1847 // for elements which are referred to by labelledby or are labels | 1927 // for elements which are referred to by labelledby or are labels |
1848 | 1928 |
1849 return ret; | 1929 return ret; |
1850 } | 1930 } |
1851 | 1931 |
(...skipping 11 matching lines...) Expand all Loading... |
1863 return NSNotFound; | 1943 return NSNotFound; |
1864 } | 1944 } |
1865 | 1945 |
1866 // Returns whether or not the specified attribute can be set by the | 1946 // Returns whether or not the specified attribute can be set by the |
1867 // accessibility API via |accessibilitySetValue:forAttribute:|. | 1947 // accessibility API via |accessibilitySetValue:forAttribute:|. |
1868 - (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute { | 1948 - (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute { |
1869 if (!browserAccessibility_) | 1949 if (!browserAccessibility_) |
1870 return NO; | 1950 return NO; |
1871 | 1951 |
1872 if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) | 1952 if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) |
1873 return GetState(browserAccessibility_, | 1953 if ([self internalRole] == ui::AX_ROLE_DATE_TIME) |
1874 ui::AX_STATE_FOCUSABLE); | 1954 return NO; |
| 1955 return GetState(browserAccessibility_, ui::AX_STATE_FOCUSABLE); |
1875 if ([attribute isEqualToString:NSAccessibilityValueAttribute]) { | 1956 if ([attribute isEqualToString:NSAccessibilityValueAttribute]) { |
1876 return browserAccessibility_->GetBoolAttribute( | 1957 return browserAccessibility_->GetBoolAttribute( |
1877 ui::AX_ATTR_CAN_SET_VALUE); | 1958 ui::AX_ATTR_CAN_SET_VALUE); |
1878 } | 1959 } |
1879 if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute] && | 1960 if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute] && |
1880 browserAccessibility_->IsEditableText()) | 1961 browserAccessibility_->IsEditableText()) |
1881 return YES; | 1962 return YES; |
1882 | 1963 |
1883 return NO; | 1964 return NO; |
1884 } | 1965 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1983 if (!browserAccessibility_) | 2064 if (!browserAccessibility_) |
1984 return [super hash]; | 2065 return [super hash]; |
1985 return browserAccessibility_->GetId(); | 2066 return browserAccessibility_->GetId(); |
1986 } | 2067 } |
1987 | 2068 |
1988 - (BOOL)accessibilityShouldUseUniqueId { | 2069 - (BOOL)accessibilityShouldUseUniqueId { |
1989 return YES; | 2070 return YES; |
1990 } | 2071 } |
1991 | 2072 |
1992 @end | 2073 @end |
OLD | NEW |