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

Unified Diff: content/renderer/render_view_impl.cc

Issue 2703643004: [TTS] Add an ACK message to SelectWordAroundCaret. (Closed)
Patch Set: Update the other test in ContextualSearchTapEventTest.java to know about the ACK. Created 3 years, 7 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
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/SmartSelectionClient.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/SmartSelectionClient.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698