Open smfr opened 6 years ago
We should also resolve what happens when the author specifies transform-style:preserve-3d, but a grouping property forces it to flat.
Consider a testcase that has a preserve-3d element, and then you later add a grouping property that doesn't force a stacking context and containing block (overflow:hidden, clip, clip-path etc).
I find it a bit weird from an implementation standpoint that the change handling for overflow:hidden (which normally has nothing to do with containing blocks) needs to check if we also have transform-style:preserve-3d, and disable us from being a containing block. It's a weird dependency.
I think authors might also find it weird that adding a grouping property not only changes the visual rendering of preserve-3d, but also has the layout change of removing the containing block.
I'd prefer if the flattening effect of grouping properties applied to the rendering model, but not the layout. We could spec that as defining the stacking context/containing block parts of transform-style:preserve-3d are determined by the computed value of transform-style.
The CSS Working Group just discussed 3D Transform Interop
.
I wrote up an explanation of how Gecko interprets the spec and how the implementation works, along with a bunch of testcases to show some of the differences: https://docs.google.com/document/d/1yb4a_uhTG3KmcbGPta4B9p67v1HO_qY8ZMk-otGOwTc
It looks like the primary difference is that WebKit considers a flattening element (element with a flattening property, or stacking context with transform-style:flat) to be what establishes a 3d rendering context for its children (but not itself), whereas both Gecko and blink consider an element with transform-style:preserve-3d to be what establishes a 3d rendering context for itself and its children.
I think the blink/Gecko interpretation will be simpler to specify, since the root of the 3d rendering context needs to be a stacking context to create a flattened representation. Flattening properties (like overflow:scroll) aren't necessarily a stacking context, so we'd need to make them one, if (and only if) they happen to have 3d descendants. In Gecko/blink the root always has transform-style:preserve, which is explicitly a stacking context.
Commenting here since the css-meeting bot did, but this is effectively the same underlying issue as #3138, #1944, #1951 and #1952.
We also discussed how WebKit/blink look to non-parent ancestors to determine if we're participating in a 3d rendering context (spec says look at containing block, current behaviour appears to be stacking context), whereas Gecko looks at the direct parent element.
This causes issues when flattening properties are neither a containing block or a stacking context (overflow:scroll), but still need to influence the decision.
Gecko's approach is simpler and avoids this problem (and appears to be largely webcompat!), but does mean that a no-op \<div> will flatten (using the default transform-style:flat).
I'm reviewing this, and I'm still confused. :(
As far as I can tell, there are two independent things you want to know about an element's 3d context-ness:
These are indeed fully independent:
In other words, 2 is about flattening before the element runs its own transforms (into its own plane), while 1 is about flattening after the element runs its own transforms (into its parent's plane).
I still can't tell, from @mattwoodrow's descriptions, what the intended behavior of 'transform-style' and flattening properties is in these terms. The term "flattened" is thrown around without sufficient clarification for me to tell whether something is being 1-flattened or 2-flattened in any given instance.
Any help?
I've written up some proposed wording for this change in #3750, does that help clarify at all?
We've had quite a few changes and misunderstandings here, so it's worth being extra verbose with whatever we come up with.
Gecko's implementation (along with the TR and blink, I believe) is that transform-style:preserve-3d changes both 1 and 2 to the 3d variant, and transform-style:flat (default, explicitly set, or overridden by a flattening property) has both 1 and 2 as the flattened variant.
WebKit and the ED consider 1 to always be 3d, and transform-style just toggles between 2-3d and 2-flattened.
My proposal is to standardize on the former, where the two variants are always changed in lockstep.
Note that this all independent of the 'auto' keyword, which was added to describe behaviour where the transform-style property is currently ignored on some elements (ones that don't create a 'layer' in blink/WebKit's implementations, never in Gecko).
I've written up some proposed wording for this change in #3750, does that help clarify at all?
Ooh, I'll review. (GH's review UI is pretty actively hostile for content with long lines. I'll look in my local client instead, tomorrow.)
Gecko's implementation (along with the TR and blink, I believe) is that transform-style:preserve-3d changes both 1 and 2 to the 3d variant, and transform-style:flat (default, explicitly set, or overridden by a flattening property) has both 1 and 2 as the flattened variant.
WebKit and the ED consider 1 to always be 3d, and transform-style just toggles between 2-3d and 2-flattened.
Ah, this is a nice summary. Thanks.
Gecko's implementation (along with the TR and blink, I believe) is that transform-style:preserve-3d changes both 1 and 2 to the 3d variant, and transform-style:flat (default, explicitly set, or overridden by a flattening property) has both 1 and 2 as the flattened variant.
IIRC from the breakout session on this back in February 2019, this was one of the main issues. Let's try to resolve this one way or another this week at TPAC.
In the discussion in 2017 TPAC, it was stated that the ED/WebKit behavior is preferred, according to the notes here:
Arguments in favor of Firefox behavior:
Arguments in favor of the WebKit behavior:
Taking to review Matt's changes in #3750.
Discussion about how transform-style: flat should work.