Closed Bug 1971253 Opened 1 year ago Closed 1 month ago

jitter scrolling with layout.disable-pixel-alignment=true with transfrom style

Categories

(Core :: Layout: Scrolling and Overflow, defect, P2)

Firefox 141
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: gwarser, Assigned: gw)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Keywords: webcompat:platform-bug)

User Story

user-impact-score:105

Attachments

(3 files, 2 obsolete files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:141.0) Gecko/20100101 Firefox/141.0

Steps to reproduce:

Actual results:

Some elements, especially in the sidebar on the right, do not scroll smoothly.
See video in bug 1964517#c11

Maybe the underlying cause is same as bug 1964684.

Severity: -- → S3
Priority: -- → P2
See Also: → 1964684

I suspected this if (... && snap) branch which is the only one place where we use the snap value returned by GetOpaqueRegion or GetBounds. But the branch is unrelated since it's never hit while rendering the site in question.

gwarser, are you still able to see this bug?

Looks like the site has changed their styles. In the recoding in bug 1964517 comment 11, images inside "GorΔ…ce Wpisy" have fading-out effects, but now I don't see it. I was guessing the fading-out effects somehow causes this bug.

Flags: needinfo?(gwarser)

Okay, never mind. On https://wykop.pl/mikroblog/gorace/12, I do still see images inside "Aktywne Wpisy" are wobbling (on Windows).

Flags: needinfo?(gwarser)

I wrote reftests which are similar to the ones added in bug 1887125, but with images.

Unfortunately these reftests don't catch this bug. There should be at least one other factor to trigger this bug, I suspected it's border-radius, but it's now.

Summary: jitter scrolling with layout.disable-pixel-alignment=true → jitter scrolling with layout.disable-pixel-alignment=true (specifically images?)

I think the source of this bug is rounding the position of each transform display item, there are 3 places; here, here and here depending on the returned value of nsLayoutUtils::ShouldSnapToGrid.

As far as I can tell with disabling the rounding, images inside the "Aktywne Wpisy" looks stabler. Though it's hard to tell for me that whether it eliminates this bug or not.

gwarser would you mind trying this build to tell whether this bug is mitigated or not. You can download the package named "target.tar.xz" in the "Artifact and Debugging Tools" pane. Thanks!

Flags: needinfo?(gwarser)

For future references, I am summarizing how I did narrow down to the nsLayoutUtils::ShouldSnapToGrid.

  1. Disabled each style on the image element in question whether it mitigates this bug or not
  2. Disabled each style on each ancestor element whether it mitigates or not
  3. Realized disabling transform: translateX(-20px) on one of ancestor elements mitigates this bug
  4. Changed the transform to translateX(0px), confirmed the bug still persists
  5. Disabled the transform style and set opacity: 0.9 to see whether it's related to stacking context or not
  6. With opacity: 0.9 the bug doesn't appear there
  7. Read nsDisplayList.cpp, specifically nsDisplayTransform class to see whether there's any suspicious code
  8. Found this code block where we round the display item position even if the transform is identity, BINGO!

(In reply to Hiroyuki Ikezoe (:hiro) from comment #3)

gwarser, are you still able to see this bug?

Build ID 20250620040520?

I still see this on many other elements.

https://wykop.pl/mikroblog/gorace/12

Flags: needinfo?(gwarser)

I also sometimes see a white line appearing on the very top of the page, above the header. Looks like the header position also shifts by a pixel sometimes.

(In reply to gwarser from comment #8)

Created attachment 9495940 [details]
Screenshot_20250620_102451-1.png

Elements inside the header is bug 1972014.

Elements inside the left sidebar looks also bug 1972014, the sidebar is position:sticky.

I have no idea about the icons at the center of the screenshot.

What I am specifically wondering with the build is that whether images which were shaking in the recording in bug 1964517 comment 11 still are shaking or not.

gwarser ^

Flags: needinfo?(gwarser)

Clean profile.

Flags: needinfo?(gwarser)

(In reply to Hiroyuki Ikezoe (:hiro) from comment #10)

(In reply to gwarser from comment #8)

Created attachment 9495940 [details]
Screenshot_20250620_102451-1.png

Elements inside the header is bug 1972014.

Elements inside the left sidebar looks also bug 1972014, the sidebar is position:sticky.

I have no idea about the icons at the center of the screenshot.

What I am specifically wondering with the build is that whether images which were shaking in the recording in bug 1964517 comment 11 still are shaking or not.

These images are now fine.

(Sorry, I didn't see the answer - I didn't refresh the page.)

No longer blocks: 1973192
See Also: → 1973192

Thanks! That's great to hear.

I filed bug 1973192 for the icon issue.

Summary: jitter scrolling with layout.disable-pixel-alignment=true (specifically images?) → jitter scrolling with layout.disable-pixel-alignment=true with transfrom style

nsLayoutUtils::ShouldSnapToGrid is used only for nsDisplayTransform.

It was originally introduced for the old layers backend, and then it has been
used for WebRender as well because of bug 1501195, bug 1636119 etc. Each of
those bug has a reftest respectively and now these reftests get passed
with layout_disable_pixel_alignment=true. So now it would be safe not
to snap.

Assignee: nobody → hikezoe.birchill
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Depends on: 1977517
User Story: (updated)
Depends on: 1999575

I think this is resolved on currently nightly - Hiro, could you check?

Flags: needinfo?(hikezoe.birchill)

Glenn, unfortunately I do still see bug 1964517 on the latest nightly, the revision is 63c7136296e4969d855be04bff78a536ed2108b5 . I believe bug 1964517 should be fixed by this transform related bug. See bug 1964517 comment 26,

Flags: needinfo?(hikezoe.birchill)

I think this will be resolved once https://bugzilla.mozilla.org/show_bug.cgi?id=2004666 lands - I didn't observe any jittering from what I could see (though there are a lot of elements that were jittering, I might have missed some specific cases).

Attached file clip-seam.html (obsolete) β€”

Minimal repro

Attachment #9597284 - Attachment is obsolete: true

As far as I can tell this bug has been fixed by bug 2004666. Thank you Glenn!

Hey gwarser, if you are still able to see jitters, it would be nice to open a new bug since it's likely different from what we are aware of. Thanks!

Assignee: hikezoe.birchill → mozilla
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Depends on: 2004666
Resolution: --- → FIXED
Attachment #9496195 - Attachment is obsolete: true
Depends on: 2050535
No longer depends on: 2050535
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: