-r hyatt -a waterson


git-svn-id: svn://10.0.0.236/trunk@79683 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
evaughan%netscape.com
2000-09-21 01:20:00 +00:00
parent 8467faca47
commit 4e14fe3ce1
12 changed files with 54 additions and 22 deletions

View File

@@ -683,7 +683,8 @@ DocumentViewerImpl::Stop(void)
}
if (mPresContext) {
mPresContext->Stop();
// stop everything but the chrome.
mPresContext->Stop(PR_FALSE);
}
return NS_OK;
}

View File

@@ -683,7 +683,8 @@ DocumentViewerImpl::Stop(void)
}
if (mPresContext) {
mPresContext->Stop();
// stop everything but the chrome.
mPresContext->Stop(PR_FALSE);
}
return NS_OK;
}

View File

@@ -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();

View File

@@ -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.

View File

@@ -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;

View File

@@ -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.

View File

@@ -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.

View File

@@ -683,7 +683,8 @@ DocumentViewerImpl::Stop(void)
}
if (mPresContext) {
mPresContext->Stop();
// stop everything but the chrome.
mPresContext->Stop(PR_FALSE);
}
return NS_OK;
}

View File

@@ -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);

View File

@@ -61,7 +61,7 @@ public:
nsIFrameImageLoaderCB aCallBack,
void* aClosure, void* aKey);
NS_IMETHOD StopImageLoad();
NS_IMETHOD StopImageLoad(PRBool aStopChrome = PR_TRUE);
NS_IMETHOD AbortImageLoad();

View File

@@ -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();

View File

@@ -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