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 1b720658e242816b88432d9b22c9c6afb2ac7cf8..198f119c154c8aa738839f0d6dd6c5bc97419e50 100644 |
--- a/content/browser/accessibility/browser_accessibility_cocoa.mm |
+++ b/content/browser/accessibility/browser_accessibility_cocoa.mm |
@@ -25,6 +25,7 @@ extern "C" void NSAccessibilityUnregisterUniqueIdForUIElement(id element); |
using ui::AXNodeData; |
using content::BrowserAccessibility; |
+using content::BrowserAccessibilityDelegate; |
using content::BrowserAccessibilityManager; |
using content::BrowserAccessibilityManagerMac; |
using content::ContentClient; |
@@ -534,9 +535,16 @@ NSDictionary* attributeToMethodNameMap = nil; |
if (!browserAccessibility_) |
return NSZeroPoint; |
- gfx::Rect bounds(origin.x, origin.y, size.width, size.height); |
- gfx::Point point = [self delegate]->AccessibilityOriginInScreen(bounds); |
- return NSMakePoint(point.x(), point.y()); |
+ // Get the delegate for the topmost BrowserAccessibilityManager, because |
+ // that's the only one that can convert points to their origin in the screen. |
+ 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. |
@@ -1558,4 +1566,3 @@ NSDictionary* attributeToMethodNameMap = nil; |
} |
@end |
- |