W3C home > Mailing lists > Public > www-style@w3.org > June 2010

Re: [css3-text-layout] New editor's draft - margin-before/after/start/end etc.

From: Håkon Wium Lie <howcome@opera.com>
Date: Wed, 2 Jun 2010 23:09:54 +0200
Message-ID: <19462.51362.33086.761203@gargle.gargle.HOWL>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: Håkon Wium Lie <howcome@opera.com>, www-style list <www-style@w3.org>
Also sprach Boris Zbarsky:

 > > For example, 'margin-start: 10px' is an alias that is resolved when
 > > the computed value of 'writing-mode' has been determined;
 > > 'margin-start' is then resolved into 'margin-left: 10px', 'margin-top:
 > > 10px', or 'margin-right: 10px' (as you show in [1]).
 > 
 > So this is happening on the _computed_ style level, not specified style, 
 > right?

nYes. "margin-start: 10px" is specified in the style sheets, but
thereafter everything done at the computed style level. That's the
only way I can see it work, at least.

 > > Likewise, when the value of 'margin-start' is queried through the DOM,
 > > 'writing-mode' will be consulted to determine which of 'margin-left',
 > > 'margin-top', 'margin-right' that should be consulted to determine the
 > > value. (Or, alternatively, one could leave it to an external
 > > script/library to do this job.)
 > 
 > Is the above talking about getComputedStyle?  I would certainly hope 
 > that given:
 > 
 >    <span style="margin-start: 20px;"
 >          onclick="alert(this.style.getPropertyValue('margin-start'));">
 >      Click me
 >    </span>
 > 
 > the value alerted doesn't depend on any computed writing-mode values!  I 
 > would _especially_ hope that's the case for:
 > 
 >    <style id="x">
 >      * { margin-start: 20px; }
 >    </style>
 >    <script>
 >      alert(document.getElementById("x").sheet.cssRules[0].style
 >                    .getPropertyValue("margin-start"));
 >    </script>
 > 
 > since in that case there's no way to even talk about "the value of 
 > writing-mode" in a sane way.

getComputedStyle should work, no?

  http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSview-getComputedStyle

It seems fair that one cannot expect APIs meant for specified property
values to work for aliases -- 'margin-start' is an alias, not a
property. However, it also seems right that there should be a way to
get the computed value of 'margin-start' -- even if it involves going
through 'writing-mode'.

Cheers,

-h&kon
              Håkon Wium Lie                          CTO °þe®ª
howcome@opera.com                  http://people.opera.com/howcome
Received on Wednesday, 2 June 2010 21:10:35 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:28 GMT