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) | |
aelias_OOO_until_Jul13
2017/02/22 03:36:01
I'd prefer it not be OS_ANDROID. This makes compi
Donn Denman
2017/02/22 23:13:01
Done.
| |
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(); | |
aelias_OOO_until_Jul13
2017/02/22 03:36:00
I'm missing a bit of context; why do we set a care
Donn Denman
2017/02/22 23:13:02
Sorry about the lack of context. When the user ta
| |
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 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2716 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2731 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
2717 } | 2732 } |
2718 | 2733 |
2719 std::unique_ptr<InputEventAck> ack( | 2734 std::unique_ptr<InputEventAck> ack( |
2720 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), | 2735 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), |
2721 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); | 2736 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
2722 OnInputEventAck(std::move(ack)); | 2737 OnInputEventAck(std::move(ack)); |
2723 } | 2738 } |
2724 | 2739 |
2725 } // namespace content | 2740 } // namespace content |
OLD | NEW |