Closed Bug 1968672 Opened 1 year ago Closed 1 year ago

View transition capture doesn't work if inside a nested transform.

Categories

(Core :: Graphics: WebRender, defect)

defect
Points:
3

Tracking

()

RESOLVED FIXED
141 Branch
Tracking Status
firefox141 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

(Blocks 1 open bug)

Details

(Whiteboard: [viewtransitions:m2], [wptsync upstream])

Attachments

(3 files)

Attached file Reduced test-case.

See the attached reduced test-case. Removing the transform: scale(0.99) makes the test-case work (expected rendering is pink background with "Some text" in black).

I don't see anything going terribly wrong on the layout / display list side. Nical, can you take a look at the webrender side and see if there's anything off?

Flags: needinfo?(nical.bugzilla)
Attachment #9490922 - Attachment mime type: text/plain → text/html
Assignee: nobody → nical.bugzilla
Flags: needinfo?(nical.bugzilla)
Status: NEW → ASSIGNED
Whiteboard: [viewtransitions:triage] → [viewtransitions:m2:gfx]
Points: --- → 3

I tried fairly hard to get a reproduction of the issue using wrench to narrow things down and ease debugging, but (invertible) transforms work nicely in this environment.

It turns out that when running this this test (in Firefox), WebRender does render the snapshot for the text element, but no subsequent display list contains the image key associated with that snapshot. I do see that we are also producing snapshots for the live capture in the following frames but there are also no image display item referring to them.
So I suspect that during DL building, we don't produce the display item for the pseudo element(s) in some situations involving transforms.

Unassigning myself for now since this is on the displaylist side and I have some WebRender items to look at.

Assignee: nical.bugzilla → nobody
Status: ASSIGNED → NEW
Assignee: nobody → emilio
Flags: needinfo?(emilio)
Status: NEW → ASSIGNED

This "fixes" it:

diff --git a/dom/view-transitions/ViewTransition.cpp b/dom/view-transitions/ViewTransition.cpp
index ea38f7c53caf..ec40c4f450d6 100644
--- a/dom/view-transitions/ViewTransition.cpp
+++ b/dom/view-transitions/ViewTransition.cpp

 // TODO(emilio): This might need revision.
 static CSSToCSSMatrix4x4Flagged EffectiveTransform(nsIFrame* aFrame) {
   CSSToCSSMatrix4x4Flagged matrix;
-  if (aFrame->GetSize().IsEmpty() || aFrame->Style()->IsRootElementStyle()) {
+  if (aFrame->GetSize().IsEmpty() || aFrame->Style()->IsRootElementStyle() || (true)) {
     return matrix;
   }

So interestingly it's not an ancestor transform of the captured element what causes the issue, but an ancestor transform of the element that displays it.

Display list with that change is:

    FixedPosition p=0x7f04cb7111a0 f=0x7f04cb70e120(Block(div)(-1)) key=25 bounds(0,0,76800,57330) componentAlpha(0,0,0,0) clip() asr() clipChain()  (opaque 0,0,76800,57330) (will-change=-moz-fixed-pos-containing-block) reuse-state(None) (containerASR ) (scrolltarget 3)
      nsDisplayContainer p=0x7f04cb70f6c0 f=0x7f04cb70e370(Block(div)(0)) key=20 bounds(0,0,76800,57330) componentAlpha(0,0,0,0) clip() asr() clipChain()  (opaque 0,0,76800,57330) reuse-state(None)
        BackgroundColor p=0x7f04cb710510 f=0x7f04cb70e370(Block(div)(0)) key=6 bounds(0,0,76800,57330) componentAlpha(0,0,0,0) clip() asr() clipChain() uniform  (opaque 0,0,76800,57330) hitTestInfo(0x1) hitTestArea(0,0,76800,57330) reuse-state(None) (rgba 1,0.752941,0.796079,1) backgroundRect(x=0, y=0, w=76800, h=57330)
        nsDisplayTransform p=0x7f04cb710fc8 f=0x7f04cb70e4b8(Block(div)(0)) key=67 bounds(0,0,76800,1320) componentAlpha(0,0,0,0) clip() asr() clipChain()  reuse-state(None)[ I ] prerender(full) childrenBuildingRect(x=0, y=0, w=76800, h=1440)
          CompositorHitTestInfo p=0x7f04cb7105d8 f=0x7f04cb70e4b8(Block(div)(0)) key=19 bounds(0,0,0,0) componentAlpha(0,0,0,0) clip() asr() clipChain()  hitTestInfo(0x1) hitTestArea(0,0,76800,1320) reuse-state(None)
          BlendContainer p=0x7f04cb710e98 f=0x7f04cb70e600(Block(div)(0)) key=7 bounds(0,0,76800,1320) componentAlpha(0,0,0,0) clip() asr() clipChain()  reuse-state(None)
            CompositorHitTestInfo p=0x7f04cb710678 f=0x7f04cb70e600(Block(div)(0)) key=19 bounds(0,0,0,0) componentAlpha(0,0,0,0) clip() asr() clipChain()  hitTestInfo(0x1) hitTestArea(0,0,76800,1320) reuse-state(None)
            BlendMode p=0x7f04cb710990 f=0x7f04cb70e748(ImageFrame(div)(0)) key=8 bounds(0,0,76800,1320) componentAlpha(0,0,0,0) clip() asr() clipChain()  reuse-state(None)
              Opacity p=0x7f04cb710858 f=0x7f04cb70e748(ImageFrame(div)(0)) key=37 bounds(0,0,76800,1320) componentAlpha(0,0,0,0) clip() asr() clipChain()  reuse-state(None) (opacity 1, mChildOpacityState: Unknown)
                CompositorHitTestInfo p=0x7f04cb710718 f=0x7f04cb70e748(ImageFrame(div)(0)) key=19 bounds(0,0,0,0) componentAlpha(0,0,0,0) clip() asr() clipChain()  hitTestInfo(0x1) hitTestArea(0,0,76800,1320) reuse-state(None)
                Image p=0x7f04cb7107b8 f=0x7f04cb70e748(ImageFrame(div)(0)) key=32 bounds(0,0,76800,1320) componentAlpha(0,0,0,0) clip() asr() clipChain()  reuse-state(None)
            BlendMode p=0x7f04cb710d38 f=0x7f04cb70e8d0(ImageFrame(div)(1)) key=8 bounds(0,0,76800,1320) componentAlpha(0,0,0,0) clip() asr() clipChain()  reuse-state(None)
              Opacity p=0x7f04cb710c00 f=0x7f04cb70e8d0(ImageFrame(div)(1)) key=37 bounds(0,0,76800,1320) componentAlpha(0,0,0,0) clip() asr() clipChain()  reuse-state(None) (opacity 0, mChildOpacityState: Unknown)
                CompositorHitTestInfo p=0x7f04cb710ac0 f=0x7f04cb70e8d0(ImageFrame(div)(1)) key=19 bounds(0,0,0,0) componentAlpha(0,0,0,0) clip() asr() clipChain()  hitTestInfo(0x1) hitTestArea(0,0,76800,1320) reuse-state(None)
                Image p=0x7f04cb710b60 f=0x7f04cb70e8d0(ImageFrame(div)(1)) key=32 bounds(0,0,76800,1320) componentAlpha(0,0,0,0) clip() asr() clipChain()  reuse-state(None)

If that matrix becomes anything that isn't identity, then stuff blows up.

Fun one... I'll add a trivial reftest if nothing starts passing as a
result of this.

Flags: needinfo?(emilio)

We need to compensate with the centered origin that the transform will
get.

Pushed by ealvarez@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/42615293eb1b https://hg.mozilla.org/integration/autoland/rev/240c8559177d Don't change z-axis for view transition transforms. r=view-transitions-reviewers,boris
Whiteboard: [viewtransitions:m2:gfx] → [viewtransitions:m2]
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 141 Branch
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/53099 for changes under testing/web-platform/tests
Whiteboard: [viewtransitions:m2] → [viewtransitions:m2], [wptsync upstream]
Upstream PR merged by moz-wptsync-bot
QA Whiteboard: [qa-triage-done-c142/b141]
Depends on: 1985924
Depends on: 1985928
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: