Closed
Bug 57607
(latebg)
Opened 24 years ago
Closed 21 years ago
background images do not load in background windows (not loaded until paint)
Categories
(Core :: CSS Parsing and Computation, defect)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla1.7beta
People
(Reporter: ezh, Assigned: bzbarsky)
References
(Blocks 1 open bug, )
Details
(Keywords: helpwanted, testcase, topembed-, Whiteboard: [T2])
Attachments
(2 files, 2 obsolete files)
4.64 KB,
application/zip
|
Details | |
67.91 KB,
patch
|
pavlov
:
review+
|
Details | Diff | Splinter Review |
1. Open at least 2 mozilla windows (1 and 2)
2. Enter any URL with big BG pic (for expl: the given URL) to URL bar at one of
them (1)
3. hit enter and quick go to the other window (2)
4. In 2 open some link
5. Now go back to 1 and if you are lucky you should see the page, but the
background is reflowing (loaded, reloaded?).
It happens not every time, but I have seen this many-many time. I'm not sure
about the way I suggested to repro it, but it defenetly happens only when
switching from one window to another.
I saw this on the URL once I visited it for a few days ago.
2000102108
Updated•24 years ago
|
Assignee: asa → clayton
Component: Browser-General → Layout
QA Contact: doronr → petersen
Comment 1•24 years ago
|
||
over to layout
XML/DOM team's turn to triage Clayton's list.
Assignee: clayton → harishd
Triaging clayton's bug list:
------------------------------
To me it looks like some kind of a JS problem. Giving bug to JS people to
investigate.
Assignee: harishd → rogerl
Not sure to whom this bug should go. Starting with Pam.
Assignee: harishd → pnunn
Reporter | ||
Comment 6•24 years ago
|
||
I believe the same thing happens on www.fcenter.ru. Any sugestion?
This sounds more like a paint problem rather than a
decoding problem to me. Reassigning to the rendering folk.
Assignee: pnunn → kmcclusk
Status: ASSIGNED → NEW
Updated•24 years ago
|
Status: NEW → ASSIGNED
Comment 10•24 years ago
|
||
I'm not seeing the problem in a current build on WINNT build id 2001030904.
Marking WORKSFORME.
Target Milestone: --- → Future
Comment 11•24 years ago
|
||
I still see the problem on Build 20010522/WinXP.
Suggest rewording summary: Background image does not load when window is hidden
Also, step 4 on reproduction steps doesn't need to take place.
Comment 12•24 years ago
|
||
*** Bug 65459 has been marked as a duplicate of this bug. ***
Updated•24 years ago
|
Keywords: 4xp,
mozilla0.9.4
Comment 13•23 years ago
|
||
This no longer occurs
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 14•23 years ago
|
||
Mozilla 2001112003
This bug is not fixed. This bug is there. If You do not see it, this will not
make it go away. See how to see this bug at bug 65459.
I typed www.athlonmb.com, pressed [enter], minimized this window, took a long
pause, deminimized this window again and magically background pictures just
started loading.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 17•23 years ago
|
||
Here's an even easier method to reproduce this:
Activate tabbed browsing, check the "Load links in the background" pref and just
middle click on a link that goes to a page which exposes this problem to open it
in a new tab in the background.
Paste the following data:-URL into the location bar as a test case:
data:text/html,<a href="http://www.battle.net/diablo2exp/">Link</a>
All table backgrounds on that page only get loaded after switching to the new
tab; and I've even encountered some pages where not having the backgrounds
loaded yet had funny effects like white text on white background... that sure
does hamper your good browsing experience... :(
![]() |
Assignee | |
Comment 18•23 years ago
|
||
*** Bug 121787 has been marked as a duplicate of this bug. ***
![]() |
Assignee | |
Comment 19•23 years ago
|
||
*** Bug 143274 has been marked as a duplicate of this bug. ***
Updated•23 years ago
|
Summary: background pics are loading when page was loaded in background → background images do not load in background windows
Updated•23 years ago
|
Keywords: mozilla1.0.1
Comment 20•23 years ago
|
||
minusing for now. if a patch emerges, please re-nominate.
Keywords: mozilla1.0.1 → mozilla1.0.1-
Comment 21•23 years ago
|
||
This currently works this way by design. The background image load is initiated
from a paint.
Priority: P4 → P1
Comment 23•22 years ago
|
||
batch: adding topembed per Gecko2 document
http://rocknroll.mcom.com/users/marek/publish/Gecko/Gecko2Tasks.html
Keywords: topembed
Comment 24•22 years ago
|
||
>>This currently works this way by design. The background image load is initiated
from a paint.
This is bad design, don't you think? Causes annoying delays. Same issue with
images that are initially display:none. Causes probs with menus and other
dynamic segments.
Comment 25•22 years ago
|
||
This is an even bigger problem now we have tab groups. It looks silly to have
the background pop in as you change tabs.
Comment 26•22 years ago
|
||
Topembed- as this is not currently blocking a major embedding customer.
Comment 27•22 years ago
|
||
Observed it on w2k 2002050708
Comment 29•22 years ago
|
||
nsbeta1-. Not going to be able to get to this for the next release.
Comment 30•22 years ago
|
||
It also happends with <TD> elements, like this:
<td background="">
Confirmed in Mozilla 1.3b (BuildID 2003021008)
![]() |
Assignee | |
Comment 31•22 years ago
|
||
*** Bug 155962 has been marked as a duplicate of this bug. ***
![]() |
Assignee | |
Comment 32•22 years ago
|
||
*** Bug 93301 has been marked as a duplicate of this bug. ***
![]() |
Assignee | |
Updated•22 years ago
|
Summary: background images do not load in background windows → background images do not load in background windows (not loaded till paint)
Updated•22 years ago
|
QA Contact: praveenqa → dsirnapalli
Comment 33•22 years ago
|
||
*** Bug 208384 has been marked as a duplicate of this bug. ***
![]() |
Assignee | |
Comment 34•22 years ago
|
||
*** Bug 209132 has been marked as a duplicate of this bug. ***
Comment 35•22 years ago
|
||
-> All/All (this occurs on OS X as well)
another obvious case of this can be seen with the bottom attached background
image on this page (and just about any use of css based background images i've
ever done): http://placenamehere.com/neuralustmirror/200202/fun.php?sheet=15
OS: Windows 98 → All
Hardware: PC → All
Updated•22 years ago
|
Alias: latebg
*** Bug 217976 has been marked as a duplicate of this bug. ***
I think the way to fix this is to fix bug 113173, and then convert the image
type in that bug to some sort of image structure that causes the image load to
start.
![]() |
Assignee | |
Comment 38•22 years ago
|
||
Indeed; hence the dependency.
![]() |
Assignee | |
Comment 39•21 years ago
|
||
*** Bug 223690 has been marked as a duplicate of this bug. ***
Comment 40•21 years ago
|
||
*** Bug 216085 has been marked as a duplicate of this bug. ***
Comment 41•21 years ago
|
||
*** Bug 228908 has been marked as a duplicate of this bug. ***
Comment 42•21 years ago
|
||
Just wondering if this bug is fixed now. I couldn't reproduce it when I tried
today, and the bug that it depends on (bug 113173) is marked as fixed.
![]() |
Assignee | |
Comment 43•21 years ago
|
||
Yes, this bug is still alive and well. All you need is a slow link and a
cleared cache to easily reproduce it. ;)
Comment 44•21 years ago
|
||
Ah, so I now see, sorry :) Far more obvious on a 56k than ethernet ;)
Comment 45•21 years ago
|
||
*** Bug 231703 has been marked as a duplicate of this bug. ***
![]() |
Assignee | |
Comment 46•21 years ago
|
||
So the goals here are twofold:
1) Parsing a background URL should _not_ immediately load it. See
http://weblogs.mozillazine.org/hyatt/archives/2004_02.html#004874 (the CSS
load improvements section).
2) The image load should start as early as possible once we know we really need
it.
One possible proposal is as follows:
A) Store the background as a nsIURI* at first (in the nsCSSDeclaration)
B) The first time we compute an nsStyleBackground that wants that background,
kick off the image load. This can be done by
nsCSSCompressedDataBlock::MapRuleInfoInto, perhaps; see the check we already
make for eCSSProperty_font_family. The compressed data block will naturally
save the imgIRequest* pointer in its nsCSSValue (which will need a new type
to handle that and all). This has the problem that to do the load you need
the document (for security checks, if nothing else). We don't have that in
the data block. Maybe the block could just update itself and the
nsCSSStyleRule could have logic to do the load?
This is all great, but the problem here, of course, is that as the image comes
in the relevant frames will need to be invalidated. At the moment, I see no way
to accomplish this given the suggestion above.... There are several options I see:
1) Give the nsCSSCompressedDataBlock a way to invalidate frames or something
(bad idea).
2) Make it possible to add an observer to an imgIRequest (all the frames that
get that struct could add themselves). Pav is likely to protest, I
guess
3) Have the load start in nsCSSCompressedDataBlock and keep the nsImageLoader
stuff as-is; rely on libpr0n to coalesce the loads. This will do a bunch of
work, check cache, sometimes rehit the network, etc, whereas we just want to
use that nice imgIRequest we have there. When it works, it's equivalent to
#2.
4) Do the load from some other totally different spot (eg bug 162253). That
still has all the same invalidation problems.
The invalidation problem is an issue no matter what we do here. Really, option
#2 is the simplest one, in my mind. Everything else is just working around
failings in the libpr0n api....
Note that if option #2 were taken we could remove a bunch of code from
nsImageLoadingContent too (code that handles delivering the notifications it
gets to all the imgIDecoderObservers registered on it).
Comment 47•21 years ago
|
||
Owner is "gone."
Assignee: kmcclusk → nobody
Keywords: mozilla1.0.1- → helpwanted
QA Contact: dsirnapalli → core.layout
Summary: background images do not load in background windows (not loaded till paint) → background images do not load in background windows (not loaded until paint)
![]() |
Assignee | |
Updated•21 years ago
|
Priority: P1 → --
Target Milestone: Future → ---
Component: Layout → Style System (CSS)
![]() |
Assignee | |
Comment 48•21 years ago
|
||
I talked to pav, and he's ok with having an imgILoader method that takes an
imgIRequest and an observer and returns a new imgIRequest for that observer. So
we could even keep using the prescontext's nsImageLoader stuff as we fix this
bug (though it could use some cleanup, really...).
There's still the question of how exactly to munge the style data to work right
(in such a way that background image attributes will work too)....
Comment 49•21 years ago
|
||
*** Bug 235015 has been marked as a duplicate of this bug. ***
![]() |
Assignee | |
Comment 50•21 years ago
|
||
> There's still the question of how exactly to munge the style data to work right
Well, the compressed data block can just kick off image loads -- nsRuleData has
a prescontext member it could use to get the document and such.
Background image attributes are probably best handled by just kicking off the
image load in the attr mapping code as needed (and just having the style struct
be the only thing that's holding on to the imgIRequest).
![]() |
Assignee | |
Comment 51•21 years ago
|
||
This just does background images. I'd like to do list-style-image too, but XUL
does some weird stuff with that one, so I'd like to put that off into a
separate patch. Similarly for url() generated content, maybe (need to think
about that some more).
![]() |
Assignee | |
Comment 52•21 years ago
|
||
Comment on attachment 142661 [details] [diff] [review]
Patch
Stuart, could you take a look at the imgIRequest.idl and imgRequestProxy.cpp
changes? Putting this functionality there seemed more natural than sticking it
on imgILoader, but I suppose I could move it over to imgILoader instead, I
guess....
David, the rest of this needs your review, really. The basic change is the
introduction of the nsCSSValue::Image type which holds the imgIRequest in
addition to the nsCSSValue::URL (the latter stores the original string and
handles equality comparisons). The rest is fallout from this and a bit of
cleanup of image loading in general to share some code. Ideally, I would like
to move towards doing as much image loading as possible through the
nsContentUtils methods so that we don't have to do complicated security checks
all over...
Attachment #142661 -
Flags: superreview?(dbaron)
Attachment #142661 -
Flags: review?(pavlov)
Comment on attachment 142661 [details] [diff] [review]
Patch
The Image nested class needs an mString member for serialization, etc., just
like URL does. Given that, I think it should just inherit from URL.
I also don't see why GetImageValue would require you to include imgIRequest.h
-- just forward declaring (as you do) should be sufficient.
Attachment #142661 -
Flags: superreview?(dbaron) → superreview-
![]() |
Assignee | |
Comment 54•21 years ago
|
||
> I also don't see why GetImageValue would require you to include imgIRequest.h
Because returning an nsIFoo* out of an nsCOMPtr<nsIFoo> involves instantiating
and nsDerivedSafe<nsIFoo>, which you can't do if nsIFoo is only forward-declared.
I'll work on making Image inherit from URL.
Comment on attachment 142661 [details] [diff] [review]
Patch
I'm not sure how the whole thing compiles, then, since I thought declaring
nsCOMPtr<nsIFoo> required the header. Or did we remove the sizeof hack?
![]() |
Assignee | |
Comment 56•21 years ago
|
||
We removed the sizeof hack. See bug 107291.
![]() |
Assignee | |
Comment 57•21 years ago
|
||
Attachment #142661 -
Attachment is obsolete: true
![]() |
Assignee | |
Updated•21 years ago
|
Attachment #142661 -
Attachment is obsolete: false
Attachment #142661 -
Flags: review?(pavlov)
![]() |
Assignee | |
Comment 58•21 years ago
|
||
Comment on attachment 143224 [details] [diff] [review]
Make Image inherit from URL
I guess this is 1.8a material at this point..
Pavlov, any chance of an ETA on this review?
Attachment #143224 -
Flags: superreview?(dbaron)
Attachment #143224 -
Flags: review?(pavlov)
Comment on attachment 143224 [details] [diff] [review]
Make Image inherit from URL
>+ // Virtual destructor so we can subclass this
>+ virtual ~URL()
Why? You shouldn't need one as long as you don't delete via a base-class
pointer, which you shouldn't.
>Index: content/html/style/src/nsCSSValue.cpp
>+nsCSSValue::Image::Image(nsIURI* aURI, const PRUnichar* aString,
>+ nsIDocument* aDocument)
...
>+ if (mURI &&
>+ NS_SUCCEEDED(nsContentUtils::CanLoadImage(mURI, nsnull, aDocument))) {
>+ nsContentUtils::LoadImage(mURI, aDocument, nsnull,
>+ loadFlag,
>+ getter_AddRefs(mRequest));
The use of aDocument here is a bit ugly, no? Isn't this going to do weird
things if the same image load, from the same CSS value, is triggered from two
documents -- wouldn't it then only block onload for one of them? Or is there
code elsewhere that makes it block onload for the second?
>Index: content/html/style/src/nsCSSDeclaration.cpp
up to here, although I still have to go through the nsCSSValue changes and make
sure you added everything that you need to add.
Comment on attachment 143224 [details] [diff] [review]
Make Image inherit from URL
>Index: content/html/style/src/nsCSSValue.h
> void SetNormalValue();
>-
>+
> #ifdef DEBUG
Don't add unneeded whitespace.
>Index: content/html/style/src/nsCSSDataBlock.cpp
eCSSUnit_Null, "oops");
>+ if (iProp == eCSSProperty_background_image &&
>+ val->GetUnit() == eCSSUnit_URL) {
>+ nsCSSValue::Image* image =
>+ new nsCSSValue::Image(val->GetURLValue(),
>+ val->GetOriginalURLValue(),
>+ aRuleData->mPresContext->GetDocument());
>+ if (image) {
>+ if (image->mString) {
>+ // Need to convert this into an image. Get a
>+ // writable ref.
>+ nsCSSValue* writableVal =
>+ ValueAtCursor(NS_CONST_CAST(char*, cursor));
>+ writableVal->SetImageValue(image);
>+ } else {
>+ delete image;
>+ }
>+ }
>+ }
Perhaps everything inside this |if| could be moved into an
|nsCSSValue::StartImageLoad(nsIDocument*) const| that does the casting away of
const?
(And do you need an analogous |ConnectToImageLoad(nsIDocument*)const| for loads
that already started?)
Index: content/shared/src/nsStyleStruct.cpp
>+static PRBool EqualImages(imgIRequest *aImage1, imgIRequest* aImage2)
>+{
>+ if (aImage1 == aImage2) {
>+ return PR_TRUE;
>+ }
>+
>+ if (!aImage2 || !aImage2) {
You want to check aImage1.
>+ return PR_FALSE;
>+ }
>+
>+ nsCOMPtr<nsIURI> uri1, uri2;
>+ aImage1->GetURI(getter_AddRefs(uri1));
>+ aImage1->GetURI(getter_AddRefs(uri2));
You want the URI from aImage2.
>+ return EqualURIs(uri1, uri2);
>Index: content/base/src/nsImageLoadingContent.h
Up to here
Some additional thoughts that should perhaps be a later patch:
1. we should get the referrer right -- that may require another member of
nsCSSValue::URL
2. We should use this image loading code for list-style-image as well.
3. As I mentioned in comment 59, there are issues with blocking onload, I think,
and anything else we use |aDocument| for.
Comment on attachment 143224 [details] [diff] [review]
Make Image inherit from URL
sr=dbaron if you address the comments other than those in comment 61, although
it would be nice to address those at some point, and I didn't look too closely
at the image code (I'm assuming the reviewer will do that).
Attachment #143224 -
Flags: superreview?(dbaron) → superreview+
![]() |
Assignee | |
Comment 63•21 years ago
|
||
> as long as you don't delete via a base-class pointer
Which I'm doing, since the base-class is what does the refcounting. I suppose I
could override AddRef and Release in the subclass, though.
> Isn't this going to do weird things if the same image load, from the same CSS
> value, is triggered from two documents
To get in that situation, we need to have an nsIStyleRule that's applying to two
documents at once. This only happens for rules in user and UA sheets at the
moment. And blocking onload for backgrounds, etc is just something we plan to
use for regression tests; there user and UA sheets are not relevant, no? So I'm
not sure this is actually a problem...
If we do feel this is a concern, then we simply can't do any of this from style
data, since the different document may have different image-loading permissions
and we would thus need a separate imgIRequest stored for every document using
the nsCSSValue.
> Don't add unneeded whitespace.
Fixed.
> Perhaps everything inside this |if| could be moved
Done.
> And do you need an analogous |ConnectToImageLoad(nsIDocument*)const|
This is just for the "CSSValue is used by multiple documents" case discussed
above, right?
> You want to check aImage1.
> You want the URI from aImage2.
Argh. Tab-completion... Thank you for catching those.
I'll upload a patch with those changes once I compile it and test it in case you
want to have a look.
As for comment 61, I assume you want the referrer to be the sheet, not the
document? I suppose that makes a certain amount of sense... list-style-image I
mentioned in comment 51; I'll file a followup on that once this patch is done.
Well, in theory stylesheets can be shared between documents, but right now it
only happens for XUL. (And given character encoding issues, it should probably
stay that way.) So I guess never mind about (3).
![]() |
Assignee | |
Comment 65•21 years ago
|
||
I added nsCSSValue::StartImageLoad(), added AddRef/Release overrides on Image,
made nsCSSValue::URL.mRefCnt protected instead of private (so Image can access
it), and fixed the image1/image2 mistakes.
Attachment #142661 -
Attachment is obsolete: true
Attachment #143224 -
Attachment is obsolete: true
![]() |
Assignee | |
Updated•21 years ago
|
Attachment #143224 -
Flags: review?(pavlov)
![]() |
Assignee | |
Updated•21 years ago
|
Attachment #143322 -
Flags: review?(pavlov)
Comment 66•21 years ago
|
||
I don't think we'd block the release for this but if this patch makes the
reviews in time for beta, it'd be nice to get. If it doesn't make it for the
freeze, please request approval for any fully reviewed patch.
Flags: blocking1.7b? → blocking1.7b-
Updated•21 years ago
|
Attachment #143322 -
Flags: review?(pavlov) → review+
![]() |
Assignee | |
Comment 67•21 years ago
|
||
Checked in. This seems to have set back Tp a little bit.... I suspect that's
due to the fact that we now start image loads earlier; we may be running out of
HTTP connections and waiting for image loads to complete before being able to
load scripts and restart the parser.
At least that's my best guess as to what's going on. If there is a way to test
this theory by upping the http connection limit on btek for a few cycles, that
would be very helpful...
Assignee: nobody → bzbarsky
Target Milestone: --- → mozilla1.7beta
![]() |
Assignee | |
Comment 68•21 years ago
|
||
Bug 236889 filed on the list-style-image issue.
Status: NEW → RESOLVED
Closed: 23 years ago → 21 years ago
Resolution: --- → FIXED
Comment 69•21 years ago
|
||
The reason for the Tp regression could just that before this bug was fixed,
Mozilla could fire onload before background images loaded.
(In reply to comment #69)
> The reason for the Tp regression could just that before this bug was fixed,
> Mozilla could fire onload before background images loaded.
We can still fire Tp before CSS background images have loaded.
My guess is that bz is right and we're just loading images earlier which is
causing more competition for resources.
The link prefetch code has a mechanism for forcing their loads to not compete
with "normal" loads. Maybe we could use that for CSS background images too?
![]() |
Assignee | |
Comment 71•21 years ago
|
||
Yeah, I have some thoughts on doing something like that.. I'll probably be
filing a followup bug on that.
Comment 72•21 years ago
|
||
So now the background images are loaded before onload is fired... so what is
wrong with that? In my opinion you've managed to fix several bugs at once, the
late loading of background images and the fireing of onload before everything
was loaded. :-)
So leave it the way it is, would be my instinctive answer... no?
(In reply to comment #72)
> So now the background images are loaded before onload is fired...
No. onload can still fire before all CSS background images are loaded.
Comment 74•21 years ago
|
||
> No. onload can still fire before all CSS background images are loaded.
Agreed -- the load event fires after the document is loaded, not after all of
the subsidiary elements are loaded, too. Otherwise, a document with 200K of
images wouldn't fire onload for some time, which wouldn't be a good thing for
script components like style switchers, DOM modifiers, etc....
![]() |
Assignee | |
Comment 75•21 years ago
|
||
Guys, could we drop that discussion please? Especially since there seem to be
very few people who have any idea of when we actually fire onload (roc is one of
them, as it happens).
Comment 76•21 years ago
|
||
I just tried it out at http://www.csszengarden.com this bug is actually not fixed.
Mozilla/5.0 (Windows; U; Windows NT 5.1; de-AT; rv:1.8a1) Gecko/20040520
![]() |
Assignee | |
Comment 77•21 years ago
|
||
Nils, steps to reproduce?
Comment 78•21 years ago
|
||
I apologize, this bug is really fixed.
Go to csszengarden.com open all five Designs in Tabs.
Wait until they loadig-text on the tabs vanishes an then open the last Tab. You
will see, that Mozilla is still loading the Background images although it said
it was ready. Therefore I thought this bug was not fixed. Sorry that I judged to
rashly.
Wait until your Modem/Networkcard doesn't show any significant traffic anymore.
And open the other Tabs. You will see, that Mozilla has loaded all the images.
![]() |
Assignee | |
Comment 79•21 years ago
|
||
Ah, yes. See comment 73. That's quite intentional.
You need to log in
before you can comment on or make changes to this bug.
Description
•