diff --git a/mozilla/content/base/src/nsDocumentViewer.cpp b/mozilla/content/base/src/nsDocumentViewer.cpp index 2fdc26272c9..86056fc729f 100644 --- a/mozilla/content/base/src/nsDocumentViewer.cpp +++ b/mozilla/content/base/src/nsDocumentViewer.cpp @@ -683,7 +683,8 @@ DocumentViewerImpl::Stop(void) } if (mPresContext) { - mPresContext->Stop(); + // stop everything but the chrome. + mPresContext->Stop(PR_FALSE); } return NS_OK; } diff --git a/mozilla/layout/base/nsDocumentViewer.cpp b/mozilla/layout/base/nsDocumentViewer.cpp index 2fdc26272c9..86056fc729f 100644 --- a/mozilla/layout/base/nsDocumentViewer.cpp +++ b/mozilla/layout/base/nsDocumentViewer.cpp @@ -683,7 +683,8 @@ DocumentViewerImpl::Stop(void) } if (mPresContext) { - mPresContext->Stop(); + // stop everything but the chrome. + mPresContext->Stop(PR_FALSE); } return NS_OK; } diff --git a/mozilla/layout/base/nsPresContext.cpp b/mozilla/layout/base/nsPresContext.cpp index 162f54a9fb9..156da84b718 100644 --- a/mozilla/layout/base/nsPresContext.cpp +++ b/mozilla/layout/base/nsPresContext.cpp @@ -96,6 +96,9 @@ nsPresContext::nsPresContext() mCompatibilityLocked = PR_FALSE; mWidgetRenderingMode = eWidgetRendering_Gfx; mImageAnimationMode = eImageAnimation_Normal; + + mStopped = PR_FALSE; + mStopChrome = PR_TRUE; mShell = nsnull; @@ -913,10 +916,15 @@ nsPresContext::StartLoadImage(const nsString& aURL, nsIFrameImageLoader** aResult) { if (mStopped) { - if (aResult) { - *aResult = nsnull; - } - return NS_OK; + // if we are stopped and the image is not chrome + // don't load. + // If we are chrome don't load if we + // were told to stop chrome + if (!aURL.EqualsWithConversion("chrome:", PR_TRUE, 7) || mStopChrome) { + if (aResult) { + *aResult = nsnull; + } + } } // Allow for a null target frame argument (for precached images) @@ -1011,13 +1019,14 @@ nsPresContext::StartLoadImage(const nsString& aURL, } NS_IMETHODIMP -nsPresContext::Stop(void) +nsPresContext::Stop(PRBool aStopChrome) { + mStopChrome = aStopChrome; PRInt32 n = mImageLoaders.Count(); for (PRInt32 i = 0; i < n; i++) { nsIFrameImageLoader* loader; loader = (nsIFrameImageLoader*) mImageLoaders.ElementAt(i); - loader->StopImageLoad(); + loader->StopImageLoad(aStopChrome); NS_RELEASE(loader); } mImageLoaders.Clear(); diff --git a/mozilla/layout/base/nsPresContext.h b/mozilla/layout/base/nsPresContext.h index 8947479b86d..ba8b56b3bcf 100644 --- a/mozilla/layout/base/nsPresContext.h +++ b/mozilla/layout/base/nsPresContext.h @@ -103,8 +103,9 @@ public: /** * Stop the presentation in preperation for destruction. + * @param aStopChrome PR_TRUE to stop chrome as well. */ - NS_IMETHOD Stop(void) = 0; + NS_IMETHOD Stop(PRBool aStopChrome = PR_TRUE) = 0; /** * Set the presentation shell that this context is bound to. diff --git a/mozilla/layout/base/public/nsIFrameImageLoader.h b/mozilla/layout/base/public/nsIFrameImageLoader.h index 8f010bd4ed7..026600230dd 100644 --- a/mozilla/layout/base/public/nsIFrameImageLoader.h +++ b/mozilla/layout/base/public/nsIFrameImageLoader.h @@ -73,7 +73,7 @@ public: nsIFrameImageLoaderCB aCallBack, void* aClosure, void* aKey) = 0; - NS_IMETHOD StopImageLoad() = 0; + NS_IMETHOD StopImageLoad(PRBool aStopChrome = PR_TRUE) = 0; NS_IMETHOD AbortImageLoad() = 0; diff --git a/mozilla/layout/base/public/nsIPresContext.h b/mozilla/layout/base/public/nsIPresContext.h index 8947479b86d..ba8b56b3bcf 100644 --- a/mozilla/layout/base/public/nsIPresContext.h +++ b/mozilla/layout/base/public/nsIPresContext.h @@ -103,8 +103,9 @@ public: /** * Stop the presentation in preperation for destruction. + * @param aStopChrome PR_TRUE to stop chrome as well. */ - NS_IMETHOD Stop(void) = 0; + NS_IMETHOD Stop(PRBool aStopChrome = PR_TRUE) = 0; /** * Set the presentation shell that this context is bound to. diff --git a/mozilla/layout/base/public/nsPresContext.h b/mozilla/layout/base/public/nsPresContext.h index 8947479b86d..ba8b56b3bcf 100644 --- a/mozilla/layout/base/public/nsPresContext.h +++ b/mozilla/layout/base/public/nsPresContext.h @@ -103,8 +103,9 @@ public: /** * Stop the presentation in preperation for destruction. + * @param aStopChrome PR_TRUE to stop chrome as well. */ - NS_IMETHOD Stop(void) = 0; + NS_IMETHOD Stop(PRBool aStopChrome = PR_TRUE) = 0; /** * Set the presentation shell that this context is bound to. diff --git a/mozilla/layout/base/src/nsDocumentViewer.cpp b/mozilla/layout/base/src/nsDocumentViewer.cpp index 2fdc26272c9..86056fc729f 100644 --- a/mozilla/layout/base/src/nsDocumentViewer.cpp +++ b/mozilla/layout/base/src/nsDocumentViewer.cpp @@ -683,7 +683,8 @@ DocumentViewerImpl::Stop(void) } if (mPresContext) { - mPresContext->Stop(); + // stop everything but the chrome. + mPresContext->Stop(PR_FALSE); } return NS_OK; } diff --git a/mozilla/layout/base/src/nsFrameImageLoader.cpp b/mozilla/layout/base/src/nsFrameImageLoader.cpp index fe086e42956..7200f7bb2ee 100644 --- a/mozilla/layout/base/src/nsFrameImageLoader.cpp +++ b/mozilla/layout/base/src/nsFrameImageLoader.cpp @@ -30,6 +30,7 @@ #include "nsIStyleContext.h" #include "nsCOMPtr.h" #include "nsIDeviceContext.h" +#include "nsXPIDLString.h" #ifdef DEBUG #undef NOISY_IMAGE_LOADING @@ -251,8 +252,14 @@ nsFrameImageLoader::RemoveFrame(void* aKey) } NS_IMETHODIMP -nsFrameImageLoader::StopImageLoad() +nsFrameImageLoader::StopImageLoad(PRBool aStopChrome) { + // don't stop chrome + if (!aStopChrome) { + if (mURL.EqualsWithConversion("chrome:", PR_TRUE, 7)) + return NS_OK; + } + #ifdef NOISY_IMAGE_LOADING printf(" %p: stopping ", this); fputs(mURL, stdout); diff --git a/mozilla/layout/base/src/nsFrameImageLoader.h b/mozilla/layout/base/src/nsFrameImageLoader.h index 884cda35c0a..2d73b2565bf 100644 --- a/mozilla/layout/base/src/nsFrameImageLoader.h +++ b/mozilla/layout/base/src/nsFrameImageLoader.h @@ -61,7 +61,7 @@ public: nsIFrameImageLoaderCB aCallBack, void* aClosure, void* aKey); - NS_IMETHOD StopImageLoad(); + NS_IMETHOD StopImageLoad(PRBool aStopChrome = PR_TRUE); NS_IMETHOD AbortImageLoad(); diff --git a/mozilla/layout/base/src/nsPresContext.cpp b/mozilla/layout/base/src/nsPresContext.cpp index 162f54a9fb9..156da84b718 100644 --- a/mozilla/layout/base/src/nsPresContext.cpp +++ b/mozilla/layout/base/src/nsPresContext.cpp @@ -96,6 +96,9 @@ nsPresContext::nsPresContext() mCompatibilityLocked = PR_FALSE; mWidgetRenderingMode = eWidgetRendering_Gfx; mImageAnimationMode = eImageAnimation_Normal; + + mStopped = PR_FALSE; + mStopChrome = PR_TRUE; mShell = nsnull; @@ -913,10 +916,15 @@ nsPresContext::StartLoadImage(const nsString& aURL, nsIFrameImageLoader** aResult) { if (mStopped) { - if (aResult) { - *aResult = nsnull; - } - return NS_OK; + // if we are stopped and the image is not chrome + // don't load. + // If we are chrome don't load if we + // were told to stop chrome + if (!aURL.EqualsWithConversion("chrome:", PR_TRUE, 7) || mStopChrome) { + if (aResult) { + *aResult = nsnull; + } + } } // Allow for a null target frame argument (for precached images) @@ -1011,13 +1019,14 @@ nsPresContext::StartLoadImage(const nsString& aURL, } NS_IMETHODIMP -nsPresContext::Stop(void) +nsPresContext::Stop(PRBool aStopChrome) { + mStopChrome = aStopChrome; PRInt32 n = mImageLoaders.Count(); for (PRInt32 i = 0; i < n; i++) { nsIFrameImageLoader* loader; loader = (nsIFrameImageLoader*) mImageLoaders.ElementAt(i); - loader->StopImageLoad(); + loader->StopImageLoad(aStopChrome); NS_RELEASE(loader); } mImageLoaders.Clear(); diff --git a/mozilla/layout/base/src/nsPresContext.h b/mozilla/layout/base/src/nsPresContext.h index 1270bb2924d..c1e4191fddf 100644 --- a/mozilla/layout/base/src/nsPresContext.h +++ b/mozilla/layout/base/src/nsPresContext.h @@ -61,7 +61,7 @@ public: // nsIPresContext methods NS_IMETHOD Init(nsIDeviceContext* aDeviceContext); - NS_IMETHOD Stop(void); + NS_IMETHOD Stop(PRBool aStopChrome = PR_TRUE); NS_IMETHOD SetShell(nsIPresShell* aShell); NS_IMETHOD GetShell(nsIPresShell** aResult); NS_IMETHOD GetCompatibilityMode(nsCompatibility* aModeResult); @@ -192,6 +192,7 @@ protected: nsImageAnimation mImageAnimationMode; PRPackedBool mImageAnimationStopped; // image animation stopped PRPackedBool mStopped; // loading stopped + PRPackedBool mStopChrome; // should we stop chrome? PRUint8 mDefaultDirection; #ifdef DEBUG