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 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 IPC_END_MESSAGE_MAP() | 1289 IPC_END_MESSAGE_MAP() |
1290 | 1290 |
1291 return handled; | 1291 return handled; |
1292 } | 1292 } |
1293 | 1293 |
1294 void RenderViewImpl::OnSelectWordAroundCaret() { | 1294 void RenderViewImpl::OnSelectWordAroundCaret() { |
1295 if (!webview()) | 1295 if (!webview()) |
1296 return; | 1296 return; |
1297 | 1297 |
1298 input_handler_->set_handling_input_event(true); | 1298 input_handler_->set_handling_input_event(true); |
1299 webview()->focusedFrame()->selectWordAroundCaret(); | 1299 int start_adjust = 0; |
| 1300 int end_adjust = 0; |
| 1301 blink::WebRange initial_range = webview()->focusedFrame()->selectionRange(); |
| 1302 bool did_select = webview()->focusedFrame()->selectWordAroundCaret(); |
| 1303 if (did_select) { |
| 1304 blink::WebRange adjusted_range = |
| 1305 webview()->focusedFrame()->selectionRange(); |
| 1306 start_adjust = adjusted_range.startOffset() - initial_range.startOffset(); |
| 1307 end_adjust = adjusted_range.endOffset() - initial_range.endOffset(); |
| 1308 } |
| 1309 Send(new ViewHostMsg_SelectWordAroundCaretAck(GetRoutingID(), did_select, |
| 1310 start_adjust, end_adjust)); |
1300 input_handler_->set_handling_input_event(false); | 1311 input_handler_->set_handling_input_event(false); |
1301 } | 1312 } |
1302 | 1313 |
1303 void RenderViewImpl::OnUpdateTargetURLAck() { | 1314 void RenderViewImpl::OnUpdateTargetURLAck() { |
1304 // Check if there is a targeturl waiting to be sent. | 1315 // Check if there is a targeturl waiting to be sent. |
1305 if (target_url_status_ == TARGET_PENDING) | 1316 if (target_url_status_ == TARGET_PENDING) |
1306 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); | 1317 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); |
1307 | 1318 |
1308 target_url_status_ = TARGET_NONE; | 1319 target_url_status_ = TARGET_NONE; |
1309 } | 1320 } |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2718 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2729 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
2719 } | 2730 } |
2720 | 2731 |
2721 std::unique_ptr<InputEventAck> ack( | 2732 std::unique_ptr<InputEventAck> ack( |
2722 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), | 2733 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), |
2723 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); | 2734 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
2724 OnInputEventAck(std::move(ack)); | 2735 OnInputEventAck(std::move(ack)); |
2725 } | 2736 } |
2726 | 2737 |
2727 } // namespace content | 2738 } // namespace content |
OLD | NEW |