Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow items to be clipped by the intersection of multiple clip chains #1964

Closed
staktrace opened this issue Oct 30, 2017 · 7 comments
Closed

Comments

@staktrace
Copy link
Contributor

I'm not convinced this is entirely covered by #840, so I'm filing a new issue.

The scenario that we want to support is described by Markus at https://bugzilla.mozilla.org/show_bug.cgi?id=1408792#c13 - the problem is that the WR API doesn't allow us to say "this item should be clipped by the intersection of these two clip chains". We can only specify a single clip chain per item, plus a "local clip" on the item, which isn't powerful enough to support the use cases in question.

@staktrace
Copy link
Contributor Author

/cc @mrobinson

@mrobinson mrobinson self-assigned this Oct 30, 2017
@glennw
Copy link
Member

glennw commented Oct 30, 2017

Question - do we need an arbitrary number of clip chains that can be specified, or do we know / think that two would cover all use cases?

@mstange
Copy link
Contributor

mstange commented Oct 30, 2017

You can nest the example arbitrarily deeply, so I think we would need an arbitrary number.

The other way to resolve this conundrum would be to make it so that clips on a stacking context always apply to everything that's rendered by that stacking context (including the stacking context's contents). This would be closer to what Gecko is doing.
Maybe this already happens when the stacking context has a filter. I think it would have to happen at least for the blur filter.

@mrobinson
Copy link
Member

@mstange Just to clarify, stacking contexts don't have clips. For filters, the boundaries of the filtered area are determined by the display items inside (and their respective positions).

@mrobinson
Copy link
Member

I can understand now why we'd want to add the option to add a special clip to a stacking context.

@staktrace staktrace changed the title Allow items to be clipped by the intersection of two clip chains Allow items to be clipped by the intersection of multiple clip chains Dec 1, 2017
@staktrace
Copy link
Contributor Author

@mrobinson It would be good to prioritize fixing this, not just for correctness but also to unlock some clip optimizations on the gecko side (in that we can do a better job of deduplicating the clips we send to WR).

@staktrace
Copy link
Contributor Author

Also for the record, doing this via clips on a stacking context always applying to their contents would work, but it would mean that we would start pushing stacking context where we weren't before, just for the sake of getting the clips working properly. This might end up being pretty heavyweight. I think from my point of view the best API would be something like a push_persistent_clip(id: ClipId) (and corresponding pop function) that work similar to the current push_clip_id function, except the provided clip gets intersected into all the things pushed inside it.

mrobinson added a commit to mrobinson/webrender that referenced this issue Jan 14, 2018
API-defined clip chains allow constructing combinations of clips that
select any combination of clips from the ClipScrollTree without regard
to parents of clips. A ClipChain is defined by an optional ClipChain
parent and a vector of clips to use for that chain. A chain's clips are
combined with its parents clips to provide all the clips for display
items that set their clipping ClipId as the clip chain via
ClipId::ClipChain.

Fixes servo#1964.
mrobinson added a commit to mrobinson/webrender that referenced this issue Jan 14, 2018
API-defined clip chains allow constructing combinations of clips that
select any combination of clips from the ClipScrollTree without regard
to parents of clips. A ClipChain is defined by an optional ClipChain
parent and a vector of clips to use for that chain. A chain's clips are
combined with its parents clips to provide all the clips for display
items that set their clipping ClipId as the clip chain via
ClipId::ClipChain.

Fixes servo#1964.
mrobinson added a commit to mrobinson/webrender that referenced this issue Jan 14, 2018
API-defined clip chains allow constructing combinations of clips that
select any combination of clips from the ClipScrollTree without regard
to parents of clips. A ClipChain is defined by an optional ClipChain
parent and a vector of clips to use for that chain. A chain's clips are
combined with its parents clips to provide all the clips for display
items that set their clipping ClipId as the clip chain via
ClipId::ClipChain.

Fixes servo#1964.
mrobinson added a commit to mrobinson/webrender that referenced this issue Jan 15, 2018
API-defined clip chains allow constructing combinations of clips that
select any combination of clips from the ClipScrollTree without regard
to parents of clips. A ClipChain is defined by an optional ClipChain
parent and a vector of clips to use for that chain. A chain's clips are
combined with its parents clips to provide all the clips for display
items that set their clipping ClipId as the clip chain via
ClipId::ClipChain.

Fixes servo#1964.
mrobinson added a commit to mrobinson/webrender that referenced this issue Jan 15, 2018
API-defined clip chains allow constructing combinations of clips that
select any combination of clips from the ClipScrollTree without regard
to parents of clips. A ClipChain is defined by an optional ClipChain
parent and a vector of clips to use for that chain. A chain's clips are
combined with its parents clips to provide all the clips for display
items that set their clipping ClipId as the clip chain via
ClipId::ClipChain.

Fixes servo#840.
Fixes servo#1964.
mrobinson added a commit to mrobinson/webrender that referenced this issue Jan 16, 2018
API-defined clip chains allow constructing combinations of clips that
select any combination of clips from the ClipScrollTree without regard
to parents of clips. A ClipChain is defined by an optional ClipChain
parent and a vector of clips to use for that chain. A chain's clips are
combined with its parents clips to provide all the clips for display
items that set their clipping ClipId as the clip chain via
ClipId::ClipChain.

Fixes servo#840.
Fixes servo#1964.
bors-servo pushed a commit that referenced this issue Jan 16, 2018
Add support for API-defined ClipChains

API-defined clip chains allow constructing combinations of clips that
select any combination of clips from the ClipScrollTree without regard
to parents of clips. A ClipChain is defined by an optional ClipChain
parent and a vector of clips to use for that chain. A chain's clips are
combined with its parents clips to provide all the clips for display
items that set their clipping ClipId as the clip chain via
ClipId::ClipChain.

Fixes #1964.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2300)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants