Bug 284341
Summary: | WebKit returns 300x150 for naturalHeight/naturalWidth for SVG-as-an-image with unspecified, percent-valued, or 0 size | ||
---|---|---|---|
Product: | WebKit | Reporter: | Daniel Holbert <dholbert> |
Component: | SVG | Assignee: | Karl Dubost <karlcow> |
Status: | NEW | ||
Severity: | Normal | CC: | emilio, heycam, karlcow, sabouhallawa, webkit-bug-importer, zimmermann |
Priority: | P2 | Keywords: | BrowserCompat, InRadar |
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Daniel Holbert
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/141196049>
Karl Dubost
Pull request: https://github.com/WebKit/WebKit/pull/37685
Karl Dubost
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.