Chromium Code Reviews| Index: content/common/input/web_input_event_traits.cc |
| diff --git a/content/common/input/web_input_event_traits.cc b/content/common/input/web_input_event_traits.cc |
| index 6ca962b5720d9741d2b6bc4d4d251f7e9a86b9ec..10a28c18dbf0caf699c98e46f0575f964ddaacec 100644 |
| --- a/content/common/input/web_input_event_traits.cc |
| +++ b/content/common/input/web_input_event_traits.cc |
| @@ -9,6 +9,7 @@ |
| #include "base/logging.h" |
| #include "base/strings/stringprintf.h" |
| +#include "content/common/input_messages.h" |
| using base::StringAppendF; |
| using base::SStringPrintf; |
| @@ -461,7 +462,8 @@ void WebInputEventTraits::Coalesce(const WebInputEvent& event_to_coalesce, |
| Apply(WebInputEventCoalesce(), event->type, event_to_coalesce, event); |
| } |
| -bool WebInputEventTraits::IgnoresAckDisposition(const WebInputEvent& event) { |
| +bool WebInputEventTraits::WillReceiveAckFromRenderer( |
| + const WebInputEvent& event) { |
| switch (event.type) { |
| case WebInputEvent::MouseDown: |
| case WebInputEvent::MouseUp: |
| @@ -477,14 +479,43 @@ bool WebInputEventTraits::IgnoresAckDisposition(const WebInputEvent& event) { |
| case WebInputEvent::GesturePinchBegin: |
| case WebInputEvent::GesturePinchEnd: |
| case WebInputEvent::TouchCancel: |
| - return true; |
| + return false; |
| case WebInputEvent::TouchStart: |
| - case WebInputEvent::TouchMove: |
| case WebInputEvent::TouchEnd: |
| - return !static_cast<const WebTouchEvent&>(event).cancelable; |
| + return static_cast<const WebTouchEvent&>(event).cancelable; |
| default: |
| - return false; |
| + return true; |
| + } |
| +} |
| + |
| +scoped_ptr<IPC::Message> WebInputEventTraits::CreateAckIfNecessary( |
| + const blink::WebInputEvent& event, |
| + const content::InputEventAckState ack_state, |
| + const ui::LatencyInfo& latency_info, |
| + scoped_ptr<DidOverscrollParams> overscroll_params, |
| + int routing_id) { |
| + scoped_ptr<IPC::Message> response; |
| + if (event.type == WebInputEvent::TouchMove) { |
| + const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(event); |
| + if (!touch.cancelable) { |
| + response = scoped_ptr<IPC::Message>( |
|
jdduke (slow)
2015/04/15 17:14:53
I think we can just do:
return make_scoped_ptr(ne
lanwei
2015/04/17 20:49:00
Done.
|
| + new InputHostMsg_HandleUncancelableTouchMoveEvent_ACK(routing_id)); |
| + return response.Pass(); |
| + } |
| + } |
| + |
| + const bool send_ack = WebInputEventTraits::WillReceiveAckFromRenderer(event); |
| + if (send_ack) { |
| + DCHECK(!response); |
| + InputHostMsg_HandleInputEvent_ACK_Params ack; |
| + ack.type = event.type; |
| + ack.state = ack_state; |
| + ack.latency = latency_info; |
| + ack.overscroll = overscroll_params.Pass(); |
| + response = scoped_ptr<IPC::Message>( |
|
jdduke (slow)
2015/04/15 17:14:53
Same here, |return make_scoped_ptr(new ...)|.
lanwei
2015/04/17 20:49:00
Done.
|
| + new InputHostMsg_HandleInputEvent_ACK(routing_id, ack)); |
| } |
| + return response.Pass(); |
|
jdduke (slow)
2015/04/15 17:14:53
Then this just becomes |return nullptr;|
lanwei
2015/04/17 20:49:00
Done.
|
| } |
| } // namespace content |