Bug 192147 - Multiple Picture Sources Downloading width media-query
Summary: Multiple Picture Sources Downloading width media-query
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: Safari 12
Hardware: Mac macOS 10.13
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-11-29 06:37 PST by Yvain Liechti
Modified: 2018-11-29 11:01 PST (History)
6 users (show)

See Also:


Attachments
html file for test (1.58 KB, text/html)
2018-11-29 06:37 PST, Yvain Liechti
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yvain Liechti 2018-11-29 06:37:56 PST
Created attachment 356003 [details]
html file for test

Maybe related to #159484

When the html file join to this ticket is loaded in a small viewport (400px for example), any image from first <source> should not be loaded.

Currently on 400px wide viewport `https://dummyimage.com/512x450/100` (`https://dummyimage.com/1024x900/300` on retina screen) is loaded uselessly in addition to the one needed (`https://dummyimage.com/640x900/030` or `https://dummyimage.com/1280x1800/060` for retina screen).

```
    <picture>
        <source media="(min-width: 40rem)" srcset="
                https://dummyimage.com/256x225/100 256w,
                https://dummyimage.com/512x450/100 512w,
                https://dummyimage.com/1024x900/300 1024w,
                https://dummyimage.com/2048x1800/600 2048w,
                https://dummyimage.com/4096x3600/900 4096w" sizes="100vw">
        <img src="https://dummyimage.com/640x900/006" srcset="
                https://dummyimage.com/640x900/030 640w,
                https://dummyimage.com/1280x1800/060 1280w" sizes="100vw" alt="">
    </picture>
```
Comment 1 Colin Bendell 2018-11-29 08:28:33 PST
Looks like a preloader problem with media queries using `rem` or `em`. If the mq uses absolute `px` this problem does not appear.

* First mq is always selected when only relative units are available, adjusted later by the loader (2nd request)
* First mq with absolute unites will be selected, adjusted later by the loader
Comment 2 Radar WebKit Bug Importer 2018-11-29 11:01:28 PST
<rdar://problem/46347476>