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

Re: [css3-images] interaction of parts of the definitions of object sizing

From: L. David Baron <dbaron@dbaron.org>
Date: Thu, 22 Mar 2012 18:10:24 -0700
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: www-style@w3.org
Message-ID: <20120323011024.GB7398@pickering.dbaron.org>
On Thursday 2012-03-15 17:08 -0700, Tab Atkins Jr. wrote:
> On Wed, Mar 14, 2012 at 1:58 PM, L. David Baron <dbaron@dbaron.org> wrote:
> > http://dev.w3.org/csswg/css3-images/#default-sizing (5.3, Default

> I've substantially reworked this section now to address your comments.
> 
> * "specified size" can now be a width/height *or* a contain/cover
> constraint.  It can also have a rounding constraint in either
> dimension.  This change lets specs directly lean on the algorithm for
> contain/cover stuff or the sort of sizing that background-repeat:round
> or border-image-repeat:round does, without having to redefine it
> themselves every time.

Some comments on the two paragraphs in this section that now begin
with "If the specified size is a "..." constraint":

 * there are two typos repeated in both: "doesnt'" -> "doesn't" and
   "aspec tratio" -> "aspect ratio".

 * The logic is unclear from a formal perspective.  As written, both
   paragraphs have the form:

     If A and B, then do X.  If not-B, then do Y.

   when they really mean:

     If A:
       1. If B, then do X.
       2. If not-B, then do Y.

   I think it would be better to restructure them to this form.
   It's clearer particularly since they break the rule that
   otherwise holds within this list that each bullet is considered
   only when the "If" case at its start is true -- here the relevant
   condition for use of the entire bullet is A (the specified size
   is a "(contain/cover)" constraint) and not A and B (the object
   has an intrinsic aspect ratio).

I still find the "Otherwise:" part of the list (the final bullet)
pretty unclear, but I don't have any suggestions for improvement at
hand.

> * I've moved the list of 2.1 default object sizes to a subsection, and
> also added specified sizes for all of them.

Looks fine.

> * I've addressed both sizing cases in 'border-image' - when the full
> image is originally sized, and when the slices are sized.

Boy, this looks complicated.  I don't have time to review it now.

> * I've split the old "replaced elements" case into three, since it was
> wrong before.  There's now a section for the 'content' property
> (non-replaced, which is all you can do in 2.1), a section for replaced
> elements (just calling out that they *dont'* use the sizing algorithm
> here, and pointing to CSS2.1 sections 10.4 and 10.7 instead), and then
> a section for the *contents* of replaced elements, hooking into
> 'object-fit'.

Seems right.

> * the default sizing algorithm has been expanded to deal with the
> cover/contain constraints and the rounding constraints that the
> specified size may have.  The rounding behavior is a straight
> paraphrase of the text in B&B, so it should definitely be correct.

This seems wrong, since it's at the wrong place.  Doesn't this need
to happen *before* the computation of the size in the other
dimension, i.e., as an adjustment to the specified size rather than
as an adjustment to the concrete object size?

I think the way you have it now, you'll end up with rounding
constraints causing distortion of the aspect ratio.  That is, it no
longer honors this rule in css3-background:
  # If ‘background-repeat’ is ‘round’ for one dimension only and if
  # ‘background-size’ is ‘auto’ for the other dimension, then there
  # is a third step: that other dimension is scaled so that the
  # original aspect ratio is restored. 

(I think border-image slices don't have an equivalent issue because
they always have a specified size in the dimension that crosses the
border.)

> * 'object-fit''s values have been reworded to just declare the
> "specified size" constraints they each provide.

Looks reasonable to me.

> Please review these changes and let me know if you're satisfied with them.

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂
Received on Friday, 23 March 2012 01:10:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:48:53 GMT