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

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: 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..27bcf8aa55aed90bfb213ddb6e20db6ae0f416dc 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,8 +509,17 @@ NSDictionary* attributeToMethodNameMap = nil;
if (!browserAccessibility_)
return NSZeroPoint;
+ // 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();
aboxhall 2015/01/15 05:08:25 That's an impressive method chain! Any chance of a
dmazzoni 2015/01/15 21:02:33 Great question! * root->GetParent() can't be NULL
+ manager = root->manager();
+ BrowserAccessibilityDelegate* delegate = manager->delegate();
+
gfx::Rect bounds(origin.x, origin.y, size.width, size.height);
- gfx::Point point = [self delegate]->AccessibilityOriginInScreen(bounds);
+ gfx::Point point = delegate->AccessibilityOriginInScreen(bounds);
return NSMakePoint(point.x(), point.y());
}

Powered by Google App Engine
This is Rietveld 408576698