Chromium Code Reviews| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 int id = uniqueCellIds[i]; | 226 int id = uniqueCellIds[i]; |
| 227 BrowserAccessibility* cell = | 227 BrowserAccessibility* cell = |
| 228 browserAccessibility_->manager()->GetFromID(id); | 228 browserAccessibility_->manager()->GetFromID(id); |
| 229 if (cell && cell->GetRole() == ui::AX_ROLE_COLUMN_HEADER) | 229 if (cell && cell->GetRole() == ui::AX_ROLE_COLUMN_HEADER) |
| 230 [ret addObject:cell->ToBrowserAccessibilityCocoa()]; | 230 [ret addObject:cell->ToBrowserAccessibilityCocoa()]; |
| 231 } | 231 } |
| 232 return ret; | 232 return ret; |
| 233 } | 233 } |
| 234 | 234 |
| 235 - (NSValue*)columnIndexRange { | 235 - (NSValue*)columnIndexRange { |
| 236 if ([self internalRole] != ui::AX_ROLE_CELL) | 236 if ([self internalRole] != ui::AX_ROLE_CELL && |
|
dmazzoni
2015/01/08 18:11:25
Please add a helper function for this, like IsCell
je_julie(Not used)
2015/01/09 16:47:37
Done
| |
| 237 [self internalRole] != ui::AX_ROLE_COLUMN_HEADER && | |
| 238 [self internalRole] != ui::AX_ROLE_ROW_HEADER) | |
| 237 return nil; | 239 return nil; |
| 238 | 240 |
| 239 int column = -1; | 241 int column = -1; |
| 240 int colspan = -1; | 242 int colspan = -1; |
| 241 browserAccessibility_->GetIntAttribute( | 243 browserAccessibility_->GetIntAttribute( |
| 242 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, &column); | 244 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, &column); |
| 243 browserAccessibility_->GetIntAttribute( | 245 browserAccessibility_->GetIntAttribute( |
| 244 ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN, &colspan); | 246 ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN, &colspan); |
| 245 if (column >= 0 && colspan >= 1) | 247 if (column >= 0 && colspan >= 1) |
| 246 return [NSValue valueWithRange:NSMakeRange(column, colspan)]; | 248 return [NSValue valueWithRange:NSMakeRange(column, colspan)]; |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 659 int id = uniqueCellIds[i]; | 661 int id = uniqueCellIds[i]; |
| 660 BrowserAccessibility* cell = | 662 BrowserAccessibility* cell = |
| 661 browserAccessibility_->manager()->GetFromID(id); | 663 browserAccessibility_->manager()->GetFromID(id); |
| 662 if (cell && cell->GetRole() == ui::AX_ROLE_ROW_HEADER) | 664 if (cell && cell->GetRole() == ui::AX_ROLE_ROW_HEADER) |
| 663 [ret addObject:cell->ToBrowserAccessibilityCocoa()]; | 665 [ret addObject:cell->ToBrowserAccessibilityCocoa()]; |
| 664 } | 666 } |
| 665 return ret; | 667 return ret; |
| 666 } | 668 } |
| 667 | 669 |
| 668 - (NSValue*)rowIndexRange { | 670 - (NSValue*)rowIndexRange { |
| 669 if ([self internalRole] != ui::AX_ROLE_CELL) | 671 if ([self internalRole] != ui::AX_ROLE_CELL && |
| 672 [self internalRole] != ui::AX_ROLE_COLUMN_HEADER && | |
| 673 [self internalRole] != ui::AX_ROLE_ROW_HEADER) | |
| 670 return nil; | 674 return nil; |
| 671 | 675 |
| 672 int row = -1; | 676 int row = -1; |
| 673 int rowspan = -1; | 677 int rowspan = -1; |
| 674 browserAccessibility_->GetIntAttribute( | 678 browserAccessibility_->GetIntAttribute( |
| 675 ui::AX_ATTR_TABLE_CELL_ROW_INDEX, &row); | 679 ui::AX_ATTR_TABLE_CELL_ROW_INDEX, &row); |
| 676 browserAccessibility_->GetIntAttribute( | 680 browserAccessibility_->GetIntAttribute( |
| 677 ui::AX_ATTR_TABLE_CELL_ROW_SPAN, &rowspan); | 681 ui::AX_ATTR_TABLE_CELL_ROW_SPAN, &rowspan); |
| 678 if (row >= 0 && rowspan >= 1) | 682 if (row >= 0 && rowspan >= 1) |
| 679 return [NSValue valueWithRange:NSMakeRange(row, rowspan)]; | 683 return [NSValue valueWithRange:NSMakeRange(row, rowspan)]; |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1067 continue; | 1071 continue; |
| 1068 } | 1072 } |
| 1069 if (rowIndex < row) | 1073 if (rowIndex < row) |
| 1070 continue; | 1074 continue; |
| 1071 if (rowIndex > row) | 1075 if (rowIndex > row) |
| 1072 break; | 1076 break; |
| 1073 for (size_t j = 0; | 1077 for (size_t j = 0; |
| 1074 j < child->PlatformChildCount(); | 1078 j < child->PlatformChildCount(); |
| 1075 ++j) { | 1079 ++j) { |
| 1076 BrowserAccessibility* cell = child->PlatformGetChild(j); | 1080 BrowserAccessibility* cell = child->PlatformGetChild(j); |
| 1077 if (cell->GetRole() != ui::AX_ROLE_CELL) | 1081 if ([self internalRole] != ui::AX_ROLE_CELL && |
| 1082 [self internalRole] != ui::AX_ROLE_COLUMN_HEADER && | |
| 1083 [self internalRole] != ui::AX_ROLE_ROW_HEADER) | |
| 1078 continue; | 1084 continue; |
| 1079 int colIndex; | 1085 int colIndex; |
| 1080 if (!cell->GetIntAttribute( | 1086 if (!cell->GetIntAttribute( |
| 1081 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, | 1087 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, |
| 1082 &colIndex)) { | 1088 &colIndex)) { |
| 1083 continue; | 1089 continue; |
| 1084 } | 1090 } |
| 1085 if (colIndex == column) | 1091 if (colIndex == column) |
| 1086 return cell->ToBrowserAccessibilityCocoa(); | 1092 return cell->ToBrowserAccessibilityCocoa(); |
| 1087 if (colIndex > column) | 1093 if (colIndex > column) |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1532 return [super hash]; | 1538 return [super hash]; |
| 1533 return browserAccessibility_->GetId(); | 1539 return browserAccessibility_->GetId(); |
| 1534 } | 1540 } |
| 1535 | 1541 |
| 1536 - (BOOL)accessibilityShouldUseUniqueId { | 1542 - (BOOL)accessibilityShouldUseUniqueId { |
| 1537 return YES; | 1543 return YES; |
| 1538 } | 1544 } |
| 1539 | 1545 |
| 1540 @end | 1546 @end |
| 1541 | 1547 |
| OLD | NEW |