Open Bug 2057913 Opened 4 months ago Updated 1 month ago

backface-visibility not working in this animation

Categories

(Core :: Layout, defect)

Firefox 153
defect

Tracking

()

ASSIGNED

People

(Reporter: vtwintiger, Assigned: Kayano04)

References

Details

Attachments

(2 files, 1 external file)

Attached image Fx_backface_ani.jpg —

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:153.0) Gecko/20100101 Firefox/153.0

Steps to reproduce:

mouse/hover over a person card to see person's bio statement on page
https://ideatranslations.com/our-world/

Actual results:

the front text of the card (person name, title) shows when the card is flipped showing bio statement

Expected results:

the front of card should not be shown when the card is flipped

The Bugbug bot thinks this bug should belong to the 'Firefox::New Tab Page' component, but is not confident enough to move the bug to that component.

Component: Untriaged → General
Severity: -- → S4
Component: General → Layout
Product: Firefox → Core

Possible Firefox rendering bug, reduced to a minimal testcase (attached).

The page's card-flip is spec-correct: perspective on .flip-box, transform-style: preserve-3d on .flip-box-inner, and backface-visibility: hidden on both faces with the back pre-rotated 180°. Because the faces have transparent backgrounds (text only), when the flip completes the away-facing front face's mirrored text remains painted and shows through the back.

In the attached reduced testcase this reproduces in Firefox but renders correctly in Chrome — Chrome hides the back-facing face as expected, Firefox paints it. So backface-visibility: hidden is not being honored for a transparent, coplanar back-facing element. Moving to Core :: Layout.

I'd like to work on this

The proposed fix treats otherwise untransformed backface-hidden transformable frames in a 3D rendering context as transformed so their flattened descendants are culled together; both the attachment and new regression tests pass with this change — during full CSS transforms WPT testing on a macOS 26.4.1 ARM64 debug build, one content-process EXC_BAD_ACCESS at address 0x20 occurred, where the reported crashing-thread stack points to lockAndFinishInitializing in libobjc and LaunchServices — the affected test later passed 20 consecutive runs and a full-suite rerun had no unexpected results, but because no same-revision unpatched A/B testing has been performed, I cannot rule out a regression — is this a known crash, and does the proposed approach raise any concerns?

My proposed fix is to make nsIFrame::IsTransformed() also return true for transformable frames with backface-visibility: hidden that participate in a 3D rendering context, even when their own
transform is none; this gives the face a transform display item so its flattened subtree, including text and descendants, is culled as a unit — the local patch also moves backface-visibility change
handling out of the HasTransformStyle()-dependent path so toggling the property triggers repainting and overflow updates even without an explicit transform — the attached testcase and four new
regression tests pass locally, and the full CSS transforms suite rerun had no unexpected results — does this approach make sense, or would you prefer a more localized change in display-list
construction rather than broadening IsTransformed()?

Proposed approach seeking review (not ready to land):

Summary of changes

  • Update nsIFrame::IsTransformed() to return true for transformable frames with backface-visibility:hidden participating in a 3D context even without an explicit transform, ensuring a transform display item culls the flattened subtree including text and descendants
  • Retain nsIFrame::IsCSSTransformed() behavior and update header documentation
  • Move backface-visibility style change handling outside the HasTransformStyle()-dependent branch to ensure repaint and overflow updates always occur
  • Add four WPT reftests covering untransformed block, flex, grid descendants, parent rotation animations, dynamic backface-visibility changes, flattening, and offsets
  • Correct preserve3d-backface-hit-test-2.html to target the visible front-facing sibling rather than hidden backface descendants, matching Chromium behavior
  • Remove obsolete FAIL metadata for backface-visibility-hidden-004.html, which now passes

Reviewer feedback requested

  • Feedback on whether broadening nsIFrame::IsTransformed() is appropriate or whether a localized display list construction change would be preferred
  • Feedback on whether correcting the hit-test expectation in preserve3d-backface-hit-test-2.html is justified

Local validation

  • Verified on macOS 26.4.1 ARM64 (headless debug build of Firefox 159.0a1)
  • Bugzilla attachment and all four new WPT reftests pass
  • CSS transforms WPT suite (932 tests, 6446 checks per run): 0 unexpected results on final runs with existing expected failures unchanged
  • Native layout/reftests/transform-3d suite: 97 passed
  • Passed WPT lint, clang-format, file-whitespace, file-perm, and git diff --check
  • No CI, Linux, or Windows validation performed

Crash disclosure and completed A/B experiment

  • One earlier test run encountered a content-process EXC_BAD_ACCESS at 0x20 with signature @ lockAndFinishInitializing in macOS libobjc/LaunchServices stack during animation/transform-interpolation-004.html
  • Root cause is not established; this is not claimed to be harmless, an OS bug, or fixed
  • Completed an A/B experiment comparing the build without C++ implementation changes (A) against the build with C++ changes (B), holding tests and header comments identical with binaries differing only in XUL
  • Alternating runs over 50 repetitions of the affected test plus 3 full CSS transforms suite runs produced zero crashes in either group (A consistently reproduced rendering bug and five backface failures; B had zero unexpected results)
  • This did not reproduce the historical crash and cannot exclude a rare patch interaction
  • Shutdown leak-log warnings occurred in both groups; no complete leak-check coverage is claimed
Assignee: nobody → Kayano04
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

Isn't this a duplicate of bug 2066084 effectively?

See Also: → 2066084

(In reply to Emilio Cobos Álvarez [:emilio] from comment #8)

Isn't this a duplicate of bug 2066084 effectively?

It seems like it. I just need to finish up those patches with the necessary fixes.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: