Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit c4b5622

Browse files
committed
Bug 1916897 - Get rid of ScrollDirection::eVertical from APZHandledResult::mOverscrollDirections if mayTriggerPullToRefresh is false. r=botond,geckoview-reviewers,owlish
Though I personally think this fix is subtle, I have no other good idea to solve the issue. Once after we have a separate API for dynamic toolbar, we could handle this bug case in a clearer way. This change doesn't have a dedicated test since there have been two JUnit tests hitting this bug conditions. (If we had been running tests on browsers which support both dynamic toolbar and pull-to-refresh, this bug might have been noticed earlier?) Differential Revision: https://phabricator.services.mozilla.com/D221105
1 parent 1b1dc6a commit c4b5622

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

gfx/layers/apz/src/APZInputBridge.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,18 @@ void APZHandledResult::UpdateForTouchEvent(
149149
? APZHandledPlace::HandledByRoot
150150
: APZHandledPlace::Unhandled,
151151
rootApzc});
152+
if (aHandledResult && aHandledResult->IsHandledByRoot() &&
153+
!mayTriggerPullToRefresh) {
154+
MOZ_ASSERT(
155+
!(aTarget->ScrollableDirections() & SideBits::eBottom),
156+
"If we allowed moving the dynamic toolbar for the sub scroll "
157+
"container, the sub scroll container should NOT be scrollable to "
158+
"bottom");
159+
160+
// In cases we didn't allow pull-to-refresh (!mayTriggerPullToRefresh),
161+
// it means the root scroll container is NOT overscrollable at top.
162+
aHandledResult->mOverscrollDirections -= ScrollDirection::eVertical;
163+
}
152164
}
153165
}
154166
}

mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/InputResultDetailTest.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,17 @@ class InputResultDetailTest : BaseSessionTest() {
282282

283283
value = sessionRule.waitForResult(sendDownEvent(50f, 50f))
284284

285-
// Now the touch event should be handed to the root scroller.
285+
// Now the touch event should be handed off to the root scroller.
286286
assertResultDetail(
287287
"handoff",
288288
value,
289289
PanZoomController.INPUT_RESULT_HANDLED,
290290
PanZoomController.SCROLLABLE_FLAG_BOTTOM,
291-
(PanZoomController.OVERSCROLL_FLAG_HORIZONTAL or PanZoomController.OVERSCROLL_FLAG_VERTICAL),
291+
// Although the root scroll container is in fact over-scrollable
292+
// vertically, the child scroll container is scrollabe to top,
293+
// thus pull-to-refresh should not be triggered, that's the reason
294+
// why we don't receive OVERSCROLL_FLAG_VERTICAL here.
295+
PanZoomController.OVERSCROLL_FLAG_HORIZONTAL,
292296
)
293297
}
294298

@@ -363,7 +367,11 @@ class InputResultDetailTest : BaseSessionTest() {
363367
value,
364368
PanZoomController.INPUT_RESULT_HANDLED,
365369
PanZoomController.SCROLLABLE_FLAG_BOTTOM,
366-
(PanZoomController.OVERSCROLL_FLAG_HORIZONTAL or PanZoomController.OVERSCROLL_FLAG_VERTICAL),
370+
// Although the root scroll container is in fact over-scrollable
371+
// vertically, the child scroll container is scrollabe to top,
372+
// thus pull-to-refresh should not be triggered, that's the reason
373+
// why we don't receive OVERSCROLL_FLAG_VERTICAL here.
374+
PanZoomController.OVERSCROLL_FLAG_HORIZONTAL,
367375
)
368376
}
369377
}

0 commit comments

Comments
 (0)