NEW 284341
WebKit returns 300x150 for naturalHeight/naturalWidth for SVG-as-an-image with unspecified, percent-valued, or 0 size
https://bugs.webkit.org/show_bug.cgi?id=284341
Summary WebKit returns 300x150 for naturalHeight/naturalWidth for SVG-as-an-image wit...
Daniel Holbert
Reported 2024-12-09 17:01:04 PST
Steps to repro: 1. Visit https://bug1935269.bmoattachments.org/attachment.cgi?id=9442538 EXPECTED RESULTS: The second line of text at the top should say img naturalWidth x naturalHeight: 0 x 0" ACTUAL RESULTS: The second line of text at the top says: naturalWidth x naturalHeight: 300 x 150 Firefox gives expected-results. Chrome gives partly-expected results; they report 0 x 150. Their narrower version of this bug is https://issues.chromium.org/issues/41357911 . There's a more comprehensive test here: https://bug1935269.bmoattachments.org/attachment.cgi?id=9442584 WebKit fails 60 of the subtests there. Chrome fails 24. Firefox passes all of them. See more analysis over on https://bugzilla.mozilla.org/show_bug.cgi?id=1935269 (which I filed in Mozilla's bug tracker but is really tracking a case where Firefox is correct and other browsers are incorrect). The 3rd and 4th comments there have spec quotes that make it pretty-clear that Firefox is correct. heycam also looked at this 5 years ago over in https://bugzilla.mozilla.org/show_bug.cgi?id=1607081#c4 and concluded that it was correct to return 0x0 for this case. I posted some analysis of the relevant WebKit code in https://bugzilla.mozilla.org/show_bug.cgi?id=1935269#c6 -- https://searchfox.org/wubkat/rev/48c752dce43162935898b93cefa254a21a5e84c5/Source/WebCore/svg/graphics/SVGImage.cpp#148-149,172-180 is the main issue where it explicitly sets 300x150 if the size is empty (i.e. if either dimension happens to be 0).
Attachments
Radar WebKit Bug Importer
Comment 1 2024-12-09 20:04:02 PST
Karl Dubost
Comment 2 2024-12-09 20:15:56 PST
Karl Dubost
Comment 3 2025-01-30 21:04:23 PST
When this behavior is fixed, it will create a breakage for iCloud. See https://bugzilla.mozilla.org/show_bug.cgi?id=1923304 So it might need a Quirk at the same time that this is fixed.
Note You need to log in before you can comment on or make changes to this bug.