Re: list-style-position and text-align

On Nov 22, 2010, at 11:45 PM, Boris Zbarsky wrote:

> On 11/23/10 12:16 AM, David Hyatt wrote:
>> *inside*
>>    The marker box is the first inline box in the principal block box,
>>    after which the element's content flows. CSS 2.1 does not specify
>>    the precise location of the marker box.
>> 
>> Again, this is just wrong. When you have nested blocks inside the list
>> item, the marker box is the first inline box inside some descendant
>> block. If it were the first inline box in the list item's principal
>> block box, then when you put a div inside an li, you'd end up generating
>> an anonymous block box to wrap the marker box, but that's not what happens.
> 
> It's what happens in Gecko.  If a list-item with an inside bullet has a block as its first child, the bullet ends up on a line by itself above that child block, precisely because it ends up as the first inline box in the list item's principal block box.
> 
> I agree that this doesn't seem to be what Presto and Webkit do.
> 
> IE9 in standards mode matches Gecko and the spec here.  IE9 in quirks mode does what Presto and Webkit do.

Thanks for the clarification.

I think the behavior of Presto/WebKit/IE9-quirks-mode makes more sense here, especially when you compare with the outside list bullet case.  The fact that IE has a quirk for it also makes me think it was considered important for compatibility.

I assume that Gecko does align the bullet with a nested block's first line box in the list-style-position:outside case without putting the bullet on a line by itself?

It seems like some of the spec ambiguity could be fixed by establishing that the principal block box for the marker box isn't necessarily the list item, and then talking in terms of that box instead of the list item's principal box.  In WebKit at least, the marker is actually placed on the line that it is aligned with in both the inside and outside cases.  The only differences between the two are that the outside marker doesn't affect the placement of objects on the line, and the outside marker gets a paint translation applied to shove it outside.

dave
(hyatt@apple.com)

Received on Tuesday, 23 November 2010 05:58:54 UTC