Bug 1053986 - Rename nsIFrame::AddCSSPrefSize, AddCSSMinSize, AddCSSMaxSize, and AddCSSFlex by replacing CSS with XUL. r?dholbert draft
authorL. David Baron <dbaron@dbaron.org>
Wed, 20 Apr 2016 12:16:59 -0700
changeset 354394 c0cb4efd740695f4c783d1d25b56944536cae8ad
parent 354393 35b631dce51ab4beb835246656ba2113bbfe9e98
child 354395 cf488d384e5830cdf6e62a11c5a888ab003814e0
push id16058
push userdbaron@mozilla.com
push dateWed, 20 Apr 2016 19:17:15 +0000
reviewersdholbert
bugs1053986
milestone48.0a1
Bug 1053986 - Rename nsIFrame::AddCSSPrefSize, AddCSSMinSize, AddCSSMaxSize, and AddCSSFlex by replacing CSS with XUL. r?dholbert Written purely with sed, over .h and .cpp files in layout/. MozReview-Commit-ID: BTsQw1EMqvY
layout/generic/nsFrame.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsIFrame.h
layout/xul/grid/nsGrid.cpp
layout/xul/nsBox.cpp
layout/xul/nsBoxFrame.cpp
layout/xul/nsImageBoxFrame.cpp
layout/xul/nsMenuFrame.cpp
layout/xul/nsTextBoxFrame.cpp
layout/xul/tree/nsTreeBodyFrame.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -8704,17 +8704,17 @@ nsFrame::GetXULPrefSize(nsBoxLayoutState
     return metrics->mPrefSize;
   }
 
   if (IsXULCollapsed())
     return size;
 
   // get our size in CSS.
   bool widthSet, heightSet;
-  bool completelyRedefined = nsIFrame::AddCSSPrefSize(this, size, widthSet, heightSet);
+  bool completelyRedefined = nsIFrame::AddXULPrefSize(this, size, widthSet, heightSet);
 
   // Refresh our caches with new sizes.
   if (!completelyRedefined) {
     RefreshSizeCache(aState);
     nsSize blockSize = metrics->mBlockPrefSize;
 
     // notice we don't need to add our borders or padding
     // in. That's because the block did it for us.
@@ -8741,17 +8741,17 @@ nsFrame::GetXULMinSize(nsBoxLayoutState&
   }
 
   if (IsXULCollapsed())
     return size;
 
   // get our size in CSS.
   bool widthSet, heightSet;
   bool completelyRedefined =
-    nsIFrame::AddCSSMinSize(aState, this, size, widthSet, heightSet);
+    nsIFrame::AddXULMinSize(aState, this, size, widthSet, heightSet);
 
   // Refresh our caches with new sizes.
   if (!completelyRedefined) {
     RefreshSizeCache(aState);
     nsSize blockSize = metrics->mBlockMinSize;
 
     if (!widthSet)
       size.width = blockSize.width;
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -1419,17 +1419,17 @@ nsXULScrollFrame::GetXULPrefSize(nsBoxLa
       styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL) {
     nsSize hSize = mHelper.mHScrollbarBox->GetXULPrefSize(aState);
     nsBox::AddMargin(mHelper.mHScrollbarBox, hSize);
     pref.height += hSize.height;
   }
 
   AddBorderAndPadding(pref);
   bool widthSet, heightSet;
-  nsIFrame::AddCSSPrefSize(this, pref, widthSet, heightSet);
+  nsIFrame::AddXULPrefSize(this, pref, widthSet, heightSet);
   return pref;
 }
 
 nsSize
 nsXULScrollFrame::GetXULMinSize(nsBoxLayoutState& aState)
 {
 #ifdef DEBUG_LAYOUT
   PropagateDebug(aState);
@@ -1454,32 +1454,32 @@ nsXULScrollFrame::GetXULMinSize(nsBoxLay
      AddMargin(mHelper.mHScrollbarBox, hSize);
      min.height += hSize.height;
      if (min.width < hSize.width)
         min.width = hSize.width;
   }
 
   AddBorderAndPadding(min);
   bool widthSet, heightSet;
-  nsIFrame::AddCSSMinSize(aState, this, min, widthSet, heightSet);
+  nsIFrame::AddXULMinSize(aState, this, min, widthSet, heightSet);
   return min;
 }
 
 nsSize
 nsXULScrollFrame::GetXULMaxSize(nsBoxLayoutState& aState)
 {
 #ifdef DEBUG_LAYOUT
   PropagateDebug(aState);
 #endif
 
   nsSize maxSize(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
 
   AddBorderAndPadding(maxSize);
   bool widthSet, heightSet;
-  nsIFrame::AddCSSMaxSize(this, maxSize, widthSet, heightSet);
+  nsIFrame::AddXULMaxSize(this, maxSize, widthSet, heightSet);
   return maxSize;
 }
 
 #ifdef DEBUG_FRAME_DUMP
 nsresult
 nsXULScrollFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("XULScroll"), aResult);
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -2938,21 +2938,21 @@ public:
 #endif
 
   /**
    * @return true if this text frame ends with a newline character.  It
    * should return false if this is not a text frame.
    */
   virtual bool HasSignificantTerminalNewline() const;
 
-  static bool AddCSSPrefSize(nsIFrame* aBox, nsSize& aSize, bool& aWidth, bool& aHeightSet);
-  static bool AddCSSMinSize(nsBoxLayoutState& aState, nsIFrame* aBox,
+  static bool AddXULPrefSize(nsIFrame* aBox, nsSize& aSize, bool& aWidth, bool& aHeightSet);
+  static bool AddXULMinSize(nsBoxLayoutState& aState, nsIFrame* aBox,
                             nsSize& aSize, bool& aWidth, bool& aHeightSet);
-  static bool AddCSSMaxSize(nsIFrame* aBox, nsSize& aSize, bool& aWidth, bool& aHeightSet);
-  static bool AddCSSFlex(nsIFrame* aBox, nscoord& aFlex);
+  static bool AddXULMaxSize(nsIFrame* aBox, nsSize& aSize, bool& aWidth, bool& aHeightSet);
+  static bool AddXULFlex(nsIFrame* aBox, nscoord& aFlex);
 
   // END OF BOX LAYOUT METHODS
   // The above methods have been migrated from nsIBox and are in the process of
   // being refactored. DO NOT USE OUTSIDE OF XUL.
 
   struct CaretPosition {
     CaretPosition();
     ~CaretPosition();
--- a/layout/xul/grid/nsGrid.cpp
+++ b/layout/xul/grid/nsGrid.cpp
@@ -800,17 +800,17 @@ nsGrid::GetPrefRowHeight(nsBoxLayoutStat
 
   nsIFrame* box = row->mBox;
 
   // set in CSS?
   if (box) 
   {
     bool widthSet, heightSet;
     nsSize cssSize(-1, -1);
-    nsIFrame::AddCSSPrefSize(box, cssSize, widthSet, heightSet);
+    nsIFrame::AddXULPrefSize(box, cssSize, widthSet, heightSet);
 
     row->mPref = GET_HEIGHT(cssSize, aIsHorizontal);
 
     // yep do nothing.
     if (row->mPref != -1)
       return row->mPref;
   }
 
@@ -876,17 +876,17 @@ nsGrid::GetMinRowHeight(nsBoxLayoutState
     return row->mMin;
 
   nsIFrame* box = row->mBox;
 
   // set in CSS?
   if (box) {
     bool widthSet, heightSet;
     nsSize cssSize(-1, -1);
-    nsIFrame::AddCSSMinSize(aState, box, cssSize, widthSet, heightSet);
+    nsIFrame::AddXULMinSize(aState, box, cssSize, widthSet, heightSet);
 
     row->mMin = GET_HEIGHT(cssSize, aIsHorizontal);
 
     // yep do nothing.
     if (row->mMin != -1)
       return row->mMin;
   }
 
@@ -951,17 +951,17 @@ nsGrid::GetMaxRowHeight(nsBoxLayoutState
     return row->mMax;
 
   nsIFrame* box = row->mBox;
 
   // set in CSS?
   if (box) {
     bool widthSet, heightSet;
     nsSize cssSize(-1, -1);
-    nsIFrame::AddCSSMaxSize(box, cssSize, widthSet, heightSet);
+    nsIFrame::AddXULMaxSize(box, cssSize, widthSet, heightSet);
 
     row->mMax = GET_HEIGHT(cssSize, aIsHorizontal);
 
     // yep do nothing.
     if (row->mMax != -1)
       return row->mMax;
   }
 
@@ -1101,31 +1101,31 @@ nsGrid::GetRowFlex(int32_t aIndex, bool 
       parentsParent = nsBox::GetParentXULBox(parent);
 
       // if our parents parent is not a grid
       // the get its flex. If its 0 then we are
       // not flexible.
       if (parentsParent) {
         if (!IsGrid(parentsParent)) {
           nscoord flex = parent->GetXULFlex();
-          nsIFrame::AddCSSFlex(parent, flex);
+          nsIFrame::AddXULFlex(parent, flex);
           if (flex == 0) {
             row->mFlex = 0;
             return row->mFlex;
           }
         } else 
           break;
       }
 
       parent = parentsParent;
     }
     
     // get the row flex.
     row->mFlex = box->GetXULFlex();
-    nsIFrame::AddCSSFlex(box, row->mFlex);
+    nsIFrame::AddXULFlex(box, row->mFlex);
   }
 
   return row->mFlex;
 }
 
 void
 nsGrid::SetLargestSize(nsSize& aSize, nscoord aHeight, bool aIsHorizontal)
 {
--- a/layout/xul/nsBox.cpp
+++ b/layout/xul/nsBox.cpp
@@ -399,17 +399,17 @@ nsBox::GetXULPrefSize(nsBoxLayoutState& 
   nsSize pref(0,0);
   DISPLAY_PREF_SIZE(this, pref);
 
   if (IsXULCollapsed())
     return pref;
 
   AddBorderAndPadding(pref);
   bool widthSet, heightSet;
-  nsIFrame::AddCSSPrefSize(this, pref, widthSet, heightSet);
+  nsIFrame::AddXULPrefSize(this, pref, widthSet, heightSet);
 
   nsSize minSize = GetXULMinSize(aState);
   nsSize maxSize = GetXULMaxSize(aState);
   return BoundsCheck(minSize, pref, maxSize);
 }
 
 nsSize
 nsBox::GetXULMinSize(nsBoxLayoutState& aState)
@@ -419,17 +419,17 @@ nsBox::GetXULMinSize(nsBoxLayoutState& a
   nsSize min(0,0);
   DISPLAY_MIN_SIZE(this, min);
 
   if (IsXULCollapsed())
     return min;
 
   AddBorderAndPadding(min);
   bool widthSet, heightSet;
-  nsIFrame::AddCSSMinSize(aState, this, min, widthSet, heightSet);
+  nsIFrame::AddXULMinSize(aState, this, min, widthSet, heightSet);
   return min;
 }
 
 nsSize
 nsBox::GetXULMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState)
 {
   return nsSize(0, 0);
 }
@@ -442,26 +442,26 @@ nsBox::GetXULMaxSize(nsBoxLayoutState& a
   nsSize maxSize(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
   DISPLAY_MAX_SIZE(this, maxSize);
 
   if (IsXULCollapsed())
     return maxSize;
 
   AddBorderAndPadding(maxSize);
   bool widthSet, heightSet;
-  nsIFrame::AddCSSMaxSize(this, maxSize, widthSet, heightSet);
+  nsIFrame::AddXULMaxSize(this, maxSize, widthSet, heightSet);
   return maxSize;
 }
 
 nscoord
 nsBox::GetXULFlex()
 {
   nscoord flex = 0;
 
-  nsIFrame::AddCSSFlex(this, flex);
+  nsIFrame::AddXULFlex(this, flex);
 
   return flex;
 }
 
 uint32_t
 nsIFrame::GetXULOrdinal()
 {
   uint32_t ordinal = StyleXUL()->mBoxOrdinal;
@@ -590,17 +590,17 @@ nsIFrame::XULRedraw(nsBoxLayoutState& aS
   // nsStackLayout, at least, expects us to repaint descendants even
   // if a damage rect is provided
   InvalidateFrameSubtree();
 
   return NS_OK;
 }
 
 bool
-nsIFrame::AddCSSPrefSize(nsIFrame* aBox, nsSize& aSize, bool &aWidthSet, bool &aHeightSet)
+nsIFrame::AddXULPrefSize(nsIFrame* aBox, nsSize& aSize, bool &aWidthSet, bool &aHeightSet)
 {
     aWidthSet = false;
     aHeightSet = false;
 
     // add in the css min, max, pref
     const nsStylePosition* position = aBox->StylePosition();
 
     // see if the width or height was specifically set
@@ -663,17 +663,17 @@ nsIFrame::AddCSSPrefSize(nsIFrame* aBox,
         }
     }
 
     return (aWidthSet && aHeightSet);
 }
 
 
 bool
-nsIFrame::AddCSSMinSize(nsBoxLayoutState& aState, nsIFrame* aBox, nsSize& aSize,
+nsIFrame::AddXULMinSize(nsBoxLayoutState& aState, nsIFrame* aBox, nsSize& aSize,
                       bool &aWidthSet, bool &aHeightSet)
 {
     aWidthSet = false;
     aHeightSet = false;
 
     bool canOverride = true;
 
     // See if a native theme wants to supply a minimum size.
@@ -770,17 +770,17 @@ nsIFrame::AddCSSMinSize(nsBoxLayoutState
             aHeightSet = true;
         }
     }
 
     return (aWidthSet && aHeightSet);
 }
 
 bool
-nsIFrame::AddCSSMaxSize(nsIFrame* aBox, nsSize& aSize, bool &aWidthSet, bool &aHeightSet)
+nsIFrame::AddXULMaxSize(nsIFrame* aBox, nsSize& aSize, bool &aWidthSet, bool &aHeightSet)
 {
     aWidthSet = false;
     aHeightSet = false;
 
     // add in the css min, max, pref
     const nsStylePosition* position = aBox->StylePosition();
 
     // and max
@@ -829,17 +829,17 @@ nsIFrame::AddCSSMaxSize(nsIFrame* aBox, 
             aHeightSet = true;
         }
     }
 
     return (aWidthSet || aHeightSet);
 }
 
 bool
-nsIFrame::AddCSSFlex(nsIFrame* aBox, nscoord& aFlex)
+nsIFrame::AddXULFlex(nsIFrame* aBox, nscoord& aFlex)
 {
     bool flexSet = false;
 
     // get the flexibility
     aFlex = aBox->StyleXUL()->mBoxFlex;
 
     // attribute value overrides CSS
     nsIContent* content = aBox->GetContent();
--- a/layout/xul/nsBoxFrame.cpp
+++ b/layout/xul/nsBoxFrame.cpp
@@ -759,17 +759,17 @@ nsBoxFrame::GetXULPrefSize(nsBoxLayoutSt
   PropagateDebug(aBoxLayoutState);
 #endif
 
   if (IsXULCollapsed())
     return size;
 
   // if the size was not completely redefined in CSS then ask our children
   bool widthSet, heightSet;
-  if (!nsIFrame::AddCSSPrefSize(this, size, widthSet, heightSet))
+  if (!nsIFrame::AddXULPrefSize(this, size, widthSet, heightSet))
   {
     if (mLayoutManager) {
       nsSize layoutSize = mLayoutManager->GetXULPrefSize(this, aBoxLayoutState);
       if (!widthSet)
         size.width = layoutSize.width;
       if (!heightSet)
         size.height = layoutSize.height;
     }
@@ -822,17 +822,17 @@ nsBoxFrame::GetXULMinSize(nsBoxLayoutSta
   PropagateDebug(aBoxLayoutState);
 #endif
 
   if (IsXULCollapsed())
     return size;
 
   // if the size was not completely redefined in CSS then ask our children
   bool widthSet, heightSet;
-  if (!nsIFrame::AddCSSMinSize(aBoxLayoutState, this, size, widthSet, heightSet))
+  if (!nsIFrame::AddXULMinSize(aBoxLayoutState, this, size, widthSet, heightSet))
   {
     if (mLayoutManager) {
       nsSize layoutSize = mLayoutManager->GetXULMinSize(this, aBoxLayoutState);
       if (!widthSet)
         size.width = layoutSize.width;
       if (!heightSet)
         size.height = layoutSize.height;
     }
@@ -862,17 +862,17 @@ nsBoxFrame::GetXULMaxSize(nsBoxLayoutSta
   PropagateDebug(aBoxLayoutState);
 #endif
 
   if (IsXULCollapsed())
     return size;
 
   // if the size was not completely redefined in CSS then ask our children
   bool widthSet, heightSet;
-  if (!nsIFrame::AddCSSMaxSize(this, size, widthSet, heightSet))
+  if (!nsIFrame::AddXULMaxSize(this, size, widthSet, heightSet))
   {
     if (mLayoutManager) {
       nsSize layoutSize = mLayoutManager->GetXULMaxSize(this, aBoxLayoutState);
       if (!widthSet)
         size.width = layoutSize.width;
       if (!heightSet)
         size.height = layoutSize.height;
     }
@@ -1776,20 +1776,20 @@ nsBoxFrame::DisplayDebugInfoFor(nsIFrame
                     mDebugChild = child;
 
                     nsSize prefSizeCSS(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
                     nsSize minSizeCSS (NS_INTRINSICSIZE, NS_INTRINSICSIZE);
                     nsSize maxSizeCSS (NS_INTRINSICSIZE, NS_INTRINSICSIZE);
                     nscoord flexCSS = NS_INTRINSICSIZE;
 
                     bool widthSet, heightSet;
-                    nsIFrame::AddCSSPrefSize(child, prefSizeCSS, widthSet, heightSet);
-                    nsIFrame::AddCSSMinSize (state, child, minSizeCSS, widthSet, heightSet);
-                    nsIFrame::AddCSSMaxSize (child, maxSizeCSS, widthSet, heightSet);
-                    nsIFrame::AddCSSFlex    (child, flexCSS);
+                    nsIFrame::AddXULPrefSize(child, prefSizeCSS, widthSet, heightSet);
+                    nsIFrame::AddXULMinSize (state, child, minSizeCSS, widthSet, heightSet);
+                    nsIFrame::AddXULMaxSize (child, maxSizeCSS, widthSet, heightSet);
+                    nsIFrame::AddXULFlex    (child, flexCSS);
 
                     nsSize prefSize = child->GetXULPrefSize(state);
                     nsSize minSize = child->GetXULMinSize(state);
                     nsSize maxSize = child->GetXULMaxSize(state);
                     nscoord flexSize = child->GetXULFlex();
                     nscoord ascentSize = child->GetXULBoxAscent(state);
 
                     char min[100];
--- a/layout/xul/nsImageBoxFrame.cpp
+++ b/layout/xul/nsImageBoxFrame.cpp
@@ -560,17 +560,17 @@ nsImageBoxFrame::GetXULPrefSize(nsBoxLay
   nsSize intrinsicSize = size;
 
   nsMargin borderPadding(0,0,0,0);
   GetXULBorderAndPadding(borderPadding);
   size.width += borderPadding.LeftRight();
   size.height += borderPadding.TopBottom();
 
   bool widthSet, heightSet;
-  nsIFrame::AddCSSPrefSize(this, size, widthSet, heightSet);
+  nsIFrame::AddXULPrefSize(this, size, widthSet, heightSet);
   NS_ASSERTION(size.width != NS_INTRINSICSIZE && size.height != NS_INTRINSICSIZE,
                "non-intrinsic size expected");
 
   nsSize minSize = GetXULMinSize(aState);
   nsSize maxSize = GetXULMaxSize(aState);
 
   if (!widthSet && !heightSet) {
     if (minSize.width != NS_INTRINSICSIZE)
@@ -625,17 +625,17 @@ nsImageBoxFrame::GetXULPrefSize(nsBoxLay
 nsSize
 nsImageBoxFrame::GetXULMinSize(nsBoxLayoutState& aState)
 {
   // An image can always scale down to (0,0).
   nsSize size(0,0);
   DISPLAY_MIN_SIZE(this, size);
   AddBorderAndPadding(size);
   bool widthSet, heightSet;
-  nsIFrame::AddCSSMinSize(aState, this, size, widthSet, heightSet);
+  nsIFrame::AddXULMinSize(aState, this, size, widthSet, heightSet);
   return size;
 }
 
 nscoord
 nsImageBoxFrame::GetXULBoxAscent(nsBoxLayoutState& aState)
 {
   return GetXULPrefSize(aState).height;
 }
--- a/layout/xul/nsMenuFrame.cpp
+++ b/layout/xul/nsMenuFrame.cpp
@@ -1340,17 +1340,17 @@ nsMenuFrame::AppendFrames(ChildListID   
 }
 
 bool
 nsMenuFrame::SizeToPopup(nsBoxLayoutState& aState, nsSize& aSize)
 {
   if (!IsXULCollapsed()) {
     bool widthSet, heightSet;
     nsSize tmpSize(-1, 0);
-    nsIFrame::AddCSSPrefSize(this, tmpSize, widthSet, heightSet);
+    nsIFrame::AddXULPrefSize(this, tmpSize, widthSet, heightSet);
     if (!widthSet && GetXULFlex() == 0) {
       nsMenuPopupFrame* popupFrame = GetPopup();
       if (!popupFrame)
         return false;
       tmpSize = popupFrame->GetXULPrefSize(aState);
 
       // Produce a size such that:
       //  (1) the menu and its popup can be the same width
--- a/layout/xul/nsTextBoxFrame.cpp
+++ b/layout/xul/nsTextBoxFrame.cpp
@@ -1112,17 +1112,17 @@ nsTextBoxFrame::GetXULPrefSize(nsBoxLayo
 {
     CalcTextSize(aBoxLayoutState);
 
     nsSize size = mTextSize;
     DISPLAY_PREF_SIZE(this, size);
 
     AddBorderAndPadding(size);
     bool widthSet, heightSet;
-    nsIFrame::AddCSSPrefSize(this, size, widthSet, heightSet);
+    nsIFrame::AddXULPrefSize(this, size, widthSet, heightSet);
 
     return size;
 }
 
 /**
  * Ok return our dimensions
  */
 nsSize
@@ -1139,17 +1139,17 @@ nsTextBoxFrame::GetXULMinSize(nsBoxLayou
             size.height = 0;
         } else {
             size.width = 0;
         }
     }
 
     AddBorderAndPadding(size);
     bool widthSet, heightSet;
-    nsIFrame::AddCSSMinSize(aBoxLayoutState, this, size, widthSet, heightSet);
+    nsIFrame::AddXULMinSize(aBoxLayoutState, this, size, widthSet, heightSet);
 
     return size;
 }
 
 nscoord
 nsTextBoxFrame::GetXULBoxAscent(nsBoxLayoutState& aBoxLayoutState)
 {
     CalcTextSize(aBoxLayoutState);
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -221,17 +221,17 @@ nsTreeBodyFrame::GetXULMinSize(nsBoxLayo
       desiredRows = 0;
     }
   }
 
   min.height = mRowHeight * desiredRows;
 
   AddBorderAndPadding(min);
   bool widthSet, heightSet;
-  nsIFrame::AddCSSMinSize(aBoxLayoutState, this, min, widthSet, heightSet);
+  nsIFrame::AddXULMinSize(aBoxLayoutState, this, min, widthSet, heightSet);
 
   return min;
 }
 
 nscoord
 nsTreeBodyFrame::CalcMaxRowWidth()
 {
   if (mStringWidth != -1)