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 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 IPC_END_MESSAGE_MAP() | 1269 IPC_END_MESSAGE_MAP() |
1270 | 1270 |
1271 return handled; | 1271 return handled; |
1272 } | 1272 } |
1273 | 1273 |
1274 void RenderViewImpl::OnSelectWordAroundCaret() { | 1274 void RenderViewImpl::OnSelectWordAroundCaret() { |
1275 if (!webview()) | 1275 if (!webview()) |
1276 return; | 1276 return; |
1277 | 1277 |
1278 input_handler_->set_handling_input_event(true); | 1278 input_handler_->set_handling_input_event(true); |
1279 webview()->FocusedFrame()->SelectWordAroundCaret(); | 1279 int start_adjust = 0; |
| 1280 int end_adjust = 0; |
| 1281 blink::WebRange initial_range = webview()->FocusedFrame()->SelectionRange(); |
| 1282 bool did_select = webview()->FocusedFrame()->SelectWordAroundCaret(); |
| 1283 if (did_select) { |
| 1284 blink::WebRange adjusted_range = |
| 1285 webview()->FocusedFrame()->SelectionRange(); |
| 1286 start_adjust = adjusted_range.StartOffset() - initial_range.StartOffset(); |
| 1287 end_adjust = adjusted_range.EndOffset() - initial_range.EndOffset(); |
| 1288 } |
| 1289 Send(new ViewHostMsg_SelectWordAroundCaretAck(GetRoutingID(), did_select, |
| 1290 start_adjust, end_adjust)); |
1280 input_handler_->set_handling_input_event(false); | 1291 input_handler_->set_handling_input_event(false); |
1281 } | 1292 } |
1282 | 1293 |
1283 void RenderViewImpl::OnUpdateTargetURLAck() { | 1294 void RenderViewImpl::OnUpdateTargetURLAck() { |
1284 // Check if there is a targeturl waiting to be sent. | 1295 // Check if there is a targeturl waiting to be sent. |
1285 if (target_url_status_ == TARGET_PENDING) | 1296 if (target_url_status_ == TARGET_PENDING) |
1286 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); | 1297 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); |
1287 | 1298 |
1288 target_url_status_ = TARGET_NONE; | 1299 target_url_status_ = TARGET_NONE; |
1289 } | 1300 } |
(...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2660 input_event.GetCoalescedEventsPointers(), latency_info, | 2671 input_event.GetCoalescedEventsPointers(), latency_info, |
2661 dispatch_type); | 2672 dispatch_type); |
2662 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 2673 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
2663 } | 2674 } |
2664 idle_user_detector_->ActivityDetected(); | 2675 idle_user_detector_->ActivityDetected(); |
2665 return RenderWidget::HandleInputEvent(input_event, latency_info, | 2676 return RenderWidget::HandleInputEvent(input_event, latency_info, |
2666 dispatch_type); | 2677 dispatch_type); |
2667 } | 2678 } |
2668 | 2679 |
2669 } // namespace content | 2680 } // namespace content |
OLD | NEW |