Open Bug 827342 Opened 12 years ago Updated 2 years ago

Jpeg images as css background do not render until loading is completed

Categories

(Core :: Layout: Images, Video, and HTML Frames, enhancement)

enhancement

Tracking

()

People

(Reporter: striptm, Unassigned)

References

()

Details

Attachments

(3 files, 1 obsolete file)

As indicated in the article: http , the images included as css background are not displayed until the download is completely finished.

The attended result, specially with jpeg progressive, is to be displayed at the same time as it is being downloaded, as with the <img/> tag.
That's ... odd.  It looks like the notification stuff in ImageLoader is correct.
Attached file Test case (html) (obsolete) —
I may need a slower net connection to reproduce this. :(
Attachment #698753 - Attachment is obsolete: true
I'm adding a small test case.
I've tested in linux with:
iprelay -b2500 8000:localhost:80

In Firefox you can see that the <img/> are displayed at the same time as the are being downloaded, and the backgrounds appear only when finished.
In webkit, the result is the same.
nsImageRenderer::PrepareImage returns false if !IsComplete().  I would assume that's what causes the behavior.

If so, that dates back to a STATUS_FRAME_COMPLETE that was added in cvs rev 3.172 of nsCSSRendering.cpp:

  3.172 <kmcclusk@netscape.com> 2002-03-22 20:33
  suppress the painting of partially decoded background images bug 129908; r=pavlov
  sr=attinasi a=asa

Brings back memories... ;)

In any case, it's not clear to me what would break, if anything, if this check were now removed.
From bug 129908 comment 0:

"Since we do not incrementally display background images as image data arrives we
should not display partially decoded background images when painting damaged
areas,  We should wait until they are fully loaded before painting them."

But we should be incrementally displaying them now given the notifications we have wired up.
(So it seems like there is no reason to keep that bug's behavior).
Well, it might still be preferable to have background images appear all at once rather than in horizontal slices; especially for tiled images, that might be a poor user experience (though we're probably not the best people to answer that).  Progressive JPEGs might be different from other incremental loading of images (since we're dealing with the full frame but at lower quality).
Product: Core → Core Graveyard
Product: Core Graveyard → Core
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: