Stop cancelling user-triggered APZ animation by zero delta smooth programmatic scroll operation
Categories
(Core :: Panning and Zooming, defect, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox154 | --- | fixed |
People
(Reporter: hiro, Assigned: hiro)
References
Details
(Keywords: webcompat:platform-bug)
User Story
user-impact-score:0
Attachments
(1 file, 1 external file)
|
508 bytes,
text/html
|
Details |
This change fixes bug 2000834.
Attaching file is the same file attached in bug 1989868 comment 0. If you scroll the example, scroll would not be smooth because of window.onscroll = scroll; with scroll-behavior: smooth.
This bug fixes the test case.
| Assignee | ||
Comment 1•7 months ago
|
||
When scrollTo() or similar script APIs are called with the layout viewport
already at the destination, ApzSmoothScrollTo previously sent a NewSmoothScroll
update regardless. In APZ, receiving any smooth scroll update cancels any
ongoing animation — including user-triggered ones — which is undesirable when
the script scroll is effectively a no-op.
To fix this, introduce ScrollPositionUpdate::NewZeroDeltaLayoutScroll, a
dedicated factory for zero-delta pure-relative scroll updates targeting the
layout viewport with ScrollTriggeredByScript::Yes baked in. When the layout
viewport is already at the requested destination and the scroll was script-
triggered, ApzSmoothScrollTo emits one of these instead of a NewSmoothScroll.
In AsyncPanZoomController::NotifyMainThreadTransaction, zero-delta pure-relative
smooth scroll updates that are script-triggered are handled as follows: if no
script-triggered animation is currently running, the update is skipped as a
true no-op; if a script-triggered animation is running, CancelAnimation() is
called explicitly before skipping, stopping the animation without starting a
new one to the same destination.
NewZeroDeltaLayoutScroll is kept separate from the existing NewPureRelativeScroll
(which always targets the visual viewport, per the FIXME in bug 1984224) to
prevent future callers from accidentally passing ViewportType::Layout with a
non-zero delta, which APZ does not handle correctly.
Updated•7 months ago
|
Updated•7 months ago
|
| Assignee | ||
Comment 2•7 months ago
|
||
This will fix a webcompat issue (bug 2000834) tracked in H1 2026 WebCompat Epic.
| Assignee | ||
Updated•7 months ago
|
Comment 3•5 months ago
|
||
The following patch is waiting for review from an inactive reviewer:
| ID | Title | Author | Reviewer Status |
|---|---|---|---|
| D297520 | Bug 2035957 - Ignore zero delta smooth script scroll operation if there's no user triggered animation. r?botond | hiro | botond: Back Jun 24, 2026 |
:hiro, could you please find another reviewer?
For more information, please visit BugBot documentation.
| Assignee | ||
Updated•4 months ago
|
Comment 6•4 months ago
|
||
Backed out for causing mochitest plain failures @ test_group_scroll_position_update.html
Backout link: https://hg.mozilla.org/integration/autoland/rev/7cf6a4af8bb4ac706df4465ed12b32ef2c089292
Comment 9•4 months ago
|
||
| bugherder | ||
Updated•4 months ago
|
Description
•