Index: content/browser/accessibility/browser_accessibility_cocoa.mm |
diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/content/browser/accessibility/browser_accessibility_cocoa.mm |
index 7668c851f55fb7f6fd06939e0beca6e63949eda9..cbc46f9d14e11ff7462ebdd877df55bdae7dee67 100644 |
--- a/content/browser/accessibility/browser_accessibility_cocoa.mm |
+++ b/content/browser/accessibility/browser_accessibility_cocoa.mm |
@@ -517,16 +517,14 @@ NSDictionary* attributeToMethodNameMap = nil; |
// Get the delegate for the topmost BrowserAccessibilityManager, because |
// that's the only one that can convert points to their origin in the screen. |
- BrowserAccessibilityManager* manager = browserAccessibility_->manager(); |
- BrowserAccessibility* root = manager->GetRoot(); |
- while (root->GetParent()) |
- root = root->GetParent()->manager()->GetRoot(); |
- manager = root->manager(); |
- BrowserAccessibilityDelegate* delegate = manager->delegate(); |
- |
- gfx::Rect bounds(origin.x, origin.y, size.width, size.height); |
- gfx::Point point = delegate->AccessibilityOriginInScreen(bounds); |
- return NSMakePoint(point.x(), point.y()); |
+ BrowserAccessibilityDelegate* delegate = GetDelegateFromRootManager(); |
+ if (delegate) { |
+ gfx::Rect bounds(origin.x, origin.y, size.width, size.height); |
+ gfx::Point point = delegate->AccessibilityOriginInScreen(bounds); |
+ return NSMakePoint(point.x(), point.y()); |
+ } else { |
+ return NSZeroPoint; |
+ } |
} |
// Returns a string indicating the NSAccessibility role of this object. |
@@ -1548,4 +1546,3 @@ NSDictionary* attributeToMethodNameMap = nil; |
} |
@end |
- |