Re: [CSS21] text-decoration/visibility

On Thu, Nov 12, 2009 at 1:13 PM, Øyvind Stenhaug <oyvinds@opera.com> wrote:
> Right, I meant the cases without floats etc., such as an otherwise-unstyled
> <span style="text-decoration:underline">A<span>B</span></span>
> where I assume (haven't found anything explicit in the spec) that the first
> span generates a single inline box that contains A but not B's box. For
> "other elements" there's wording about an anonymous inline box, but not for
> "inline element"s (whatever that means; display:inline?).

I think that in the case you give, each span has its own inline box,
and A's box contains B's.  The box generated by A's span contains all
the (inline) contents of the span.  The underline is drawn under all
the parts of A's box that happen to contain text, and that includes
the part where B is.  So there's no propagation here.  The underline
is drawn under A's box, not B's.  This is very relevant if, for
instance, you replace <span>B</span> by <sup>B</sup>: B's box is then
much higher, and if it has its own underline, that will be drawn
higher.

data:text/html,<!doctype html><span
style=text-decoration:underline>A<sup
style=text-decoration:underline>B</sup></span>

If both have decorations, both decorations are drawn independently,
and the descendant's specification doesn't affect the parent's either
way.  Another example:

data:text/html,<!doctype html><span
style=text-decoration:underline;font-size:10em>A<strong
style=color:red;text-decoration:underline>B</strong><span
style=text-decoration:underline;color:lightgreen;font-size:0.8em>C</span>D

Note that B's red underline overtypes the surrounding black underline
here.  Both are drawn, but the black one is lower and so hidden.
Since C is smaller, its underline is smaller, so this effect is more
visible.  All this is a lot like backgrounds, conceptually.

The place where this is all clearly specified is Appendix E.  In fact,
Appendix E describes text-decoration drawing much like it describes
backgrounds:

[[
7. Otherwise: first for the element, then for all its in-flow,
non-positioned, block-level descendants in tree order:
...
    2. Otherwise, for each line box of that element:
        1. For each box that is a child of that element, in that line
box, in tree order:
            1. background color of element.
            2. background image of element.
            3. border of element.
            4. For inline elements:
                 1. For all the element's in-flow, non-positioned,
inline-level children that are in this line box, and all runs of text
inside the element that is on this line box, in tree order:
                     1. If this is a run of text, then:
                         1. any underlining affecting the text of the
element, in tree order of the elements applying the underlining (such
that the deepest element's underlining, if any, is painted topmost and
the root element's underlining, if any, is drawn bottommost).
                         2. any overlining affecting the text of the
element, in tree order of the elements applying the overlining (such
that the deepest element's overlining, if any, is painted topmost and
the root element's overlining, if any, is drawn bottommost).
                         3. the text.
                         4. any line-through affecting the text of the
element, in tree order of the elements applying the line-through (such
that the deepest element's line-through, if any, is painted topmost
and the root element's line-through, if any, is drawn bottommost).
]]
http://www.w3.org/TR/CSS2/zindex.html#painting-order

All this doesn't answer the question about visibility:hidden, though.
That's not clear to me at all from the spec.

Received on Thursday, 12 November 2009 20:21:38 UTC