Bug 31630 - Avoid downloading CSS background images that will never be visible
Summary: Avoid downloading CSS background images that will never be visible
Status: RESOLVED DUPLICATE of bug 24223
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: HasReduction
Depends on:
Blocks:
 
Reported: 2009-11-18 09:47 PST by Anthony Ricaud
Modified: 2010-02-14 14:26 PST (History)
7 users (show)

See Also:


Attachments
Testcase (302 bytes, text/html)
2009-11-18 09:47 PST, Anthony Ricaud
no flags Details
Shows how an with "! important" overwritten image gets loaded. (45 bytes, text/plain)
2009-12-01 13:56 PST, Martin Klepsch
no flags Details
Shows how an regulary overwritten image gets loaded. (66 bytes, text/plain)
2009-12-01 14:09 PST, Martin Klepsch
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Ricaud 2009-11-18 09:47:46 PST
Created attachment 43437 [details]
Testcase

1. Open the attached testcase
2. Check in the Resources panel or in the Activity window

Actual result:
The image was downloaded

Expected result:
The image wasn't downloaded

Without this behavior, the CSS gradients are less useful since you still download a useless image.

Firefox3.6beta3 is not downloading the image.
Comment 1 Darin Adler 2009-11-19 11:24:17 PST
Hyatt has long been our "what images need to be loaded" strategist. In general there are images and stylesheets and other objects you might wish to not load that need to be loaded to support "preloading" behavior expected by websites or other correctness issues. But obviously, not loading things is *way* better for performance.

Hyatt, can you weigh in on this?
Comment 2 Martin Klepsch 2009-12-01 13:56:34 PST
Created attachment 44099 [details]
Shows how an with "! important" overwritten image gets loaded.

when forcing backgound-image: none; with !important any background-image declaration after that one should be ignored therfore the images should not get downloaded to the client.
Comment 3 Martin Klepsch 2009-12-01 14:09:39 PST
Created attachment 44100 [details]
Shows how an regulary overwritten image gets loaded.

this shows that images that are overwritten simply by a second background assignment are also loaded.
Comment 4 Martin Klepsch 2009-12-01 14:18:09 PST
(In reply to comment #1)
> Hyatt has long been our "what images need to be loaded" strategist. In general
> there are images and stylesheets and other objects you might wish to not load
> that need to be loaded to support "preloading" behavior expected by websites or
> other correctness issues. But obviously, not loading things is *way* better for
> performance.
> 
> Hyatt, can you weigh in on this?

i think it's okay to load images that are just not visible at the beginning (icons for js flash messages for example) but loading images that are overwritten by another property declaration is unneeded.
maybe i'm wrong but i've never seen something like this in js: 
removing a second property declaration in order to make the first declaration used by the browser to render the page.
Comment 5 Hugues Lismonde 2010-02-01 13:48:15 PST
I'll vote for this one too. Overridden background-image should never be downloaded, as Anthony said, it defeats the purpose of using graceful degradation with gradients, shadows, ... (but "invisible" background images should definitively be downloaded/prefetched).
Comment 6 Dave Hyatt 2010-02-14 14:24:54 PST
Yes, this is just a bug.  I think it's already been filed.
Comment 7 Dave Hyatt 2010-02-14 14:26:42 PST

*** This bug has been marked as a duplicate of bug 24223 ***