Re: [CSS21] should text-decoration propagate to table-cells from table or above?

On Wed, Aug 20, 2008 at 8:25 AM, fantasai <fantasai.lists@inkedblade.net> wrote:
>
> Arron and fantasai wrote:
>>
>> Proposal:
>>  In
>>    "the decorations are propagated to an anonymous inline box
>>     that wraps all the in-flow inline children of the element,
>>     and to any block-level in-flow descendants."
>>  Replace
>>    "in-flow descendants"
>>  With
>>    "in-flow children and internal table elements"
>>  Where "internal table elements" links to the definition at the
>>  end of 17.1.
>
> This isn't enough, since it doesn't say that the propagation is
> recursive.
>
> Also we don't seem to have a definition for what happens with
>  <p><u><span style="display: block">Am I underlined?</span></u></p>
>
> It is underlined in Opera, Safari, and IE. Mozilla does not underline
> the span.


I looked into this issue in depth today with fantasai.  There are
several missing cases in the existing definition for text-decoration
regarding what should be painted and what should be propagated.  In
addition, the definition currently will cause underlining in some
cases that we do not want (this is alluded to in Arron's email), such
as <block underline><inline-block><block>foo</block></inline-block></block>,
due to the language stating that decorations are propagated to block
*descendants*.

I propose the following text to replace the first paragraph in section
16.3.1 of CSS 2.1:

Inline elements cause all of the boxes they generate to be affected by
any text-decoration specified on the element or propagated from a
non-inline parent, and further propagate these text-decorations to any
in-flow children that are not inline-table or inline-block. All other
elements propagate text-decorations to their in-flow children.
Non-inline elements with inline children are considered to have an
anonymous inline box that wraps any inline content.

This should cause decorations exactly when we want and not when we
don't, based on careful study of the current text, Arron's proposal
and the discussion around it, and talking with Elika.  Specifically,
decorations now propagate through tables, but not through
inline-blocks or inline-tables in any case.  I believe it also handles
all inline cases in the way we want.

For example, given this markup:
<div style="text-decoration: underline; color: blue;">
  <p>
    some
    <em style="color:green;">text
      <span style="display:block;">
        here
      </span>
    </em>
  </p>
</div>

The div does not do anything directly with its text-decoration, but
propagates it to the p.  The p propagates to an anonymous inline box
wrapping its inline content, which causes underlines to be drawn on
"some" and "text" (as it's an inline element, and those are the line
boxes generated by it).  This anonymous inline propagates the
decoration to em, which does *not* draw a decoration (it has an inline
parent - the anonymous inline box), but still propagates to the span.
The span then propagates to an anonymous inline box, which draws the
(blue) underline on "here".

~TJ

Received on Saturday, 14 November 2009 02:37:31 UTC