<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>23015</bug_id>
          
          <creation_ts>2013-08-19 22:06:00 +0000</creation_ts>
          <short_desc>Preserve-3d + backface visibility semantics need to be clarified</short_desc>
          <delta_ts>2017-01-13 18:04:18 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>CSS</product>
          <component>Transforms</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>MOVED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Shawn Singh">shawnsingh</reporter>
          <assigned_to name="Simon Fraser">smfr</assigned_to>
          <cc>ayg</cc>
    
    <cc>cmarrin</cc>
    
    <cc>dino</cc>
    
    <cc>dschulze</cc>
    
    <cc>eoconnor</cc>
    
    <cc>smfr</cc>
          
          <qa_contact>public-css-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>92299</commentid>
    <comment_count>0</comment_count>
      <attachid>1387</attachid>
    <who name="Shawn Singh">shawnsingh</who>
    <bug_when>2013-08-19 22:06:00 +0000</bug_when>
    <thetext>Created attachment 1387
Test case for Example 2

I have two examples that illustrate questions about preserve-3d and backface visibility.

The first example can be found in the chromium bug here:
  https://code.google.com/p/chromium/issues/detail?id=224618

This developer&apos;s page has the following structure:

&lt;div with perspective, but NOT preserve-3d&gt;
   &lt;div for face1 of cube, with backface visibility hidden&gt;
   &lt;div for face2 of cube, with backface visibility hidden&gt;
   &lt;div for face3 of cube, with backface visibility hidden&gt;
   &lt;div for face4 of cube, with backface visibility hidden&gt;
   &lt;div for face5 of cube, with backface visibility hidden&gt;
   &lt;div for face6 of cube, with backface visibility hidden&gt;
&lt;/div&gt;

According to spec, because the 6 faces are technically NOT in a 3d rendering context, backface visibility must be checked against each layer&apos;s local transform. This is awkward - the transform used to test backface visibility (without perspective) is not the same one that is used to actually display the layers (including perspective). As a result, if things are implemented perfectly to spec, sometimes layers will disappear because to local transform without perspective thinks the back-side of an element is visible.  But with perspective, the front-side of the element is actually visible.

Some options how we could address this awkwardness:
 (1) leave the spec as-is, and the developer should actually be using preserve-3d on the perspective container.
 (2) define that perspective transform creates a 3d rendering context, just the same way that preserve-3d would.
 (3) make a special case that a perspective transform from a direct parent should be included when testing backface visibility, even when not in a 3d rendering context.


The second example is attached. This page illustrates a flip-card scenario when the back side of the card is facing the camera.

On current versions of Chrome and Safari, this example actually renders the child element of &quot;front&quot;, even though it&apos;s back face is visible.  Should this be considered a bug in the browsers?

I can see two different interpretations of spec:
(1) backface-visibility applies only to the element&apos;s itself.  The child element in this example would test backface visibility using it&apos;s own local transform (because it is not in a 3d rendering context), and ignore the backface visibility of its ancestors. In this case, the child element would awkwardly remain visible.
(2) Because there is no preserve-3d on the element, it implies that the container element &quot;flattens&quot; its subtree before rendering.  In that case, the child element gets hidden too when the parent&apos;s backside faces the camera.

It seems that Safari and Chrome both behave like #1, but I think it is more intuitive for developers if it behaves like #2.

If that seems agreeable, then maybe we want to say something like this in the spec:

&quot;If the element specifies preserve-3d, then backface-visibility applies only to the element itself and not its children.  If the element does not specific preserve-3d, then it is interpreted that the entire subtree &quot;flattens&quot; to the element, and backface-visibility would be used to determined if all the flattened content (i.e. the entire subtree) should be displayed or not.&quot;

Thanks in advance for looking at these issues.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93828</commentid>
    <comment_count>1</comment_count>
    <who name="Dirk Schulze">dschulze</who>
    <bug_when>2013-09-25 20:57:40 +0000</bug_when>
    <thetext>(In reply to Shawn Singh from comment #0)
&gt; Created attachment 1387 [details]
&gt; Test case for Example 2

I think we should create two bug reports to discuss this.

&gt; 
&gt; I have two examples that illustrate questions about preserve-3d and backface
&gt; visibility.
&gt; 
&gt; The first example can be found in the chromium bug here:
&gt;   https://code.google.com/p/chromium/issues/detail?id=224618
&gt; 
&gt; This developer&apos;s page has the following structure:
&gt; 
&gt; &lt;div with perspective, but NOT preserve-3d&gt;
&gt;    &lt;div for face1 of cube, with backface visibility hidden&gt;
&gt;    &lt;div for face2 of cube, with backface visibility hidden&gt;
&gt;    &lt;div for face3 of cube, with backface visibility hidden&gt;
&gt;    &lt;div for face4 of cube, with backface visibility hidden&gt;
&gt;    &lt;div for face5 of cube, with backface visibility hidden&gt;
&gt;    &lt;div for face6 of cube, with backface visibility hidden&gt;
&gt; &lt;/div&gt;
&gt; 
&gt; According to spec, because the 6 faces are technically NOT in a 3d rendering
&gt; context, backface visibility must be checked against each layer&apos;s local
&gt; transform. This is awkward - the transform used to test backface visibility
&gt; (without perspective) is not the same one that is used to actually display
&gt; the layers (including perspective). As a result, if things are implemented
&gt; perfectly to spec, sometimes layers will disappear because to local
&gt; transform without perspective thinks the back-side of an element is visible.
&gt; But with perspective, the front-side of the element is actually visible.
&gt; 
&gt; Some options how we could address this awkwardness:
&gt;  (1) leave the spec as-is, and the developer should actually be using
&gt; preserve-3d on the perspective container.
&gt;  (2) define that perspective transform creates a 3d rendering context, just
&gt; the same way that preserve-3d would.
&gt;  (3) make a special case that a perspective transform from a direct parent
&gt; should be included when testing backface visibility, even when not in a 3d
&gt; rendering context.
&gt; 

I am creating a test suite that exactly checks the different behaviors across browsers on preserve-3d and flatten. You can find the repository on github under

http://adobe-webplatform.github.io/transform-tests/comparison.html

The tests still need clean up and quite some corrections. Also, expected results fully depend on the outcome of the discussions.

Your example touches the last test cases with blue and yellow. You&apos;ll see that the problem is not just related to perspective but the interpretation of &apos;flatten&apos; on the transform-style property. In fact all tests test edge cases of transform-style  with certain other settings like perspective.

I encourage you to transform your tests to ref-tests in the format of the CSS WG. See http://wiki.csswg.org/test/reftest

That makes it easier to compare results and makes it possible to reuse the tests  for spec testing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128382</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Fraser">smfr</who>
    <bug_when>2017-01-13 18:04:18 +0000</bug_when>
    <thetext>https://github.com/w3c/csswg-drafts/issues/918</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>1387</attachid>
            <date>2013-08-19 22:06:00 +0000</date>
            <delta_ts>2013-08-19 22:06:00 +0000</delta_ts>
            <desc>Test case for Example 2</desc>
            <filename>backface-visibility-flip-card.html</filename>
            <type>text/html</type>
            <size>2048</size>
            <attacher name="Shawn Singh">shawnsingh</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+Cgo8IS0tCiAgIFJlZHVjZWQgdGVzdCBjYXNlIGRlbW9uc3RyYXRpbmcg
YSBmbGlwIGNhcmQuCiAgIFdoZW4gdGhlIGNhcmQgaXMgcm90YXRlZCBzbyBpdCdzIGJhY2sgZmFj
ZXMgdGhlIGNhbWVyYSwKICAgc2hvdWxkIHRoZSBjaGlsZHJlbiBlbGVtZW50cyBhbHNvIGJlIGNv
bnNpZGVyZWQKICAgdG8gYmUgYmFjay1mYWNlIHZpc2libGU/Ci0tPgoKPGh0bWw+CjxoZWFkPgo8
c3R5bGU+CgogIC5wZXJzcGVjdGl2ZSB7CiAgICAgIHdpZHRoOiAyMjBweDsKICAgICAgaGVpZ2h0
OiAzMDBweDsKICAgICAgcG9zaXRpb246IGFic29sdXRlOwogICAgICB0b3A6IDEwMHB4OwogICAg
ICBsZWZ0OiAxMDBweDsKCiAgICAgIC13ZWJraXQtcGVyc3BlY3RpdmU6IDEwMDBweDsKICAg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