| 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 346 |
| 347 - (NSString*)ariaRelevant { | 347 - (NSString*)ariaRelevant { |
| 348 return NSStringForStringAttribute( | 348 return NSStringForStringAttribute( |
| 349 browserAccessibility_, AccessibilityNodeData::ATTR_LIVE_RELEVANT); | 349 browserAccessibility_, AccessibilityNodeData::ATTR_LIVE_RELEVANT); |
| 350 } | 350 } |
| 351 | 351 |
| 352 // Returns an array of BrowserAccessibilityCocoa objects, representing the | 352 // Returns an array of BrowserAccessibilityCocoa objects, representing the |
| 353 // accessibility children of this object. | 353 // accessibility children of this object. |
| 354 - (NSArray*)children { | 354 - (NSArray*)children { |
| 355 if (!children_) { | 355 if (!children_) { |
| 356 children_.reset([[NSMutableArray alloc] | 356 uint32 childCount = browserAccessibility_->PlatformChildCount(); |
| 357 initWithCapacity:browserAccessibility_->child_count()] ); | 357 children_.reset([[NSMutableArray alloc] initWithCapacity:childCount]); |
| 358 for (uint32 index = 0; | 358 for (uint32 index = 0; index < childCount; ++index) { |
| 359 index < browserAccessibility_->child_count(); | |
| 360 ++index) { | |
| 361 BrowserAccessibilityCocoa* child = | 359 BrowserAccessibilityCocoa* child = |
| 362 browserAccessibility_->GetChild(index)->ToBrowserAccessibilityCocoa(); | 360 browserAccessibility_->PlatformGetChild(index)-> |
| 361 ToBrowserAccessibilityCocoa(); |
| 363 if ([child isIgnored]) | 362 if ([child isIgnored]) |
| 364 [children_ addObjectsFromArray:[child children]]; | 363 [children_ addObjectsFromArray:[child children]]; |
| 365 else | 364 else |
| 366 [children_ addObject:child]; | 365 [children_ addObject:child]; |
| 367 } | 366 } |
| 368 | 367 |
| 369 // Also, add indirect children (if any). | 368 // Also, add indirect children (if any). |
| 370 const std::vector<int32>& indirectChildIds = | 369 const std::vector<int32>& indirectChildIds = |
| 371 browserAccessibility_->GetIntListAttribute( | 370 browserAccessibility_->GetIntListAttribute( |
| 372 AccessibilityNodeData::ATTR_INDIRECT_CHILD_IDS); | 371 AccessibilityNodeData::ATTR_INDIRECT_CHILD_IDS); |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 int row = [[array objectAtIndex:1] intValue]; | 1043 int row = [[array objectAtIndex:1] intValue]; |
| 1045 int num_columns = browserAccessibility_->GetIntAttribute( | 1044 int num_columns = browserAccessibility_->GetIntAttribute( |
| 1046 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT); | 1045 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT); |
| 1047 int num_rows = browserAccessibility_->GetIntAttribute( | 1046 int num_rows = browserAccessibility_->GetIntAttribute( |
| 1048 AccessibilityNodeData::ATTR_TABLE_ROW_COUNT); | 1047 AccessibilityNodeData::ATTR_TABLE_ROW_COUNT); |
| 1049 if (column < 0 || column >= num_columns || | 1048 if (column < 0 || column >= num_columns || |
| 1050 row < 0 || row >= num_rows) { | 1049 row < 0 || row >= num_rows) { |
| 1051 return nil; | 1050 return nil; |
| 1052 } | 1051 } |
| 1053 for (size_t i = 0; | 1052 for (size_t i = 0; |
| 1054 i < browserAccessibility_->child_count(); | 1053 i < browserAccessibility_->PlatformChildCount(); |
| 1055 ++i) { | 1054 ++i) { |
| 1056 BrowserAccessibility* child = browserAccessibility_->GetChild(i); | 1055 BrowserAccessibility* child = browserAccessibility_->PlatformGetChild(i); |
| 1057 if (child->role() != WebKit::WebAXRoleRow) | 1056 if (child->role() != WebKit::WebAXRoleRow) |
| 1058 continue; | 1057 continue; |
| 1059 int rowIndex; | 1058 int rowIndex; |
| 1060 if (!child->GetIntAttribute( | 1059 if (!child->GetIntAttribute( |
| 1061 AccessibilityNodeData::ATTR_TABLE_ROW_INDEX, &rowIndex)) { | 1060 AccessibilityNodeData::ATTR_TABLE_ROW_INDEX, &rowIndex)) { |
| 1062 continue; | 1061 continue; |
| 1063 } | 1062 } |
| 1064 if (rowIndex < row) | 1063 if (rowIndex < row) |
| 1065 continue; | 1064 continue; |
| 1066 if (rowIndex > row) | 1065 if (rowIndex > row) |
| 1067 break; | 1066 break; |
| 1068 for (size_t j = 0; | 1067 for (size_t j = 0; |
| 1069 j < child->child_count(); | 1068 j < child->PlatformChildCount(); |
| 1070 ++j) { | 1069 ++j) { |
| 1071 BrowserAccessibility* cell = child->GetChild(j); | 1070 BrowserAccessibility* cell = child->PlatformGetChild(j); |
| 1072 if (cell->role() != WebKit::WebAXRoleCell) | 1071 if (cell->role() != WebKit::WebAXRoleCell) |
| 1073 continue; | 1072 continue; |
| 1074 int colIndex; | 1073 int colIndex; |
| 1075 if (!cell->GetIntAttribute( | 1074 if (!cell->GetIntAttribute( |
| 1076 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX, | 1075 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX, |
| 1077 &colIndex)) { | 1076 &colIndex)) { |
| 1078 continue; | 1077 continue; |
| 1079 } | 1078 } |
| 1080 if (colIndex == column) | 1079 if (colIndex == column) |
| 1081 return cell->ToBrowserAccessibilityCocoa(); | 1080 return cell->ToBrowserAccessibilityCocoa(); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1451 return [super hash]; | 1450 return [super hash]; |
| 1452 return browserAccessibility_->renderer_id(); | 1451 return browserAccessibility_->renderer_id(); |
| 1453 } | 1452 } |
| 1454 | 1453 |
| 1455 - (BOOL)accessibilityShouldUseUniqueId { | 1454 - (BOOL)accessibilityShouldUseUniqueId { |
| 1456 return YES; | 1455 return YES; |
| 1457 } | 1456 } |
| 1458 | 1457 |
| 1459 @end | 1458 @end |
| 1460 | 1459 |
| OLD | NEW |