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 29fd891e02b785c3c46e54767a046514fef71dd5..ed80519ad0c68b0f2e573ab52b8c98daf027c228 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm |
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm |
@@ -40,6 +40,7 @@ |
#include "content/browser/frame_host/frame_tree_node.h" |
#include "content/browser/frame_host/render_frame_host_impl.h" |
#include "content/browser/gpu/compositor_util.h" |
+#include "content/browser/renderer_host/input/input_router.h" |
#include "content/browser/renderer_host/input/web_input_event_builders_mac.h" |
#include "content/browser/renderer_host/render_view_host_impl.h" |
#include "content/browser/renderer_host/render_widget_helper.h" |
@@ -2328,6 +2329,22 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged( |
[NSCursor setHiddenUntilMouseMoves:YES]; |
} |
+- (void)forceTouchEvent:(NSEvent*)theEvent { |
+ // Convert the event point into coordinates in the a web content. |
+ NSPoint locationInView = |
+ [self convertPoint:[theEvent locationInWindow] fromView:nil]; |
+ NSPoint webContentPoint = NSMakePoint( |
+ locationInView.x, [self frame].size.height - locationInView.y); |
+ |
+ // Sends an input to the renderer to select the word at the event's |
+ // coordinates. A response from the renderer for this event will cause the |
+ // browser to look up the selected word. |
+ RenderWidgetHostImpl* rwh = renderWidgetHostView_->render_widget_host_; |
+ rwh->input_router()->SendInput( |
+ scoped_ptr<IPC::Message>(new InputMsg_SelectWordIfAnyAtCoordinates( |
+ rwh->GetRoutingID(), webContentPoint.x, webContentPoint.y))); |
+} |
+ |
- (void)shortCircuitScrollWheelEvent:(NSEvent*)event { |
DCHECK(base::mac::IsOSLionOrLater()); |