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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 2703643004: [TTS] Add an ACK message to SelectWordAroundCaret. (Closed)
Patch Set: Added a counter to track calls to SelectWordAroundCaret without any 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 unified diff | Download patch
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/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 // platform specific ones at the end. 1271 // platform specific ones at the end.
1272 1272
1273 // Have the super handle all other messages. 1273 // Have the super handle all other messages.
1274 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) 1274 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message))
1275 IPC_END_MESSAGE_MAP() 1275 IPC_END_MESSAGE_MAP()
1276 1276
1277 return handled; 1277 return handled;
1278 } 1278 }
1279 1279
1280 void RenderViewImpl::OnSelectWordAroundCaret() { 1280 void RenderViewImpl::OnSelectWordAroundCaret() {
1281 if (!webview()) 1281 if (!webview())
Donn Denman 2017/05/11 23:05:46 I noticed this early return, and think it violates
1282 return; 1282 return;
1283 1283
1284 input_handler_->set_handling_input_event(true); 1284 input_handler_->set_handling_input_event(true);
1285 webview()->FocusedFrame()->SelectWordAroundCaret(); 1285 int start_adjust = 0;
1286 int end_adjust = 0;
1287 blink::WebRange initial_range = webview()->FocusedFrame()->SelectionRange();
nasko 2017/05/11 22:21:38 FocusedFrame() can return nullptr, it needs to be
Donn Denman 2017/05/11 23:05:46 Done.
1288 bool did_select = webview()->FocusedFrame()->SelectWordAroundCaret();
1289 if (did_select) {
1290 blink::WebRange adjusted_range =
1291 webview()->FocusedFrame()->SelectionRange();
nasko 2017/05/11 22:21:38 This is the third call to webview()->FocusedFrame(
Donn Denman 2017/05/11 23:05:46 Done.
1292 start_adjust = adjusted_range.StartOffset() - initial_range.StartOffset();
1293 end_adjust = adjusted_range.EndOffset() - initial_range.EndOffset();
1294 }
1295 Send(new ViewHostMsg_SelectWordAroundCaretAck(GetRoutingID(), did_select,
1296 start_adjust, end_adjust));
1286 input_handler_->set_handling_input_event(false); 1297 input_handler_->set_handling_input_event(false);
1287 } 1298 }
1288 1299
1289 void RenderViewImpl::OnUpdateTargetURLAck() { 1300 void RenderViewImpl::OnUpdateTargetURLAck() {
1290 // Check if there is a targeturl waiting to be sent. 1301 // Check if there is a targeturl waiting to be sent.
1291 if (target_url_status_ == TARGET_PENDING) 1302 if (target_url_status_ == TARGET_PENDING)
1292 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); 1303 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_));
1293 1304
1294 target_url_status_ = TARGET_NONE; 1305 target_url_status_ = TARGET_NONE;
1295 } 1306 }
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
2669 input_event.GetCoalescedEventsPointers(), latency_info, 2680 input_event.GetCoalescedEventsPointers(), latency_info,
2670 dispatch_type); 2681 dispatch_type);
2671 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; 2682 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
2672 } 2683 }
2673 idle_user_detector_->ActivityDetected(); 2684 idle_user_detector_->ActivityDetected();
2674 return RenderWidget::HandleInputEvent(input_event, latency_info, 2685 return RenderWidget::HandleInputEvent(input_event, latency_info,
2675 dispatch_type); 2686 dispatch_type);
2676 } 2687 }
2677 2688
2678 } // namespace content 2689 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698