WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
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
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