Re: [csswg-drafts] [css-transforms-2] Preserve-3d + backface visibility semantics need to be clarified (#918)

I think this seems like a good approach.  A few comments:

* I think the definition of when `backface-visibility: hidden` needs to create a stacking context should have two parts:  either (a) if it participates in a 3D rendering context or (b) it has a 3D transform.  This is needed since `backface-visibility` does work on elements with 3D transforms even if they're not in a 3D rendering context (see [example](https://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A%3Cstyle%3E%0A%0Adiv%20%7B%20width%3A%20100px%3B%20height%3A%20100px%3B%20%7D%0A%0A%23outer%20%7B%20background%3A%20yellow%3B%20%7D%0A%23inner%20%7B%20background%3A%20green%3B%20transform%3A%20rotateX(120deg)%3B%20backface-visibility%3A%20hidden%3B%20%7D%0A%0A%3C%2Fstyle%3E%0A%0A%0A%3Cdiv%20id%3D%22outer%22%3E%0A%20%20%3Cdiv%20id%3D%22inner%22%3Ehello%3C%2Fdiv%3E%0A%3C%2Fdiv%3E)).
* As to the question of what is *in* that stacking context (and hidden if the backface is hidden):  I think the idea of all descendants in the plane, but not other descendants, is a good one.  It's sort of an unusual thing to specify... but I think maybe it's also sort of how the stacking context established by `transform` itself works.
* One important question with this proposal is what makes content "in the plane" versus "out of the plane" (since that now controls both whether it's in the stacking context and whether the backface-visibility: hidden applies to it).  I'd suggest maybe this should be defined based on whether the transform function is a 3D transform function or not.  This has the advantages that:
  * we don't need to worry about mathematical precision issues for whether a transform is flat or not and
  * it avoids discontinuity at the ends of animations (for example, if the endpoints of an animation are flat but the middle is 3D, which I think is a reasonable setup and probably not an unusual use of 3D transforms) and
  * it gives authors a relatively straightforward way to escape from the stacking context.

We probably need to do some measurement/testing of whether we're going to have any compatibility problems with this approach, but it seems like a sensible plan and one that has a reasonable chance of being sufficiently compatible.

-- 
GitHub Notification of comment by dbaron
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/918#issuecomment-1697405902 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 29 August 2023 13:03:41 UTC