Re: [css3-writing-modes] a third option for implementing logical properties

On Oct 24, 2010, at 5:32 PM, Håkon Wium Lie wrote:

> Also sprach David Hyatt:
> 
>> What about allowing named sub-blocks within a declaration block?
>> Then everything could cascade properly. Maybe via a new @-rule.
>> 
>> @writing-mode p {
>> 	horizontal {
>> 		margin: 1em 0;
>> 	}
>> 	vertical {
>> 		margin: 0 1em;
>> 	}
>> }
> 
> Hmm. So, you're branching based on the computed value of
> 'writing-mode'? In principle, you could use the same syntax for other
> properties, e.g.:
> 
>  @font-style p {
>    italic {
>      color: red;
>    }
>    normal {
>      color: blue;
>    }
>  }
> 
> (Not that I would encourage it.)
> 

Yeah, basically.  Engines already have to collect the rules and then do a first pass to resolve the properties that the other ones depend on (font, direction, writing-mode) and then do a second pass to compute the values for the other properties.  This means the solution above should be easily implementable in any engine.

> I'm not sure we need per-element switches, though. I think the use
> case is more for different document modes. For example, a button on a
> Japanese tablet that toggles between vertical and horizontal layout.

That's one thing I'm wondering as well.  Is there really any desire to be abstract at the element level (other than on the part of the UA, who can always just use internal logical properties that aren't exposed to authors)?  If the switching really is done at a document level, then a media query makes a lot of sense.

It's really a question of whether the logical properties will make authoring significantly easier for those who wish to use them.  I don't know enough about Japanese text layout to say for sure.  I suppose it's a question of how big the stylesheets are for these documents and how many rules you would have to duplicate in order to support both modes.

dave
(hyatt@apple.com)

Received on Sunday, 24 October 2010 23:02:27 UTC