Re: [CSS2.1] Position of list-item markers

On Wednesday 2008-11-12 11:32 -0800, Saloni Mira Rai wrote:
> Scenario #1 - List-item is immediately preceded by a float (left). The float pushes the list-item content to the right. According to the rules above the marker should be outside of the principal box and to the left of the float.
> However
> Opera and Safari all put the marker to the right of the float and next to the text.
> Firefox puts the marker on the float.
> IE8 puts the marker to the left of the float.
> 
> 
> Scenario #2 - List-item has text-align set to center. Should the marker be next to the text or outside the principal box?
> Firefox, Opera and Safari put the marker right next to the text, within the border of the list-item
> IE8 puts the marker outside the list-item.

IE8 seems to have changed its behavior in both of these cases to
match Firefox.  (This seems to go against the majority of the
comments on the list from the discussion at
http://lists.w3.org/Archives/Public/www-style/2008Nov/thread.html#msg298 ,
but I prefer this behavior.)

In the cases (in Saloni's testcase) where IE8/Firefox and
WebKit(/Opera?) differ, they differ in both the position of the text
and the position of the bullet.  This means that, in all browsers,
the distance between the bullet and the position of a hypothetical
empty inline at the beginning of the line box (with direction
matching the block's direction, and never moved to the other side by
bidi reordering) is constant.

Given that, I think we have two options:

 (1) leave things undefined, or

 (2) add to the definition of 'list-style-position: outside' to say
     that the horizontal position of the marker is fixed relative to
     the horizontal position of the start of the contents of the
     line box, or a hypothetical empty inline at the start of the
     line box like the one I mentioned above.

However, there are a bunch of caveats here.

First, the block, or a descendant of the block containing its first
line box, could have 'overflow' != 'visible'.

Second, the block could have something else "substantive" before its
first line box.


I think the algorithm for positioning 'outside' bullets ought to
work something like this, but I'm not sure how much of it we can
specify in CSS 2.1:

  Bullets are positioned, both horizontally and vertically, relative
  to a box that is inside the 'list-item' box, called the "bullet's
  anchor".  The bullet's anchor is either (a) a line box or (b) a
  block-level box (on the outside, i.e., something that does not
  have a line box around it when it is inside a block) that is not a
  non-replaced block with 'overflow: visible'.  In particular, it is
  the first such box that is a descendant of the list-item box.
  When no such box exists, it must be created by creating a line box
  in the deepest box that is either the list-item box, its first
  child box, its first child box's first child box, etc.  When such
  a line box is created, it has a height and baseline based on the
  font metrics and line-height of its containing block.

  When the bullet's anchor is a line box:
    (a) the bullet participates in vertical alignment and height
    calculations for the line box, and it is vertically aligned
    'baseline' as though it is a sibling of the contents of the line
    box

    (b) The bullet's horizontal position is, when direction is 'ltr'
    ('rtl'), an implementation-specific fixed distance to the left
    (right) of the position of a hypothetical inline element at the
    start-edge of the contents of the line box.  The distance may be
    fixed in any CSS units, and if those units are relative to the
    font size of the element on which they are used, then the
    relevant element is the list-item box.

  When the bullet's anchor is not a line box:
    I'm not quite sure what should happen here for either vertical
    or horizontal positioning.

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/

Received on Thursday, 25 March 2010 19:50:27 UTC