[css3-images] Some issues with 'object-fit'/'object-position'

Hi CSS WG,

At the SVG WG's F2F meeting last week we took another look at
'object-fit'/'object-position'[1]. Of particular concern to us is how these new
CSS properties interact with SVG's existing mechanism for describing
fit/position (the preserveAspectRatio attribute[2]), and compatibility between
the CSS and the existing/old SVG mechanism.

Loosely speaking it seems like the interaction should be as follows:

-------------------------------------------------------------------
When deciding how to fit/position an embedded resource:

  1) if values for 'object-fit'/'object-position' are specified
     for the embedding element by the author, use those, else;

  2) if the embedding element supports a legacy method for specifying
     fit/position behavior, use that mechanism's specified/default
     behavior, else;

  3) if the embedded resource has its own specified or default
     fit/position behavior, use that, else;

  4) use the CSS/embedding element's default fit/position behavior.
-------------------------------------------------------------------

The way the specification for 'object-fit'/'object-position' is currently
written does not seem to leave scope for steps #2-4.

Regarding #3, the initial values for the properties are |object-fit: fill;
object-position: 50% 50%|, which is compatible with the way implementations
treat embedded raster images. However, it is incompatible with the way
implementations currently handle embedded SVG by default (the default for SVG's
preserveAspectRatio is equivalent to |object-fit: contain; object-position: 50%
50%|), and incompatible in that implementations will currently honor the various
values of preserveAspectRatio that can be explicitly specified in embedded SVG.

Regarding #2, this is in reference to SVG elements such as SVG <image> which
support the preserveAspectRatio attribute on themselves so that authors can
provide/override fit/position behavior for the embedded resource.

While user agent style sheet rules could be used as part of the solution here,
there are currently no values for 'object-fit' and 'object-position' that would
allow the fit/position behavior to come from the embedded resource. It seems
like both 'object-fit' and 'object-position' need new 'auto' values that are
their initial values in order to support this and to be compatible with existing
implementations that support SVG.

Regards,
Jonathan

1. http://dev.w3.org/csswg/css3-images/#object-fit0
2. http://www.w3.org/TR/SVG11/coords.html#PreserveAspectRatioAttribute

Received on Monday, 7 March 2011 01:17:12 UTC