[Webkit-unassigned] [Bug 215375] Inserting image with srcset into dynamically created iframe results in invisible image

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 11 16:44:52 PDT 2020


https://bugs.webkit.org/show_bug.cgi?id=215375

--- Comment #3 from Said Abou-Hallawa <sabouhallawa at apple.com> ---
(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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200811/e65d478b/attachment.htm>


More information about the webkit-unassigned mailing list