Re: [css-transforms] Initial value of transform-style

On Feb 26, 2014, at 5:53 PM, Matt Rakow <marakow@microsoft.com> wrote:
> 
> Ah, good point, I hadn't thought of that.  It does seem like there's value in requiring the developer to explicitly mark the root of a 3d scene.
> 
> Perhaps the better approach would be to make transform-style inherit?  This would still help facilitate that mainstream use case (continuing to build out a 3d scene).  Also, it would require the developer to explicitly mark the root of a nested flattened scene as "flat", which also seems nice for its explicitness.
> 
> This would change the example from my previous mail to:
> 
>    <div class="three-d-root">
>        <div class="transformed-element">
>            <div class="transformed-element">
>                <div class="transformed-element">
>                    <div class="scene-flattener">
>                        <div class="three-d-root">
>                            <div class="transformed-element">
>                                <div class="transformed-element">
>                                    <div class="transformed-element">
> 
>    .three-d-root { transform-style: preserve-3d; }
>    .scene-flattener { transform-style: flat; }
> 
> What do you think?

Matt asked me this again in private email, so bringing up this old thread to answer his question in public.

I think it would be bad for transform-style to inherit, because that would lead to unwanted flattening chains. Consider:

.scene-root {
  transform-style: flat;
  perspective: 500px;
}

.transformed {
  transform: rotateX(45deg);
}

<div class=“scene-root”>
  <div class=“container">
    <div class=“transformed>
…

If transform-style inherits, then <div class=“container”> gets transform-style:flat, so the transform on the leaf is not affected by the perspective. Making this work would require that the author explicitly makes .container have “transform-style: preserve-3d”. I think there’s plenty of content out there that works in WebKit and has intermediate elements with no explicit transform-style, so pref the non-inherited auto/flat/preserve-3d behavior described in <https://docs.google.com/document/d/1mNF7Z67WnnV05RqXa37PmfvRbgAZwj7-h-7Y_uQ_UPE>.

Simon

Received on Friday, 24 October 2014 23:03:18 UTC