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

Unified Diff: content/browser/accessibility/browser_accessibility_cocoa.mm

Issue 849143003: Fix focus and bounds calculations for guest frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
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 92515d542894d31b8b2baa16a18ff8c17eb9871f..dd91619d4cf508c3e163827660a4ece3595b6ae4 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;
@@ -508,9 +509,22 @@ 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.
+ BrowserAccessibilityManager* manager = browserAccessibility_->manager();
+ BrowserAccessibility* root = manager->GetRoot();
+ while (root->GetParent())
+ root = root->GetParent()->manager()->GetRoot();
+ manager = root->manager();
+ BrowserAccessibilityDelegate* delegate = manager->delegate();
+
+ 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.
« no previous file with comments | « content/browser/accessibility/browser_accessibility.cc ('k') | content/browser/accessibility/browser_accessibility_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698