| 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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 nil; | 510 nil; |
| 511 } | 511 } |
| 512 | 512 |
| 513 - (NSPoint)pointInScreen:(NSPoint)origin | 513 - (NSPoint)pointInScreen:(NSPoint)origin |
| 514 size:(NSSize)size { | 514 size:(NSSize)size { |
| 515 if (!browserAccessibility_) | 515 if (!browserAccessibility_) |
| 516 return NSZeroPoint; | 516 return NSZeroPoint; |
| 517 | 517 |
| 518 // Get the delegate for the topmost BrowserAccessibilityManager, because | 518 // Get the delegate for the topmost BrowserAccessibilityManager, because |
| 519 // that's the only one that can convert points to their origin in the screen. | 519 // that's the only one that can convert points to their origin in the screen. |
| 520 BrowserAccessibilityManager* manager = browserAccessibility_->manager(); | 520 BrowserAccessibilityDelegate* delegate = GetDelegateFromRootManager(); |
| 521 BrowserAccessibility* root = manager->GetRoot(); | 521 if (delegate) { |
| 522 while (root->GetParent()) | 522 gfx::Rect bounds(origin.x, origin.y, size.width, size.height); |
| 523 root = root->GetParent()->manager()->GetRoot(); | 523 gfx::Point point = delegate->AccessibilityOriginInScreen(bounds); |
| 524 manager = root->manager(); | 524 return NSMakePoint(point.x(), point.y()); |
| 525 BrowserAccessibilityDelegate* delegate = manager->delegate(); | 525 } else { |
| 526 | 526 return NSZeroPoint; |
| 527 gfx::Rect bounds(origin.x, origin.y, size.width, size.height); | 527 } |
| 528 gfx::Point point = delegate->AccessibilityOriginInScreen(bounds); | |
| 529 return NSMakePoint(point.x(), point.y()); | |
| 530 } | 528 } |
| 531 | 529 |
| 532 // Returns a string indicating the NSAccessibility role of this object. | 530 // Returns a string indicating the NSAccessibility role of this object. |
| 533 - (NSString*)role { | 531 - (NSString*)role { |
| 534 ui::AXRole role = [self internalRole]; | 532 ui::AXRole role = [self internalRole]; |
| 535 if (role == ui::AX_ROLE_CANVAS && | 533 if (role == ui::AX_ROLE_CANVAS && |
| 536 browserAccessibility_->GetBoolAttribute( | 534 browserAccessibility_->GetBoolAttribute( |
| 537 ui::AX_ATTR_CANVAS_HAS_FALLBACK)) { | 535 ui::AX_ATTR_CANVAS_HAS_FALLBACK)) { |
| 538 return NSAccessibilityGroupRole; | 536 return NSAccessibilityGroupRole; |
| 539 } | 537 } |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 if (!browserAccessibility_) | 1539 if (!browserAccessibility_) |
| 1542 return [super hash]; | 1540 return [super hash]; |
| 1543 return browserAccessibility_->GetId(); | 1541 return browserAccessibility_->GetId(); |
| 1544 } | 1542 } |
| 1545 | 1543 |
| 1546 - (BOOL)accessibilityShouldUseUniqueId { | 1544 - (BOOL)accessibilityShouldUseUniqueId { |
| 1547 return YES; | 1545 return YES; |
| 1548 } | 1546 } |
| 1549 | 1547 |
| 1550 @end | 1548 @end |
| 1551 | |
| OLD | NEW |