Skip to content
This repository has been archived by the owner on Jan 9, 2020. It is now read-only.

How does 'intrinsicsize' work with 'object-fit' #14

Open
loonybear opened this issue Apr 26, 2019 · 5 comments
Open

How does 'intrinsicsize' work with 'object-fit' #14

loonybear opened this issue Apr 26, 2019 · 5 comments

Comments

@loonybear
Copy link
Collaborator

This concern was bought up here. Images get distorted when using object-fit.

@dvoytenko proposed a feasible solution could be forcing object-fit:contain instead of the default object-fit:fill when 'intrinsicsize' is specified.

@fantasai
Copy link

Squishing images is problematic for photographs, but it's not that crazy for vector graphics. So it's not clear to me that this would be Web-compatible.

@dvoytenko
Copy link

@fantasai to clarify:

  1. The squishing would happen only if the actual size is different from declared size.
  2. Hopefully, it's a default at the lowest level of specificity and can be easily changed in the stylesheet.
  3. It's there to avoid stretching or otherwise deforming the image, which is arguably worse.

@fantasai
Copy link

@dvoytenko What I'm saying is that this behavior of images, that they deform when resized to a different aspect ratio, has been built into how the Web renders since the mid 1990s. While on some pages it may be an unintentional error, on others it's probably intentional. I don't think we can change this default behavior.

@dvoytenko
Copy link

@fantasai I think your comment might be more relevant for #4. If you agree, please repost there. The explainer proposes to add a new attribute intrinsicsize and derive the new behavior and default styling from it. It's defined this way to explicitly avoid backward compatibility issues. The #4 makes a case to change the current behavior and that debate is still ongoing there.

@fantasai
Copy link

@dvoytenko I'm not convinced changing object-fit based on the presence of intrinsicsize is a good idea. It's an unexpected interaction, and one more thing for authors to puzzle over...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants