W3C home > Mailing lists > Public > www-style@w3.org > February 2012

Re: [css3-images][css3-transforms] element() and content with 3D Transforms

From: Simon Fraser <smfr@me.com>
Date: Sun, 26 Feb 2012 09:21:24 -0800
Cc: Dirk Schulze <dschulze@adobe.com>, "www-style@w3.org list" <www-style@w3.org>
Message-id: <905684E8-E563-4DBF-B607-8EACACC69229@me.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
On Feb 24, 2012, at 2:54 pm, Tab Atkins Jr. wrote:

> On Fri, Feb 24, 2012 at 2:08 PM, Dirk Schulze <dschulze@adobe.com> wrote:
>> Hi,
>> 
>> It is not clear how 3D transformation applied to elements references by element() should be treated:
>> 
>> <div id="bg">
>>   <image width="100" height="100" style="transform: rotateX(45deg); perspective: 200;">
>> </div>
>> 
>> <div id="content" style="background: element(#bg); perspective: 500;">
>> Test
>> </div>
>> 
>> Should 3D transforms still be allowed on referenced elements and their child elements? If they are allowed, how do they apply to the element? In the example above, the element with the id 'content' has another perspective then the reference background element. How should browsers deal with it? Should browsers try to render it, even if the content is behind the background elements (from the perspective)? Should the background element get "flattened" before used as background? If so, how?
> 
> If the <img> is in the "paint source" branch, the transform has no effect.
> 
> If it's in the "rendered content" branch, you do exactly what the spec
> says - set up a box the size of the element's border box, and render
> exactly what's in there.  If you've done a transform that pushes the
> image's rendering outside of its border box geometry, you just don't
> see anything (the element is drawn over an infinite field of
> transparent black, so you'll just see the field).
> 
> In your specific example, the image will be drawn with its specified
> transformations, and then taken as a static image and painted into the
> background of #content.  #content's own perspective property has no
> effect on how the image is drawn.  So yes, it's flattened.

I concur.

There is one tricky case here:

<div style="perspective: 500px">
  <div id="target" style="transform-style: preserve-3d">
    <div style="transform: rotateY(45deg)"></div>
  </div>
</div>

<div style="background-image: element(#target)"></div>

When rendering the element(#target), does the perspective affect the rendering of the rotateY()?

Simon
Received on Sunday, 26 February 2012 17:22:04 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:51 GMT