Re: Layers. Z-index

On 29/11/2010 14:17, Ruslan Fayzrakhmanov wrote:

> Because actually the z-index and Stacking Contexts, they just used to
> order elements for drawing and not to form a real layers. As I
> understand the current "layers" can be represented only as a tree of
> Stacking Contexts.

Indeed from the global perspective we should not be talking about layers 
(and the spec doesn't do so).

> The problem is that there are no global ordering of the Stacking Contexts.

Well, there certainly is a tree of elements and pseudo-elements that 
contains a subtree of stacking contexts (or more usefully, a subtree of 
true stacking contexts and of pseudo–stacking contexts such as 
non-positioned floats etc).  However, rendering relies on recursion not 
on a system of global layering.

Why do you see this as a problem?

> I am working on the representation of the visualized information and
> actually now I am interested in visual representation of web pages.
>
> <div id="A" style="position:relative; z-index:0; width:...;height:...">
> <div id="A1" style="position:relative; z-index:0;
> width:...;height:...">...</div>
> <div id="A2" style="position:relative; z-index:1;
> width:...;height:...">...</div>
> </div>
> <div id="B" style="position:relative; z-index:0;
> width:...;height:...">...</div>
>
> In this example, for instance we cannot say that element A and B on the
> same layer 0.

Yes we can (and they do).  They lie on layer 0 *in the stacking context 
to which they both belong*.  But the painting layers are not a global 
concept; each stacking context and pseudo–stacking context consist of a 
"local" set of painting layers, onto which the drawing items are placed. 
  Note that the (pseudo–)stacking context "children" of the current 
stacking context are rendered atomically (ie, as one self-contained 
pre-rendered unit) on the appropriate layers.  This is where the 
recursion arises.

Cheers,
Anton Prowse
http://dev.moonhenge.net

Received on Monday, 29 November 2010 17:14:58 UTC