| Index: content/browser/renderer_host/render_widget_host_view_mac.mm
|
| diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
|
| index 82255825b061d603f6d5bb7ab7924a237d65cb66..17c73d59ebbf3e858b5fdf33648e2828e763ba29 100644
|
| --- a/content/browser/renderer_host/render_widget_host_view_mac.mm
|
| +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
|
| @@ -2065,14 +2065,13 @@
|
| render_widget_host_->SetBackgroundOpaque(opaque);
|
| }
|
|
|
| -void RenderWidgetHostViewMac::CreateBrowserAccessibilityManagerIfNeeded() {
|
| - if (!GetBrowserAccessibilityManager()) {
|
| - SetBrowserAccessibilityManager(
|
| - new BrowserAccessibilityManagerMac(
|
| - cocoa_view_,
|
| - BrowserAccessibilityManagerMac::GetEmptyDocument(),
|
| - render_widget_host_));
|
| - }
|
| +BrowserAccessibilityManager*
|
| + RenderWidgetHostViewMac::CreateBrowserAccessibilityManager(
|
| + BrowserAccessibilityDelegate* delegate) {
|
| + return new BrowserAccessibilityManagerMac(
|
| + cocoa_view_,
|
| + BrowserAccessibilityManagerMac::GetEmptyDocument(),
|
| + delegate);
|
| }
|
|
|
| gfx::Point RenderWidgetHostViewMac::AccessibilityOriginInScreen(
|
| @@ -2087,33 +2086,9 @@
|
| return gfx::Point(originInScreen.x, originInScreen.y);
|
| }
|
|
|
| -void RenderWidgetHostViewMac::OnAccessibilitySetFocus(int accObjId) {
|
| - // Immediately set the focused item even though we have not officially set
|
| - // focus on it as VoiceOver expects to get the focused item after this
|
| - // method returns.
|
| - BrowserAccessibilityManager* manager = GetBrowserAccessibilityManager();
|
| - if (manager)
|
| - manager->SetFocus(manager->GetFromID(accObjId), false);
|
| -}
|
| -
|
| -void RenderWidgetHostViewMac::AccessibilityShowMenu(int accObjId) {
|
| - BrowserAccessibilityManager* manager = GetBrowserAccessibilityManager();
|
| - if (!manager)
|
| - return;
|
| - BrowserAccessibilityCocoa* obj =
|
| - manager->GetFromID(accObjId)->ToBrowserAccessibilityCocoa();
|
| -
|
| - // Performs a right click copying WebKit's
|
| - // accessibilityPerformShowMenuAction.
|
| - NSPoint objOrigin = [obj origin];
|
| - NSSize size = [[obj size] sizeValue];
|
| - gfx::Point origin = AccessibilityOriginInScreen(
|
| - gfx::Rect(objOrigin.x, objOrigin.y, size.width, size.height));
|
| - NSPoint location = NSMakePoint(origin.x(), origin.y());
|
| +void RenderWidgetHostViewMac::AccessibilityShowMenu(const gfx::Point& point) {
|
| + NSPoint location = NSMakePoint(point.x(), point.y());
|
| location = [[cocoa_view_ window] convertScreenToBase:location];
|
| - location.x += size.width/2;
|
| - location.y += size.height/2;
|
| -
|
| NSEvent* fakeRightClick = [NSEvent
|
| mouseEventWithType:NSRightMouseDown
|
| location:location
|
| @@ -2127,8 +2102,6 @@
|
|
|
| [cocoa_view_ mouseEvent:fakeRightClick];
|
| }
|
| -
|
| -
|
|
|
| void RenderWidgetHostViewMac::SetTextInputActive(bool active) {
|
| if (active) {
|
| @@ -3177,7 +3150,7 @@
|
|
|
| - (id)accessibilityAttributeValue:(NSString *)attribute {
|
| BrowserAccessibilityManager* manager =
|
| - renderWidgetHostView_->GetBrowserAccessibilityManager();
|
| + renderWidgetHostView_->GetHost()->GetRootBrowserAccessibilityManager();
|
|
|
| // Contents specifies document view of RenderWidgetHostViewCocoa provided by
|
| // BrowserAccessibilityManager. Children includes all subviews in addition to
|
| @@ -3202,25 +3175,28 @@
|
| }
|
|
|
| - (id)accessibilityHitTest:(NSPoint)point {
|
| - if (!renderWidgetHostView_->GetBrowserAccessibilityManager())
|
| + BrowserAccessibilityManager* manager =
|
| + renderWidgetHostView_->GetHost()->GetRootBrowserAccessibilityManager();
|
| + if (!manager)
|
| return self;
|
| NSPoint pointInWindow = [[self window] convertScreenToBase:point];
|
| NSPoint localPoint = [self convertPoint:pointInWindow fromView:nil];
|
| localPoint.y = NSHeight([self bounds]) - localPoint.y;
|
| - BrowserAccessibilityCocoa* root = renderWidgetHostView_->
|
| - GetBrowserAccessibilityManager()->
|
| - GetRoot()->ToBrowserAccessibilityCocoa();
|
| + BrowserAccessibilityCocoa* root =
|
| + manager->GetRoot()->ToBrowserAccessibilityCocoa();
|
| id obj = [root accessibilityHitTest:localPoint];
|
| return obj;
|
| }
|
|
|
| - (BOOL)accessibilityIsIgnored {
|
| - return !renderWidgetHostView_->GetBrowserAccessibilityManager();
|
| + BrowserAccessibilityManager* manager =
|
| + renderWidgetHostView_->GetHost()->GetRootBrowserAccessibilityManager();
|
| + return !manager;
|
| }
|
|
|
| - (NSUInteger)accessibilityGetIndexOf:(id)child {
|
| BrowserAccessibilityManager* manager =
|
| - renderWidgetHostView_->GetBrowserAccessibilityManager();
|
| + renderWidgetHostView_->GetHost()->GetRootBrowserAccessibilityManager();
|
| // Only child is root.
|
| if (manager &&
|
| manager->GetRoot()->ToBrowserAccessibilityCocoa() == child) {
|
| @@ -3232,7 +3208,7 @@
|
|
|
| - (id)accessibilityFocusedUIElement {
|
| BrowserAccessibilityManager* manager =
|
| - renderWidgetHostView_->GetBrowserAccessibilityManager();
|
| + renderWidgetHostView_->GetHost()->GetRootBrowserAccessibilityManager();
|
| if (manager) {
|
| BrowserAccessibility* focused_item = manager->GetFocus(NULL);
|
| DCHECK(focused_item);
|
|
|