www.assembly.ca.gov - Scrolling is slow/sluggish
Categories
(Core :: Panning and Zooming, defect, P3)
Tracking
()
People
(Reporter: ctanase, Assigned: dshin)
References
()
Details
(Keywords: webcompat:needs-diagnosis, webcompat:site-report)
User Story
diagnosis-team:apz user-impact-score:0
Attachments
(1 file, 1 obsolete file)
|
1.75 MB,
video/mp4
|
Details |
Environment:
Operating system: Android 14 (Pixel 5)
Firefox version: Firefox Mobile 145/147
Steps to reproduce:
- Navigate to: https://www.assembly.ca.gov/
- Wait for the page to load completely (refresh the page if stuck)
- Scroll the page.
Expected Behavior:
The scroll is smooth.
Actual Behavior:
The scroll is slow/sluggish.
Notes:
- Reproduces regardless of the status of ETP
- Reproduces in firefox-nightly, and firefox-release
- Does not reproduce in chrome
Comment 1•1 year ago
|
||
Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.
Updated•1 year ago
|
Updated•1 year ago
|
Comment 2•1 year ago
|
||
The severity field is not set for this bug.
:bas.schouten, could you have a look please?
For more information, please visit BugBot documentation.
Comment 3•11 months ago
|
||
Including a profile, this is indeed a disaster. But it doesn't look like we're particularly busy, it feels like an event handling issue to me. Botond, do you have any idea on this? Or should this go to the front-end folks?
https://share.firefox.dev/3MyVo4T
The Performance Impact Calculator has determined this bug's performance impact to be medium. If you'd like to request re-triage, you can reset the Performance Impact flag to "?" or needinfo the triage sheriff.
Platforms: Android
Impact on site: Renders site effectively unusable
[x] Able to reproduce locally
Comment 4•11 months ago
|
||
(In reply to Calin Tanase from comment #0)
Firefox version: Firefox Mobile 145/147
Note the behaviour is different in 145 vs. 147.
In 145, the site is basically unusable/unscrollable. This was at least mitigated in bug 1988486 / bug 1989868, and as a result in 147 the scrolling on the site is "merely" slow.
(In reply to Bas Schouten (:bas.schouten) from comment #3)
it feels like an event handling issue to me. Botond, do you have any idea on this? Or should this go to the front-end folks?
Agree it's very likely an event handling issue. Our investigation of bug 1988486 has shown the site is doing something pretty wonky (setting window.onscroll = scroll; or some such).
==> APZ is the right component for at least an initial investigation. Will add to our WebCompat diagnosis queue.
Updated•11 months ago
|
Updated•11 months ago
|
Comment 5•11 months ago
|
||
(In reply to Botond Ballo [:botond] from comment #4)
(In reply to Calin Tanase from comment #0)
==> APZ is the right component for at least an initial investigation. Will add to our WebCompat diagnosis queue.
I can explain what's going on there.
window.onscroll = scrollis equivalent withwindow.scrollTo(window.scrollX, window.scrollY).- Thus given that in one of the event handler, the scrollY is 100px
- In the meantime APZ can scroll further, say 102px
- The absolute scroll position update scrollY=100px reaches to APZ
- APZ updates the scroll offset to 100px
- APZ tries to scroll from the offset=100px again, then it goes to 102px again
I think this kind of things keep happening.
An approach to fix this jitter scrolling is to defer querying window.scrollXY values to APZ. But this approach has a side-effect if there's a scroll linked animation. Well our scroll-linked effect machinery may handle it gracefully, I am not sure.
Another approach is just to disable APZ for the container.
Comment 6•11 months ago
|
||
The severity field is not set for this bug.
:botond, could you have a look please?
For more information, please visit BugBot documentation.
Comment 7•11 months ago
|
||
Diagnosing this bug has been tracked by 2026 H1 APZ WebCompat Work, so P2:S3. The priority might be changed after the diagnosis.
Updated•10 months ago
|
| Assignee | ||
Comment 8•8 months ago
|
||
Investigating this as part of the burndown. Less familiar with this side of the codebase, but :hiro's diagnosis seems right, though on my android phone, rather than the scroll oscillating, but it just seems to stop often.
Looking at the log:
[GPU 16044: Main Thread]: D/apz.controller 747a411100(root scrollId=21): got a touch-start in state NOTHING
[GPU 16044: Main Thread]: D/apz.controller 747a411100(root scrollId=21): changing from state NOTHING to TOUCHING
...
[GPU 16044: Main Thread]: D/apz.inputqueue received new touch event (type=1) in block 7343120d00
[GPU 16044: Main Thread]: D/apz.inputqueue dropping event due to block 7343120d00 being in mini-slop
[GPU 16044: Main Thread]: D/apz.inputqueue processing input from block 7343120d00; preventDefault 0 shouldDropEvents 0 target 747a411100
[GPU 16044: Main Thread]: D/apz.controller 747a411100(root scrollId=21): got a touch-move in state TOUCHING
...
[GPU 16044: Main Thread]: D/apz.controller 747a411100(root scrollId=21): got a touch-move in state TOUCHING
[GPU 16044: Main Thread]: D/apz.controller 747a411100(root scrollId=21): changing from state TOUCHING to PANNING
...
... But then:
[GPU 16044: WRSceneBuilder#5]: D/apz.controller 7481f75700 smooth scrolling to (0,776.25)
[GPU 16044: WRSceneBuilder#5]: D/apz.controller 7481f75700(root scrollId=4): running CancelAnimation(0x0) in state PANNING
[GPU 16044: WRSceneBuilder#5]: D/apz.controller 7481f75700(root scrollId=4): changing from state PANNING to NOTHING
[GPU 16044: WRSceneBuilder#5]: D/apz.controller 7481f75700(root scrollId=4): changing from state NOTHING to SMOOTH_SCROLL
...
[GPU 16044: Main Thread]: D/apz.controller 7481f75700(root scrollId=4): got a touch-move in state SMOOTH_SCROLL
[GPU 16044: Main Thread]: D/apz.controller 7481f75700(root scrollId=4): running CancelAnimation(0x0) in state SMOOTH_SCROLL
[GPU 16044: Main Thread]: D/apz.controller 7481f75700(root scrollId=4): changing from state SMOOTH_SCROLL to NOTHING
[GPU 16044: Main Thread]: D/apz.controller 7481f75700(root scrollId=4): got a touch-start in state NOTHING
[GPU 16044: Main Thread]: D/apz.controller 7481f75700(root scrollId=4): changing from state NOTHING to TOUCHING
Which then cycles. I imagine smooth scroll happens because the values are out-of-sync as :hiro described - As a result, we start panning but keep clobbering that action with panning, which then the further touch movement cancels, and so on.
I also see:
[GPU 16044: Main Thread]: D/apz.controller 7481f75700 taking overscroll during panning
Which doesn't make sense to me because I'm definitely not at the end of the viewport scroll...
| Assignee | ||
Comment 9•8 months ago
|
||
FWIW: The problem-inducing window.onscroll = scroll call is in a resize handler, and is set only if the width of the document is less than 1023px - resizing on desktop to trigger this causes the same issue.
Comment 10•8 months ago
|
||
Okay I think in this specific case, Chrome does just drop the scroll call via the onscroll.
A relevant code is;
if (ScrollOffsetIsNoop(offset)) {
CancelProgrammaticScrollAnimation();
return false;
}
Presumably we can simply take the same approach.
Note about bug 2009679, bug 2009679 is slightly different from this bug, see bug 2025232 comment 2.
| Assignee | ||
Comment 11•8 months ago
|
||
Hm, I think your observation is right, but the programmatic scroll request is ignored elsewhere: See bug 2025232 comment 4.
| Assignee | ||
Comment 12•8 months ago
|
||
One more thing to add: The resize event triggers on Fenix but not in responsive mode, because scrolling causes the URL bar to start hiding itself, and that triggers the resize event.
Comment 13•7 months ago
•
|
||
I had a further diagnosis why window.onscroll = scroll; with scroll-behavior: smooth; is sluggish on Firefox. There are a couple of reasons;
- each APZC (an APZC is corresponding to a scroll container) has only one animation instance so that a new smooth scroll operation clobbers the existing wheel scroll animation triggered by user, Chrome rather has two independent animators, one is for programatic scroll operations, the other is probably for user's operations
- bug 1740164, once after we've done 1), this will not be matter since there will exist an APZ animation though, as of now we don't yet transmogrify scrollTo into scrollByCSSPixels
- for 2) we might want to use pure relative for scrollByCSSPixel since I have posted a patch to remove relative smooth scroll position update in bug 2028680
Comment 14•7 months ago
|
||
Downgrading the priority since I believe we've finished diagnosis.
Comment 15•7 months ago
|
||
(In reply to Hiroyuki Ikezoe (:hiro) from comment #13)
- bug 1740164, once after we've done 1), this will not be matter since there will exist an APZ animation though, as of now we don't yet transmogrify scrollTo into scrollByCSSPixels
- for 2) we might want to use pure relative for scrollByCSSPixel since I have posted a patch to remove relative smooth scroll position update in bug 2028680
Those two won't work. The transmogrified smooth relative scroll operation ends up being a smooth absolute scroll operation via ScrollContainerFrame::ApzSmoothScrollTo.
So I did rather use a smooth pure-relative scroll update for this kind of zero delta change, I confirmed it works. I will file a bug.
Comment 16•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.
Comment 17•7 months ago
|
||
Comment on attachment 9575292 [details]
WIP: Bug 2000834 - Ignore zero delta smooth script scroll operation if there's no user triggered animation.
Revision D297520 was moved to bug 2035957. Setting attachment 9575292 [details] to obsolete.
Comment 18•4 months ago
|
||
Now bug 2035957 has landed, so I think this bug was fixed by the change.
Comment 19•3 months ago
|
||
Verified, the issue no longer reproduces.
Tested with:
- Browser / Version: Fenix 154.0-candidate build 1
- Operating System: Android 11
Updated•3 months ago
|
Updated•3 months ago
|
Description
•