Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1273 // platform specific ones at the end. | 1273 // platform specific ones at the end. |
| 1274 | 1274 |
| 1275 // Have the super handle all other messages. | 1275 // Have the super handle all other messages. |
| 1276 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) | 1276 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
| 1277 IPC_END_MESSAGE_MAP() | 1277 IPC_END_MESSAGE_MAP() |
| 1278 | 1278 |
| 1279 return handled; | 1279 return handled; |
| 1280 } | 1280 } |
| 1281 | 1281 |
| 1282 void RenderViewImpl::OnSelectWordAroundCaret() { | 1282 void RenderViewImpl::OnSelectWordAroundCaret() { |
| 1283 if (!webview()) | 1283 // Set default values for the ACK |
| 1284 return; | 1284 bool did_select = false; |
| 1285 int start_adjust = 0; | |
| 1286 int end_adjust = 0; | |
| 1285 | 1287 |
| 1286 input_handler_->set_handling_input_event(true); | 1288 if (webview()) { |
| 1287 webview()->FocusedFrame()->SelectWordAroundCaret(); | 1289 auto* focused_frame = GetWebView()->FocusedFrame(); |
|
aelias_OOO_until_Jul13
2017/05/15 17:46:20
nit: please avoid 'auto' here, type is likely not
Donn Denman
2017/05/15 21:13:14
Done.
| |
| 1288 input_handler_->set_handling_input_event(false); | 1290 if (focused_frame) { |
| 1291 input_handler_->set_handling_input_event(true); | |
| 1292 blink::WebRange initial_range = focused_frame->SelectionRange(); | |
| 1293 did_select = focused_frame->SelectWordAroundCaret(); | |
| 1294 if (did_select) { | |
| 1295 blink::WebRange adjusted_range = focused_frame->SelectionRange(); | |
| 1296 start_adjust = | |
| 1297 adjusted_range.StartOffset() - initial_range.StartOffset(); | |
| 1298 end_adjust = adjusted_range.EndOffset() - initial_range.EndOffset(); | |
| 1299 } | |
| 1300 input_handler_->set_handling_input_event(false); | |
| 1301 } | |
| 1302 } | |
| 1303 Send(new ViewHostMsg_SelectWordAroundCaretAck(GetRoutingID(), did_select, | |
| 1304 start_adjust, end_adjust)); | |
| 1289 } | 1305 } |
| 1290 | 1306 |
| 1291 void RenderViewImpl::OnUpdateTargetURLAck() { | 1307 void RenderViewImpl::OnUpdateTargetURLAck() { |
| 1292 // Check if there is a targeturl waiting to be sent. | 1308 // Check if there is a targeturl waiting to be sent. |
| 1293 if (target_url_status_ == TARGET_PENDING) | 1309 if (target_url_status_ == TARGET_PENDING) |
| 1294 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); | 1310 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); |
| 1295 | 1311 |
| 1296 target_url_status_ = TARGET_NONE; | 1312 target_url_status_ = TARGET_NONE; |
| 1297 } | 1313 } |
| 1298 | 1314 |
| (...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2671 input_event.GetCoalescedEventsPointers(), latency_info, | 2687 input_event.GetCoalescedEventsPointers(), latency_info, |
| 2672 dispatch_type); | 2688 dispatch_type); |
| 2673 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 2689 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
| 2674 } | 2690 } |
| 2675 idle_user_detector_->ActivityDetected(); | 2691 idle_user_detector_->ActivityDetected(); |
| 2676 return RenderWidget::HandleInputEvent(input_event, latency_info, | 2692 return RenderWidget::HandleInputEvent(input_event, latency_info, |
| 2677 dispatch_type); | 2693 dispatch_type); |
| 2678 } | 2694 } |
| 2679 | 2695 |
| 2680 } // namespace content | 2696 } // namespace content |
| OLD | NEW |