Bug 492520 - Optimize some Frame classes for memory usage; r+sr=roc
authorArpad Borsos <arpad.borsos@googlemail.com>
Tue, 12 May 2009 12:13:09 +0200
changeset 28285 e7877c4ddaa56b94ad5861846e53a6afe948b1ce
parent 28284 0ee7865c78c5f19805b59aff29afd7b61ac26353
child 28286 da613c9fae8c36e8e9c3111e3d3edd1487fa1b3e
push idunknown
push userunknown
push dateunknown
bugs492520
milestone1.9.2a1pre
Bug 492520 - Optimize some Frame classes for memory usage; r+sr=roc
layout/generic/nsBulletFrame.h
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsFrameSetFrame.h
layout/generic/nsSimplePageSequence.h
layout/tables/nsTableColFrame.h
layout/xul/base/src/nsImageBoxFrame.cpp
layout/xul/base/src/nsImageBoxFrame.h
layout/xul/base/src/nsListBoxBodyFrame.cpp
layout/xul/base/src/nsListBoxBodyFrame.h
layout/xul/base/src/nsMenuPopupFrame.cpp
layout/xul/base/src/nsMenuPopupFrame.h
layout/xul/base/src/nsSliderFrame.h
layout/xul/base/src/nsTextBoxFrame.cpp
layout/xul/base/src/nsTextBoxFrame.h
layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
layout/xul/base/src/tree/src/nsTreeBodyFrame.h
--- a/layout/generic/nsBulletFrame.h
+++ b/layout/generic/nsBulletFrame.h
@@ -107,19 +107,19 @@ public:
 
 protected:
   void GetDesiredSize(nsPresContext* aPresContext,
                       nsIRenderingContext *aRenderingContext,
                       nsHTMLReflowMetrics& aMetrics);
 
   void GetLoadGroup(nsPresContext *aPresContext, nsILoadGroup **aLoadGroup);
 
-  PRInt32 mOrdinal;
   nsMargin mPadding;
   nsCOMPtr<imgIRequest> mImageRequest;
   nsCOMPtr<imgIDecoderObserver> mListener;
 
   nsSize mIntrinsicSize;
   nsSize mComputedSize;
+  PRInt32 mOrdinal;
   PRBool mTextIsRTL;
 };
 
 #endif /* nsBulletFrame_h___ */
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -159,26 +159,26 @@ public:
   void PaintBorder(nsIRenderingContext& aRenderingContext, nsPoint aPt);
 
 protected:
   nsHTMLFramesetBorderFrame(nsStyleContext* aContext, PRInt32 aWidth, PRBool aVertical, PRBool aVisible);
   virtual ~nsHTMLFramesetBorderFrame();
   virtual nscoord GetIntrinsicWidth();
   virtual nscoord GetIntrinsicHeight();
 
+  // the prev and next neighbors are indexes into the row (for a horizontal border) or col (for
+  // a vertical border) of nsHTMLFramesetFrames or nsHTMLFrames
+  PRInt32 mPrevNeighbor;
+  PRInt32 mNextNeighbor;
+  nscolor mColor;
   PRInt32 mWidth;
   PRPackedBool mVertical;
   PRPackedBool mVisibility;
   PRPackedBool mVisibilityOverride;
-  nscolor mColor;
-  // the prev and next neighbors are indexes into the row (for a horizontal border) or col (for
-  // a vertical border) of nsHTMLFramesetFrames or nsHTMLFrames
-  PRInt32 mPrevNeighbor; 
-  PRInt32 mNextNeighbor;
-  PRBool mCanResize;
+  PRPackedBool mCanResize;
   friend class nsHTMLFramesetFrame;
 };
 /*******************************************************************************
  * nsHTMLFramesetBlankFrame
  ******************************************************************************/
 class nsHTMLFramesetBlankFrame : public nsLeafFrame {
 
 public:
--- a/layout/generic/nsFrameSetFrame.h
+++ b/layout/generic/nsFrameSetFrame.h
@@ -75,21 +75,21 @@ struct nsBorderColor
 
 enum nsFrameborder {
   eFrameborder_Yes = 0,
   eFrameborder_No,
   eFrameborder_Notset
 };
 
 struct nsFramesetDrag {
-  PRBool               mVertical;  // vertical if true, otherwise horizontal
+  nsHTMLFramesetFrame* mSource;    // frameset whose border was dragged to cause the resize
   PRInt32              mIndex;     // index of left col or top row of effected area
   PRInt32              mChange;    // pos for left to right or top to bottom, neg otherwise
-  nsHTMLFramesetFrame* mSource;    // frameset whose border was dragged to cause the resize
-  PRBool               mActive;
+  PRPackedBool         mVertical;  // vertical if true, otherwise horizontal
+  PRPackedBool         mActive;
 
   nsFramesetDrag();
   nsFramesetDrag(PRBool               aVertical, 
                  PRInt32              aIndex, 
                  PRInt32              aChange, 
                  nsHTMLFramesetFrame* aSource); 
   void Reset(PRBool               aVertical, 
              PRInt32              aIndex, 
@@ -233,39 +233,36 @@ protected:
   
   void SetBorderResize(PRInt32*                   aChildTypes, 
                        nsHTMLFramesetBorderFrame* aBorderFrame);
 
   PRBool ChildIsFrameset(nsIFrame* aChild); 
 
   static int FrameResizePrefCallback(const char* aPref, void* aClosure);
 
+  nsFramesetDrag   mDrag;
+  nsBorderColor    mEdgeColors;
+  nsHTMLFramesetBorderFrame* mDragger;
+  nsHTMLFramesetFrame* mTopLevelFrameset;
+  nsHTMLFramesetBorderFrame** mVerBorders;  // vertical borders
+  nsHTMLFramesetBorderFrame** mHorBorders;  // horizontal borders
+  PRInt32*         mChildTypes; // frameset/frame distinction of children
+  nsFrameborder*   mChildFrameborder; // the frameborder attr of children
+  nsBorderColor*   mChildBorderColors;
+  nscoord*         mRowSizes;  // currently computed row sizes
+  nscoord*         mColSizes;  // currently computed col sizes
+  nsIntPoint       mFirstDragPoint;
   PRInt32          mNumRows;
-  nscoord*         mRowSizes;  // currently computed row sizes 
   PRInt32          mNumCols;
-  nscoord*         mColSizes;  // currently computed col sizes 
   PRInt32          mNonBorderChildCount; 
   PRInt32          mNonBlankChildCount; 
   PRInt32          mEdgeVisibility;
-  nsBorderColor    mEdgeColors;
   nsFrameborder    mParentFrameborder;
   nscolor          mParentBorderColor;
   PRInt32          mParentBorderWidth;
-
-  nsHTMLFramesetBorderFrame* mDragger;
-  nsFramesetDrag   mDrag;
-  nsIntPoint       mFirstDragPoint;
   PRInt32          mPrevNeighborOrigSize; // used during resize
   PRInt32          mNextNeighborOrigSize;
   PRInt32          mMinDrag;
   PRInt32          mChildCount;
-  nsHTMLFramesetFrame* mTopLevelFrameset;
-  nsHTMLFramesetBorderFrame** mVerBorders;  // vertical borders
-  nsHTMLFramesetBorderFrame** mHorBorders;  // horizontal borders
-
-  PRInt32*         mChildTypes; // frameset/frame distinction of children  
-  nsFrameborder*   mChildFrameborder; // the frameborder attr of children 
-  nsBorderColor*   mChildBorderColors;
-  
-  PRBool mForceFrameResizability;
+  PRBool           mForceFrameResizability;
 };
 
 #endif
--- a/layout/generic/nsSimplePageSequence.h
+++ b/layout/generic/nsSimplePageSequence.h
@@ -144,34 +144,36 @@ protected:
 
   void SetPageNumberFormat(const char* aPropName, const char* aDefPropVal, PRBool aPageNumOnly);
 
   // SharedPageData Helper methods
   void SetDateTimeStr(PRUnichar * aDateTimeStr);
   void SetPageNumberFormat(PRUnichar * aFormatStr, PRBool aForPageNumOnly);
 
   nsMargin mMargin;
-  PRBool   mIsPrintingSelection;
+
+  // I18N date formatter service which we'll want to cache locally.
+  nsCOMPtr<nsIDateTimeFormat> mDateFormatter;
+
+  nsSize       mSize;
+  nsSharedPageData* mPageData; // data shared by all the nsPageFrames
 
   // Asynch Printing
+  nsIFrame *   mCurrentPageFrame;
   PRInt32      mPageNum;
   PRInt32      mTotalPages;
-  nsIFrame *   mCurrentPageFrame;
-  PRPackedBool mDoingPageRange;
   PRInt32      mPrintRangeType;
   PRInt32      mFromPageNum;
   PRInt32      mToPageNum;
-  PRPackedBool mPrintThisPage;
-
-  nsSize       mSize;
-  nsSharedPageData* mPageData; // data shared by all the nsPageFrames
 
   // Selection Printing Info
   nscoord      mSelectionHeight;
   nscoord      mYSelOffset;
 
-  // I18N date formatter service which we'll want to cache locally.
-  nsCOMPtr<nsIDateTimeFormat> mDateFormatter;
+  // Asynch Printing
+  PRPackedBool mPrintThisPage;
+  PRPackedBool mDoingPageRange;
 
+  PRPackedBool mIsPrintingSelection;
 };
 
 #endif /* nsSimplePageSequence_h___ */
 
--- a/layout/tables/nsTableColFrame.h
+++ b/layout/tables/nsTableColFrame.h
@@ -294,40 +294,41 @@ public:
     return mFinalWidth;
   }
 
 protected:
 
   nsTableColFrame(nsStyleContext* aContext);
   ~nsTableColFrame();
 
+  nscoord mMinCoord;
+  nscoord mPrefCoord;
+  nscoord mSpanMinCoord; // XXX...
+  nscoord mSpanPrefCoord; // XXX...
+  float mPrefPercent;
+  float mSpanPrefPercent; // XXX...
+  // ...XXX the four members marked above could be allocated as part of
+  // a separate array allocated only during
+  // BasicTableLayoutStrategy::ComputeColumnIntrinsicWidths (and only
+  // when colspans were present).
+  nscoord mFinalWidth;
+
   // the index of the column with respect to the whole tabble (starting at 0) 
   // it should never be smaller then the start column index of the parent 
   // colgroup
   PRUint32 mColIndex:        16;
   
   // border width in pixels of the inner half of the border only
   BCPixelSize mLeftBorderWidth;
   BCPixelSize mRightBorderWidth;
   BCPixelSize mTopContBorderWidth;
   BCPixelSize mRightContBorderWidth;
   BCPixelSize mBottomContBorderWidth;
 
   PRPackedBool mHasSpecifiedCoord;
-  nscoord mMinCoord;
-  nscoord mPrefCoord;
-  nscoord mSpanMinCoord; // XXX...
-  nscoord mSpanPrefCoord; // XXX...
-  float mPrefPercent;
-  float mSpanPrefPercent; // XXX...
-  // ...XXX the four members marked above could be allocated as part of
-  // a separate array allocated only during
-  // BasicTableLayoutStrategy::ComputeColumnIntrinsicWidths (and only
-  // when colspans were present).
-  nscoord mFinalWidth;
 };
 
 inline PRInt32 nsTableColFrame::GetColIndex() const
 {
   return mColIndex; 
 }
 
 inline void nsTableColFrame::SetColIndex (PRInt32 aColIndex)
--- a/layout/xul/base/src/nsImageBoxFrame.cpp
+++ b/layout/xul/base/src/nsImageBoxFrame.cpp
@@ -177,20 +177,20 @@ nsImageBoxFrame::AttributeChanged(PRInt3
   else if (aAttribute == nsGkAtoms::validate)
     UpdateLoadFlags();
 
   return rv;
 }
 
 nsImageBoxFrame::nsImageBoxFrame(nsIPresShell* aShell, nsStyleContext* aContext):
   nsLeafBoxFrame(aShell, aContext),
+  mIntrinsicSize(0,0),
+  mLoadFlags(nsIRequest::LOAD_NORMAL),
   mUseSrcAttr(PR_FALSE),
-  mSuppressStyleCheck(PR_FALSE),
-  mIntrinsicSize(0,0),
-  mLoadFlags(nsIRequest::LOAD_NORMAL)
+  mSuppressStyleCheck(PR_FALSE)
 {
   MarkIntrinsicWidthsDirty();
 }
 
 nsImageBoxFrame::~nsImageBoxFrame()
 {
 }
 
--- a/layout/xul/base/src/nsImageBoxFrame.h
+++ b/layout/xul/base/src/nsImageBoxFrame.h
@@ -133,23 +133,22 @@ public:
 
 protected:
   nsImageBoxFrame(nsIPresShell* aShell, nsStyleContext* aContext);
 
   virtual void GetImageSize();
 
 private:
 
+  nsRect mSubRect; ///< If set, indicates that only the portion of the image specified by the rect should be used.
+  nsSize mIntrinsicSize;
+  nsSize mImageSize;
+
   nsCOMPtr<imgIRequest> mImageRequest;
   nsCOMPtr<imgIDecoderObserver> mListener;
 
+  PRInt32 mLoadFlags;
+
   PRPackedBool mUseSrcAttr; ///< Whether or not the image src comes from an attribute.
   PRPackedBool mSuppressStyleCheck;
-  
-  nsRect mSubRect; ///< If set, indicates that only the portion of the image specified by the rect should be used.
-
-  nsSize mIntrinsicSize;
-  PRInt32 mLoadFlags;
-
-  nsSize mImageSize;
 }; // class nsImageBoxFrame
 
 #endif /* nsImageBoxFrame_h___ */
--- a/layout/xul/base/src/nsListBoxBodyFrame.cpp
+++ b/layout/xul/base/src/nsListBoxBodyFrame.cpp
@@ -168,32 +168,32 @@ nsListScrollSmoother::Stop()
 NS_IMPL_ISUPPORTS1(nsListScrollSmoother, nsITimerCallback)
 
 /////////////// nsListBoxBodyFrame //////////////////
 
 nsListBoxBodyFrame::nsListBoxBodyFrame(nsIPresShell* aPresShell,
                                        nsStyleContext* aContext,
                                        nsIBoxLayout* aLayoutManager)
   : nsBoxFrame(aPresShell, aContext, PR_FALSE, aLayoutManager),
-    mRowCount(-1),
-    mRowHeight(0),
-    mRowHeightWasSet(PR_FALSE),
-    mAvailableHeight(0),
-    mStringWidth(-1),
     mTopFrame(nsnull),
     mBottomFrame(nsnull),
     mLinkupFrame(nsnull),
+    mScrollSmoother(nsnull),
     mRowsToPrepend(0),
+    mRowCount(-1),
+    mRowHeight(0),
+    mAvailableHeight(0),
+    mStringWidth(-1),
     mCurrentIndex(0),
     mOldIndex(0),
+    mYPosition(0),
+    mTimePerRow(TIME_PER_ROW_INITAL),
+    mRowHeightWasSet(PR_FALSE),
     mScrolling(PR_FALSE),
     mAdjustScroll(PR_FALSE),
-    mYPosition(0),
-    mScrollSmoother(nsnull),
-    mTimePerRow(TIME_PER_ROW_INITAL),
     mReflowCallbackPosted(PR_FALSE)
 {
 }
 
 nsListBoxBodyFrame::~nsListBoxBodyFrame()
 {
   NS_IF_RELEASE(mScrollSmoother);
 
--- a/layout/xul/base/src/nsListBoxBodyFrame.h
+++ b/layout/xul/base/src/nsListBoxBodyFrame.h
@@ -185,38 +185,42 @@ protected:
     nsListBoxBodyFrame* mFrame;
     PRBool mUp;
     PRInt32 mDelta;
   };
 
   void ComputeTotalRowCount();
   void RemoveChildFrame(nsBoxLayoutState &aState, nsIFrame *aChild);
 
-  // row height
-  PRInt32 mRowCount;
-  nscoord mRowHeight;
-  PRPackedBool mRowHeightWasSet;
-  nscoord mAvailableHeight;
-  nscoord mStringWidth;
+  nsTArray< nsRefPtr<nsPositionChangedEvent> > mPendingPositionChangeEvents;
+  nsCOMPtr<nsPIBoxObject> mBoxObject;
 
   // frame markers
   nsWeakFrame mTopFrame;
   nsIFrame* mBottomFrame;
   nsIFrame* mLinkupFrame;
+
+  nsListScrollSmoother* mScrollSmoother;
+
   PRInt32 mRowsToPrepend;
 
+  // row height
+  PRInt32 mRowCount;
+  nscoord mRowHeight;
+  nscoord mAvailableHeight;
+  nscoord mStringWidth;
+
   // scrolling
   PRInt32 mCurrentIndex; // Row-based
   PRInt32 mOldIndex; 
-  PRPackedBool mScrolling;
-  PRPackedBool mAdjustScroll;
   PRInt32 mYPosition;
-  nsListScrollSmoother* mScrollSmoother;
   PRInt32 mTimePerRow;
 
-  nsTArray< nsRefPtr<nsPositionChangedEvent> > mPendingPositionChangeEvents;
+  // row height
+  PRPackedBool mRowHeightWasSet;
+  // scrolling
+  PRPackedBool mScrolling;
+  PRPackedBool mAdjustScroll;
 
   PRPackedBool mReflowCallbackPosted;
-
-  nsCOMPtr<nsPIBoxObject> mBoxObject;
-}; 
+};
 
 #endif // nsListBoxBodyFrame_h
--- a/layout/xul/base/src/nsMenuPopupFrame.cpp
+++ b/layout/xul/base/src/nsMenuPopupFrame.cpp
@@ -101,29 +101,29 @@ NS_NewMenuPopupFrame(nsIPresShell* aPres
 }
 
 //
 // nsMenuPopupFrame ctor
 //
 nsMenuPopupFrame::nsMenuPopupFrame(nsIPresShell* aShell, nsStyleContext* aContext)
   :nsBoxFrame(aShell, aContext),
   mCurrentMenu(nsnull),
+  mPrefSize(-1, -1),
+  mPopupType(ePopupTypePanel),
+  mPopupState(ePopupClosed),
   mPopupAlignment(POPUPALIGNMENT_NONE),
   mPopupAnchor(POPUPALIGNMENT_NONE),
-  mPopupType(ePopupTypePanel),
-  mPopupState(ePopupClosed),
   mIsOpenChanged(PR_FALSE),
   mIsContextMenu(PR_FALSE),
   mAdjustOffsetForContextMenu(PR_FALSE),
   mGeneratedChildren(PR_FALSE),
   mMenuCanOverlapOSBar(PR_FALSE),
   mShouldAutoPosition(PR_TRUE),
   mConsumeRollupEvent(nsIPopupBoxObject::ROLLUP_DEFAULT),
-  mInContentShell(PR_TRUE),
-  mPrefSize(-1, -1)
+  mInContentShell(PR_TRUE)
 {
   if (sDefaultLevelParent >= 0)
     return;
   sDefaultLevelParent =
     nsContentUtils::GetBoolPref("ui.panel.default_level_parent", PR_FALSE);
 } // ctor
 
 
--- a/layout/xul/base/src/nsMenuPopupFrame.h
+++ b/layout/xul/base/src/nsMenuPopupFrame.h
@@ -325,54 +325,54 @@ protected:
                        nscoord aScreenBegin, nscoord aScreenEnd,
                        nscoord aAnchorBegin, nscoord aAnchorEnd,
                        nscoord aMarginBegin, nscoord aMarginEnd,
                        nscoord aOffsetForContextMenu, PRBool aFlip);
 
   // Move the popup to the position specified in its |left| and |top| attributes.
   void MoveToAttributePosition();
 
+  nsString     mIncrementalString;  // for incremental typing navigation
+
   // the content that the popup is anchored to, if any, which may be in a
   // different document than the popup.
   nsCOMPtr<nsIContent> mAnchorContent;
 
   nsMenuFrame* mCurrentMenu; // The current menu that is active.
 
-  // popup alignment relative to the anchor node
-  PRInt8 mPopupAlignment;
-  PRInt8 mPopupAnchor;
+  // A popup's preferred size may be different than its actual size stored in
+  // mRect in the case where the popup was resized because it was too large
+  // for the screen. The preferred size mPrefSize holds the full size the popup
+  // would be before resizing. Computations are performed using this size.
+  // The parent frame is responsible for setting the preferred size using
+  // SetPreferredBounds or SetPreferredSize before positioning the popup with
+  // SetPopupPosition.
+  nsSize mPrefSize;
 
   // the position of the popup. The screen coordinates, if set to values other
   // than -1, override mXPos and mYPos.
   PRInt32 mXPos;
   PRInt32 mYPos;
   PRInt32 mScreenXPos;
   PRInt32 mScreenYPos;
 
   nsPopupType mPopupType; // type of popup
   nsPopupState mPopupState; // open state of the popup
 
+  // popup alignment relative to the anchor node
+  PRInt8 mPopupAlignment;
+  PRInt8 mPopupAnchor;
+
   PRPackedBool mIsOpenChanged; // true if the open state changed since the last layout
   PRPackedBool mIsContextMenu; // true for context menus
   // true if we need to offset the popup to ensure it's not under the mouse
   PRPackedBool mAdjustOffsetForContextMenu;
   PRPackedBool mGeneratedChildren; // true if the contents have been created
 
   PRPackedBool mMenuCanOverlapOSBar;    // can we appear over the taskbar/menubar?
   PRPackedBool mShouldAutoPosition; // Should SetPopupPosition be allowed to auto position popup?
   PRPackedBool mConsumeRollupEvent; // Should the rollup event be consumed?
   PRPackedBool mInContentShell; // True if the popup is in a content shell
 
-  nsString     mIncrementalString;  // for incremental typing navigation
-
-  // A popup's preferred size may be different than its actual size stored in
-  // mRect in the case where the popup was resized because it was too large
-  // for the screen. The preferred size mPrefSize holds the full size the popup
-  // would be before resizing. Computations are performed using this size.
-  // The parent frame is responsible for setting the preferred size using
-  // SetPreferredBounds or SetPreferredSize before positioning the popup with
-  // SetPopupPosition.
-  nsSize mPrefSize;
-
   static PRInt8 sDefaultLevelParent;
 }; // class nsMenuPopupFrame
 
 #endif
--- a/layout/xul/base/src/nsSliderFrame.h
+++ b/layout/xul/base/src/nsSliderFrame.h
@@ -227,26 +227,27 @@ private:
   void StopRepeat() {
     nsRepeatService::GetInstance()->Stop(Notify, this);
   }
   void Notify();
   static void Notify(void* aData) {
     (static_cast<nsSliderFrame*>(aData))->Notify();
   }
  
+  nsPoint mDestinationPoint;
+  nsRefPtr<nsSliderMediator> mMediator;
+
   float mRatio;
 
   nscoord mDragStart;
   nscoord mThumbStart;
 
   PRInt32 mCurPos;
 
   nscoord mChange;
-  nsPoint mDestinationPoint;
-  nsRefPtr<nsSliderMediator> mMediator;
 
   // true if an attribute change has been caused by the user manipulating the
   // slider. This allows notifications to tell how a slider's current position
   // was changed.
   PRBool mUserChanged;
 
   static PRBool gMiddlePref;
   static PRInt32 gSnapMultiplier;
--- a/layout/xul/base/src/nsTextBoxFrame.cpp
+++ b/layout/xul/base/src/nsTextBoxFrame.cpp
@@ -134,17 +134,17 @@ nsTextBoxFrame::AttributeChanged(PRInt32
     // The old value has been unregistered in nsXULElement::SetAttr
     if (aAttribute == nsGkAtoms::accesskey || aAttribute == nsGkAtoms::control)
         RegUnregAccessKey(PR_TRUE);
 
     return NS_OK;
 }
 
 nsTextBoxFrame::nsTextBoxFrame(nsIPresShell* aShell, nsStyleContext* aContext):
-  nsLeafBoxFrame(aShell, aContext), mCropType(CropRight), mAccessKeyInfo(nsnull),
+  nsLeafBoxFrame(aShell, aContext), mAccessKeyInfo(nsnull), mCropType(CropRight),
   mNeedsReflowCallback(PR_FALSE)
 {
     mState |= NS_STATE_NEED_LAYOUT;
     MarkIntrinsicWidthsDirty();
 }
 
 nsTextBoxFrame::~nsTextBoxFrame()
 {
--- a/layout/xul/base/src/nsTextBoxFrame.h
+++ b/layout/xul/base/src/nsTextBoxFrame.h
@@ -132,27 +132,27 @@ private:
                          const nscolor*       aOverrideColor);
 
   void PaintOneShadow(gfxContext *     aCtx,
                       const nsRect&    aTextRect,
                       nsCSSShadowItem* aShadowDetails,
                       const nscolor&   aForegroundColor,
                       const nsRect&    aDirtyRect);
 
-
-  CroppingStyle mCropType;
   nsString mTitle;
   nsString mCroppedTitle;
   nsString mAccessKey;
+  nsSize mTextSize;
+  nsAccessKeyInfo* mAccessKeyInfo;
+
+  CroppingStyle mCropType;
   nscoord mTitleWidth;
-  nsAccessKeyInfo* mAccessKeyInfo;
+  nscoord mAscent;
   PRPackedBool mNeedsRecalc;
   PRPackedBool mNeedsReflowCallback;
-  nsSize mTextSize;
-  nscoord mAscent;
 
   static PRBool gAlwaysAppendAccessKey;
   static PRBool gAccessKeyPrefInitialized;
   static PRBool gInsertSeparatorBeforeAccessKey;
   static PRBool gInsertSeparatorPrefInitialized;
 
 }; // class nsTextBoxFrame
 
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -139,32 +139,32 @@ NS_QUERYFRAME_HEAD(nsTreeBodyFrame)
   NS_QUERYFRAME_ENTRY(nsICSSPseudoComparator)
   NS_QUERYFRAME_ENTRY(nsIScrollbarMediator)
   NS_QUERYFRAME_ENTRY(nsTreeBodyFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsLeafBoxFrame)
 
 // Constructor
 nsTreeBodyFrame::nsTreeBodyFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 :nsLeafBoxFrame(aPresShell, aContext),
- mTopRowIndex(0), 
+ mSlots(nsnull),
+ mTopRowIndex(0),
  mHorzPosition(0),
  mHorzWidth(0),
  mAdjustWidth(0),
  mRowHeight(0),
  mIndentation(0),
  mStringWidth(-1),
+ mUpdateBatchNest(0),
+ mRowCount(0),
+ mMouseOverRow(-1),
  mFocused(PR_FALSE),
  mHasFixedRowCount(PR_FALSE),
  mVerticalOverflow(PR_FALSE),
  mHorizontalOverflow(PR_FALSE),
- mReflowCallbackPosted(PR_FALSE),
- mUpdateBatchNest(0),
- mRowCount(0),
- mMouseOverRow(-1),
- mSlots(nsnull)
+ mReflowCallbackPosted(PR_FALSE)
 {
   mColumns = new nsTreeColumns(nsnull);
   NS_NewISupportsArray(getter_AddRefs(mScratchArray));
 }
 
 // Destructor
 nsTreeBodyFrame::~nsTreeBodyFrame()
 {
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.h
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.h
@@ -488,80 +488,16 @@ protected:
    * @param aEndCol    the end invalidated column, nsnull means that rows have
    *                   been invalidated only
    */
   void FireInvalidateEvent(PRInt32 aStartRow, PRInt32 aEndRow,
                            nsITreeColumn *aStartCol, nsITreeColumn *aEndCol);
 #endif
 
 protected: // Data Members
-  // The cached box object parent.
-  nsCOMPtr<nsITreeBoxObject> mTreeBoxObject;
-
-  // Cached column information.
-  nsRefPtr<nsTreeColumns> mColumns;
-
-  // The current view for this tree widget.  We get all of our row and cell data
-  // from the view.
-  nsCOMPtr<nsITreeView> mView;    
-
-  // A cache of all the style contexts we have seen for rows and cells of the tree.  This is a mapping from
-  // a list of atoms to a corresponding style context.  This cache stores every combination that
-  // occurs in the tree, so for n distinct properties, this cache could have 2 to the n entries
-  // (the power set of all row properties).
-  nsTreeStyleCache mStyleCache;
-
-  // A hashtable that maps from URLs to image request/listener pairs.  The URL
-  // is provided by the view or by the style context. The style context
-  // represents a resolved :-moz-tree-cell-image (or twisty) pseudo-element.
-  // It maps directly to an imgIRequest.
-  nsDataHashtable<nsStringHashKey, nsTreeImageCacheEntry> mImageCache;
-
-  // The index of the first visible row and the # of rows visible onscreen.  
-  // The tree only examines onscreen rows, starting from
-  // this index and going up to index+pageLength.
-  PRInt32 mTopRowIndex;
-  PRInt32 mPageLength;
-
-  // The horizontal scroll position
-  nscoord mHorzPosition;
-  // Our desired horizontal width (the width for which we actually have tree
-  // columns).
-  nscoord mHorzWidth;
-  // The amount by which to adjust the width of the last cell.
-  // This depends on whether or not the columnpicker and scrollbars are present.
-  nscoord mAdjustWidth;
-
-  // Cached heights and indent info.
-  nsRect mInnerBox;
-  PRInt32 mRowHeight;
-  PRInt32 mIndentation;
-  nscoord mStringWidth;
-
-  // A scratch array used when looking up cached style contexts.
-  nsCOMPtr<nsISupportsArray> mScratchArray;
-
-  // Whether or not we're currently focused.
-  PRPackedBool mFocused;
-
-  // Do we have a fixed number of onscreen rows?
-  PRPackedBool mHasFixedRowCount;
-
-  PRPackedBool mVerticalOverflow;
-  PRPackedBool mHorizontalOverflow;
-
-  PRPackedBool mReflowCallbackPosted;
-
-  PRInt32 mUpdateBatchNest;
-
-  // Cached row count.
-  PRInt32 mRowCount;
-
-  // The row the mouse is hovering over.
-  PRInt32 mMouseOverRow;
 
   class Slots {
     public:
       Slots() {
       }
 
       ~Slots() {
         if (mTimer)
@@ -593,11 +529,76 @@ protected: // Data Members
 
       // An array used to keep track of all spring loaded folders.
       nsTArray<PRInt32>        mArray;
   };
 
   Slots* mSlots;
 
   nsRevocableEventPtr<ScrollEvent> mScrollEvent;
+
+  // The cached box object parent.
+  nsCOMPtr<nsITreeBoxObject> mTreeBoxObject;
+
+  // Cached column information.
+  nsRefPtr<nsTreeColumns> mColumns;
+
+  // The current view for this tree widget.  We get all of our row and cell data
+  // from the view.
+  nsCOMPtr<nsITreeView> mView;
+
+  // A cache of all the style contexts we have seen for rows and cells of the tree.  This is a mapping from
+  // a list of atoms to a corresponding style context.  This cache stores every combination that
+  // occurs in the tree, so for n distinct properties, this cache could have 2 to the n entries
+  // (the power set of all row properties).
+  nsTreeStyleCache mStyleCache;
+
+  // A hashtable that maps from URLs to image request/listener pairs.  The URL
+  // is provided by the view or by the style context. The style context
+  // represents a resolved :-moz-tree-cell-image (or twisty) pseudo-element.
+  // It maps directly to an imgIRequest.
+  nsDataHashtable<nsStringHashKey, nsTreeImageCacheEntry> mImageCache;
+
+  // A scratch array used when looking up cached style contexts.
+  nsCOMPtr<nsISupportsArray> mScratchArray;
+
+  // The index of the first visible row and the # of rows visible onscreen.  
+  // The tree only examines onscreen rows, starting from
+  // this index and going up to index+pageLength.
+  PRInt32 mTopRowIndex;
+  PRInt32 mPageLength;
+
+  // The horizontal scroll position
+  nscoord mHorzPosition;
+  // Our desired horizontal width (the width for which we actually have tree
+  // columns).
+  nscoord mHorzWidth;
+  // The amount by which to adjust the width of the last cell.
+  // This depends on whether or not the columnpicker and scrollbars are present.
+  nscoord mAdjustWidth;
+
+  // Cached heights and indent info.
+  nsRect mInnerBox; // 4-byte aligned
+  PRInt32 mRowHeight;
+  PRInt32 mIndentation;
+  nscoord mStringWidth;
+
+  PRInt32 mUpdateBatchNest;
+
+  // Cached row count.
+  PRInt32 mRowCount;
+
+  // The row the mouse is hovering over.
+  PRInt32 mMouseOverRow;
+
+  // Whether or not we're currently focused.
+  PRPackedBool mFocused;
+
+  // Do we have a fixed number of onscreen rows?
+  PRPackedBool mHasFixedRowCount;
+
+  PRPackedBool mVerticalOverflow;
+  PRPackedBool mHorizontalOverflow;
+
+  PRPackedBool mReflowCallbackPosted;
 }; // class nsTreeBodyFrame
 
 #endif