Continuing nsIPresContext deCOMtamination. This patch changes Get/SetImageAnimationMode. Bug 229371, r+sr=bzbarsky.

This commit is contained in:
bryner%brianryner.com 2003-12-26 04:24:11 +00:00
Родитель 793fc4027a
Коммит 73561d1e28
16 изменённых файлов: 53 добавлений и 119 удалений

Просмотреть файл

@ -2735,7 +2735,7 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO, PRBool aDoCalcShrink)
// turn off animated GIFs
if (aPO->mPresContext) {
aPO->mPresContext->GetImageAnimationMode(&aPO->mImgAnimationMode);
aPO->mImgAnimationMode = aPO->mPresContext->ImageAnimationMode();
aPO->mPresContext->SetImageAnimationMode(imgIContainer::kDontAnimMode);
}

Просмотреть файл

@ -128,8 +128,7 @@ nsSetDocumentOptionsCommand::DoCommandParams(const char *aCommandName,
{
// for possible values of animation mode, see:
// http://lxr.mozilla.org/seamonkey/source/modules/libpr0n/public/imgIContainer.idl
rv = presContext->SetImageAnimationMode(animationMode);
if (NS_FAILED(rv)) return rv;
presContext->SetImageAnimationMode(animationMode);
}
PRBool allowPlugins;
@ -182,11 +181,8 @@ nsSetDocumentOptionsCommand::GetCommandStateParams(const char *aCommandName,
{
// for possible values of animation mode, see
// http://lxr.mozilla.org/seamonkey/source/modules/libpr0n/public/imgIContainer.idl
PRUint16 tmp;
rv = presContext->GetImageAnimationMode(&tmp);
if (NS_FAILED(rv)) return rv;
rv = aParams->SetLongValue("imageAnimation", animationMode);
rv = aParams->SetLongValue("imageAnimation",
presContext->ImageAnimationMode());
if (NS_FAILED(rv)) return rv;
}

Просмотреть файл

@ -407,8 +407,7 @@ nsEditingSession::SetupEditorOnWindow(nsIDOMWindow *aWindow)
if (NS_FAILED(rv)) return rv;
if (!presContext) return NS_ERROR_FAILURE;
rv = presContext->SetImageAnimationMode(imgIContainer::kDontAnimMode);
if (NS_FAILED(rv)) return rv;
presContext->SetImageAnimationMode(imgIContainer::kDontAnimMode);
// create and set editor
nsCOMPtr<nsIEditorDocShell> editorDocShell = do_QueryInterface(docShell, &rv);

Просмотреть файл

@ -140,10 +140,7 @@ NS_IMETHODIMP nsImageLoader::OnStartContainer(imgIRequest *aRequest,
* one frame = 1
* one loop = 2
*/
PRUint16 animateMode = imgIContainer::kNormalAnimMode; //default value
nsresult rv = mPresContext->GetImageAnimationMode(&animateMode);
if (NS_SUCCEEDED(rv))
aImage->SetAnimationMode(animateMode);
aImage->SetAnimationMode(mPresContext->ImageAnimationMode());
}
return NS_OK;
}

Просмотреть файл

@ -685,7 +685,7 @@ nsPresContext::SetShell(nsIPresShell* aShell)
if (doc) {
mBaseURL = doc->GetBaseURL();
if (mBaseURL) {
if (!mNeverAnimate && mBaseURL) {
PRBool isChrome = PR_FALSE;
PRBool isRes = PR_FALSE;
mBaseURL->SchemeIs("chrome", &isChrome);
@ -774,14 +774,6 @@ nsPresContext::SetCompatibilityMode(nsCompatibility aMode)
}
}
NS_IMETHODIMP
nsPresContext::GetImageAnimationMode(PRUint16* aModeResult)
{
NS_PRECONDITION(aModeResult, "null out param");
*aModeResult = mImageAnimationMode;
return NS_OK;
}
// Helper function for setting Anim Mode on image
static void SetImgAnimModeOnImgReq(imgIRequest* aImgReq, PRUint16 aMode)
{
@ -826,7 +818,7 @@ void nsPresContext::SetImgAnimations(nsIContent *aParent, PRUint16 aMode)
}
}
NS_IMETHODIMP
void
nsPresContext::SetImageAnimationMode(PRUint16 aMode)
{
NS_ASSERTION(aMode == imgIContainer::kNormalAnimMode ||
@ -851,7 +843,6 @@ nsPresContext::SetImageAnimationMode(PRUint16 aMode)
}
mImageAnimationMode = aMode;
return NS_OK;
}
/*

Просмотреть файл

@ -158,8 +158,8 @@ public:
/**
* Access the image animation mode for this context
*/
NS_IMETHOD GetImageAnimationMode(PRUint16* aModeResult) = 0;
NS_IMETHOD SetImageAnimationMode(PRUint16 aMode) = 0;
PRUint16 ImageAnimationMode() const { return mImageAnimationMode; }
virtual void SetImageAnimationMode(PRUint16 aMode) = 0;
/**
* Get an special load flags for images for this context
@ -580,6 +580,7 @@ protected:
nsIEventStateManager* mEventManager; // [STRONG]
nsCompatibility mCompatibilityMode;
PRUint16 mImageAnimationMode;
};
// Bit values for StartLoadImage's aImageStatus

Просмотреть файл

@ -158,8 +158,8 @@ public:
/**
* Access the image animation mode for this context
*/
NS_IMETHOD GetImageAnimationMode(PRUint16* aModeResult) = 0;
NS_IMETHOD SetImageAnimationMode(PRUint16 aMode) = 0;
PRUint16 ImageAnimationMode() const { return mImageAnimationMode; }
virtual void SetImageAnimationMode(PRUint16 aMode) = 0;
/**
* Get an special load flags for images for this context
@ -580,6 +580,7 @@ protected:
nsIEventStateManager* mEventManager; // [STRONG]
nsCompatibility mCompatibilityMode;
PRUint16 mImageAnimationMode;
};
// Bit values for StartLoadImage's aImageStatus

Просмотреть файл

@ -158,8 +158,8 @@ public:
/**
* Access the image animation mode for this context
*/
NS_IMETHOD GetImageAnimationMode(PRUint16* aModeResult) = 0;
NS_IMETHOD SetImageAnimationMode(PRUint16 aMode) = 0;
PRUint16 ImageAnimationMode() const { return mImageAnimationMode; }
virtual void SetImageAnimationMode(PRUint16 aMode) = 0;
/**
* Get an special load flags for images for this context
@ -580,6 +580,7 @@ protected:
nsIEventStateManager* mEventManager; // [STRONG]
nsCompatibility mCompatibilityMode;
PRUint16 mImageAnimationMode;
};
// Bit values for StartLoadImage's aImageStatus

Просмотреть файл

@ -140,10 +140,7 @@ NS_IMETHODIMP nsImageLoader::OnStartContainer(imgIRequest *aRequest,
* one frame = 1
* one loop = 2
*/
PRUint16 animateMode = imgIContainer::kNormalAnimMode; //default value
nsresult rv = mPresContext->GetImageAnimationMode(&animateMode);
if (NS_SUCCEEDED(rv))
aImage->SetAnimationMode(animateMode);
aImage->SetAnimationMode(mPresContext->ImageAnimationMode());
}
return NS_OK;
}

Просмотреть файл

@ -685,7 +685,7 @@ nsPresContext::SetShell(nsIPresShell* aShell)
if (doc) {
mBaseURL = doc->GetBaseURL();
if (mBaseURL) {
if (!mNeverAnimate && mBaseURL) {
PRBool isChrome = PR_FALSE;
PRBool isRes = PR_FALSE;
mBaseURL->SchemeIs("chrome", &isChrome);
@ -774,14 +774,6 @@ nsPresContext::SetCompatibilityMode(nsCompatibility aMode)
}
}
NS_IMETHODIMP
nsPresContext::GetImageAnimationMode(PRUint16* aModeResult)
{
NS_PRECONDITION(aModeResult, "null out param");
*aModeResult = mImageAnimationMode;
return NS_OK;
}
// Helper function for setting Anim Mode on image
static void SetImgAnimModeOnImgReq(imgIRequest* aImgReq, PRUint16 aMode)
{
@ -826,7 +818,7 @@ void nsPresContext::SetImgAnimations(nsIContent *aParent, PRUint16 aMode)
}
}
NS_IMETHODIMP
void
nsPresContext::SetImageAnimationMode(PRUint16 aMode)
{
NS_ASSERTION(aMode == imgIContainer::kNormalAnimMode ||
@ -851,7 +843,6 @@ nsPresContext::SetImageAnimationMode(PRUint16 aMode)
}
mImageAnimationMode = aMode;
return NS_OK;
}
/*

Просмотреть файл

@ -72,8 +72,7 @@ public:
NS_IMETHOD Init(nsIDeviceContext* aDeviceContext);
NS_IMETHOD SetShell(nsIPresShell* aShell);
virtual void SetCompatibilityMode(nsCompatibility aMode);
NS_IMETHOD GetImageAnimationMode(PRUint16* aModeResult);
NS_IMETHOD SetImageAnimationMode(PRUint16 aMode);
virtual void SetImageAnimationMode(PRUint16 aMode);
NS_IMETHOD GetImageLoadFlags(nsLoadFlags& aLoadFlags);
NS_IMETHOD GetLookAndFeel(nsILookAndFeel** aLookAndFeel);
NS_IMETHOD GetIOService(nsIIOService** aIOService);
@ -256,8 +255,7 @@ protected:
nsCOMPtr<nsIURI> mBaseURL;
PRPackedBool mImageAnimationStopped; // image animation stopped
PRUint16 mImageAnimationMode;
PRPackedBool mNeverAnimate; // never animate images
PRPackedBool mStopped; // loading stopped
PRPackedBool mStopChrome; // should we stop chrome?

Просмотреть файл

@ -66,8 +66,7 @@ public:
NS_IMETHOD GetPaginatedScrolling(PRBool* aResult);
NS_IMETHOD GetPageDim(nsRect* aActualRect, nsRect* aAdjRect);
NS_IMETHOD SetPageDim(nsRect* aRect);
NS_IMETHOD SetImageAnimationMode(PRUint16 aMode);
NS_IMETHOD GetImageAnimationMode(PRUint16* aModeResult);
virtual void SetImageAnimationMode(PRUint16 aMode);
NS_IMETHOD SetPrintSettings(nsIPrintSettings* aPS);
NS_IMETHOD GetPrintSettings(nsIPrintSettings** aPS);
@ -81,6 +80,9 @@ PrintContext::PrintContext() :
{
SetBackgroundImageDraw(PR_FALSE);
SetBackgroundColorDraw(PR_FALSE);
// Printed images are never animated
mImageAnimationMode = imgIContainer::kDontAnimMode;
mNeverAnimate = PR_TRUE;
}
PrintContext::~PrintContext()
@ -163,21 +165,9 @@ PrintContext::SetPageDim(nsRect* aPageDim)
/**
* Ignore any attempt to set an animation mode for printed images
*/
NS_IMETHODIMP
void
PrintContext::SetImageAnimationMode(PRUint16 aMode)
{
return NS_OK;
}
/**
* Printed images are never animated: always return kDontAnimMode
*/
NS_IMETHODIMP
PrintContext::GetImageAnimationMode(PRUint16* aModeResult)
{
NS_PRECONDITION(aModeResult, "null out param");
*aModeResult = imgIContainer::kDontAnimMode;
return NS_OK;
}
NS_IMETHODIMP

Просмотреть файл

@ -63,8 +63,7 @@ public:
NS_IMETHOD GetPaginatedScrolling(PRBool* aResult);
NS_IMETHOD GetPageDim(nsRect* aActualRect, nsRect* aAdjRect);
NS_IMETHOD SetPageDim(nsRect* aRect);
NS_IMETHOD SetImageAnimationMode(PRUint16 aMode);
NS_IMETHOD GetImageAnimationMode(PRUint16* aModeResult);
virtual void SetImageAnimationMode(PRUint16 aMode);
NS_IMETHOD SetPrintSettings(nsIPrintSettings* aPS);
NS_IMETHOD GetPrintSettings(nsIPrintSettings** aPS);
NS_IMETHOD GetScaledPixelsToTwips(float* aScale) const;
@ -84,6 +83,9 @@ PrintPreviewContext::PrintPreviewContext() :
{
SetBackgroundImageDraw(PR_FALSE);
SetBackgroundColorDraw(PR_FALSE);
// Printed images are never animated
mImageAnimationMode = imgIContainer::kDontAnimMode;
mNeverAnimate = PR_TRUE;
}
PrintPreviewContext::~PrintPreviewContext()
@ -165,21 +167,9 @@ PrintPreviewContext::SetPageDim(nsRect* aPageDim)
* Ignore any attempt to set an animation mode for images in print
* preview
*/
NS_IMETHODIMP
void
PrintPreviewContext::SetImageAnimationMode(PRUint16 aMode)
{
return NS_OK;
}
/**
* Images in print preview are never animated: always return kDontAnimMode
*/
NS_IMETHODIMP
PrintPreviewContext::GetImageAnimationMode(PRUint16* aModeResult)
{
NS_PRECONDITION(aModeResult, "null out param");
*aModeResult = imgIContainer::kDontAnimMode;
return NS_OK;
}
NS_IMETHODIMP

Просмотреть файл

@ -331,15 +331,12 @@ nsImageFrame::Init(nsIPresContext* aPresContext,
// If we already have an image container, OnStartContainer won't be called
// Set the animation mode here
nsCOMPtr<imgIContainer> image;
if (currentRequest)
if (currentRequest) {
currentRequest->GetImage(getter_AddRefs(image));
if (image) {
PRUint16 animateMode = imgIContainer::kNormalAnimMode; //default value
nsresult rv = mPresContext->GetImageAnimationMode(&animateMode);
if (NS_SUCCEEDED(rv))
image->SetAnimationMode(animateMode);
if (image)
image->SetAnimationMode(mPresContext->ImageAnimationMode());
}
return rv;
}
@ -536,18 +533,12 @@ nsImageFrame::OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage)
return NS_OK;
}
if (aImage)
{
/* Get requested animation policy from the pres context:
* normal = 0
* one frame = 1
* one loop = 2
*/
PRUint16 animateMode = imgIContainer::kNormalAnimMode; //default value
nsresult rv = mPresContext->GetImageAnimationMode(&animateMode);
if (NS_SUCCEEDED(rv))
aImage->SetAnimationMode(animateMode);
}
/* Get requested animation policy from the pres context:
* normal = 0
* one frame = 1
* one loop = 2
*/
aImage->SetAnimationMode(mPresContext->ImageAnimationMode());
if (IsPendingLoad(aRequest)) {
// We don't care

Просмотреть файл

@ -331,15 +331,12 @@ nsImageFrame::Init(nsIPresContext* aPresContext,
// If we already have an image container, OnStartContainer won't be called
// Set the animation mode here
nsCOMPtr<imgIContainer> image;
if (currentRequest)
if (currentRequest) {
currentRequest->GetImage(getter_AddRefs(image));
if (image) {
PRUint16 animateMode = imgIContainer::kNormalAnimMode; //default value
nsresult rv = mPresContext->GetImageAnimationMode(&animateMode);
if (NS_SUCCEEDED(rv))
image->SetAnimationMode(animateMode);
if (image)
image->SetAnimationMode(mPresContext->ImageAnimationMode());
}
return rv;
}
@ -536,18 +533,12 @@ nsImageFrame::OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage)
return NS_OK;
}
if (aImage)
{
/* Get requested animation policy from the pres context:
* normal = 0
* one frame = 1
* one loop = 2
*/
PRUint16 animateMode = imgIContainer::kNormalAnimMode; //default value
nsresult rv = mPresContext->GetImageAnimationMode(&animateMode);
if (NS_SUCCEEDED(rv))
aImage->SetAnimationMode(animateMode);
}
/* Get requested animation policy from the pres context:
* normal = 0
* one frame = 1
* one loop = 2
*/
aImage->SetAnimationMode(mPresContext->ImageAnimationMode());
if (IsPendingLoad(aRequest)) {
// We don't care

Просмотреть файл

@ -2735,7 +2735,7 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO, PRBool aDoCalcShrink)
// turn off animated GIFs
if (aPO->mPresContext) {
aPO->mPresContext->GetImageAnimationMode(&aPO->mImgAnimationMode);
aPO->mImgAnimationMode = aPO->mPresContext->ImageAnimationMode();
aPO->mPresContext->SetImageAnimationMode(imgIContainer::kDontAnimMode);
}