Bug 211620 - Incorrect image srcset candidate chosen for <img> cloned from <template>
Summary: Incorrect image srcset candidate chosen for <img> cloned from <template>
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: Safari 13
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords: BrowserCompat, HasReduction, InRadar
: 244815 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-05-08 03:08 PDT by Javan Makhmali
Modified: 2022-09-10 21:17 PDT (History)
12 users (show)

See Also:


Attachments
Minimal test case (833 bytes, text/html)
2020-05-08 03:08 PDT, Javan Makhmali
no flags Details
Screenshot of test case (87.37 KB, image/png)
2020-05-08 03:09 PDT, Javan Makhmali
no flags Details
Browser comparison (252.26 KB, image/png)
2020-05-08 03:58 PDT, Javan Makhmali
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Javan Makhmali 2020-05-08 03:08:16 PDT
Created attachment 398848 [details]
Minimal test case

To reproduce: Open the attached template-img-srcset.html file in Safari on a 2x DPR or higher display.

Expected: Both images load the same URL.

Actual: The first image loads the correct URL. The second image (cloned from a <template>) incorrectly loads the first URL from its srcset.
Comment 1 Javan Makhmali 2020-05-08 03:09:11 PDT
Created attachment 398849 [details]
Screenshot of test case
Comment 2 Javan Makhmali 2020-05-08 03:58:25 PDT
Created attachment 398853 [details]
Browser comparison

Does not occur in Firefox or Chrome (top). Does occur in Safari and Safari Technology Preview (bottom).
Comment 3 Radar WebKit Bug Importer 2020-05-08 15:45:11 PDT
<rdar://problem/63039539>
Comment 4 Ahmad Saleem 2022-08-29 08:05:20 PDT
I am able to reproduce this bug in Safari Technology Preview 152 and Safari 15.6.1 on macOS 12.5.1 using attached test case and it shows "2x" and "1x" while all other browsers show "2x" and "2x".

Weirdly. on iOS 15.6.1 on iPhone 13 Pro Max, it shows "3x" and "1x". Just wanted to share latest testing results. Thanks!
Comment 5 Ryosuke Niwa 2022-08-31 11:27:12 PDT
Pull request: https://github.com/WebKit/WebKit/pull/3864
Comment 6 Anthony Ricaud 2022-09-05 11:00:32 PDT
Based on a Twitter conversation, I've opened bug 244815. This seems very similar.
Comment 7 Ryosuke Niwa 2022-09-10 14:45:44 PDT
*** Bug 244815 has been marked as a duplicate of this bug. ***
Comment 8 Ryosuke Niwa 2022-09-10 15:00:44 PDT
Pull request: https://github.com/WebKit/WebKit/pull/4228
Comment 9 EWS 2022-09-10 21:17:32 PDT
Committed 254361@main (ebdff21ed516): <https://commits.webkit.org/254361@main>

Reviewed commits have been landed. Closing PR #4228 and removing active labels.