Skip to content

CSSImageValue intrinsicWidth/Height should be unsigned long #714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
annevk opened this issue Feb 22, 2018 · 6 comments
Open

CSSImageValue intrinsicWidth/Height should be unsigned long #714

annevk opened this issue Feb 22, 2018 · 6 comments

Comments

@annevk
Copy link
Member

annevk commented Feb 22, 2018

It seems like making these doubles is a mistake?

Wouldn't it be better to make these match (also in name) the naturalWidth/Height attributes of the img element? Seems slightly better to have consistency here? Alternatively perhaps just not expose these?

@tabatkins
Copy link
Member

Ah yes, we should probably match up.

I note that img sets its properties to 0 if they don't exist, rather than making them nullable. Do you know if there's a particular reason for this? An intrinsic zero width/height is an actual thing that you can have, so it's not a very effective sentinel value to mean "stretchy in this dimension".

Right now I'm inclined to make them unsigned long?.

@tabatkins
Copy link
Member

In the interest of giving myself time to get all this right, I've severely trimmed down the API for this level (#716), and this issue is now moot. I'll move it to level 2.

@annevk
Copy link
Member Author

annevk commented Feb 23, 2018

I'm not sure.

@tabatkins
Copy link
Member

K. Absent any further convincing reasoning to match HTML exactly, then, I'll make it nullable. CSS has a lot more stretchy images than HTML tends to have, after all (every gradient!).

@annevk
Copy link
Member Author

annevk commented Feb 24, 2018

I wonder if we can still change HTML or if we want to support lack of height/width differently. It's relevant in HTML too with SVG and such.

@AmeliaBR
Copy link

AmeliaBR commented Mar 2, 2018

Given the discussion in whatwg/html#3510, and the evidence that current browsers are so inconsistent that there is likely no compat issue with changing the HTML behavior, I would argue for harmonizing both the behavior and the names (i.e., "natural" instead of "intrinsic").

To touch on @annevk's initial comment: with pixel density adjustments, it is conceivable that the integral dimensions are not integers when measured in CSS pixels. But I think consistency should probably outweigh mathematical precision in that case.

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

No branches or pull requests

3 participants