Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: content/browser/accessibility/browser_accessibility_cocoa.mm

Issue 2825803002: Expose internal treegrid role, do some cleanup for table/grid/treegrid handling (Closed)
Patch Set: Expose table properties for <table role=grid> Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #import "content/browser/accessibility/browser_accessibility_cocoa.h" 5 #import "content/browser/accessibility/browser_accessibility_cocoa.h"
6 6
7 #include <execinfo.h> 7 #include <execinfo.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 children_.reset(); 771 children_.reset();
772 } else { 772 } else {
773 [ToBrowserAccessibilityCocoa(browserAccessibility_->PlatformGetParent()) 773 [ToBrowserAccessibilityCocoa(browserAccessibility_->PlatformGetParent())
774 childrenChanged]; 774 childrenChanged];
775 } 775 }
776 } 776 }
777 777
778 - (NSArray*)columnHeaders { 778 - (NSArray*)columnHeaders {
779 if (![self instanceActive]) 779 if (![self instanceActive])
780 return nil; 780 return nil;
781 if ([self internalRole] != ui::AX_ROLE_TABLE && 781 if (!browserAccessibility_->IsTableOrGridOrTreeGridRole()) {
782 [self internalRole] != ui::AX_ROLE_GRID) {
783 return nil; 782 return nil;
784 } 783 }
785 784
786 NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease]; 785 NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease];
787 const std::vector<int32_t>& uniqueCellIds = 786 const std::vector<int32_t>& uniqueCellIds =
788 browserAccessibility_->GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); 787 browserAccessibility_->GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS);
789 for (size_t i = 0; i < uniqueCellIds.size(); ++i) { 788 for (size_t i = 0; i < uniqueCellIds.size(); ++i) {
790 int id = uniqueCellIds[i]; 789 int id = uniqueCellIds[i];
791 BrowserAccessibility* cell = 790 BrowserAccessibility* cell =
792 browserAccessibility_->manager()->GetFromID(id); 791 browserAccessibility_->manager()->GetFromID(id);
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 grabbed == "true") 999 grabbed == "true")
1001 return [NSNumber numberWithBool:YES]; 1000 return [NSNumber numberWithBool:YES];
1002 1001
1003 return [NSNumber numberWithBool:NO]; 1002 return [NSNumber numberWithBool:NO];
1004 } 1003 }
1005 1004
1006 - (id)header { 1005 - (id)header {
1007 if (![self instanceActive]) 1006 if (![self instanceActive])
1008 return nil; 1007 return nil;
1009 int headerElementId = -1; 1008 int headerElementId = -1;
1010 if ([self internalRole] == ui::AX_ROLE_TABLE || 1009 if (browserAccessibility_->IsTableOrGridOrTreeGridRole()) {
1011 [self internalRole] == ui::AX_ROLE_GRID) {
1012 browserAccessibility_->GetIntAttribute( 1010 browserAccessibility_->GetIntAttribute(
1013 ui::AX_ATTR_TABLE_HEADER_ID, &headerElementId); 1011 ui::AX_ATTR_TABLE_HEADER_ID, &headerElementId);
1014 } else if ([self internalRole] == ui::AX_ROLE_COLUMN) { 1012 } else if ([self internalRole] == ui::AX_ROLE_COLUMN) {
1015 browserAccessibility_->GetIntAttribute( 1013 browserAccessibility_->GetIntAttribute(
1016 ui::AX_ATTR_TABLE_COLUMN_HEADER_ID, &headerElementId); 1014 ui::AX_ATTR_TABLE_COLUMN_HEADER_ID, &headerElementId);
1017 } else if ([self internalRole] == ui::AX_ROLE_ROW) { 1015 } else if ([self internalRole] == ui::AX_ROLE_ROW) {
1018 browserAccessibility_->GetIntAttribute( 1016 browserAccessibility_->GetIntAttribute(
1019 ui::AX_ATTR_TABLE_ROW_HEADER_ID, &headerElementId); 1017 ui::AX_ATTR_TABLE_ROW_HEADER_ID, &headerElementId);
1020 } 1018 }
1021 1019
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 default: 1507 default:
1510 break; 1508 break;
1511 } 1509 }
1512 1510
1513 return NSAccessibilityRoleDescription(role, nil); 1511 return NSAccessibilityRoleDescription(role, nil);
1514 } 1512 }
1515 1513
1516 - (NSArray*)rowHeaders { 1514 - (NSArray*)rowHeaders {
1517 if (![self instanceActive]) 1515 if (![self instanceActive])
1518 return nil; 1516 return nil;
1519 if ([self internalRole] != ui::AX_ROLE_TABLE && 1517 if (!browserAccessibility_->IsTableOrGridOrTreeGridRole()) {
1520 [self internalRole] != ui::AX_ROLE_GRID) {
1521 return nil; 1518 return nil;
1522 } 1519 }
1523 1520
1524 NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease]; 1521 NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease];
1525 const std::vector<int32_t>& uniqueCellIds = 1522 const std::vector<int32_t>& uniqueCellIds =
1526 browserAccessibility_->GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); 1523 browserAccessibility_->GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS);
1527 for (size_t i = 0; i < uniqueCellIds.size(); ++i) { 1524 for (size_t i = 0; i < uniqueCellIds.size(); ++i) {
1528 int id = uniqueCellIds[i]; 1525 int id = uniqueCellIds[i];
1529 BrowserAccessibility* cell = 1526 BrowserAccessibility* cell =
1530 browserAccessibility_->manager()->GetFromID(id); 1527 browserAccessibility_->manager()->GetFromID(id);
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after
2899 } 2896 }
2900 2897
2901 - (BOOL)accessibilityNotifiesWhenDestroyed { 2898 - (BOOL)accessibilityNotifiesWhenDestroyed {
2902 // Indicate that BrowserAccessibilityCocoa will post a notification when it's 2899 // Indicate that BrowserAccessibilityCocoa will post a notification when it's
2903 // destroyed (see -detach). This allows VoiceOver to do some internal things 2900 // destroyed (see -detach). This allows VoiceOver to do some internal things
2904 // more efficiently. 2901 // more efficiently.
2905 return YES; 2902 return YES;
2906 } 2903 }
2907 2904
2908 @end 2905 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698