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

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

Issue 10382051: Add initial GTK web accessibility framework (third attempt). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
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 #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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // Returns an array of BrowserAccessibilityCocoa objects, representing the 336 // Returns an array of BrowserAccessibilityCocoa objects, representing the
337 // accessibility children of this object. 337 // accessibility children of this object.
338 - (NSArray*)children { 338 - (NSArray*)children {
339 if (!children_.get()) { 339 if (!children_.get()) {
340 children_.reset([[NSMutableArray alloc] 340 children_.reset([[NSMutableArray alloc]
341 initWithCapacity:browserAccessibility_->child_count()] ); 341 initWithCapacity:browserAccessibility_->child_count()] );
342 for (uint32 index = 0; 342 for (uint32 index = 0;
343 index < browserAccessibility_->child_count(); 343 index < browserAccessibility_->child_count();
344 ++index) { 344 ++index) {
345 BrowserAccessibilityCocoa* child = 345 BrowserAccessibilityCocoa* child =
346 browserAccessibility_->GetChild(index)->toBrowserAccessibilityCocoa(); 346 browserAccessibility_->GetChild(index)->ToBrowserAccessibilityCocoa();
347 if ([child isIgnored]) 347 if ([child isIgnored])
348 [children_ addObjectsFromArray:[child children]]; 348 [children_ addObjectsFromArray:[child children]];
349 else 349 else
350 [children_ addObject:child]; 350 [children_ addObject:child];
351 } 351 }
352 352
353 // Also, add indirect children (if any). 353 // Also, add indirect children (if any).
354 for (uint32 i = 0; 354 for (uint32 i = 0;
355 i < browserAccessibility_->indirect_child_ids().size(); 355 i < browserAccessibility_->indirect_child_ids().size();
356 ++i) { 356 ++i) {
357 int32 child_id = browserAccessibility_->indirect_child_ids()[i]; 357 int32 child_id = browserAccessibility_->indirect_child_ids()[i];
358 BrowserAccessibility* child = 358 BrowserAccessibility* child =
359 browserAccessibility_->manager()->GetFromRendererID(child_id); 359 browserAccessibility_->manager()->GetFromRendererID(child_id);
360 360
361 // This only became necessary as a result of crbug.com/93095. It should be 361 // This only became necessary as a result of crbug.com/93095. It should be
362 // a DCHECK in the future. 362 // a DCHECK in the future.
363 if (child) { 363 if (child) {
364 BrowserAccessibilityCocoa* child_cocoa = 364 BrowserAccessibilityCocoa* child_cocoa =
365 child->toBrowserAccessibilityCocoa(); 365 child->ToBrowserAccessibilityCocoa();
366 [children_ addObject:child_cocoa]; 366 [children_ addObject:child_cocoa];
367 } 367 }
368 } 368 }
369 } 369 }
370 return children_; 370 return children_;
371 } 371 }
372 372
373 - (void)childrenChanged { 373 - (void)childrenChanged {
374 if (![self isIgnored]) { 374 if (![self isIgnored]) {
375 children_.reset(); 375 children_.reset();
376 } else { 376 } else {
377 [browserAccessibility_->parent()->toBrowserAccessibilityCocoa() 377 [browserAccessibility_->parent()->ToBrowserAccessibilityCocoa()
378 childrenChanged]; 378 childrenChanged];
379 } 379 }
380 } 380 }
381 381
382 - (NSArray*)columns { 382 - (NSArray*)columns {
383 NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease]; 383 NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease];
384 for (BrowserAccessibilityCocoa* child in [self children]) { 384 for (BrowserAccessibilityCocoa* child in [self children]) {
385 if ([[child role] isEqualToString:NSAccessibilityColumnRole]) 385 if ([[child role] isEqualToString:NSAccessibilityColumnRole])
386 [ret addObject:child]; 386 [ret addObject:child];
387 } 387 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 // bottom-left origin. 481 // bottom-left origin.
482 - (NSPoint)origin { 482 - (NSPoint)origin {
483 gfx::Rect bounds = browserAccessibility_->GetLocalBoundsRect(); 483 gfx::Rect bounds = browserAccessibility_->GetLocalBoundsRect();
484 return NSMakePoint(bounds.x(), bounds.y()); 484 return NSMakePoint(bounds.x(), bounds.y());
485 } 485 }
486 486
487 - (id)parent { 487 - (id)parent {
488 // A nil parent means we're the root. 488 // A nil parent means we're the root.
489 if (browserAccessibility_->parent()) { 489 if (browserAccessibility_->parent()) {
490 return NSAccessibilityUnignoredAncestor( 490 return NSAccessibilityUnignoredAncestor(
491 browserAccessibility_->parent()->toBrowserAccessibilityCocoa()); 491 browserAccessibility_->parent()->ToBrowserAccessibilityCocoa());
492 } else { 492 } else {
493 // Hook back up to RenderWidgetHostViewCocoa. 493 // Hook back up to RenderWidgetHostViewCocoa.
494 return browserAccessibility_->manager()->GetParentView(); 494 return browserAccessibility_->manager()->GetParentView();
495 } 495 }
496 } 496 }
497 497
498 - (NSValue*)position { 498 - (NSValue*)position {
499 return [NSValue valueWithPoint:[delegate_ accessibilityPointInScreen:self]]; 499 return [NSValue valueWithPoint:[delegate_ accessibilityPointInScreen:self]];
500 } 500 }
501 501
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 return base::SysUTF16ToNSString(browserAccessibility_->name()); 625 return base::SysUTF16ToNSString(browserAccessibility_->name());
626 } 626 }
627 627
628 - (id)titleUIElement { 628 - (id)titleUIElement {
629 int titleElementId; 629 int titleElementId;
630 if (browserAccessibility_->GetIntAttribute( 630 if (browserAccessibility_->GetIntAttribute(
631 WebAccessibility::ATTR_TITLE_UI_ELEMENT, &titleElementId)) { 631 WebAccessibility::ATTR_TITLE_UI_ELEMENT, &titleElementId)) {
632 BrowserAccessibility* titleElement = 632 BrowserAccessibility* titleElement =
633 browserAccessibility_->manager()->GetFromRendererID(titleElementId); 633 browserAccessibility_->manager()->GetFromRendererID(titleElementId);
634 if (titleElement) 634 if (titleElement)
635 return titleElement->toBrowserAccessibilityCocoa(); 635 return titleElement->ToBrowserAccessibilityCocoa();
636 } 636 }
637 return nil; 637 return nil;
638 } 638 }
639 639
640 - (NSString*)url { 640 - (NSString*)url {
641 StringAttribute urlAttribute = 641 StringAttribute urlAttribute =
642 [[self role] isEqualToString:@"AXWebArea"] ? 642 [[self role] isEqualToString:@"AXWebArea"] ?
643 WebAccessibility::ATTR_DOC_URL : 643 WebAccessibility::ATTR_DOC_URL :
644 WebAccessibility::ATTR_URL; 644 WebAccessibility::ATTR_URL;
645 return NSStringForStringAttribute( 645 return NSStringForStringAttribute(
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 return [super hash]; 1043 return [super hash];
1044 return browserAccessibility_->renderer_id(); 1044 return browserAccessibility_->renderer_id();
1045 } 1045 }
1046 1046
1047 - (BOOL)accessibilityShouldUseUniqueId { 1047 - (BOOL)accessibilityShouldUseUniqueId {
1048 return YES; 1048 return YES;
1049 } 1049 }
1050 1050
1051 @end 1051 @end
1052 1052
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility.cc ('k') | content/browser/accessibility/browser_accessibility_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698