OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 } | 470 } |
471 | 471 |
472 - (NSNumber*)numberOfCharacters { | 472 - (NSNumber*)numberOfCharacters { |
473 return [NSNumber numberWithInt:browserAccessibility_->value().length()]; | 473 return [NSNumber numberWithInt:browserAccessibility_->value().length()]; |
474 } | 474 } |
475 | 475 |
476 // The origin of this accessibility object in the page's document. | 476 // The origin of this accessibility object in the page's document. |
477 // This is relative to webkit's top-left origin, not Cocoa's | 477 // This is relative to webkit's top-left origin, not Cocoa's |
478 // bottom-left origin. | 478 // bottom-left origin. |
479 - (NSPoint)origin { | 479 - (NSPoint)origin { |
480 return NSMakePoint(browserAccessibility_->location().x(), | 480 gfx::Rect bounds = browserAccessibility_->GetLocalBoundsRect(); |
481 browserAccessibility_->location().y()); | 481 return NSMakePoint(bounds.x(), bounds.y()); |
482 } | 482 } |
483 | 483 |
484 - (id)parent { | 484 - (id)parent { |
485 // A nil parent means we're the root. | 485 // A nil parent means we're the root. |
486 if (browserAccessibility_->parent()) { | 486 if (browserAccessibility_->parent()) { |
487 return NSAccessibilityUnignoredAncestor( | 487 return NSAccessibilityUnignoredAncestor( |
488 browserAccessibility_->parent()->toBrowserAccessibilityCocoa()); | 488 browserAccessibility_->parent()->toBrowserAccessibilityCocoa()); |
489 } else { | 489 } else { |
490 // Hook back up to RenderWidgetHostViewCocoa. | 490 // Hook back up to RenderWidgetHostViewCocoa. |
491 return browserAccessibility_->manager()->GetParentView(); | 491 return browserAccessibility_->manager()->GetParentView(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 for (BrowserAccessibilityCocoa* child in [self children]) { | 560 for (BrowserAccessibilityCocoa* child in [self children]) { |
561 if ([[child role] isEqualToString:NSAccessibilityRowRole]) | 561 if ([[child role] isEqualToString:NSAccessibilityRowRole]) |
562 [ret addObject:child]; | 562 [ret addObject:child]; |
563 } | 563 } |
564 | 564 |
565 return ret; | 565 return ret; |
566 } | 566 } |
567 | 567 |
568 // Returns the size of this object. | 568 // Returns the size of this object. |
569 - (NSValue*)size { | 569 - (NSValue*)size { |
570 return [NSValue valueWithSize:NSMakeSize( | 570 gfx::Rect bounds = browserAccessibility_->GetLocalBoundsRect(); |
571 browserAccessibility_->location().width(), | 571 return [NSValue valueWithSize:NSMakeSize(bounds.width(), bounds.height())]; |
572 browserAccessibility_->location().height())]; | |
573 } | 572 } |
574 | 573 |
575 // Returns a subrole based upon the role. | 574 // Returns a subrole based upon the role. |
576 - (NSString*) subrole { | 575 - (NSString*) subrole { |
577 WebAccessibility::Role browserAccessibilityRole = | 576 WebAccessibility::Role browserAccessibilityRole = |
578 static_cast<WebAccessibility::Role>(browserAccessibility_->role()); | 577 static_cast<WebAccessibility::Role>(browserAccessibility_->role()); |
579 if (browserAccessibilityRole == WebAccessibility::ROLE_TEXT_FIELD && | 578 if (browserAccessibilityRole == WebAccessibility::ROLE_TEXT_FIELD && |
580 GetState(browserAccessibility_, WebAccessibility::STATE_PROTECTED)) { | 579 GetState(browserAccessibility_, WebAccessibility::STATE_PROTECTED)) { |
581 return @"AXSecureTextField"; | 580 return @"AXSecureTextField"; |
582 } | 581 } |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 return [super hash]; | 1034 return [super hash]; |
1036 return browserAccessibility_->renderer_id(); | 1035 return browserAccessibility_->renderer_id(); |
1037 } | 1036 } |
1038 | 1037 |
1039 - (BOOL)accessibilityShouldUseUniqueId { | 1038 - (BOOL)accessibilityShouldUseUniqueId { |
1040 return YES; | 1039 return YES; |
1041 } | 1040 } |
1042 | 1041 |
1043 @end | 1042 @end |
1044 | 1043 |
OLD | NEW |