Re: [css-text] text-align-last and cascading

On 06/14/2013 02:56 AM, fantasai wrote:
> There was an open issue on whether 'text-align-last' has an effect
> when 'text-align: justify' or not. IIRC in IE, it only works when
> 'text-align: justify', whereas in Gecko it works any time.
> [...]
> Having the two properties be independent creates this cascading problem.
> IE dealt with it by only triggering on 'text-align: justify'.
>
> An alternate way to deal with it is by making 'text-align' a shorthand
> of 'text-align-last'. This has a few benefits:
>
>    1. Solves cascading problem 100%, even for more complex
>       cases that involve a return to 'text-align: justify'.
>
>    2. Allows nice shorthanding of common case with e.g.
>         text-align: justify-all;
>
>    3. Behaves the way authors would expect given 'text-align' is a
>       prefix of 'text-align-last'.
> [...]
> Full proposal would be:
>
>    text-align: <alignment-values>{1,2} | justify-all;
>    -> text-align-all: <alignment-values>;
>    -> text-align-last: auto | <alignment-values>;
>
>    (Alternatively, in this level, we could only allow a single position
>    instead of two.)
>
>    The poetry use case that currently uses two values
>      text-align: start end; /* start-align first line, end-align rest */
>    would become
>      text-align: start-first end;
>    which is probably more understandable anyway. Or we could defer it
>    to L4 in case we want to consider a 'text-align-first' property
>    instead.

Based on discussion from the last telecon
   http://lists.w3.org/Archives/Public/www-style/2013Aug/0242.html
and Bert's email:
   http://lists.w3.org/Archives/Public/www-style/2013Jul/0706.html

Here's the full proposal for L4:

   <alignment> := left | right | center | start | end | justify

   text-align: <'text-align-all'> <'text-align-last'>? | justify-all
   -> text-align-all: start-first end | <alignment>
   -> text-align-last: auto | <alignment>

   * If a line is both first and last, it follows the "first line"
     rule if there's a special one, otherwise it follows the
     "last line" rule.

   * A missing 'text-align-last' value in the shorthand becomes 'auto'.

   (Note: Alternately, we can create a text-align-first property,
    instead of putting 'start-first' as part of text-align-all.
    But I can't think of any reason to want them to cascade
    separately. The text-align-last property has the useful and
    interesting property of controlling unjustifiable lines,
    however, and might have reasons to cascade separately.)

For the subset we'll take for L3, I suggest we leave out the
'start-first' keyword. It lets us think a bit longer about
exactly the right syntax for that.

   text-align: <'text-align-all'> <'text-align-last'>? | justify-all
   -> text-align-all: <alignment>
   -> text-align-last: auto | <alignment>

These match up to Bert's cases as follows:

   1. text-align: start-first end;
      First line start-aligned (left for LTR), subsequent lines end-aligned.

   2. See #1. (Unless someone has a use case for end-aligning the first line,
      in which case we can add text-align: end-first start.)

   3. text-align: left;
      All lines left-aligned.

   4. text-align: right;
      All lines right-aligned.

   5. text-align: center;
      All lines centered.

   6. text-align: justify;
      All lines justified, last (and unjustifiable) lines start-aligned.

   7. text-align: justify left;
      All lines justified, last (and unjustifiable) lines left-aligned.

   8. text-align: justify right;
      All lines justified, last (and unjustifiable) lines right-aligned.

   9. text-align: justify center;
      All lines justified, last (and unjustifiable) lines centered.

   10. text-align: justify-all;
       All lines justified.

   11-15. Not adding top/bottom. I think we've covered all vertical-text
          use cases with just left/right/start/end.

~fantasai

p.s. For the pedants, I'm ignoring the inherit | initial | match-parent
      values for the purposes of this discussion.

Received on Wednesday, 21 August 2013 00:09:29 UTC