Bug 817774 - Let nsIntRect not have a nsIntRect static data member, as that kills GDB printing it - r=dholbert
authorBenoit Jacob <bjacob@mozilla.com>
Mon, 17 Dec 2012 16:59:53 -0500
changeset 116329 e0fce89f61286f413457c93e49f9bfaff4b7a153
parent 116328 f3de630ebd0d9f86e003c7fa06b0dc4d62e78942
child 116330 bffe151ab8acc96e3fa148540e3a44d2b176bb5d
push idunknown
push userunknown
push dateunknown
reviewersdholbert
bugs817774
milestone20.0a1
Bug 817774 - Let nsIntRect not have a nsIntRect static data member, as that kills GDB printing it - r=dholbert
gfx/src/nsRect.cpp
gfx/src/nsRect.h
--- a/gfx/src/nsRect.cpp
+++ b/gfx/src/nsRect.cpp
@@ -2,24 +2,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsRect.h"
 #include "nsString.h"
 #include "nsDeviceContext.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);
-
 #ifdef DEBUG
 // Diagnostics
 
 FILE* operator<<(FILE* out, const nsRect& rect)
 {
   nsAutoString tmp;
 
   // Output the coordinates in fractional pixels so they're easier to read
--- a/gfx/src/nsRect.h
+++ b/gfx/src/nsRect.h
@@ -11,16 +11,17 @@
 #include "nsCoord.h"
 #include "nsPoint.h"
 #include "nsSize.h"
 #include "nsMargin.h"
 #include "gfxCore.h"
 #include "nsTraceRefcnt.h"
 #include "mozilla/gfx/BaseRect.h"
 #include "mozilla/Likely.h"
+#include <climits>
 
 struct nsIntRect;
 
 struct NS_GFX nsRect :
   public mozilla::gfx::BaseRect<nscoord, nsRect, nsPoint, nsSize, nsMargin> {
   typedef mozilla::gfx::BaseRect<nscoord, nsRect, nsPoint, nsSize, nsMargin> Super;
 
   static void VERIFY_COORD(nscoord aValue) { ::VERIFY_COORD(aValue); }
@@ -226,26 +227,26 @@ struct NS_GFX nsIntRect :
       Super(aX, aY, aWidth, aHeight)
   {
   }
 
   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; }
+  static const nsIntRect& GetMaxSizedIntRect() {
+    static const nsIntRect r(0, 0, INT_MAX, INT_MAX);
+    return r;
+  }
 
   // This is here only to keep IPDL-generated code happy. DO NOT USE.
   bool operator==(const nsIntRect& aRect) const
   {
     return IsEqualEdges(aRect);
   }
-
-protected:
-  static const nsIntRect kMaxSizedIntRect;
 };
 
 /*
  * App Unit/Pixel conversions
  */
 
 inline nsRect
 nsRect::ConvertAppUnitsRoundOut(int32_t aFromAPP, int32_t aToAPP) const