Skip to content

[css-transforms-2, css2.1] Define the pseudo stacking context concept #4360

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

Open
chrishtr opened this issue Sep 20, 2019 · 5 comments
Open

Comments

@chrishtr
Copy link
Contributor

For de-facto [1] interop [2] reasons relating to WebKit/Blink implementation behavior, a pseudo stacking context should be defined.

Proposal: an element induces a pseudo stacking context if at least one of the following holds for the element:

  • Induces a stacking context
  • Is positioned
  • Has backface-visibility: hidden
  • Specifies columns (has non-auto column count or width)
  • Scrolls overflow (note: not overflow: hidden with or without overflow)
  • Is an embedded object, video, or canvas

[1] This concept is very similar to that for a "self-painting layer" in WebKit and Blink. In Blink at least, there are couple of additional corner cases that cause self-painting layers, such as overlay scrollbars. Also, there are some unreliable corner cases, such as whether an iframe is composited or not. I don't think these should be specified. Instead Blink and WebKit should work towards not requiring self-painting layers for these cases.

[2] Elements which induce a pseudo stacking context will likely be specified to:

@mattwoodrow
Copy link
Contributor

I don't think we can have the last two conditions in the first list.

Overflow:scroll shouldn't create a pseudo stacking context (unfortunately), since it should be possible for things outside the scroller to interleave things inside. That'd be a significant webcompat change I think.

Videos/canvas don't paint as positioned for gecko, and the actual video is sorted separately to the background for a video element (content group, and backgrounds/block-backgrounds respectively)

@chrishtr
Copy link
Contributor Author

Overflow:scroll shouldn't create a pseudo stacking context (unfortunately), since it should be possible for things outside the scroller to interleave things inside. That'd be a significant webcompat change I think.

Pseudo stacking contexts aren't stacking contexts. They are just paint-as-if-positioned, plus the relationship to backface-visibility and maybe preserve-3d.

As for web compat: Blink already does it, so it's web compatible. And I do think that it is likely not good that backface-visibility leaks across scrolling elements.

Videos/canvas don't paint as positioned for gecko, and the actual video is sorted separately to the background for a video element (content group, and backgrounds/block-backgrounds respectively)

On reflection, I think it's fine to not specify this case. These elements can't have children anyway, so it's just about paint-as-if-positioned behavior. Right now Blink and WebKit both paint them as if positioned due to limitations in their rendering architectures. Blink is working on fixing that and it will eventually be fixed.

@mattwoodrow
Copy link
Contributor

Overflow:scroll shouldn't create a pseudo stacking context (unfortunately), since it should be possible for things outside the scroller to interleave things inside. That'd be a significant webcompat change I think.

Pseudo stacking contexts aren't stacking contexts. They are just paint-as-if-positioned, plus the relationship to backface-visibility and maybe preserve-3d.

As for web compat: Blink already does it, so it's web compatible. And I do think that it is likely not good that backface-visibility leaks across scrolling elements.

Oh interesting, I wasn't aware that Blink/WebKit were doing that.

Made a quick testcase to display the difference: https://codepen.io/woodrow_matt/pen/jONXjNG

I think overflow:scroll isn't painting as positioned, since the red (actually positioned) is still on top. It's definitely causing the background (blue) and content (image) to form a group and not get the orange floated color between them though.

It feels a bit weird to have overflow:hidden and overflow:scroll result in different paint orders.

Anyway, we should probably do that as a separate change if you want to try spec it, since it's a definite behaviour change for Gecko.

@chrishtr
Copy link
Contributor Author

It feels a bit weird to have overflow:hidden and overflow:scroll result in different paint orders.

I agree. I think we should avoid spec'ing this unless we are forced to.

@dbaron
Copy link
Member

dbaron commented Mar 16, 2021

This issue is connected to a resolution shortly before it was filed (see also minutes).

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

4 participants