Re: [svgwg] naturalWidth and naturalHeight in the context of an HTML image (#1044)

Prior to those bugs, I think Gecko matched the spec and passed that WPT; but as @fsoder noted, websites [including parts of the iCloud website] depended on a different behavior, so we changed in favor of webcompat.

We should probably update the test expectations, and (until the spec PR is written/merged) we should rename it to .tentative.  Browsers are interoperable with each other on that whole test except for this part:
```
HTMLImageElement.prototype.naturalWidth/naturalHeight, SVG image, width/height unspecified; viewBox
```

IIRC for that test:
- Gecko uses the default/fallback concrete object size (300x150) to get a `naturalWidth` of `300px`, and then we use the `viewBox`'s aspect-ratio to derive a `naturalHeight` from that.
- Chromium does the same except they prefer to start with the height; so they use a `naturalHeight` of 150px and then they use the aspect-ratio to derive the `naturalWidth` from that. (200px in this case)
- WebKit just directly uses the size of the `viewBox` as if it were a width and height (possibly with some offsetting for border/padding, I'm guessing -- something apparently gets subtracted from the `viewBox`'s 800px-width to yield WebKit's width of `767`).

-- 
GitHub Notification of comment by dholbert
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/1044#issuecomment-3672360983 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 18 December 2025 21:36:37 UTC