Bug 594650: Replace static variable in header file with static variable + accessor method, to fix codesighs & Composer.dll bustage. r=roc r=taras a=bustage

This commit is contained in:
Daniel Holbert 2010-09-09 09:41:58 -07:00
parent 2f6c001135
commit ecd6d13497
6 changed files with 18 additions and 17 deletions

View File

@ -39,10 +39,15 @@
#include "nsString.h"
#include "nsIDeviceContext.h"
#include "prlog.h"
#include <limits.h>
// the mozilla::css::Side sequence must match the nsMargin nscoord sequence
PR_STATIC_ASSERT((NS_SIDE_TOP == 0) && (NS_SIDE_RIGHT == 1) && (NS_SIDE_BOTTOM == 2) && (NS_SIDE_LEFT == 3));
/* static */
const nsIntRect nsIntRect::kMaxSizedIntRect(0, 0, INT_MAX, INT_MAX);
// Containment
PRBool nsRect::Contains(nscoord aX, nscoord aY) const
{

View File

@ -335,6 +335,13 @@ struct NS_GFX nsIntRect {
PRInt32 YMost() const {return y + height;}
inline nsRect ToAppUnits(nscoord aAppUnitsPerPixel) const;
// Returns a special nsIntRect that's used in some places to signify
// "all available space".
static const nsIntRect& GetMaxSizedIntRect() { return kMaxSizedIntRect; }
protected:
static const nsIntRect kMaxSizedIntRect;
};
/*

View File

@ -204,7 +204,7 @@ NS_IMETHODIMP nsImageLoader::FrameChanged(imgIContainer *aContainer,
return NS_OK;
}
nsRect r = (*aDirtyRect == mozilla::imagelib::kFullImageSpaceRect) ?
nsRect r = (*aDirtyRect == nsIntRect::GetMaxSizedIntRect()) ?
nsRect(nsPoint(0, 0), mFrame->GetSize()) :
aDirtyRect->ToAppUnits(nsPresContext::AppUnitsPerCSSPixel());

View File

@ -577,7 +577,7 @@ nsImageFrame::OnDataAvailable(imgIRequest *aRequest,
// XXX We really need to round this out, now that we're doing better
// image scaling!
nsRect r = (*aRect == mozilla::imagelib::kFullImageSpaceRect) ?
nsRect r = (*aRect == nsIntRect::GetMaxSizedIntRect()) ?
GetInnerArea() :
SourceRectToDest(*aRect);
@ -660,7 +660,7 @@ nsImageFrame::FrameChanged(imgIContainer *aContainer,
return NS_OK;
}
nsRect r = (*aDirtyRect == mozilla::imagelib::kFullImageSpaceRect) ?
nsRect r = (*aDirtyRect == nsIntRect::GetMaxSizedIntRect()) ?
GetInnerArea() :
SourceRectToDest(*aDirtyRect);

View File

@ -56,17 +56,6 @@ interface imgIDecoderObserver;
#include "limits.h"
class nsIFrame;
namespace mozilla {
namespace imagelib {
/**
* A sentinel value that can be passed to various imagelib methods
* to represent "the full image space".
*/
static const nsIntRect kFullImageSpaceRect(0, 0, INT_MAX, INT_MAX);
}
}
%}
[ptr] native gfxImageSurface(gfxImageSurface);

View File

@ -242,7 +242,7 @@ VectorImage::Init(imgIDecoderObserver* aObserver,
void
VectorImage::GetCurrentFrameRect(nsIntRect& aRect)
{
aRect = kFullImageSpaceRect;
aRect = nsIntRect::GetMaxSizedIntRect();
}
PRUint32
@ -646,7 +646,7 @@ VectorImage::OnStopRequest(nsIRequest* aRequest, nsISupports* aCtxt,
// NOTE: This signals that width/height are available.
observer->OnStartContainer(nsnull, this);
observer->FrameChanged(this, &kFullImageSpaceRect);
observer->FrameChanged(this, &nsIntRect::GetMaxSizedIntRect());
observer->OnStopFrame(nsnull, 0);
observer->OnStopDecode(nsnull, NS_OK, nsnull);
}
@ -678,7 +678,7 @@ VectorImage::InvalidateObserver()
{
nsCOMPtr<imgIContainerObserver> observer(do_QueryReferent(mObserver));
if (observer) {
observer->FrameChanged(this, &kFullImageSpaceRect);
observer->FrameChanged(this, &nsIntRect::GetMaxSizedIntRect());
}
}