diff --git a/gfx/src/nsRect.cpp b/gfx/src/nsRect.cpp index e939838c1ec..ae24a2fb587 100644 --- a/gfx/src/nsRect.cpp +++ b/gfx/src/nsRect.cpp @@ -39,10 +39,15 @@ #include "nsString.h" #include "nsIDeviceContext.h" #include "prlog.h" +#include // 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 { diff --git a/gfx/src/nsRect.h b/gfx/src/nsRect.h index bb212031165..9668f3401ab 100644 --- a/gfx/src/nsRect.h +++ b/gfx/src/nsRect.h @@ -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; }; /* diff --git a/layout/base/nsImageLoader.cpp b/layout/base/nsImageLoader.cpp index 8e6f98024f7..e759ce76baa 100644 --- a/layout/base/nsImageLoader.cpp +++ b/layout/base/nsImageLoader.cpp @@ -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()); diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index d2074d90de8..90ceecbcdde 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -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); diff --git a/modules/libpr0n/public/imgIContainer.idl b/modules/libpr0n/public/imgIContainer.idl index e4026099c5e..bc4305d05a1 100644 --- a/modules/libpr0n/public/imgIContainer.idl +++ b/modules/libpr0n/public/imgIContainer.idl @@ -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); diff --git a/modules/libpr0n/src/VectorImage.cpp b/modules/libpr0n/src/VectorImage.cpp index 168616bb966..9e361cd2a1f 100644 --- a/modules/libpr0n/src/VectorImage.cpp +++ b/modules/libpr0n/src/VectorImage.cpp @@ -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 observer(do_QueryReferent(mObserver)); if (observer) { - observer->FrameChanged(this, &kFullImageSpaceRect); + observer->FrameChanged(this, &nsIntRect::GetMaxSizedIntRect()); } }