Re: [css-images] Overconstrained image sizing and preserving aspect ratio: the object-sizing property

On 9 Feb 2014, at 6:24 pm, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> On Sun Feb 09 2014 at 5:17:14 PM, Dean Jackson <dino@apple.com> wrote:
> 
> On 7 Feb 2014, at 3:07 pm, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> 
> > On Fri, Feb 7, 2014 at 2:32 PM, Edward O'Connor <eoconnor@apple.com> wrote:
> >>> I'm fine with "prefer-intrinsic", or something similar, for the one
> >>> that just upgrades the power of an intrinsic aspect ratio.
> >>
> >> Dean keeps typing "preserve-intrinsic," which might be a hint that
> >> "preserve" is a better term than "prefer." *shrug*
> >
> > I'm thinking that we want the keyword for intrinsic AR and the keyword
> > for calculated AR from width/height to be similar, and there's nothing
> > to "preserve" in the latter.
> >
> > Let's stick with the image-resolution:from-image precedent, and do
> > "from-intrinsic" and "from-dimensions" (or "from-size"?) as the two
> > keywords?
> 
> First up, let me apologize for sending an email about CSS to the www-shadow-dom-fighting list.
> 
> I’ve got an implementation of this aspect-ratio/object-sizing thing mostly working (and it improves the cases we were hitting, so I’m fairly happy). Now I need an actual specification to conform to, and I think it might require a fair amount of patchwork into the existing CSS layout specs.
> 
> Tab, are you willing to expand your official blog post on aspect-ratio into something on dev.w3.org?
> 
> I think we’re agreed on:
> 
> 1. Adding aspect-ratio: from-intrinsic; (and from-dimensions or from-size)
> 2. Having this value somehow interrupt the typical sizing algorithm to value the aspect-ratio over other sizing contraints (this is where it gets tricky, and will probably require a lot of review)
> 
> I’ve only implemented this for replaced elements, but I’m fine with it applying to everything, as long as someone writes the spec.
> 
> My current implementation is intentionally hacky, because I was trying to see if the behaviour was useful. I apply an override after the existing layout has happened, and reduce either width or height until we meet the specified aspect ratio. This means you can end up with something that is sized smaller than min-width or min-height, but Tab’s blog post says that you should just ignore the aspect-ratio property in this case (do we really want this?)
> 
> My blog post should *not* be followed.  It was written early in my speccing career, and it doesn't actually make much sense.
> 
> I'm happy to redefine 'aspect-ratio', and put it in the Sizing module.

Great. It would be really nice if this could be specced sort-of the way I’ve hacked it: something that adjusts the size after all the regular layout rules apply. However, I expect there are a few dragons in there, given how complicated the layout algorithm already is.

Dean

Received on Monday, 10 February 2014 02:30:22 UTC