New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 765095 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 3
Type: Feature



Sign in to add a comment

Incorrect download of hidden background images

Reported by sombragr...@gmail.com, Sep 14 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36

Steps to reproduce the problem:
1. Have hidden elements with background image
2. Open the Dev Tools
3. Reload the page while observing the Network tab. Hidden elements will have their images downloaded nevertheless.

What is the expected behavior?
They should not be downloaded.

What went wrong?
Images are downloaded, hence wasting bandwidth.

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 60.0.3112.113  Channel: stable
OS Version: OS X 10.12.6
Flash Version: Shockwave Flash 27.0 r0

I'm pretty sure this worked before but I'm unsure on when this went awry. Tested this on Canary (63.0.3215.0) too and the issue is happening there too.

I can confirm this doesn't happen on Firefox and Safari.
 
test.html
553 bytes View Download
Components: Blink>CSS Blink>Loader
Labels: OS-Windows
Status: Untriaged (was: Unconfirmed)
Components: -Blink>CSS
Labels: Needs-Bisect
Adding Needs-Bisect, we'd like to see if this is actually a regression, and if so when it regressed.
Cc: susanjuniab@chromium.org
Labels: Needs-Triage-M60 Needs-Feedback
sombragriselros@ thanks for the issue.

Tested this issue on Windows 7 and Mac OS 10.12.6 on the latest Stable 61.0.3163.91 and latest Canary 63.0.3219.0 using the below steps.

1. Launched Chrome and opened the attached .html on chrome.
2. Opened Devtools and navigated to Networks tab and reloaded the page.
3. Could observe that the files are getting downloaded.

tested this issue on 50.0.2625.0 chrome version as well and could observe the same behavior. 
Please find the attached screen-shots for reference.

Can you please provide us the screen-shot/cast of the expected behavior for better understanding of the issue.

Thanks..


765095_latest-canary.png
106 KB View Download
765095-M50chrome.png
120 KB View Download
Hello Susan,

The cute_unicorn image shouldn't be downloaded at all. Background is hidden hence it shouldn't be downloaded. This behaviour can be seen on other browsers as you can see on the screenshots.

I also think it makes sense to be able to save bandwidth. Seems counter intuitive to have to manually set a background image to none on mobile devices.
Firefox.png
294 KB View Download
Safari.png
300 KB View Download
Image doesn't get downloaded if parent is hidden and it's a background. 

Image elements seem to be always downloaded nevertheless, consistently with all browsers.

This doesn't seem consistent to me and adding the need to wrap the element to hide it to avoid the download seems a bit tedious and counter intuitive IMHO.
Cc: rbasuvula@chromium.org
Labels: -Needs-Feedback -Needs-Bisect M-64 OS-Linux
Thanks for the update! This is a Non-Regression issue since seeing this from M50 #50.0.2625.0, Making the status in Untriaged only so that the issue would get addressed.

Could some one from Blink>Loader dev team please look in to this issue.

Note : Able to reproduce the issue in Linux Ubuntu 14.04.

Thank you.
Cc: yhirano@chromium.org
Components: -Blink>Loader Blink>CSS
We, the loading module, don't know whether an image is hidden or not. The CSS module knows that, so adding Blink>CSS.
Cc: futhark@chromium.org
ElementStyleResources::LoadPendingResources seems to load resources based on which ComputedStyles were constructed. I did some testing with background-image which shows:

* We load background-image for the root element of a display:none subtree simply because we compute style to figure out that it's display:none.
* We also load background-image for visibility:hidden and display:contents.
* We do not load background-image for other elements in a display:none subtree.
* We load background-image for an element in a display:none subtree if we query the style through getComputedStyle(). You can query any property to trigger the load, the essential thing is that the ComputedStyle is constructed.

I haven't tested any other browsers or looked at any specs.

Any changes in the policy here is probably done in ElementStyleResources based on the passed in ComputedStyle.

Labels: -Type-Bug -Pri-2 -Hotlist-Interop Performance-Loading Pri-3 Type-Feature
Status: Available (was: Untriaged)
Thanks for the investigation Rune. This doesn't sound like an interop/correctness  issue as the page displays fine, but it may cause additional bandwidth use. 

It's been around for a while (see 5 year old question at https://stackoverflow.com/questions/12158540/does-displaynone-prevent-an-image-from-loading).

I'll mark this as available, as it's a potential optimisation.
Project Member

Comment 11 by sheriffbot@chromium.org, Dec 3

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: Available (was: Untriaged)

Sign in to add a comment