Skip to content

HTML: correct naturalWidth and naturalHeight for SVG#59304

Merged
annevk merged 2 commits into
masterfrom
annevk/naturalwidthheight
Apr 22, 2026
Merged

HTML: correct naturalWidth and naturalHeight for SVG#59304
annevk merged 2 commits into
masterfrom
annevk/naturalwidthheight

Conversation

@annevk
Copy link
Copy Markdown
Member

@annevk annevk commented Apr 17, 2026

The change from the tentative version is that image density does not impact the 300 x 150 fallback so when intrinsic dimensions are missing we use the same values in the API and rendering.

This complements whatwg/html#12382.

Copy link
Copy Markdown
Contributor

@dholbert dholbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me - thank you! I included one inline suggestion to validate the new that the data-density attribute is set to something that we recognize. LGTM either way.

Copy link
Copy Markdown
Contributor

@dholbert dholbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one request-change thing, actually, to help screen for incorrect implementations of the new rule that we're adding here...

annevk added 2 commits April 22, 2026 08:12
The change from the tentative version is that image density does not impact the 300 x 150 fallback so when intrinsic dimensions are missing we use the same values in the API and rendering.

This complements whatwg/html#12382.
@annevk annevk force-pushed the annevk/naturalwidthheight branch from 844b538 to 368925a Compare April 22, 2026 15:42
@annevk annevk merged commit 4a0dd70 into master Apr 22, 2026
19 checks passed
@annevk annevk deleted the annevk/naturalwidthheight branch April 22, 2026 16:03
annevk added a commit to whatwg/html that referenced this pull request Apr 22, 2026
… dimension

Unfortunately the more correct behavior was never implemented widely enough and web content started to depend on these properties being non-0.

We take special care that dimensions that are missing do not get divided by density so we return the same values for them as CSS (300 by 150).

Tests: web-platform-tests/wpt#59304.

Fixes #11287.
noamr pushed a commit to whatwg/html that referenced this pull request May 13, 2026
… dimension

Unfortunately the more correct behavior was never implemented widely enough and web content started to depend on these properties being non-0.

We take special care that dimensions that are missing do not get divided by density so we return the same values for them as CSS (300 by 150).

Tests: web-platform-tests/wpt#59304.

Fixes #11287.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants