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