Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(914)

Unified Diff: content/browser/renderer_host/input/input_router_impl.cc

Issue 657803002: Update touch selection to only modify one selection point at a time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix DCHECK Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/input/input_router_impl.cc
diff --git a/content/browser/renderer_host/input/input_router_impl.cc b/content/browser/renderer_host/input/input_router_impl.cc
index 441f9384bb8745e05efd53d9e1e645aa94255124..f3b4169705adf6b47ef7dc10f7bd2086f81edd7d 100644
--- a/content/browser/renderer_host/input/input_router_impl.cc
+++ b/content/browser/renderer_host/input/input_router_impl.cc
@@ -69,6 +69,7 @@ InputRouterImpl::InputRouterImpl(IPC::Sender* sender,
ack_handler_(ack_handler),
routing_id_(routing_id),
select_range_pending_(false),
+ move_range_selection_extent_pending_(false),
move_caret_pending_(false),
mouse_move_pending_(false),
mouse_wheel_pending_(false),
@@ -96,6 +97,8 @@ bool InputRouterImpl::SendInput(scoped_ptr<IPC::Message> message) {
// Check for types that require an ACK.
case InputMsg_SelectRange::ID:
return SendSelectRange(message.Pass());
+ case InputMsg_MoveRangeSelectionExtent::ID:
+ return SendMoveRangeSelectionExtent(message.Pass());
case InputMsg_MoveCaret::ID:
return SendMoveCaret(message.Pass());
case InputMsg_HandleInputEvent::ID:
@@ -267,8 +270,10 @@ bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(InputRouterImpl, message)
IPC_MESSAGE_HANDLER(InputHostMsg_HandleInputEvent_ACK, OnInputEventAck)
IPC_MESSAGE_HANDLER(InputHostMsg_DidOverscroll, OnDidOverscroll)
- IPC_MESSAGE_HANDLER(ViewHostMsg_MoveCaret_ACK, OnMsgMoveCaretAck)
- IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnSelectRangeAck)
+ IPC_MESSAGE_HANDLER(InputHostMsg_MoveCaret_ACK, OnMsgMoveCaretAck)
+ IPC_MESSAGE_HANDLER(InputHostMsg_SelectRange_ACK, OnSelectRangeAck)
+ IPC_MESSAGE_HANDLER(InputHostMsg_MoveRangeSelectionExtent_ACK,
+ OnMoveRangeSelectionExtentAck)
IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers,
OnHasTouchEventHandlers)
IPC_MESSAGE_HANDLER(InputHostMsg_SetTouchAction,
@@ -309,6 +314,20 @@ bool InputRouterImpl::SendSelectRange(scoped_ptr<IPC::Message> message) {
return Send(message.release());
}
+bool InputRouterImpl::SendMoveRangeSelectionExtent(
+ scoped_ptr<IPC::Message> message) {
+ DCHECK(message->type() == InputMsg_MoveRangeSelectionExtent::ID);
jdduke (slow) 2014/10/21 16:57:36 Hmm, so, in theory |SelectRange| and |MoveRangeSel
christiank 2014/10/22 12:16:06 I think you're right. Maybe we could use the queue
+ // TODO(jdduke): Factor out common logic between selection and caret-related
+ // IPC messages.
+ if (move_range_selection_extent_pending_) {
+ next_range_selection_extent_move_ = message.Pass();
+ return true;
+ }
+
+ move_range_selection_extent_pending_ = true;
+ return Send(message.release());
+}
+
bool InputRouterImpl::SendMoveCaret(scoped_ptr<IPC::Message> message) {
DCHECK(message->type() == InputMsg_MoveCaret::ID);
if (move_caret_pending_) {
@@ -493,6 +512,12 @@ void InputRouterImpl::OnSelectRangeAck() {
SendSelectRange(next_selection_range_.Pass());
}
+void InputRouterImpl::OnMoveRangeSelectionExtentAck() {
+ move_range_selection_extent_pending_ = false;
+ if (next_range_selection_extent_move_)
+ SendMoveRangeSelectionExtent(next_range_selection_extent_move_.Pass());
+}
+
void InputRouterImpl::OnHasTouchEventHandlers(bool has_handlers) {
TRACE_EVENT1("input", "InputRouterImpl::OnHasTouchEventHandlers",
"has_handlers", has_handlers);
@@ -680,6 +705,7 @@ bool InputRouterImpl::HasPendingEvents() const {
mouse_move_pending_ ||
mouse_wheel_pending_ ||
select_range_pending_ ||
+ move_range_selection_extent_pending_ ||
move_caret_pending_;
}

Powered by Google App Engine
This is Rietveld 408576698