Construct all our image loaders when we create frames so that we can allow arbitrary numbers of image loaders per frame (for multiple background images). (Bug 322475) r+sr=bzbarsky
This commit is contained in:
@@ -91,7 +91,6 @@
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "nsStyleStructInlines.h"
|
||||
|
||||
#include "nsFrameManager.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
@@ -1085,24 +1084,6 @@ CaptureChange(nsStyleContext* aOldContext, nsStyleContext* aNewContext,
|
||||
return aMinChange;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
ShouldStopImage(imgIRequest *aOldImage, imgIRequest *aNewImage)
|
||||
{
|
||||
if (!aOldImage)
|
||||
return PR_FALSE;
|
||||
|
||||
PRBool stopImages = !aNewImage;
|
||||
if (!stopImages) {
|
||||
nsCOMPtr<nsIURI> oldURI, newURI;
|
||||
aOldImage->GetURI(getter_AddRefs(oldURI));
|
||||
aNewImage->GetURI(getter_AddRefs(newURI));
|
||||
PRBool equal;
|
||||
stopImages =
|
||||
NS_FAILED(oldURI->Equals(newURI, &equal)) || !equal;
|
||||
}
|
||||
return stopImages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recompute style for aFrame and accumulate changes into aChangeList
|
||||
* given that aMinChange is already accumulated for an ancestor.
|
||||
@@ -1264,33 +1245,6 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
|
||||
// if frame gets regenerated, let it keep old context
|
||||
aFrame->SetStyleContext(newContext);
|
||||
}
|
||||
// if old context had image and new context does not have the same image,
|
||||
// stop the image load for the frame
|
||||
if (ShouldStopImage(
|
||||
oldContext->GetStyleBackground()->mBackgroundImage,
|
||||
newContext->GetStyleBackground()->mBackgroundImage)) {
|
||||
// stop the image loading for the frame, the image has changed
|
||||
aPresContext->StopBackgroundImageFor(aFrame);
|
||||
}
|
||||
|
||||
imgIRequest *newBorderImage =
|
||||
newContext->GetStyleBorder()->GetBorderImage();
|
||||
if (ShouldStopImage(oldContext->GetStyleBorder()->GetBorderImage(),
|
||||
newBorderImage)) {
|
||||
// stop the image loading for the frame, the image has changed
|
||||
aPresContext->StopBorderImageFor(aFrame);
|
||||
}
|
||||
|
||||
// Since the CalcDifference call depended on the result of
|
||||
// GetActualBorder() and that result depends on whether the
|
||||
// image has loaded, start the image load now so that we'll get
|
||||
// notified when it completes loading and can do a restyle.
|
||||
// Otherwise, the image might finish loading from the network
|
||||
// before we start listening to its notifications, and then
|
||||
// we'll never know that it's finished loading.
|
||||
if (newBorderImage) {
|
||||
aPresContext->LoadBorderImage(newBorderImage, aFrame);
|
||||
}
|
||||
}
|
||||
oldContext->Release();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user