Bug 1663000 - Handle the event as if it's consumed in the root APZC in InputQueue::ReceiveTouchInput() if there's contents covered by the dynamic toolbar. r=geckoview-reviewers,botond,snorp

Differential Revision: https://phabricator.services.mozilla.com/D93917
This commit is contained in:
Hiroyuki Ikezoe 2020-11-04 03:16:17 +00:00
Родитель 32b301eceb
Коммит f5ab9e9122
3 изменённых файлов: 35 добавлений и 28 удалений

Просмотреть файл

@ -856,9 +856,14 @@ bool AsyncPanZoomController::ArePointerEventsConsumable(
bool pannableX = aBlock->TouchActionAllowsPanningX() &&
aBlock->GetOverscrollHandoffChain()->CanScrollInDirection(
this, ScrollDirection::eHorizontal);
bool pannableY = aBlock->TouchActionAllowsPanningY() &&
aBlock->GetOverscrollHandoffChain()->CanScrollInDirection(
this, ScrollDirection::eVertical);
bool pannableY =
(aBlock->TouchActionAllowsPanningY() &&
(aBlock->GetOverscrollHandoffChain()->CanScrollInDirection(
this, ScrollDirection::eVertical) ||
// In the case of the root APZC with any dynamic toolbar, it
// shoule be pannable if there is room moving the dynamic
// toolbar.
(IsRootContent() && CanScrollDownwardsWithDynamicToolbar())));
bool pannable;

Просмотреть файл

@ -178,6 +178,11 @@ nsEventStatus InputQueue::ReceiveTouchInput(
INPQ_LOG("dropping event due to block %p being in slop\n", block);
result = nsEventStatus_eConsumeNoDefault;
} else {
// FIXME: Even if the event is consumed in a non-root APZC, if scroll
// positions in all relevant APZCs are at the bottom edge and if there are
// contents covered by the dynamic toolbar, we need to handle the event as
// if it's consumed in the root APZC so that GeckoView can tel the
// dynamic toolbar needs to move.
result = nsEventStatus_eConsumeDoDefault;
}
} else if (block->UpdateSlopState(aEvent, false)) {

Просмотреть файл

@ -354,34 +354,31 @@ class PanZoomControllerTest : BaseSessionTest() {
assertThat("The input result should be HANDLED_CONTENT in iframe_100_percent_height_scrollable.html",
value, equalTo(PanZoomController.INPUT_RESULT_HANDLED_CONTENT))
// Below cases don't work yet without event handlers
if (withEventHandler) {
// The content height is greater than "screen height - the dynamic toolbar height".
setupTouchEventDocument(ROOT_98VH_HTML_PATH, withEventHandler)
value = sessionRule.waitForResult(sendDownEvent(50f, 50f))
assertThat("The input result should be HANDLED in root_98vh.html",
value, equalTo(PanZoomController.INPUT_RESULT_HANDLED))
// The content height is greater than "screen height - the dynamic toolbar height".
setupTouchEventDocument(ROOT_98VH_HTML_PATH, withEventHandler)
value = sessionRule.waitForResult(sendDownEvent(50f, 50f))
assertThat("The input result should be HANDLED in root_98vh.html",
value, equalTo(PanZoomController.INPUT_RESULT_HANDLED))
// The content height is equal to "screen height".
setupTouchEventDocument(ROOT_100VH_HTML_PATH, withEventHandler)
value = sessionRule.waitForResult(sendDownEvent(50f, 50f))
assertThat("The input result should be HANDLED in root_100vh.html",
value, equalTo(PanZoomController.INPUT_RESULT_HANDLED))
// The content height is equal to "screen height".
setupTouchEventDocument(ROOT_100VH_HTML_PATH, withEventHandler)
value = sessionRule.waitForResult(sendDownEvent(50f, 50f))
assertThat("The input result should be HANDLED in root_100vh.html",
value, equalTo(PanZoomController.INPUT_RESULT_HANDLED))
// There is a 98vh iframe which is not scrollable.
setupTouchEventDocument(IFRAME_98VH_NO_SCROLLABLE_HTML_PATH, withEventHandler)
value = sessionRule.waitForResult(sendDownEvent(50f, 50f))
// The input result should NOT be handled in the iframe content.
assertThat("The input result should be HANDLED in iframe_98vh_no_scrollable.html",
value, equalTo(PanZoomController.INPUT_RESULT_HANDLED))
// There is a 98vh iframe which is not scrollable.
setupTouchEventDocument(IFRAME_98VH_NO_SCROLLABLE_HTML_PATH, withEventHandler)
value = sessionRule.waitForResult(sendDownEvent(50f, 50f))
// The input result should NOT be handled in the iframe content.
assertThat("The input result should be HANDLED in iframe_98vh_no_scrollable.html",
value, equalTo(PanZoomController.INPUT_RESULT_HANDLED))
// There is a 98vh iframe which is scrollable.
setupTouchEventDocument(IFRAME_98VH_SCROLLABLE_HTML_PATH, withEventHandler)
value = sessionRule.waitForResult(sendDownEvent(50f, 50f))
// The input result should be handled in the iframe content initially.
assertThat("The input result should be HANDLED_CONTENT initially in iframe_98vh_scrollable.html",
value, equalTo(PanZoomController.INPUT_RESULT_HANDLED_CONTENT))
}
// There is a 98vh iframe which is scrollable.
setupTouchEventDocument(IFRAME_98VH_SCROLLABLE_HTML_PATH, withEventHandler)
value = sessionRule.waitForResult(sendDownEvent(50f, 50f))
// The input result should be handled in the iframe content initially.
assertThat("The input result should be HANDLED_CONTENT initially in iframe_98vh_scrollable.html",
value, equalTo(PanZoomController.INPUT_RESULT_HANDLED_CONTENT))
// The following test doesn't work either with/without event handlers.
if (false) {