Chromium Code Reviews| Index: content/renderer/input/main_thread_event_queue.cc |
| diff --git a/content/renderer/input/main_thread_event_queue.cc b/content/renderer/input/main_thread_event_queue.cc |
| index ee2a34918d69a96861d89c6cf1935c2be2e93f48..c7ff94751142c429d1c2f31ffef54a3686e6b7c1 100644 |
| --- a/content/renderer/input/main_thread_event_queue.cc |
| +++ b/content/renderer/input/main_thread_event_queue.cc |
| @@ -41,6 +41,7 @@ MainThreadEventQueue::MainThreadEventQueue( |
| : routing_id_(routing_id), |
| client_(client), |
| is_flinging_(false), |
| + is_last_touch_start_force_passive_(false), |
| main_task_runner_(main_task_runner) {} |
| MainThreadEventQueue::~MainThreadEventQueue() {} |
| @@ -57,10 +58,6 @@ bool MainThreadEventQueue::HandleEvent( |
| bool non_blocking = original_dispatch_type == DISPATCH_TYPE_NON_BLOCKING || |
| ack_result == INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING; |
| - |
| - InputEventDispatchType dispatch_type = |
| - non_blocking ? DISPATCH_TYPE_NON_BLOCKING : DISPATCH_TYPE_BLOCKING; |
| - |
| bool is_wheel = event->type == blink::WebInputEvent::MouseWheel; |
| bool is_touch = blink::WebInputEvent::isTouchEventType(event->type); |
| @@ -74,6 +71,23 @@ bool MainThreadEventQueue::HandleEvent( |
| touch_event->dispatchType = |
| blink::WebInputEvent::ListenersNonBlockingPassive; |
| } |
| + |
| + if (base::FeatureList::IsEnabled( |
| + features::kPassiveEventListenersDueToFling) && |
|
tdresser
2016/08/17 14:32:27
Let's read this flag once, and store the result in
lanwei
2016/08/18 12:31:47
Done.
|
| + is_flinging_ && touch_event->touchStartOrFirstTouchMove && |
| + touch_event->dispatchType == blink::WebInputEvent::Blocking) { |
| + // If the touch start is forced to be passive due to fling, its following |
| + // touch move should also be passive. |
| + if (touch_event->type == blink::WebInputEvent::TouchStart || |
| + is_last_touch_start_force_passive_) { |
| + touch_event->dispatchType = |
| + blink::WebInputEvent::ListenersForcedNonBlockingPassiveDueToFling; |
| + non_blocking = true; |
| + is_last_touch_start_force_passive_ = true; |
|
tdresser
2016/08/17 14:32:27
This variable name is a bit confusing, as the tens
lanwei
2016/08/18 12:31:47
Done.
|
| + } |
| + } else if (touch_event->type == blink::WebInputEvent::TouchStart) { |
| + is_last_touch_start_force_passive_ = false; |
| + } |
| } |
| if (is_wheel && non_blocking) { |
| // Adjust the |dispatchType| on the event since the compositor |
| @@ -82,6 +96,8 @@ bool MainThreadEventQueue::HandleEvent( |
| ->dispatchType = blink::WebInputEvent::ListenersNonBlockingPassive; |
| } |
| + InputEventDispatchType dispatch_type = |
| + non_blocking ? DISPATCH_TYPE_NON_BLOCKING : DISPATCH_TYPE_BLOCKING; |
| std::unique_ptr<EventWithDispatchType> event_with_dispatch_type( |
| new EventWithDispatchType(std::move(event), latency, dispatch_type)); |