Open vmpstr opened 2 years ago
contain-intrinsic-size should have no direct interaction with this object-view-box; the two are operating on different concepts and at different "times", so they'll each just do their own thing.
In particular, c-i-s sets the "explicit intrinsic inner size", which is a term of art defined to have an effect on how a contain:paint element is sized (it overrides the results of calculating the size of the element's content); this is unrelated to the natural sizes of a replaced element, which are derived directly from the image/etc.
o-v-b just changes how the image content itself reports its natural sizes and paints itself relative to those natural-size bounds; layout of the image into whatever layout-based sizes you get happen after that. As far as all of layout is concerned, you've just loaded an image whose natural dimensions are now what o-v-b reports, and which might paint slightly oddly (outside the bounds of those natural sizes); in all other respects it's identical to how the image would have originally worked without o-v-b.
The fact that these questions are coming up at all, tho, indicates that I almost certainly do need to go ahead and define some more terms to make this layering more explicit; I was trying to avoid that.
@tabatkins, IIUC your comment correctly contain-intrinsic-size should only be an input to the layout of the replaced element. This is the order of operations done during layout :
Once the element has been sized, the object-fit and object-position properties used to paint the element work on the natural size of the element's content (which may have been updated using object-view-box). At paint time, contain-intrinsic-size has no effect. Does that sound right?
Correct.
object-view-box
property says thatMy interpretation of this is that we use the element's natural size in conjunction with the viewbox size to do some math and figure out new positions and sizes. My question is what happens if the element has size containment and a specified
contain-intrinsic-size
, which says thatSo should the math that we do use the original element content size (say original image's natural dimensions), or should it use the
contain-intrinsic-size
"overrides". And in general, should size-containment andcontain-intrinsic-size
apply before theobject-view-box
property? I think that if there is size containment with nocontain-intrinsic-size
then we would ignore theobject-view-box
property because it would have 0 intrinsic dimensions. Should be ignore the viewbox even if there iscontain-intrinsic-size
or is it a matter of which sizes we use for computing the painted output dimensions/positionsI'm not sure if there is a important distinction between "natural" sizes and "intrinsic" sizes that should be called out.
/cc @khushalsagar @tabatkins