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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 25434005: Implement accessible BoundsForRange on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/accessibility/browser_accessibility_mac_unittest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <QuartzCore/QuartzCore.h> 8 #include <QuartzCore/QuartzCore.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 3064 matching lines...) Expand 10 before | Expand all | Expand 10 after
3075 // word in a text field. 3075 // word in a text field.
3076 - (void)accessibilitySetTextSelection:(int32)accId 3076 - (void)accessibilitySetTextSelection:(int32)accId
3077 startOffset:(int32)startOffset 3077 startOffset:(int32)startOffset
3078 endOffset:(int32)endOffset { 3078 endOffset:(int32)endOffset {
3079 RenderWidgetHostImpl* rwh = renderWidgetHostView_->render_widget_host_; 3079 RenderWidgetHostImpl* rwh = renderWidgetHostView_->render_widget_host_;
3080 rwh->AccessibilitySetTextSelection(accId, startOffset, endOffset); 3080 rwh->AccessibilitySetTextSelection(accId, startOffset, endOffset);
3081 } 3081 }
3082 3082
3083 // Convert a web accessibility's location in web coordinates into a cocoa 3083 // Convert a web accessibility's location in web coordinates into a cocoa
3084 // screen coordinate. 3084 // screen coordinate.
3085 - (NSPoint)accessibilityPointInScreen: 3085 - (NSPoint)accessibilityPointInScreen:(NSPoint)origin
3086 (BrowserAccessibilityCocoa*)accessibility { 3086 size:(NSSize)size {
3087 NSPoint origin = [accessibility origin];
3088 NSSize size = [[accessibility size] sizeValue];
3089 origin.y = NSHeight([self bounds]) - origin.y; 3087 origin.y = NSHeight([self bounds]) - origin.y;
3090 NSPoint originInWindow = [self convertPoint:origin toView:nil]; 3088 NSPoint originInWindow = [self convertPoint:origin toView:nil];
3091 NSPoint originInScreen = [[self window] convertBaseToScreen:originInWindow]; 3089 NSPoint originInScreen = [[self window] convertBaseToScreen:originInWindow];
3092 originInScreen.y = originInScreen.y - size.height; 3090 originInScreen.y = originInScreen.y - size.height;
3093 return originInScreen; 3091 return originInScreen;
3094 } 3092 }
3095 3093
3096 - (void)setAccessibilityFocus:(BOOL)focus 3094 - (void)setAccessibilityFocus:(BOOL)focus
3097 accessibilityId:(int32)accessibilityObjectId { 3095 accessibilityId:(int32)accessibilityObjectId {
3098 if (focus) { 3096 if (focus) {
3099 RenderWidgetHostImpl* rwh = renderWidgetHostView_->render_widget_host_; 3097 RenderWidgetHostImpl* rwh = renderWidgetHostView_->render_widget_host_;
3100 rwh->Send(new AccessibilityMsg_SetFocus( 3098 rwh->Send(new AccessibilityMsg_SetFocus(
3101 rwh->GetRoutingID(), accessibilityObjectId)); 3099 rwh->GetRoutingID(), accessibilityObjectId));
3102 3100
3103 // Immediately set the focused item even though we have not officially set 3101 // Immediately set the focused item even though we have not officially set
3104 // focus on it as VoiceOver expects to get the focused item after this 3102 // focus on it as VoiceOver expects to get the focused item after this
3105 // method returns. 3103 // method returns.
3106 BrowserAccessibilityManager* manager = 3104 BrowserAccessibilityManager* manager =
3107 renderWidgetHostView_->GetBrowserAccessibilityManager(); 3105 renderWidgetHostView_->GetBrowserAccessibilityManager();
3108 manager->SetFocus(manager->GetFromRendererID(accessibilityObjectId), false); 3106 manager->SetFocus(manager->GetFromRendererID(accessibilityObjectId), false);
3109 } 3107 }
3110 } 3108 }
3111 3109
3112 - (void)performShowMenuAction:(BrowserAccessibilityCocoa*)accessibility { 3110 - (void)performShowMenuAction:(BrowserAccessibilityCocoa*)accessibility {
3113 // Performs a right click copying WebKit's 3111 // Performs a right click copying WebKit's
3114 // accessibilityPerformShowMenuAction. 3112 // accessibilityPerformShowMenuAction.
3115 NSPoint location = [self accessibilityPointInScreen:accessibility]; 3113 NSPoint origin = [accessibility origin];
3116 NSSize size = [[accessibility size] sizeValue]; 3114 NSSize size = [[accessibility size] sizeValue];
3115 NSPoint location = [self accessibilityPointInScreen:origin size:size];
3117 location = [[self window] convertScreenToBase:location]; 3116 location = [[self window] convertScreenToBase:location];
3118 location.x += size.width/2; 3117 location.x += size.width/2;
3119 location.y += size.height/2; 3118 location.y += size.height/2;
3120 3119
3121 NSEvent* fakeRightClick = [NSEvent 3120 NSEvent* fakeRightClick = [NSEvent
3122 mouseEventWithType:NSRightMouseDown 3121 mouseEventWithType:NSRightMouseDown
3123 location:location 3122 location:location
3124 modifierFlags:0 3123 modifierFlags:0
3125 timestamp:0 3124 timestamp:0
3126 windowNumber:[[self window] windowNumber] 3125 windowNumber:[[self window] windowNumber]
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
3924 return YES; 3923 return YES;
3925 } 3924 }
3926 3925
3927 - (BOOL)isOpaque { 3926 - (BOOL)isOpaque {
3928 if (renderWidgetHostView_->use_core_animation_) 3927 if (renderWidgetHostView_->use_core_animation_)
3929 return YES; 3928 return YES;
3930 return [super isOpaque]; 3929 return [super isOpaque];
3931 } 3930 }
3932 3931
3933 @end 3932 @end
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility_mac_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698