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 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 subRange = NSMakeRange(index, arrayCount - index); | 1145 subRange = NSMakeRange(index, arrayCount - index); |
1146 } else { | 1146 } else { |
1147 subRange = NSMakeRange(index, maxCount); | 1147 subRange = NSMakeRange(index, maxCount); |
1148 } | 1148 } |
1149 return [fullArray subarrayWithRange:subRange]; | 1149 return [fullArray subarrayWithRange:subRange]; |
1150 } | 1150 } |
1151 | 1151 |
1152 // Returns the count of the specified accessibility array attribute. | 1152 // Returns the count of the specified accessibility array attribute. |
1153 - (NSUInteger)accessibilityArrayAttributeCount:(NSString*)attribute { | 1153 - (NSUInteger)accessibilityArrayAttributeCount:(NSString*)attribute { |
1154 if (!browserAccessibility_) | 1154 if (!browserAccessibility_) |
1155 return nil; | 1155 return 0; |
1156 | 1156 |
1157 NSArray* fullArray = [self accessibilityAttributeValue:attribute]; | 1157 NSArray* fullArray = [self accessibilityAttributeValue:attribute]; |
1158 return [fullArray count]; | 1158 return [fullArray count]; |
1159 } | 1159 } |
1160 | 1160 |
1161 // Returns the list of accessibility attributes that this object supports. | 1161 // Returns the list of accessibility attributes that this object supports. |
1162 - (NSArray*)accessibilityAttributeNames { | 1162 - (NSArray*)accessibilityAttributeNames { |
1163 if (!browserAccessibility_) | 1163 if (!browserAccessibility_) |
1164 return nil; | 1164 return nil; |
1165 | 1165 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 } | 1307 } |
1308 // TODO(aboxhall): expose NSAccessibilityServesAsTitleForUIElementsAttribute | 1308 // TODO(aboxhall): expose NSAccessibilityServesAsTitleForUIElementsAttribute |
1309 // for elements which are referred to by labelledby or are labels | 1309 // for elements which are referred to by labelledby or are labels |
1310 | 1310 |
1311 return ret; | 1311 return ret; |
1312 } | 1312 } |
1313 | 1313 |
1314 // Returns the index of the child in this objects array of children. | 1314 // Returns the index of the child in this objects array of children. |
1315 - (NSUInteger)accessibilityGetIndexOf:(id)child { | 1315 - (NSUInteger)accessibilityGetIndexOf:(id)child { |
1316 if (!browserAccessibility_) | 1316 if (!browserAccessibility_) |
1317 return nil; | 1317 return 0; |
1318 | 1318 |
1319 NSUInteger index = 0; | 1319 NSUInteger index = 0; |
1320 for (BrowserAccessibilityCocoa* childToCheck in [self children]) { | 1320 for (BrowserAccessibilityCocoa* childToCheck in [self children]) { |
1321 if ([child isEqual:childToCheck]) | 1321 if ([child isEqual:childToCheck]) |
1322 return index; | 1322 return index; |
1323 ++index; | 1323 ++index; |
1324 } | 1324 } |
1325 return NSNotFound; | 1325 return NSNotFound; |
1326 } | 1326 } |
1327 | 1327 |
1328 // Returns whether or not the specified attribute can be set by the | 1328 // Returns whether or not the specified attribute can be set by the |
1329 // accessibility API via |accessibilitySetValue:forAttribute:|. | 1329 // accessibility API via |accessibilitySetValue:forAttribute:|. |
1330 - (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute { | 1330 - (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute { |
1331 if (!browserAccessibility_) | 1331 if (!browserAccessibility_) |
1332 return nil; | 1332 return NO; |
1333 | 1333 |
1334 if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) | 1334 if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) |
1335 return GetState(browserAccessibility_, | 1335 return GetState(browserAccessibility_, |
1336 ui::AX_STATE_FOCUSABLE); | 1336 ui::AX_STATE_FOCUSABLE); |
1337 if ([attribute isEqualToString:NSAccessibilityValueAttribute]) { | 1337 if ([attribute isEqualToString:NSAccessibilityValueAttribute]) { |
1338 return browserAccessibility_->GetBoolAttribute( | 1338 return browserAccessibility_->GetBoolAttribute( |
1339 ui::AX_ATTR_CAN_SET_VALUE); | 1339 ui::AX_ATTR_CAN_SET_VALUE); |
1340 } | 1340 } |
1341 if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute] && | 1341 if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute] && |
1342 ([[self role] isEqualToString:NSAccessibilityTextFieldRole] || | 1342 ([[self role] isEqualToString:NSAccessibilityTextFieldRole] || |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 return [super hash]; | 1451 return [super hash]; |
1452 return browserAccessibility_->GetId(); | 1452 return browserAccessibility_->GetId(); |
1453 } | 1453 } |
1454 | 1454 |
1455 - (BOOL)accessibilityShouldUseUniqueId { | 1455 - (BOOL)accessibilityShouldUseUniqueId { |
1456 return YES; | 1456 return YES; |
1457 } | 1457 } |
1458 | 1458 |
1459 @end | 1459 @end |
1460 | 1460 |
OLD | NEW |