Backed out changeset 513192eb7df4 (bug 1148971) for causing bc2 memory leaks
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 30 Mar 2015 15:04:09 +0200
changeset 255524 fbd6031f29580de6f43b9208a48cf35abdefdfb3
parent 255523 8a32e2c9fe218a3add201d5057d4e4c9ceab4d28
child 255525 f8ccc1fed2047893ee058f7d95eec56c21741fa9
push id8007
push userraliiev@mozilla.com
push dateMon, 11 May 2015 19:23:16 +0000
treeherdermozilla-aurora@e2ce1aac996e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1148971
milestone39.0a1
backs out513192eb7df4da949f0763fe86c1d5fc62935361
Backed out changeset 513192eb7df4 (bug 1148971) for causing bc2 memory leaks
gfx/src/nsITheme.h
layout/base/nsLayoutUtils.cpp
layout/forms/nsRangeFrame.cpp
layout/generic/nsFlexContainerFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/xul/nsBox.cpp
layout/xul/nsScrollbarFrame.cpp
layout/xul/tree/nsTreeBodyFrame.cpp
widget/cocoa/nsNativeThemeCocoa.h
widget/cocoa/nsNativeThemeCocoa.mm
widget/gtk/nsNativeThemeGTK.cpp
widget/gtk/nsNativeThemeGTK.h
widget/windows/nsNativeThemeWin.cpp
widget/windows/nsNativeThemeWin.h
--- a/gfx/src/nsITheme.h
+++ b/gfx/src/nsITheme.h
@@ -7,19 +7,21 @@
 /* service providing platform-specific native rendering for widgets */
 
 #ifndef nsITheme_h_
 #define nsITheme_h_
 
 #include "nsISupports.h"
 #include "nsCOMPtr.h"
 #include "nsColor.h"
-#include "Units.h"
+#include "nsSize.h"
 
 struct nsRect;
+struct nsIntRect;
+class nsIntRegion;
 struct nsFont;
 struct nsIntMargin;
 class nsPresContext;
 class nsRenderingContext;
 class nsDeviceContext;
 class nsIFrame;
 class nsIContent;
 class nsIAtom;
@@ -109,17 +111,17 @@ public:
    * Get the minimum border-box size of a widget, in *pixels* (in
    * |aResult|).  If |aIsOverridable| is set to true, this size is a
    * minimum size; if false, this size is the only valid size for the
    * widget.
    */
   NS_IMETHOD GetMinimumWidgetSize(nsPresContext* aPresContext,
                                   nsIFrame* aFrame,
                                   uint8_t aWidgetType,
-                                  mozilla::LayoutDeviceIntSize* aResult,
+                                  nsIntSize* aResult,
                                   bool* aIsOverridable)=0;
 
 
   enum Transparency {
     eOpaque = 0,
     eTransparent,
     eUnknownTransparency
   };
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -4562,17 +4562,17 @@ nsLayoutUtils::IntrinsicForContainer(nsR
   }
 
   min = AddPercents(aType, min, pctTotal);
   if (result < min)
     result = min;
 
   const nsStyleDisplay *disp = aFrame->StyleDisplay();
   if (aFrame->IsThemed(disp)) {
-    LayoutDeviceIntSize size;
+    nsIntSize size(0, 0);
     bool canOverride = true;
     nsPresContext *presContext = aFrame->PresContext();
     presContext->GetTheme()->
       GetMinimumWidgetSize(presContext, aFrame, disp->mAppearance,
                            &size, &canOverride);
 
     nscoord themeISize =
       presContext->DevPixelsToAppUnits(isVertical ? size.height : size.width);
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -512,17 +512,17 @@ nsRangeFrame::GetValueAtEventPoint(Widge
 
   nsRect rangeContentRect = GetContentRectRelativeToSelf();
   nsSize thumbSize;
 
   if (IsThemed()) {
     // We need to get the size of the thumb from the theme.
     nsPresContext *presContext = PresContext();
     bool notUsedCanOverride;
-    LayoutDeviceIntSize size;
+    nsIntSize size;
     presContext->GetTheme()->
       GetMinimumWidgetSize(presContext, this, NS_THEME_RANGE_THUMB, &size,
                            &notUsedCanOverride);
     thumbSize.width = presContext->DevPixelsToAppUnits(size.width);
     thumbSize.height = presContext->DevPixelsToAppUnits(size.height);
     MOZ_ASSERT(thumbSize.width > 0 && thumbSize.height > 0);
   } else {
     nsIFrame* thumbFrame = mThumbDiv->GetPrimaryFrame();
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -164,24 +164,24 @@ public:
   AxisOrientationType GetCrossAxis() const { return mCrossAxis; }
 
   bool IsMainAxisHorizontal() const { return IsAxisHorizontal(mMainAxis); }
   bool IsCrossAxisHorizontal() const { return IsAxisHorizontal(mCrossAxis); }
 
   nscoord GetMainComponent(const nsSize& aSize) const {
     return GET_MAIN_COMPONENT(*this, aSize.width, aSize.height);
   }
-  int32_t GetMainComponent(const LayoutDeviceIntSize& aIntSize) const {
+  int32_t GetMainComponent(const nsIntSize& aIntSize) const {
     return GET_MAIN_COMPONENT(*this, aIntSize.width, aIntSize.height);
   }
 
   nscoord GetCrossComponent(const nsSize& aSize) const {
     return GET_CROSS_COMPONENT(*this, aSize.width, aSize.height);
   }
-  int32_t GetCrossComponent(const LayoutDeviceIntSize& aIntSize) const {
+  int32_t GetCrossComponent(const nsIntSize& aIntSize) const {
     return GET_CROSS_COMPONENT(*this, aIntSize.width, aIntSize.height);
   }
 
   nscoord GetMarginSizeInMainAxis(const nsMargin& aMargin) const {
     return IsMainAxisHorizontal() ?
       aMargin.LeftRight() :
       aMargin.TopBottom();
   }
@@ -1040,17 +1040,17 @@ nsFlexContainerFrame::GenerateFlexItemFo
 
   // SPECIAL-CASE FOR WIDGET-IMPOSED SIZES
   // Check if we're a themed widget, in which case we might have a minimum
   // main & cross size imposed by our widget (which we can't go below), or
   // (more severe) our widget might have only a single valid size.
   bool isFixedSizeWidget = false;
   const nsStyleDisplay* disp = aChildFrame->StyleDisplay();
   if (aChildFrame->IsThemed(disp)) {
-    LayoutDeviceIntSize widgetMinSize;
+    nsIntSize widgetMinSize(0, 0);
     bool canOverride = true;
     aPresContext->GetTheme()->
       GetMinimumWidgetSize(aPresContext, aChildFrame,
                            disp->mAppearance,
                            &widgetMinSize, &canOverride);
 
     nscoord widgetMainMinSize =
       aPresContext->DevPixelsToAppUnits(
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -4290,17 +4290,17 @@ nsFrame::ComputeSize(nsRenderingContext 
                                          boxSizingAdjust.BSize(aWM),
                                          minBSizeCoord);
       result.BSize(aWM) = std::max(minBSize, result.BSize(aWM));
     }
   }
 
   const nsStyleDisplay *disp = StyleDisplay();
   if (IsThemed(disp)) {
-    LayoutDeviceIntSize widget;
+    nsIntSize widget(0, 0);
     bool canOverride = true;
     nsPresContext *presContext = PresContext();
     presContext->GetTheme()->
       GetMinimumWidgetSize(presContext, this, disp->mAppearance,
                            &widget, &canOverride);
 
     // Dimensions from themed widgets are applied physically...
     nsSize size;
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -1034,17 +1034,17 @@ ScrollFrameHelper::GetNondisappearingScr
   if (LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 0) {
     // We're using overlay scrollbars, so we need to get the width that
     // non-disappearing scrollbars would have.
     nsITheme* theme = aState->PresContext()->GetTheme();
     if (theme &&
         theme->ThemeSupportsWidget(aState->PresContext(),
                                    mVScrollbarBox,
                                    NS_THEME_SCROLLBAR_NON_DISAPPEARING)) {
-      LayoutDeviceIntSize size;
+      nsIntSize size;
       bool canOverride = true;
       theme->GetMinimumWidgetSize(aState->PresContext(),
                                   mVScrollbarBox,
                                   NS_THEME_SCROLLBAR_NON_DISAPPEARING,
                                   &size,
                                   &canOverride);
       if (size.width) {
         return aState->PresContext()->DevPixelsToAppUnits(size.width);
--- a/layout/xul/nsBox.cpp
+++ b/layout/xul/nsBox.cpp
@@ -676,17 +676,17 @@ nsIFrame::AddCSSMinSize(nsBoxLayoutState
 
     bool canOverride = true;
 
     // See if a native theme wants to supply a minimum size.
     const nsStyleDisplay* display = aBox->StyleDisplay();
     if (display->mAppearance) {
       nsITheme *theme = aState.PresContext()->GetTheme();
       if (theme && theme->ThemeSupportsWidget(aState.PresContext(), aBox, display->mAppearance)) {
-        LayoutDeviceIntSize size;
+        nsIntSize size;
         theme->GetMinimumWidgetSize(aState.PresContext(), aBox,
                                     display->mAppearance, &size, &canOverride);
         if (size.width) {
           aSize.width = aState.PresContext()->DevPixelsToAppUnits(size.width);
           aWidthSet = true;
         }
         if (size.height) {
           aSize.height = aState.PresContext()->DevPixelsToAppUnits(size.height);
--- a/layout/xul/nsScrollbarFrame.cpp
+++ b/layout/xul/nsScrollbarFrame.cpp
@@ -170,17 +170,17 @@ nsresult
 nsScrollbarFrame::GetMargin(nsMargin& aMargin)
 {
   aMargin.SizeTo(0,0,0,0);
 
   if (LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 0) {
     nsPresContext* presContext = PresContext();
     nsITheme* theme = presContext->GetTheme();
     if (theme) {
-      LayoutDeviceIntSize size;
+      nsIntSize size;
       bool isOverridable;
       theme->GetMinimumWidgetSize(presContext, this, NS_THEME_SCROLLBAR, &size,
                                   &isOverridable);
       if (IsHorizontal()) {
         aMargin.top = -presContext->DevPixelsToAppUnits(size.height);
       }
       else {
         if (StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -2082,17 +2082,17 @@ nsTreeBodyFrame::GetTwistyRect(int32_t a
   const nsStyleDisplay* twistyDisplayData = aTwistyContext->StyleDisplay();
   if (twistyDisplayData->mAppearance) {
     theme = aPresContext->GetTheme();
     if (theme && theme->ThemeSupportsWidget(aPresContext, nullptr, twistyDisplayData->mAppearance))
       useTheme = true;
   }
 
   if (useTheme) {
-    LayoutDeviceIntSize minTwistySizePx;
+    nsIntSize minTwistySizePx(0,0);
     bool canOverride = true;
     theme->GetMinimumWidgetSize(aPresContext, this, twistyDisplayData->mAppearance,
                                 &minTwistySizePx, &canOverride);
 
     // GMWS() returns size in pixels, we need to convert it back to app units
     nsSize minTwistySize;
     minTwistySize.width = aPresContext->DevPixelsToAppUnits(minTwistySizePx.width);
     minTwistySize.height = aPresContext->DevPixelsToAppUnits(minTwistySizePx.height);
--- a/widget/cocoa/nsNativeThemeCocoa.h
+++ b/widget/cocoa/nsNativeThemeCocoa.h
@@ -61,17 +61,17 @@ public:
                                   uint8_t aWidgetType,
                                   nsIntMargin* aResult) override;
 
   virtual bool GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFrame,
                                    uint8_t aWidgetType, nsRect* aOverflowRect) override;
 
   NS_IMETHOD GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame,
                                   uint8_t aWidgetType,
-                                  mozilla::LayoutDeviceIntSize* aResult, bool* aIsOverridable) override;
+                                  nsIntSize* aResult, bool* aIsOverridable) override;
   NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType, 
                                 nsIAtom* aAttribute, bool* aShouldRepaint) override;
   NS_IMETHOD ThemeChanged() override;
   bool ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* aFrame, uint8_t aWidgetType) override;
   bool WidgetIsContainer(uint8_t aWidgetType) override;
   bool ThemeDrawsFocusForWidget(uint8_t aWidgetType) override;
   bool ThemeNeedsComboboxDropmarker() override;
   virtual bool WidgetAppearanceDependsOnWindowFocus(uint8_t aWidgetType) override;
--- a/widget/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/cocoa/nsNativeThemeCocoa.mm
@@ -3158,17 +3158,17 @@ nsNativeThemeCocoa::GetWidgetOverflow(ns
 
 static const int32_t kRegularScrollbarThumbMinSize = 26;
 static const int32_t kSmallScrollbarThumbMinSize = 26;
 
 NS_IMETHODIMP
 nsNativeThemeCocoa::GetMinimumWidgetSize(nsPresContext* aPresContext,
                                          nsIFrame* aFrame,
                                          uint8_t aWidgetType,
-                                         LayoutDeviceIntSize* aResult,
+                                         nsIntSize* aResult,
                                          bool* aIsOverridable)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   aResult->SizeTo(0,0);
   *aIsOverridable = true;
 
   switch (aWidgetType) {
--- a/widget/gtk/nsNativeThemeGTK.cpp
+++ b/widget/gtk/nsNativeThemeGTK.cpp
@@ -1060,18 +1060,17 @@ nsNativeThemeGTK::GetWidgetOverflow(nsDe
 
   aOverflowRect->Inflate(m);
   return true;
 }
 
 NS_IMETHODIMP
 nsNativeThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
                                        nsIFrame* aFrame, uint8_t aWidgetType,
-                                       LayoutDeviceIntSize* aResult,
-                                       bool* aIsOverridable)
+                                       nsIntSize* aResult, bool* aIsOverridable)
 {
   aResult->width = aResult->height = 0;
   *aIsOverridable = true;
 
   switch (aWidgetType) {
     case NS_THEME_SCROLLBAR_BUTTON_UP:
     case NS_THEME_SCROLLBAR_BUTTON_DOWN:
       {
--- a/widget/gtk/nsNativeThemeGTK.h
+++ b/widget/gtk/nsNativeThemeGTK.h
@@ -40,17 +40,17 @@ public:
 
   virtual bool GetWidgetOverflow(nsDeviceContext* aContext,
                                  nsIFrame* aFrame,
                                  uint8_t aWidgetType,
                                  nsRect* aOverflowRect) override;
 
   NS_IMETHOD GetMinimumWidgetSize(nsPresContext* aPresContext,
                                   nsIFrame* aFrame, uint8_t aWidgetType,
-                                  mozilla::LayoutDeviceIntSize* aResult,
+                                  nsIntSize* aResult,
                                   bool* aIsOverridable) override;
 
   NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType, 
                                 nsIAtom* aAttribute,
                                 bool* aShouldRepaint) override;
 
   NS_IMETHOD ThemeChanged() override;
 
--- a/widget/windows/nsNativeThemeWin.cpp
+++ b/widget/windows/nsNativeThemeWin.cpp
@@ -348,17 +348,17 @@ static CaptionButtonPadding buttonData[3
   },
   { 
     { { 0, 2, 0, 2 }, { 0, 2, 1, 2 }, { 1, 2, 2, 2 } }
   }
 };
 
 // Adds "hot" caption button padding to minimum widget size.
 static void
-AddPaddingRect(LayoutDeviceIntSize* aSize, CaptionButton button) {
+AddPaddingRect(nsIntSize* aSize, CaptionButton button) {
   if (!aSize)
     return;
   RECT offset;
   if (!IsAppThemed())
     offset = buttonData[CAPTION_CLASSIC].hotPadding[button];
   else if (!IsVistaOrLater())
     offset = buttonData[CAPTION_XPTHEME].hotPadding[button];
   else
@@ -2249,17 +2249,17 @@ nsNativeThemeWin::GetWidgetOverflow(nsDe
   }
 
   return false;
 }
 
 NS_IMETHODIMP
 nsNativeThemeWin::GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame,
                                        uint8_t aWidgetType,
-                                       LayoutDeviceIntSize* aResult, bool* aIsOverridable)
+                                       nsIntSize* aResult, bool* aIsOverridable)
 {
   (*aResult).width = (*aResult).height = 0;
   *aIsOverridable = true;
 
   HANDLE theme = GetTheme(aWidgetType);
   if (!theme)
     return ClassicGetMinimumWidgetSize(aPresContext, aFrame, aWidgetType, aResult, aIsOverridable);
 
@@ -2913,17 +2913,17 @@ nsNativeThemeWin::ClassicGetWidgetPaddin
     default:
       return false;
   }
 }
 
 nsresult
 nsNativeThemeWin::ClassicGetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame,
                                        uint8_t aWidgetType,
-                                       LayoutDeviceIntSize* aResult, bool* aIsOverridable)
+                                       nsIntSize* aResult, bool* aIsOverridable)
 {
   (*aResult).width = (*aResult).height = 0;
   *aIsOverridable = true;
   switch (aWidgetType) {
     case NS_THEME_RADIO:
     case NS_THEME_CHECKBOX:
       (*aResult).width = (*aResult).height = 13;
       break;
--- a/widget/windows/nsNativeThemeWin.h
+++ b/widget/windows/nsNativeThemeWin.h
@@ -11,16 +11,18 @@
 #include "nsCOMPtr.h"
 #include "nsIAtom.h"
 #include "nsNativeTheme.h"
 #include "gfxTypes.h"
 #include <windows.h>
 #include "mozilla/TimeStamp.h"
 #include "nsSize.h"
 
+struct nsIntRect;
+
 class nsNativeThemeWin : private nsNativeTheme,
                          public nsITheme {
   virtual ~nsNativeThemeWin();
 
 public:
   typedef mozilla::TimeStamp TimeStamp;
   typedef mozilla::TimeDuration TimeDuration;
 
@@ -45,17 +47,17 @@ public:
 
   virtual bool GetWidgetOverflow(nsDeviceContext* aContext,
                                    nsIFrame* aFrame,
                                    uint8_t aWidgetType,
                                    nsRect* aOverflowRect);
 
   NS_IMETHOD GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame,
                                   uint8_t aWidgetType,
-                                  mozilla::LayoutDeviceIntSize* aResult,
+                                  nsIntSize* aResult,
                                   bool* aIsOverridable);
 
   virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, uint8_t aWidgetType);
 
   NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType, 
                                 nsIAtom* aAttribute, bool* aShouldRepaint);
 
   NS_IMETHOD ThemeChanged();
@@ -98,17 +100,17 @@ protected:
                                   uint8_t aWidgetType,
                                   nsIntMargin* aResult);
   bool ClassicGetWidgetPadding(nsDeviceContext* aContext,
                                nsIFrame* aFrame,
                                uint8_t aWidgetType,
                                nsIntMargin* aResult);
   nsresult ClassicGetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame,
                                        uint8_t aWidgetType,
-                                       mozilla::LayoutDeviceIntSize* aResult,
+                                       nsIntSize* aResult,
                                        bool* aIsOverridable);
   bool ClassicThemeSupportsWidget(nsPresContext* aPresContext, 
                                   nsIFrame* aFrame,
                                   uint8_t aWidgetType);
   void DrawCheckedRect(HDC hdc, const RECT& rc, int32_t fore, int32_t back,
                        HBRUSH defaultBack);
   uint32_t GetWidgetNativeDrawingFlags(uint8_t aWidgetType);
   int32_t StandardGetState(nsIFrame* aFrame, uint8_t aWidgetType, bool wantFocused);