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
authorDaniel Holbert <dholbert@cs.stanford.edu>
Thu, 09 Sep 2010 09:41:58 -0700
changeset 52306 cfb46cb1043bc9c0dd195ab92f1610b419f91e20
parent 52305 6bed6915317a1f3c86ca4f60ff08f50682654273
child 52308 99b5dc548631d468d6f2fece4e532ec453b6501b
push id15595
push userdholbert@mozilla.com
push dateThu, 09 Sep 2010 16:42:57 +0000
treeherdermozilla-central@cfb46cb1043b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, taras, bustage
bugs594650
milestone2.0b6pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
gfx/src/nsRect.cpp
gfx/src/nsRect.h
layout/base/nsImageLoader.cpp
layout/generic/nsImageFrame.cpp
modules/libpr0n/public/imgIContainer.idl
modules/libpr0n/src/VectorImage.cpp
--- a/gfx/src/nsRect.cpp
+++ b/gfx/src/nsRect.cpp
@@ -34,20 +34,25 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsRect.h"
 #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
 {
   return (PRBool) ((aX >= x) && (aY >= y) &&
                    (aX < XMost()) && (aY < YMost()));
 }
 
 //Also Returns true if aRect is Empty
--- a/gfx/src/nsRect.h
+++ b/gfx/src/nsRect.h
@@ -330,16 +330,23 @@ struct NS_GFX nsIntRect {
 
   nsIntSize Size() const { return nsIntSize(width, height); }
 
   // Helper methods for computing the extents
   PRInt32 XMost() const {return x + width;}
   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;
 };
 
 /*
  * App Unit/Pixel conversions
  */
 
 inline nsRect
 nsRect::ConvertAppUnitsRoundOut(PRInt32 aFromAPP, PRInt32 aToAPP) const
--- a/layout/base/nsImageLoader.cpp
+++ b/layout/base/nsImageLoader.cpp
@@ -199,17 +199,17 @@ NS_IMETHODIMP nsImageLoader::FrameChange
   if (!mFrame)
     return NS_ERROR_FAILURE;
 
   if (!mRequest) {
     // We're in the middle of a paint anyway
     return NS_OK;
   }
 
-  nsRect r = (*aDirtyRect == mozilla::imagelib::kFullImageSpaceRect) ?
+  nsRect r = (*aDirtyRect == nsIntRect::GetMaxSizedIntRect()) ?
     nsRect(nsPoint(0, 0), mFrame->GetSize()) :
     aDirtyRect->ToAppUnits(nsPresContext::AppUnitsPerCSSPixel());
 
   DoRedraw(&r);
 
   return NS_OK;
 }
 
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -572,17 +572,17 @@ nsImageFrame::OnDataAvailable(imgIReques
 
   // Don't invalidate if the current visible frame isn't the one the data is
   // from
   if (!aCurrentFrame)
     return NS_OK;
 
   // 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);
 
 #ifdef DEBUG_decode
   printf("Source rect (%d,%d,%d,%d) -> invalidate dest rect (%d,%d,%d,%d)\n",
          aRect->x, aRect->y, aRect->width, aRect->height,
          r.x, r.y, r.width, r.height);
 #endif
@@ -655,17 +655,17 @@ nsImageFrame::FrameChanged(imgIContainer
     return NS_OK;
   }
 
   if (IsPendingLoad(aContainer)) {
     // We don't care about it
     return NS_OK;
   }
 
-  nsRect r = (*aDirtyRect == mozilla::imagelib::kFullImageSpaceRect) ?
+  nsRect r = (*aDirtyRect == nsIntRect::GetMaxSizedIntRect()) ?
     GetInnerArea() :
     SourceRectToDest(*aDirtyRect);
 
   // Update border+content to account for image change
   Invalidate(r);
   return NS_OK;
 }
 
--- a/modules/libpr0n/public/imgIContainer.idl
+++ b/modules/libpr0n/public/imgIContainer.idl
@@ -51,27 +51,16 @@ interface imgIDecoderObserver;
 #include "gfxRect.h"
 #include "gfxPattern.h"
 #include "gfxASurface.h"
 #include "nsRect.h"
 #include "nsSize.h"
 #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);
 [ptr] native gfxASurface(gfxASurface);
 native gfxImageFormat(gfxASurface::gfxImageFormat);
 [ptr] native gfxContext(gfxContext);
 [ref] native gfxMatrix(gfxMatrix);
 [ref] native gfxRect(gfxRect);
--- a/modules/libpr0n/src/VectorImage.cpp
+++ b/modules/libpr0n/src/VectorImage.cpp
@@ -237,17 +237,17 @@ VectorImage::Init(imgIDecoderObserver* a
   mIsInitialized = PR_TRUE;
 
   return NS_OK;
 }
 
 void
 VectorImage::GetCurrentFrameRect(nsIntRect& aRect)
 {
-  aRect = kFullImageSpaceRect;
+  aRect = nsIntRect::GetMaxSizedIntRect();
 }
 
 PRUint32
 VectorImage::GetDataSize()
 {
   // XXXdholbert "sizeof(*this)" is, of course, quite an underestimate.  This
   // needs to be smarter -- see bug 590790.
   return sizeof(*this);
@@ -641,17 +641,17 @@ VectorImage::OnStopRequest(nsIRequest* a
 #endif // MOZ_ENABLE_LIBXUL
 
   // Tell *our* observers that we're done loading
   nsCOMPtr<imgIDecoderObserver> observer = do_QueryReferent(mObserver);
   if (observer) {
     // 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);
   }
 
   return rv;
 }
 
 //------------------------------------------------------------------------------
@@ -673,14 +673,14 @@ VectorImage::OnDataAvailable(nsIRequest*
 // --------------------------
 // Invalidation helper method
 
 void
 VectorImage::InvalidateObserver()
 {
   nsCOMPtr<imgIContainerObserver> observer(do_QueryReferent(mObserver));
   if (observer) {
-    observer->FrameChanged(this, &kFullImageSpaceRect);
+    observer->FrameChanged(this, &nsIntRect::GetMaxSizedIntRect());
   }
 }
 
 } // namespace imagelib
 } // namespace mozilla