← Back to release summary

object-fit and object-position apply to SVG documents in <object> and <embed>

Category
CSS
Type
Chromium catches up
Status
Proposed (Chrome Proposed)
Intent stage
None

WPT details: https://wpt.fyi/results/css/css-images/object-fit-contain-svg-001e.html https://wpt.fyi/results/css/css-images/object-fit-contain-svg-001o.html https://wpt.fyi/results/css/css-images/object-fit-contain-svg-002e.html https://wpt.fyi/results/css/css-images/object-fit-contain-svg-002o.html https://wpt.fyi/results/css/css-images/object-fit-contain-svg-003e.html https://wpt.fyi/results/css/css-images/object-fit-contain-svg-003o.html https://wpt.fyi/results/css/css-images/object-fit-contain-svg-004e.html https://wpt.fyi/results/css/css-images/object-fit-contain-svg-004o.html https://wpt.fyi/results/css/css-images/object-fit-contain-svg-005e.html https://wpt.fyi/results/css/css-images/object-fit-contain-svg-005o.html https://wpt.fyi/results/css/css-images/object-fit-contain-svg-006e.html https://wpt.fyi/results/css/css-images/object-fit-contain-svg-006o.html https://wpt.fyi/results/css/css-images/object-fit-cover-svg-001e.html https://wpt.fyi/results/css/css-images/object-fit-cover-svg-001o.html https://wpt.fyi/results/css/css-images/object-fit-cover-svg-002e.html https://wpt.fyi/results/css/css-images/object-fit-cover-svg-002o.html https://wpt.fyi/results/css/css-images/object-fit-cover-svg-003e.html https://wpt.fyi/results/css/css-images/object-fit-cover-svg-003o.html https://wpt.fyi/results/css/css-images/object-fit-cover-svg-004e.html https://wpt.fyi/results/css/css-images/object-fit-cover-svg-004o.html https://wpt.fyi/results/css/css-images/object-fit-cover-svg-005e.html https://wpt.fyi/results/css/css-images/object-fit-cover-svg-005o.html https://wpt.fyi/results/css/css-images/object-fit-cover-svg-006e.html https://wpt.fyi/results/css/css-images/object-fit-cover-svg-006o.html https://wpt.fyi/results/css/css-images/object-fit-dyn-aspect-ratio-001.html https://wpt.fyi/results/css/css-images/object-fit-dyn-aspect-ratio-002.html https://wpt.fyi/results/css/css-images/object-fit-fill-svg-001e.html https://wpt.fyi/results/css/css-images/object-fit-fill-svg-001o.html https://wpt.fyi/results/css/css-images/object-fit-fill-svg-002e.html https://wpt.fyi/results/css/css-images/object-fit-fill-svg-002o.html https://wpt.fyi/results/css/css-images/object-fit-fill-svg-003e.html https://wpt.fyi/results/css/css-images/object-fit-fill-svg-003o.html https://wpt.fyi/results/css/css-images/object-fit-fill-svg-004e.html https://wpt.fyi/results/css/css-images/object-fit-fill-svg-004o.html https://wpt.fyi/results/css/css-images/object-fit-fill-svg-005e.html https://wpt.fyi/results/css/css-images/object-fit-fill-svg-005o.html https://wpt.fyi/results/css/css-images/object-fit-fill-svg-006e.html https://wpt.fyi/results/css/css-images/object-fit-fill-svg-006o.html https://wpt.fyi/results/css/css-images/object-fit-none-svg-001e.html https://wpt.fyi/results/css/css-images/object-fit-none-svg-001o.html https://wpt.fyi/results/css/css-images/object-fit-none-svg-002e.html https://wpt.fyi/results/css/css-images/object-fit-none-svg-002o.html https://wpt.fyi/results/css/css-images/object-fit-none-svg-003e.html https://wpt.fyi/results/css/css-images/object-fit-none-svg-003o.html https://wpt.fyi/results/css/css-images/object-fit-none-svg-004e.html https://wpt.fyi/results/css/css-images/object-fit-none-svg-004o.html https://wpt.fyi/results/css/css-images/object-fit-none-svg-005e.html https://wpt.fyi/results/css/css-images/object-fit-none-svg-005o.html https://wpt.fyi/results/css/css-images/object-fit-none-svg-006e.html https://wpt.fyi/results/css/css-images/object-fit-none-svg-006o.html https://wpt.fyi/results/css/css-images/object-fit-scale-down-svg-001e.html https://wpt.fyi/results/css/css-images/object-fit-scale-down-svg-001o.html https://wpt.fyi/results/css/css-images/object-fit-scale-down-svg-002e.html https://wpt.fyi/results/css/css-images/object-fit-scale-down-svg-002o.html https://wpt.fyi/results/css/css-images/object-fit-scale-down-svg-003e.html https://wpt.fyi/results/css/css-images/object-fit-scale-down-svg-003o.html https://wpt.fyi/results/css/css-images/object-fit-scale-down-svg-004e.html https://wpt.fyi/results/css/css-images/object-fit-scale-down-svg-004o.html https://wpt.fyi/results/css/css-images/object-fit-scale-down-svg-005e.html https://wpt.fyi/results/css/css-images/object-fit-scale-down-svg-005o.html https://wpt.fyi/results/css/css-images/object-fit-scale-down-svg-006e.html https://wpt.fyi/results/css/css-images/object-fit-scale-down-svg-006o.html

Summary

SVG documents loaded through <object> or <embed> are sized and positioned inside the element's content box according to the CSS object-fit and object-position properties, the same way <img> content is. Previously Chrome ignored both properties for embedded SVG documents and always stretched the document viewport to the whole content box.

Motivation

Authors use object-fit and object-position to control how replaced content is scaled and placed inside its box. https://drafts.csswg.org/css-images-3/#the-object-fit https://drafts.csswg.org/css-images-3/#the-object-position Currently, Chrome applies them to images and videos but ignores them for SVG documents loaded through <object> or <embed>, which are always stretched to fill the element. The fix has been implemented behind the SVGEmbeddedAsReplacedElement flag since M141. This entry ships it by default.

Standards & signals

Ecosystem

View on chromestatus.com