Closed Bug 1951167 Opened 1 year ago Closed 1 year ago

bug: image-masks not expected on rect/quads with view transition live captures

Categories

(Core :: Graphics: WebRender, defect)

defect

Tracking

()

RESOLVED FIXED
138 Branch
Tracking Status
firefox138 --- fixed

People

(Reporter: emilio, Assigned: nical)

References

(Blocks 1 open bug)

Details

(Whiteboard: [viewtransitions:m1:gfx])

Attachments

(2 external files)

On debug we also see frame time asserts: https://treeherder.mozilla.org/jobs?repo=try&revision=5c5080d805837dc08229eaa3ab3eb8875d4a5b33

But those can be probably removed as per the comments in https://phabricator.services.mozilla.com/D240030

Blocks: 1951999
Whiteboard: [viewtransitions:m1] → [viewtransitions:m1:gfx]
Severity: -- → S3

We are running into this assertion because the display list contains an image-mask clip (in the case of testing/web-platform/tests/css/css-view-transitions/new-content-captures-clip-path.html it's a polygon clip turned into an image for mask so that WR can consume it) that is applied to a rectangle item instead of its parent picture/stacking-context.

Unefortunately the story for how this happens is a bit blurry because of the way clips are specified in the display list: All items are affected by clip chains that define all of the clips up to the root, and during scene building, WR finds all of the clips shared by a picture and its children so that the common part is applied to the picture and only specific clips for each child item is applied to them.

The code that looks for common clips is here.

Looking at testing/web-platform/tests/css/css-view-transitions/new-content-captures-clip-path.html, the polygon clip should be applied to the snapshotted picture instead of the rectangle, but somehow WR fails to deduplicate the clip. I haven't worked out how yet. I suspect that the display list is built in a slightly different way from what WR expects and it throws off the clip extraction.

Ah I think I found the issue: During scene building I inserted a way to wrap a snapshotted picture into another one to handle some specific filter and shadowing situations, and that seems to be what is throwing off the clip chain deduplicaiton code.

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

The previous behavior was to set the clip chain on the outermost picture and nothing on the wrapped one, but it threw off the shared clip chain determination and caused outer clips to be applied to the children items of the snapshotted stacking context (and in the case of this bug, an image mask clip which we only support on a picture, leading to crashes).

This patch leverages the common clip extraction optimization happening during scene building to ensure that snapshots are not clipped by ancestor elements as required by the spec.
The snapshotting code was already relying on it but under certain conditions the optimization would not take place.

In addition to the correctness issue, this also more reliably ensures that image masks are only applied to pictures (and not their children items, which would crash) even if the picture is extracted from the traversal of the scene into a snapshot root.

Attachment #9471122 - Attachment description: Bug 1951167 - Assign te same clip chain when wrapping a snapshot into another picture. r=gw → Bug 1951167 - Assign the same clip chain when wrapping a snapshot into another picture. r=gw
Pushed by nsilva@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/607d4fa7a748 Assign the same clip chain when wrapping a snapshot into another picture. r=gw https://hg.mozilla.org/integration/autoland/rev/f7610eb57ce4 Try harder to extract parent clips from snapshot pictures. r=gw
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 138 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: