Closed Bug 1886745 Opened 8 months ago Closed 6 months ago

object-fit is broken for elements with contain: size

Categories

(Core :: Layout: Images, Video, and HTML Frames, defect)

defect

Tracking

()

RESOLVED FIXED
128 Branch
Tracking Status
firefox126 --- wontfix
firefox127 --- wontfix
firefox128 --- fixed

People

(Reporter: zcorpan, Assigned: emilio)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

See https://github.com/whatwg/html/issues/10079#issuecomment-2010809133

object-fit doesn't work with contain: size. Demo: https://codepen.io/eeeps/pen/dyLNEdN

From the spec issue, it's not clear if we want to use the aspect ratio from the image data, as in img.naturalWidth/img.naturalHeight or use contain-intrinsic-size. But right now we just stretch the image.

This issue (on today's CSSWG agenda) seems related, too: https://github.com/w3c/csswg-drafts/issues/10116

Severity: -- → S3
See Also: → 1895541
Duplicate of this bug: 1895541

We were already doing the right thing for canvas/video.

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/685ef9cd0166 Ignore containment for object-fit computation. r=dholbert,layout-reviewers
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch

The patch landed in nightly and beta is affected.
:emilio, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox127 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: