Closed Bug 1501111 Opened 6 years ago Closed 5 years ago

Wrong clipping with clip-path and a nested clip.

Categories

(Core :: Graphics: WebRender, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox-esr60 --- unaffected
firefox64 --- disabled
firefox65 --- disabled
firefox66 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

(Keywords: regression)

Attachments

(3 files, 1 obsolete file)

Attached file Testcase
This is a recent regression.

Expected: Green background with text.

Actual: A bullet.

The relevant bit is that a bullet is a nested clip.

This affects: https://christopher-tierney.com/apotheke-la/
Assignee: nobody → emilio
Flags: needinfo?(emilio)
This regressed with https://github.com/servo/webrender/commit/47242e13a6f88c17186afeaf2545796670e2d078.

Glenn, any chance you can take a look? Otherwise let me know needinfo?ing me back and I'll take a look, though will be probably next week since I'm at TPAC.
Blocks: 1494898
Flags: needinfo?(emilio) → needinfo?(gwatson)
Priority: -- → P2
Flags: needinfo?(emilio)
So, I took a look and talked a bit with Glenn about this.

So this test-case breaks WebRender's assumption that any clip with spatial node index < stacking context's spatial node.

WebRender only creates spatial nodes for sticky frames, reference frames, and scroll frames. But it also creates a surface for clip-path, for example:

  https://searchfox.org/mozilla-central/rev/eac6295c397133b7346822ad31867197e30d7e94/gfx/webrender/src/display_list_flattener.rs#1013

This is sound for transforms and such because they create a fixed-pos containing block. I think it's fine for scroll frames because we don't create separate surfaces for them, but this is not true for masks, so this falls apart in that case.

So potential fixes for this are:

 (a) Make WR not create separate surfaces for anything that isn't a reference frame (i.e. make clip-path not generate a surface).
 (b) Make position: fixed its own spatial node.

Given we want to put more stuff in surfaces in the future, (b) sounds better.
> So this test-case breaks WebRender's assumption that any clip with spatial node index < stacking context's spatial node.

This should read "that any clip with spatial node index < stacking context's spatial node is safe to apply to the whole stacking context".
Flags: needinfo?(gwatson)
Still a couple things to iron out, since I need to dig into some of
the async-scrolling reftests that are failing, but this should hopefully be on
the right track.
Comment on attachment 9021984 [details]
Bug 1501111 - [WIP] Make fixed pos display items create a WR spatial node.

Kats, Glenn, does this look on the right track to you?

I need to figure out some async-scrolling test failures, and write a test for this of course, but it'd be great confirming that this looks roughly right.
Attachment #9021984 - Flags: feedback?(kats)
Attachment #9021984 - Flags: feedback?(gwatson)
Comment on attachment 9021984 [details]
Bug 1501111 - [WIP] Make fixed pos display items create a WR spatial node.

The gecko side looks reasonable to me.
Attachment #9021984 - Flags: feedback?(kats) → feedback+
Also just a heads-up in case you weren't aware of servo/webrender#3251, there will likely be some rebasing involved for whoever lands second.
We briefly discussed in IRC that I was initially thinking this could be done without WR patches - I'm not sure if we worked out if that was the case or not?
Comment on attachment 9021984 [details]
Bug 1501111 - [WIP] Make fixed pos display items create a WR spatial node.

Did you have a chance to look into whether this can be done without WR changes?
Attachment #9021984 - Flags: feedback?(gwatson) → feedback+
Emilio, what's the status of this?
FWIW, I _think_ we can probably actually solve this by essentially reverting the commit that originally created the regression. That change is, I believe, no longer necessary with the way the picture caching code has ended up working. Emilio, perhaps we can discuss this next week and give it a try?
(In reply to Jeff Muizelaar [:jrmuizel] from comment #10)
> Emilio, what's the status of this?

The status is that it was not clear this was the right way to fix it. We could fix it that way, but the issue is that essentially the assumption bug 1494898 introduced doesn't hold.

(In reply to Glenn Watson [:gw] from comment #11)
> FWIW, I _think_ we can probably actually solve this by essentially reverting
> the commit that originally created the regression. That change is, I
> believe, no longer necessary with the way the picture caching code has ended
> up working. Emilio, perhaps we can discuss this next week and give it a try?

Sure, that'd be great, I did notice the WR clip node collector stuff changing recently, so will do. Sorry for the lag with all these bugs btw, had some unexpected PTO time this week...
Attached file GitHub Pull Request

Will add a reftest patch shortly.

Flags: needinfo?(emilio)
Attachment #9021984 - Attachment is obsolete: true
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/14749 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: