html icon indicating copy to clipboard operation
html copied to clipboard

Rename 'intrinsic dimensions' to 'natural dimensions' to match CSS

Open zcorpan opened this issue 3 years ago • 1 comments

Fixes #6233.


/canvas.html ( diff ) /dnd.html ( diff ) /embedded-content-other.html ( diff ) /embedded-content.html ( diff ) /imagebitmap-and-animations.html ( diff ) /images.html ( diff ) /infrastructure.html ( diff ) /input.html ( diff ) /media.html ( diff ) /references.html ( diff ) /rendering.html ( diff )

zcorpan avatar Aug 09 '22 14:08 zcorpan

This is blocking #8008

zcorpan avatar Aug 11 '22 07:08 zcorpan

if CSS's "natural width" = our definition of "natural width"

AFAICT that's the case.

zcorpan avatar Aug 15 '22 15:08 zcorpan

@tabatkins would you like to review this, to verify it still makes sense from CSS's point of view?

zcorpan avatar Aug 15 '22 15:08 zcorpan

CSS isn't sufficiently well-specified here, but afaict we do intend for "natural dimensions" to refer to the density-corrected values. See, for example, https://w3c.github.io/csswg-drafts/css-images-4/#preferred-resolution. And in general we use "natural dimensions" when doing things like sizing, which definitely uses the density-corrected values or else it would be nonsensical.

tabatkins avatar Nov 14 '22 22:11 tabatkins

@tabatkins density-corrected from information in the image, or from srcset?

HTML defines "density-corrected natural width and height" for images by dividing natural dimensions by current pixel density: https://whatpr.org/html/8175/ba579d7...74081ef/images.html#density-corrected-natural-width-and-height

zcorpan avatar Mar 08 '23 13:03 zcorpan

The way natural dimensions read to me is as if they are in CSS pixels. Especially given the examples given. I don't think that's accurate for what we want here.

annevk avatar Mar 08 '23 17:03 annevk

Yeah, same as "intrinsic dimensions" before. Why is it not what we want?

zcorpan avatar Mar 09 '23 15:03 zcorpan

How would that make sense for https://html.spec.whatwg.org/#density-corrected-intrinsic-width-and-height, for instance? Or perhaps the problem is that it doesn't make sense today?

annevk avatar Mar 14 '23 11:03 annevk

~The width and height in step 1 are the width and height of the image in image pixels.~ Edit: reading the spec again, step 1 applies density correction from EXIF, and gives a number in CSS pixels.

Maybe there's a bug for the case where that is null, where the pixel density shouldn't be applied. Filed https://github.com/whatwg/html/issues/9023

zcorpan avatar Mar 14 '23 15:03 zcorpan

Maybe step 2 in https://html.spec.whatwg.org/#images-processing-model:preferred-density-corrected-dimensions should say "physical dimensions" (new term) instead of "natural dimensions" (or currently, "intrinsic dimensions"), defined as step 2 in https://html.spec.whatwg.org/#preparing-an-image-for-presentation:preferred-density-corrected-dimensions

the width and height obtained from req's image data, as defined by the relevant codec.

zcorpan avatar May 17 '23 13:05 zcorpan

I don't think we should add a new term. It seems like "natural dimensions" would be correct for step 2, but some context as per #9023 in a note would help make it more understandable what is going on.

annevk avatar May 22 '23 14:05 annevk

Added a note and rebased to resolve conflicts.

zcorpan avatar May 23 '23 11:05 zcorpan

@annevk thanks, fixed. I found some more "natural dimensions" that should be "density-corrected natural width and height" and fixed them also.

zcorpan avatar May 24 '23 21:05 zcorpan

@zcorpan can we move the IDs to the <dfn>? If you're done with this PR I'm happy to do it before merging.

annevk avatar May 25 '23 15:05 annevk

@annevk sure

zcorpan avatar May 25 '23 16:05 zcorpan