Closed Bug 1782025 Opened 3 years ago Closed 3 years ago

Obey contain-intrinsic-size in images

Categories

(Core :: Layout, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
105 Branch
Tracking Status
firefox105 --- fixed

People

(Reporter: Oriol, Assigned: Oriol)

References

Details

Attachments

(1 file)

Bug 1780475 already covered images with size containment in a single axis, but images with size containment in both axes are currently ignoring contain-intrinsic-size and just using 0x0.

Note the spec is not completely clear, but what Chromium does seems reasonable:

  • Per https://drafts.csswg.org/css-contain/#sizing-as-if-empty, an image with size containment is treated as having no natural aspect ratio, and contain-intrinsic-size doesn't change this.
  • An image with size containment is treated as having a natural size of the value provided by contain-intrinsic-size, defaulting to 0x0 for none.

Other approaches can be discussed in https://github.com/w3c/csswg-drafts/issues/7519#issuecomment-1190780627

Bug 1780475 already covered images with size containment in a single
axis, but images with size containment in both axes were still ignoring
contain-intrinsic-size and just using 0x0.

Note the spec is not completely clear about what to do for replaced
elements with size containment, but what Chromium does seems reasonable:

  • No natural aspect ratio, regardless of contain-intrinsic-size.
  • Natural sizes are provided by contain-intrinsic-size (0x0 for none).

https://github.com/w3c/csswg-drafts/issues/7519#issuecomment-1190780627
can discuss other approaches, but for now this patch brings consistency
and makes some tests pass.

Pushed by oriol-bugzilla@hotmail.com: https://hg.mozilla.org/integration/autoland/rev/8baa4dd25fb0 Obey contain-intrinsic-size in images. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 105 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: