W3C home > Mailing lists > Public > www-style@w3.org > December 2011

Re: aspect-ratio property

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 2 Dec 2011 16:02:09 -0800
Message-ID: <CAAWBYDB3YfK44woKJ8y=Qa91FbSMcT_VOwz30J9ine2Dvu-39Q@mail.gmail.com>
To: www-style list <www-style@w3.org>
On Wed, Oct 6, 2010 at 11:43 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> So, we talked about aspect-ratio a little while ago.  There was
> general agreement that it sounded like a pretty cool idea, but then
> nobody took it farther, probably because it doesn't have a good home,
> seeing as Box Model 3 is dead at the moment.
>
> I've taken the liberty of drafting up a spec for it, for discussion
> and possible later incorporation into another module -
> <http://www.xanthir.com/:cz9>.
>
> I don't have the language quite right yet, I know.  I want to disallow
> it on table* elements right now, because resolution of it should be up
> to the table-layout algo in play.  Generally, I just want it only
> defined on things in static or positioned flow.  How do I phrase it
> correctly to state that?  I also need to expand my definition of
> "underspecified" to properly handle positioned elements, where
> left/right/top/bottom comes into play as well.

Note: the correct link is now <http://xanthir.com/b4810>.

Fady Samuel has been working on adding this property to WebKit, so I
thought it would be good to revive the discussion.  There are still
some lingering issues I'd like to resolve:

1. I'm still not sure how to resolve the wordsmithing issue in my
original email.

2. The <number> is an open interval, which we consider evil.  However,
it's somewhat unavoidable unless we do something silly like require
the value to be the log of the ratio we want.

dbaron suggested switching this to an explicit ratio with two numbers,
but that doesn't solve the issue at all - now *both* numbers have to
be greater than zero. For example, for "aspect-ratio: 1 .0000001;
width: auto; height: 1px;", the width would get resolved to 1 million
pixels.  As the ratio approaches "1 0", the width approaches infinity.
 The same happens if the first number approaches zero if height is
underspecified instead.

I can resolve this by including zero but making its behavior
discontinuous (probably by saying that "0" is the same as "none").
Thoughts?

3. How should this be interpolated for Transitions/Animations?  Do we
want to make it work like a normal number?  Work in ratio space (if
the number is >1, represent it as "x : 1", if it's <1, represent it as
"1 : 1/x", then interpolate each side)?  Work in log space?  Work in
width/height space instead?  I haven't given this enough thought to
know if any of the preceding are identical, or what each looks like.

~TJ
Received on Saturday, 3 December 2011 00:02:58 GMT

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