[whatwg] Magic alignment issues

Ian Hickson ian at hixie.ch
Thu Jan 17 14:45:59 PST 2013


On Fri, 7 Dec 2012, Matt Falkenhagen wrote:
>
> How are cycles with magically aligned elements resolved?
> 
> For example, if a and b are dialogs and you do:
> 
> a.show(b);
> b.show(a);
>
> I think an anchoring cycle can also occur if an element |a| is anchored 
> to a descendent of an element anchored to |a|.

On Mon, 10 Dec 2012, Tab Atkins Jr. wrote:
> 
> This is a closely-related problem to what I ran into when writing up my 
> proposal for Positioned Layout <http://www.xanthir.com/blog/b48H0>. The 
> only correct answer is to do cycle-detection, and break the cycle at 
> some predictable location.  In Positioned Layout I used document order 
> to figure out where to break the cycle, but here you have a nice 
> temporal ordering already available - if a show() call would produce a 
> cycle, it should instead act as if no anchor was provided.

The temporal order isn't that useful. Consider:

   <a/> <b/> <c/>
   a.show(b);
   b.show(c);
   a.appendChild(c);

I think we're forced to rely on the tree order here too. It's unfortunate, 
but I really can't see a better solution.


On Tue, 11 Dec 2012, Matt Falkenhagen wrote:
>
> The spec seems unclear on whether a magically aligned element[1] should 
> follow its anchor when its anchor moves, e.g., by dynamic style changes 
> or something like CSS animations.

It should. I've tried to make this explicit, but it was supposed to be 
already required by the use of the word "while" and other such phraseology 
in the requirements.


> Relatedly, it's not clear what happens if anchor is display: none or is 
> not in the document when show() is called, but later has a rendered box 
> and is in the document. And the reverse: if it is in the document when 
> show() is called and later is removed.

The requirements apply continually while they match, so while one is 
'display:none' (or not in the doc, or whatever) the 'position' property on 
the anchored element will compute normally, but once the conditions are 
met, it will compute to 'absolute-anchored', and then the requirements on 
'absolute-anchored' apply.


On Tue, 11 Dec 2012, Tab Atkins Jr. wrote:
>
> The spec defines this - the magical alignment only happens while A and B 
> have rendered boxes.  When the conditions don't apply, it's not 
> magically aligned.  (The spec's recommendation for CSS is somewhat badly 
> designed for this - assume that it merely forces A to 
> "position:absolute", and while B doesn't have a box, A isn't anchored 
> and is interpreted as a normal abspos box.)

How should I change the spec to not be badly designed here?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list