Commit 166974ea authored by Xida Chen's avatar Xida Chen Committed by Commit Bot

Do not set touch action to Auto at GSB if it is already set

In chrome VR or virtual keyboard case, we can get GestureScrollBegin
without GestureTapDown, and that |scrolling_touch_action_| may have no
value. In this case, we set it to Auto to prevent crash. This was done
in a previous CL:
https://chromium-review.googlesource.com/c/chromium/src/+/1195649

However, there was a small mistake in the previous CL. That is, the
|scrolling_touch_action_| could have been set when the browser receives
the ACK for the touch start from the main thread. In this case, we should
not set it to Auto.

Bug: 880701
Change-Id: I250bb7a09840f16665cfcf5826236cad99b533c5
Reviewed-on: https://chromium-review.googlesource.com/1213502Reviewed-by: default avatarNavid Zolghadr <nzolghadr@chromium.org>
Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Commit-Queue: Xida Chen <xidachen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590059}
parent 98a5ecf7
......@@ -55,10 +55,12 @@ FilterGestureEventResult TouchActionFilter::FilterGestureEvent(
switch (gesture_event->GetType()) {
case WebInputEvent::kGestureScrollBegin: {
DCHECK(!suppress_manipulation_events_);
// In VR, GestureScrollBegin could come without GestureTapDown.
// In VR or virtual keyboard (https://crbug.com/880701),
// GestureScrollBegin could come without GestureTapDown.
if (!gesture_sequence_in_progress_) {
gesture_sequence_in_progress_ = true;
SetTouchAction(cc::kTouchActionAuto);
if (!scrolling_touch_action_.has_value())
SetTouchAction(cc::kTouchActionAuto);
}
gesture_sequence_.append("B");
if (!scrolling_touch_action_.has_value()) {
......
......@@ -1149,6 +1149,20 @@ TEST_F(TouchActionFilterTest, ScrollBeginWithoutTapDown) {
EXPECT_EQ(filter_.allowed_touch_action().value(), cc::kTouchActionAuto);
}
TEST_F(TouchActionFilterTest, ScrollBeginWithoutTapDownWithKnownTouchAction) {
filter_.OnHasTouchEventHandlers(true);
EXPECT_FALSE(ScrollingTouchAction().has_value());
EXPECT_FALSE(filter_.allowed_touch_action().has_value());
filter_.OnSetTouchAction(cc::kTouchActionPan);
WebGestureEvent scroll_begin =
SyntheticWebGestureEventBuilder::BuildScrollBegin(5, 0, kSourceDevice);
EXPECT_EQ(filter_.FilterGestureEvent(&scroll_begin),
FilterGestureEventResult::kFilterGestureEventAllowed);
EXPECT_EQ(ScrollingTouchAction().value(), cc::kTouchActionPan);
EXPECT_EQ(filter_.allowed_touch_action().value(), cc::kTouchActionPan);
}
TEST_F(TouchActionFilterTest, TouchpadScroll) {
WebGestureEvent scroll_begin =
SyntheticWebGestureEventBuilder::BuildScrollBegin(
......
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