position:sticky about:addons sidebar text shifts up/down when scrolling with layout.disable-pixel-alignment=true
Categories
(Core :: Panning and Zooming, defect, P2)
Tracking
()
People
(Reporter: ke5trel, Assigned: gw)
References
(Blocks 1 open bug)
Details
Attachments
(4 files, 1 obsolete file)
STR:
- Change
layout.disable-pixel-alignment = true. - Visit
about:addons. - Scroll up and down.
Expected:
Text in sidebar remains static while scrolling.
Actual:
Text shifts up and down slightly when scrolling.
Does not happen with layout.disable-pixel-alignment = false.
Updated•1 year ago
|
Comment 1•1 year ago
|
||
Looks like it commonly happens on position:sticky elements. I do less see the shifting on about:addons, but I do easier see on https://elixir.bootlin.com/linux/latest/source/MAINTAINERS by dragging scrolling thumb scrolls.
CCing Glenn.
Comment 2•1 year ago
|
||
I do see element shifting in the header on https://wykop.pl/wykopalisko/najnowsze . The header is also position:sticky.
Comment 3•1 year ago
|
||
FWIW, I wrote some reftests involving position:sticky based on the reftests added in bug 1887125. Though these reftest don't catch this bug unfortunately.
Comment 4•1 year ago
|
||
I did audit StickyScrollContainer.cpp that there's no suspicious pixel rounding/alignment code.
Now I realized that the sticky container itself is not shifting, elements inside sticky container are shifting. I did double-check by adding background-color: red to the position sticky element in question to easily tell whether the element is shifting or not.
Updated•1 year ago
|
Comment 5•1 year ago
|
||
IIUC what https://phabricator.services.mozilla.com/D235720 did, I think, for elements inside sticky container;
- If the sticky container is not stuck, do
normalize_rect_scroll_offset - If the sticky container is stuck,
normalize_rect_scroll_offsetis not necessary? (because the container is kinda out-of-flow of the parent scroll container)
I did confirm that we do call normalize_rect_scroll_offset for elements inside a position sticky container while the container is being stuck.
Glenn?
Comment 6•1 year ago
|
||
Well what I saw was normalize_scroll_offset_and_snap_rect.
| Assignee | ||
Comment 7•1 year ago
|
||
I'm not sure what the right answer is here without doing some detailed debugging sorry - not sure when I'll have time to come back to this. May be worth raising with Bob to get it on the radar.
| Assignee | ||
Updated•10 months ago
|
| Assignee | ||
Updated•10 months ago
|
| Assignee | ||
Comment 8•10 months ago
|
||
I can't reproduce this locally - are you still able to reproduce on current nightly?
Yes, I can still repro it on latest Nightly 145.0a1 (2025-09-17).
| Assignee | ||
Comment 10•10 months ago
|
||
Perhaps it depends on compositing backend / screen resolution / scaling factor or something like that. Could you attach the content of your about:support output?
| Assignee | ||
Comment 11•10 months ago
|
||
I am able to reproduce this locally is I set layout.css.devPixelsPerPx to a high enough value (> 3.4 seems to do it). However, it is also occurring in the same way if I set layout.disable-pixel-alignment back to false and restart.
| Assignee | ||
Comment 12•10 months ago
|
||
Note to self when next working on this - frame_rect in StickyFrameInfo is changing by fractional amounts during scrolling with the pref enabled, but is always constant (though not integer) when the pref is disabled.
| Reporter | ||
Comment 13•10 months ago
|
||
Happens on multiple systems with Ubuntu 25.04 and 24.04 LTS as well as Windows 11 (VirtualBox).
- 100% and 125% display scaling, more noticeable at 100%.
- New profiles with no customization.
- HW-WR and SW-WR.
- Wayland and XWayland.
I don't see it with layout.css.devPixelsPerPx = 1.25 unless layout.disable-pixel-alignment = true. It is more noticeable with this setting than 125% display scaling.
| Assignee | ||
Comment 14•10 months ago
|
||
A minimal repro case. With layout.css.devPixelsPerPx set to 1.0, a single mouse wheel down on the page will result in a slight jump after the scroll and the next display list arrives. This may suggest something related to how things are interacting between APZ + new display list arriving when fractional scroll is enabled.
| Assignee | ||
Comment 15•10 months ago
|
||
The attachment only reproduces when layout.disable-pixel-alignment is true for me.
| Assignee | ||
Comment 16•10 months ago
|
||
Can remove the dependency on mouse wheel with the following adjustment:
e.onclick = function() {
window.scrollBy({ left: 0.0, top: 100.0, behavior: "smooth" });
}
The discrepancy seems to occur after the scroll completes and the next time a new scene build begins.
| Assignee | ||
Comment 17•10 months ago
|
||
The sticky position element gets hoisted to be a standalone scroll layer, i.e. a picture tile cache.
The size of the surface allocated remains correct (280 x 100), and the rasterization on the tile cache surface appears correct (the root and prim spatial nodes are the same since the tile cache forms a raster root, thus the rasterization transform is always [correctly] identity).
However, during the scroll the tile cache surface sometimes gets composited at a y-offset of 166.0 and remains there. Other times it gets composited at a y-offset of 167.0, which is where it gets composited after a new scene build and display list is processed.
| Assignee | ||
Comment 18•10 months ago
|
||
| Assignee | ||
Comment 19•10 months ago
|
||
A minimal repro based on the content from https://wykop.pl. Text jitters during autoscroll at 200% display scale, even with the attached WIP patch applied (which does appear to fix jitter on the background sticky layer itself).
| Assignee | ||
Comment 20•10 months ago
|
||
There are definitely two similar but unrelated bugs. The attached patch fixes the rounding of placement of sticky position picture caches when the scroll offset flips sign (due to external scroll offset changes). The second bug appears specific to text runs, and may be related to how / when we snap text run offsets during frame building.
| Assignee | ||
Comment 21•10 months ago
|
||
The local space offsets of the glyphs that are pushed by Gecko to WR differ in this test case when the preference is flipped (and running at 200% display scale). When fractional scaling is enabled, the glyphs are placed at half-pixel offsets, which doesn't seem right.
Updated•9 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Comment 23•8 months ago
|
||
Reproduced the issue on an affected Nightly build from 2025-06-13 on Windows 10.
Verified as fixed on Nightly 147.0a1 (20251113163320) and Firefox 146.0b2 (20251112090346) across Windows 10, Ubuntu 22, and macOS 11. No vertical jitter is observed.
Description
•