WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
215375
Inserting image with srcset into dynamically created iframe results in invisible image
https://bugs.webkit.org/show_bug.cgi?id=215375
Summary
Inserting image with srcset into dynamically created iframe results in invisi...
Comandeer
Reported
2020-08-11 08:44:33 PDT
Demo of the bug:
https://jsfiddle.net/6Le9nwx7/
Inserting image with [srcset] attribute into dynamically created iframe results in the image that has its natural dimensions set to 0, therefore – it's not visible. Tested on Safari 13.1.2 (15609.3.5.1.3).
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2020-08-11 10:53:27 PDT
<
rdar://problem/66849050
>
Simon Fraser (smfr)
Comment 2
2020-08-11 11:14:30 PDT
Chrome also says 0x0. Firefox gives a size.
Said Abou-Hallawa
Comment 3
2020-08-11 16:44:52 PDT
(In reply to Simon Fraser (smfr) from
comment #2
)
> Chrome also says 0x0. Firefox gives a size.
This happens because the 'sizes' attribute is missing from the <img> tag. So in HTMLImageElement::selectImageSource(), we end up having sourceSize = 0. And in pickBestImageCandidate(), we do this calculation: candidate.density = static_cast<float>(candidate.resourceWidth) / sourceSize; but because sourceSize = 0, we calculate candidate.density = +inf. And in HTMLImageElement::setBestFitURLAndDPRFromImageCandidate(), we do this calculation: m_imageDevicePixelRatio = 1 / candidate.density; So we end up having m_imageDevicePixelRatio = 0. And this is why HTMLImageElement::naturalWidth() returns zero.
Ahmad Saleem
Comment 4
2023-03-31 22:47:04 PDT
(In reply to Comandeer from
comment #0
)
> Demo of the bug:
https://jsfiddle.net/6Le9nwx7/
> > Inserting image with [srcset] attribute into dynamically created iframe > results in the image that has its natural dimensions set to 0, therefore – > it's not visible. > > Tested on Safari 13.1.2 (15609.3.5.1.3).
Firefox Nightly 113: 300x372 Chrome Canary 113: 300x372 Safari Technology Preview 166: 0x0
Ahmad Saleem
Comment 5
2026-04-01 23:08:36 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/61886
EWS
Comment 6
2026-04-02 10:03:02 PDT
Committed
310446@main
(088193491341): <
https://commits.webkit.org/310446@main
> Reviewed commits have been landed. Closing PR #61886 and removing active labels.
Ahmad Saleem
Comment 7
2026-04-02 11:45:46 PDT
Submitted web-platform-tests pull request:
https://github.com/web-platform-tests/wpt/pull/58959
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug