Commit 86ae14e9 authored by Stephen Nusko's avatar Stephen Nusko Committed by Commit Bot

Revert "Ensure that TouchEvents are always async after scrolling has started."

This reverts commit f4886cba.

Reason for revert: This causes unintended throttling of TouchMoves if
the page is at the overflow already. Fix will land in next release.
See crbug/1123304 for details.


Original change's description:
> Ensure that TouchEvents are always async after scrolling has started.
>
> Currently we can flip flop back and forth between TouchMoves being sent
> async or sync which can cause some pretty noticeable cases of jank. This
> ensures that we are always consistently scrolling after deciding
> TouchMoves can be async.
>
> Bug: 1072364
> Change-Id: I3ef1ed6715d4b1fd2d3e1377ebd6b0c8bcc02872
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2182426
> Commit-Queue: Stephen Nusko <nuskos@chromium.org>
> Auto-Submit: Stephen Nusko <nuskos@chromium.org>
> Reviewed-by: David Bokan <bokan@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#776487}

TBR=bokan@chromium.org,nuskos@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1072364,1123304
Change-Id: I7645aa130ddaf5214bde77a8cbcdd239e48f729c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2413491
Auto-Submit: Stephen Nusko <nuskos@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Reviewed-by: default avatarStephen Nusko <nuskos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807464}
parent a806a882
......@@ -1676,9 +1676,6 @@ TEST_F(InputRouterImplTest, AsyncTouchMoveAckedImmediately) {
dispatched_messages[0]->ToEvent()->CallCallback(
blink::mojom::InputEventResultState::kConsumed);
EXPECT_EQ(1U, disposition_handler_->GetAndResetAckCount());
EXPECT_EQ(WebInputEvent::Type::kTouchStart,
disposition_handler_->ack_event_type());
SimulateGestureEvent(WebInputEvent::Type::kGestureScrollBegin,
blink::WebGestureDevice::kTouchscreen);
dispatched_messages = GetAndResetDispatchedMessages();
......@@ -1687,55 +1684,14 @@ TEST_F(InputRouterImplTest, AsyncTouchMoveAckedImmediately) {
dispatched_messages[0]->ToEvent()->CallCallback(
blink::mojom::InputEventResultState::kConsumed);
EXPECT_EQ(1U, disposition_handler_->GetAndResetAckCount());
EXPECT_EQ(WebInputEvent::Type::kGestureScrollBegin,
disposition_handler_->ack_event_type());
SimulateGestureEvent(WebInputEvent::Type::kGestureScrollUpdate,
blink::WebGestureDevice::kTouchscreen);
EXPECT_EQ(0U, disposition_handler_->GetAndResetAckCount());
dispatched_messages = GetAndResetDispatchedMessages();
EXPECT_EQ(2U, dispatched_messages.size());
EXPECT_EQ(WebInputEvent::Type::kTouchScrollStarted,
dispatched_messages[0]->ToEvent()->Event()->Event().GetType());
EXPECT_EQ(WebInputEvent::Type::kGestureScrollUpdate,
dispatched_messages[1]->ToEvent()->Event()->Event().GetType());
// Ack the GestureScrollUpdate.
dispatched_messages[1]->ToEvent()->CallCallback(
blink::mojom::InputEventResultState::kConsumed);
EXPECT_EQ(WebInputEvent::Type::kGestureScrollUpdate,
disposition_handler_->ack_event_type());
EXPECT_EQ(1U, disposition_handler_->GetAndResetAckCount());
EXPECT_EQ(2U, GetAndResetDispatchedMessages().size());
// Now since we're scrolling send an async move.
// Now send an async move.
MoveTouchPoint(0, 5, 5);
SendTouchEvent();
EXPECT_EQ(WebInputEvent::Type::kTouchMove,
disposition_handler_->ack_event_type());
EXPECT_EQ(1U, disposition_handler_->GetAndResetAckCount());
EXPECT_EQ(1U, GetAndResetDispatchedMessages().size());
// To catch crbug/1072364 send another scroll which returns kNoConsumerExists
// and ensure we're still async scrolling since we've already started the
// scroll.
SimulateGestureEvent(WebInputEvent::Type::kGestureScrollUpdate,
blink::WebGestureDevice::kTouchscreen);
EXPECT_EQ(0U, disposition_handler_->GetAndResetAckCount());
dispatched_messages = GetAndResetDispatchedMessages();
EXPECT_EQ(1U, dispatched_messages.size());
EXPECT_EQ(WebInputEvent::Type::kGestureScrollUpdate,
dispatched_messages[0]->ToEvent()->Event()->Event().GetType());
// Ack the GestureScrollUpdate.
dispatched_messages[0]->ToEvent()->CallCallback(
blink::mojom::InputEventResultState::kNoConsumerExists);
EXPECT_EQ(WebInputEvent::Type::kGestureScrollUpdate,
disposition_handler_->ack_event_type());
EXPECT_EQ(1U, disposition_handler_->GetAndResetAckCount());
// Now since we're scrolling (even with NoConsumerExists) send an async move.
MoveTouchPoint(0, 10, 5);
SendTouchEvent();
EXPECT_EQ(WebInputEvent::Type::kTouchMove,
disposition_handler_->ack_event_type());
EXPECT_EQ(1U, disposition_handler_->GetAndResetAckCount());
EXPECT_EQ(1U, GetAndResetDispatchedMessages().size());
}
......
......@@ -145,7 +145,6 @@ void PassthroughTouchEventQueue::ProcessTouchAck(
void PassthroughTouchEventQueue::OnGestureScrollEvent(
const GestureEventWithLatencyInfo& gesture_event) {
// Turn events sent during gesture scrolls to be async.
if (gesture_event.event.GetType() ==
blink::WebInputEvent::Type::kGestureScrollUpdate) {
send_touch_events_async_ = true;
......@@ -155,12 +154,11 @@ void PassthroughTouchEventQueue::OnGestureScrollEvent(
void PassthroughTouchEventQueue::OnGestureEventAck(
const GestureEventWithLatencyInfo& event,
blink::mojom::InputEventResultState ack_result) {
// When the scroll finishes allow TouchEvents to be blocking again.
if (event.event.GetType() == blink::WebInputEvent::Type::kGestureScrollEnd) {
send_touch_events_async_ = false;
} else if (event.event.GetType() ==
blink::WebInputEvent::Type::kGestureScrollUpdate) {
send_touch_events_async_ = true;
// Turn events sent during gesture scrolls to be async.
if (event.event.GetType() ==
blink::WebInputEvent::Type::kGestureScrollUpdate) {
send_touch_events_async_ =
(ack_result == blink::mojom::InputEventResultState::kConsumed);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment