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

Unified Diff: content/renderer/render_view_impl.cc

Issue 2703643004: [TTS] Add an ACK message to SelectWordAroundCaret. (Closed)
Patch Set: Clean up the logic in render_view_impl.cc Created 3 years, 10 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/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 65f6b337a9cae51b4f59338f35febd64f5319b6f..9cbd166207cd0e114469eaaa7a39bea0bf3727a7 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -1294,7 +1294,22 @@ void RenderViewImpl::OnSelectWordAroundCaret() {
return;
input_handler_->set_handling_input_event(true);
+#if defined(OS_ANDROID)
+ int start_adjust = 0;
+ int end_adjust = 0;
+ blink::WebRange initial_range = webview()->focusedFrame()->selectionRange();
+ bool did_select = webview()->focusedFrame()->selectWordAroundCaret();
+ if (did_select) {
+ blink::WebRange adjusted_range =
+ webview()->focusedFrame()->selectionRange();
+ start_adjust = adjusted_range.startOffset() - initial_range.startOffset();
+ end_adjust = adjusted_range.endOffset() - initial_range.endOffset();
+ }
+ Send(new ViewHostMsg_SelectWordAroundCaret_ACK(GetRoutingID(), did_select,
+ start_adjust, end_adjust));
+#else
webview()->focusedFrame()->selectWordAroundCaret();
+#endif
input_handler_->set_handling_input_event(false);
}

Powered by Google App Engine
This is Rietveld 408576698