W3C home > Mailing lists > Public > www-style@w3.org > January 2012

Re: [css3-text] <spacing-limit> incompatible with calc due to different treatment of lengths and %s

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 6 Jan 2012 08:02:05 -0800
Message-ID: <CAAWBYDA3T=DT_ZK2kCGSe9obJFxrpR4xKTxH8UttWMF5CGxzrg@mail.gmail.com>
To: Stephen Zilles <szilles@adobe.com>
Cc: "fantasai.lists@inkedblade.net" <fantasai.lists@inkedblade.net>, "www-style@w3.org" <www-style@w3.org>
On Thu, Jan 5, 2012 at 8:58 PM, Stephen Zilles <szilles@adobe.com> wrote:
> Tab,
> Apologies for a top post
> I do not see your problem. To me 150% is equivalent to 1.5ch. So, 1.5ch+150%
> is equivalent to 1.5ch+1.5ch. That is, both values return a length and
> lengths add. Why do you think this does not make sense?

The issue is that plain percentages are *not* treated as lengths (they
don't add to the default word-spacing, they add to 0), but percentages
in calc() are turned into lengths.

For a somewhat simpler example that illustrates my point,
"word-spacing: 50%" gives .5 times the default word spacing, while
"word-spacing: calc(50%);" gives 1.5 times the default word spacing.
We should avoid this kind of behavior inconsistency when possible,
which means either (a) changing word-spacing to give %s and lengths
the same behavior, possible with a keyword to switch between the two
types of behavior or something, or (b) change calc() to make
percentages be a returnable unit type.  (Note that B doesn't fix my
earlier example, but it does at least ensure that wrapping a value in
calc() doesn't change the behavior.

Another problem with this behavioral inconsistency is that it's
impossible to properly represent intermediate states in transitions,
unless you resolve the percentage into a (possibly negative) length
and work with that.

Received on Friday, 6 January 2012 16:03:19 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:09 UTC