W3C home > Mailing lists > Public > public-fx@w3.org > January to March 2011

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

From: Jonathan Watt <jwatt@jwatt.org>
Date: Mon, 07 Mar 2011 14:15:52 +1300
Message-ID: <4D7431C8.5010005@jwatt.org>
To: www-style@w3.org, www-svg <www-svg@w3.org>, public-fx@w3.org
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:18:16 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 March 2011 01:18:19 GMT