Index: content/renderer/render_view_impl.cc |
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
index 83640d7a96da178d57ffdfc0ce6824a0f7d3fdc7..afb3b3f04f7b5dfec2df4a1dc3084da8974bddbc 100644 |
--- a/content/renderer/render_view_impl.cc |
+++ b/content/renderer/render_view_impl.cc |
@@ -1273,12 +1273,28 @@ bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { |
} |
void RenderViewImpl::OnSelectWordAroundCaret() { |
- if (!webview()) |
- return; |
+ // Set default values for the ACK |
+ bool did_select = false; |
+ int start_adjust = 0; |
+ int end_adjust = 0; |
- input_handler_->set_handling_input_event(true); |
- webview()->FocusedFrame()->SelectWordAroundCaret(); |
- input_handler_->set_handling_input_event(false); |
+ if (webview()) { |
+ WebLocalFrame* focused_frame = GetWebView()->FocusedFrame(); |
+ if (focused_frame) { |
+ input_handler_->set_handling_input_event(true); |
+ blink::WebRange initial_range = focused_frame->SelectionRange(); |
+ did_select = focused_frame->SelectWordAroundCaret(); |
+ if (did_select) { |
+ blink::WebRange adjusted_range = focused_frame->SelectionRange(); |
+ start_adjust = |
+ adjusted_range.StartOffset() - initial_range.StartOffset(); |
+ end_adjust = adjusted_range.EndOffset() - initial_range.EndOffset(); |
+ } |
+ input_handler_->set_handling_input_event(false); |
+ } |
+ } |
+ Send(new ViewHostMsg_SelectWordAroundCaretAck(GetRoutingID(), did_select, |
+ start_adjust, end_adjust)); |
} |
void RenderViewImpl::OnUpdateTargetURLAck() { |