From dfad41fa5aef3b1683f6ff1190292ec79545c242 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Thu, 22 Feb 2007 18:05:14 +0000 Subject: [PATCH] deCOMtaminate SetBounds(), GetChildBox(), GetNextBox(), GetParentBox(), GetVAlign(), GetHAlign(). Remove GetInset(). Bug 243370, patch by Andreas Lange , r+sr=roc git-svn-id: svn://10.0.0.236/trunk@220744 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/forms/nsTextControlFrame.cpp | 1 - mozilla/layout/generic/nsFrame.cpp | 6 -- mozilla/layout/generic/nsGfxScrollFrame.cpp | 5 -- mozilla/layout/generic/nsIFrame.h | 36 ++++---- mozilla/layout/xul/base/src/grid/nsGrid.cpp | 30 +++---- .../xul/base/src/grid/nsGridRowGroupFrame.cpp | 5 +- .../base/src/grid/nsGridRowGroupLayout.cpp | 22 ++--- .../xul/base/src/grid/nsGridRowLayout.cpp | 14 ++- .../xul/base/src/grid/nsGridRowLeafLayout.cpp | 20 ++--- mozilla/layout/xul/base/src/nsBox.cpp | 78 ++--------------- mozilla/layout/xul/base/src/nsBox.h | 15 +--- mozilla/layout/xul/base/src/nsBoxFrame.cpp | 57 ++----------- mozilla/layout/xul/base/src/nsBoxFrame.h | 6 +- mozilla/layout/xul/base/src/nsBoxLayout.cpp | 12 +-- mozilla/layout/xul/base/src/nsBoxLayout.h | 1 - mozilla/layout/xul/base/src/nsDeckFrame.cpp | 6 +- .../layout/xul/base/src/nsFrameNavigator.cpp | 27 +++--- .../layout/xul/base/src/nsGroupBoxFrame.cpp | 8 +- .../layout/xul/base/src/nsImageBoxFrame.cpp | 9 +- mozilla/layout/xul/base/src/nsImageBoxFrame.h | 2 +- .../xul/base/src/nsListBoxBodyFrame.cpp | 2 - .../layout/xul/base/src/nsListBoxLayout.cpp | 5 +- mozilla/layout/xul/base/src/nsMenuFrame.cpp | 6 +- .../layout/xul/base/src/nsPopupSetFrame.cpp | 3 +- .../layout/xul/base/src/nsScrollBoxObject.cpp | 16 ++-- mozilla/layout/xul/base/src/nsSliderFrame.cpp | 6 +- .../layout/xul/base/src/nsSplitterFrame.cpp | 23 ++--- .../layout/xul/base/src/nsSprocketLayout.cpp | 85 +++++++------------ mozilla/layout/xul/base/src/nsStackLayout.cpp | 49 +++++------ .../layout/xul/base/src/nsTextBoxFrame.cpp | 14 ++- mozilla/layout/xul/base/src/nsTextBoxFrame.h | 2 +- .../xul/base/src/tree/src/nsTreeBodyFrame.cpp | 5 +- .../xul/base/src/tree/src/nsTreeBodyFrame.h | 4 +- .../xul/base/src/tree/src/nsTreeColFrame.cpp | 6 +- .../xul/base/src/tree/src/nsTreeColFrame.h | 4 +- 35 files changed, 176 insertions(+), 414 deletions(-) diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp index 4a3663ae4cb..5f11b6e2093 100644 --- a/mozilla/layout/forms/nsTextControlFrame.cpp +++ b/mozilla/layout/forms/nsTextControlFrame.cpp @@ -1742,7 +1742,6 @@ nsTextControlFrame::GetPrefSize(nsBoxLayoutState& aState) nsresult rv = CalcIntrinsicSize(aState.GetRenderingContext(), pref); NS_ENSURE_SUCCESS(rv, pref); AddBorderAndPadding(pref); - AddInset(pref); mPrefSize = pref; diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index 51dad6e1a84..6700d5241a2 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -5899,8 +5899,6 @@ nsFrame::GetPrefSize(nsBoxLayoutState& aState) // notice we don't need to add our borders or padding // in. That's because the block did it for us. - // but we do need to add insets so debugging will work. - AddInset(size); nsIBox::AddCSSPrefSize(aState, this, size); } @@ -5930,7 +5928,6 @@ nsFrame::GetMinSize(nsBoxLayoutState& aState) if (!completelyRedefined) { RefreshSizeCache(aState); size = metrics->mBlockMinSize; - AddInset(size); nsIBox::AddCSSMinSize(aState, this, size); } @@ -5984,9 +5981,6 @@ nsFrame::GetBoxAscent(nsBoxLayoutState& aState) // Refresh our caches with new sizes. RefreshSizeCache(aState); metrics->mAscent = metrics->mBlockAscent; - nsMargin m(0, 0, 0, 0); - GetInset(m); - metrics->mAscent += m.top; } return metrics->mAscent; diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp index c5d3a479161..83029ca6765 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.cpp +++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp @@ -1056,8 +1056,6 @@ nsXULScrollFrame::GetBoxAscent(nsBoxLayoutState& aState) ascent += m.top; GetMargin(m); ascent += m.top; - GetInset(m); - ascent += m.top; return ascent; } @@ -1090,7 +1088,6 @@ nsXULScrollFrame::GetPrefSize(nsBoxLayoutState& aState) } AddBorderAndPadding(pref); - AddInset(pref); nsIBox::AddCSSPrefSize(aState, this, pref); return pref; } @@ -1125,7 +1122,6 @@ nsXULScrollFrame::GetMinSize(nsBoxLayoutState& aState) } AddBorderAndPadding(min); - AddInset(min); nsIBox::AddCSSMinSize(aState, this, min); return min; } @@ -1140,7 +1136,6 @@ nsXULScrollFrame::GetMaxSize(nsBoxLayoutState& aState) nsSize max(NS_INTRINSICSIZE, NS_INTRINSICSIZE); AddBorderAndPadding(max); - AddInset(max); nsIBox::AddCSSMaxSize(aState, this, max); return max; } diff --git a/mozilla/layout/generic/nsIFrame.h b/mozilla/layout/generic/nsIFrame.h index 018d92200cf..e9fd0ef5355 100644 --- a/mozilla/layout/generic/nsIFrame.h +++ b/mozilla/layout/generic/nsIFrame.h @@ -100,10 +100,10 @@ struct nsMargin; typedef class nsIFrame nsIBox; // IID for the nsIFrame interface -// 4ea7876f-1550-40d4-a764-739a0e4289a1 +// 902aaa17-6433-4d96-86b3-fe1f4af41159 #define NS_IFRAME_IID \ -{ 0x4ea7876f, 0x1550, 0x40d4, \ - { 0xa7, 0x64, 0x73, 0x9a, 0x0e, 0x42, 0x89, 0xa1 } } +{ 0x902aaa17, 0x6433, 0x4d96, \ + { 0x86, 0xb3, 0xfe, 0x1f, 0x4a, 0xf4, 0x11, 0x59 } } /** * Indication of how the frame can be split. This is used when doing runaround @@ -1862,38 +1862,36 @@ NS_PTR_TO_INT32(frame->GetProperty(nsGkAtoms::embeddingLevel)) // area. It's enough to just call Layout or SyncLayout on the // box. You can pass PR_TRUE to aRemoveOverflowArea as a // convenience. - NS_IMETHOD SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect, - PRBool aRemoveOverflowArea = PR_FALSE)=0; + virtual void SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect, + PRBool aRemoveOverflowArea = PR_FALSE)=0; NS_HIDDEN_(nsresult) Layout(nsBoxLayoutState& aBoxLayoutState); - nsresult GetChildBox(nsIBox** aBox) + nsIBox* GetChildBox() const { // box layout ends at box-wrapped frames, so don't allow these frames // to report child boxes. - *aBox = IsBoxFrame() ? GetFirstChild(nsnull) : nsnull; - return NS_OK; + return IsBoxFrame() ? GetFirstChild(nsnull) : nsnull; } - nsresult GetNextBox(nsIBox** aBox) + nsIBox* GetNextBox() const { - *aBox = (mParent && mParent->IsBoxFrame()) ? mNextSibling : nsnull; - return NS_OK; + return (mParent && mParent->IsBoxFrame()) ? mNextSibling : nsnull; + } + nsIBox* GetParentBox() const + { + return (mParent && mParent->IsBoxFrame()) ? mParent : nsnull; } - NS_HIDDEN_(nsresult) GetParentBox(nsIBox** aParent); // Box methods. Note that these do NOT just get the CSS border, padding, // etc. They also talk to nsITheme. NS_IMETHOD GetBorderAndPadding(nsMargin& aBorderAndPadding); NS_IMETHOD GetBorder(nsMargin& aBorder)=0; NS_IMETHOD GetPadding(nsMargin& aBorderAndPadding)=0; -#ifdef DEBUG_LAYOUT - NS_IMETHOD GetInset(nsMargin& aInset)=0; -#else - nsresult GetInset(nsMargin& aInset) { aInset.SizeTo(0, 0, 0, 0); return NS_OK; } -#endif NS_IMETHOD GetMargin(nsMargin& aMargin)=0; NS_IMETHOD SetLayoutManager(nsIBoxLayout* aLayout)=0; NS_IMETHOD GetLayoutManager(nsIBoxLayout** aLayout)=0; NS_HIDDEN_(nsresult) GetClientRect(nsRect& aContentRect); - NS_IMETHOD GetVAlign(Valignment& aAlign) = 0; - NS_IMETHOD GetHAlign(Halignment& aAlign) = 0; + + // For nsSprocketLayout + virtual Valignment GetVAlign() const = 0; + virtual Halignment GetHAlign() const = 0; PRBool IsHorizontal() const { return (mState & NS_STATE_IS_HORIZONTAL) != 0; } PRBool IsNormalDirection() const { return (mState & NS_STATE_IS_DIRECTION_NORMAL) != 0; } diff --git a/mozilla/layout/xul/base/src/grid/nsGrid.cpp b/mozilla/layout/xul/base/src/grid/nsGrid.cpp index 8bd67d4fe54..55d03c19ba4 100644 --- a/mozilla/layout/xul/base/src/grid/nsGrid.cpp +++ b/mozilla/layout/xul/base/src/grid/nsGrid.cpp @@ -285,7 +285,7 @@ nsGrid::FindRowsAndColumns(nsIBox** aRows, nsIBox** aColumns) nsIBox* child = nsnull; // if we have then mBox will be null (bug 125689) if (mBox) - mBox->GetChildBox(&child); + child = mBox->GetChildBox(); while(child) { @@ -322,7 +322,7 @@ nsGrid::FindRowsAndColumns(nsIBox** aRows, nsIBox** aColumns) child = oldBox; } - child->GetNextBox(&child); + child = child->GetNextBox(); } } @@ -460,7 +460,7 @@ nsGrid::PopulateCellMap(nsGridRow* aRows, nsGridRow* aColumns, PRInt32 aRowCount child = row->mBox; if (child) { - child->GetChildBox(&child); + child = child->GetChildBox(); j = 0; @@ -479,7 +479,7 @@ nsGrid::PopulateCellMap(nsGridRow* aRows, nsGridRow* aColumns, PRInt32 aRowCount else GetCellAt(i,j)->SetBoxInColumn(child); - child->GetNextBox(&child); + child = child->GetNextBox(); j++; } @@ -739,27 +739,23 @@ nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, n // add up all the padding nsMargin margin(0,0,0,0); - nsMargin inset(0,0,0,0); nsMargin border(0,0,0,0); nsMargin padding(0,0,0,0); nsMargin totalBorderPadding(0,0,0,0); nsMargin totalMargin(0,0,0,0); // if there is a box and it's not bogus take its - // borders padding and insets into account + // borders padding into account if (box && !row->mIsBogus) { if (!box->IsCollapsed(aState)) { - box->GetInset(inset); - // get real border and padding. GetBorderAndPadding // is redefined on nsGridRowLeafFrame. If we called it here // we would be in finite recurson. box->GetBorder(border); box->GetPadding(padding); - totalBorderPadding += inset; totalBorderPadding += border; totalBorderPadding += padding; } @@ -823,13 +819,11 @@ nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, n // at this point border/padding and margins all added // up to more needed space. margin = GetBoxTotalMargin(box, !aIsHorizontal); - box->GetInset(inset); // get real border and padding. GetBorderAndPadding // is redefined on nsGridRowLeafFrame. If we called it here // we would be in finite recurson. box->GetBorder(border); box->GetPadding(padding); - totalChildBorderPadding += inset; totalChildBorderPadding += border; totalChildBorderPadding += padding; totalChildBorderPadding += margin; @@ -1198,16 +1192,14 @@ nsGrid::GetRowFlex(nsBoxLayoutState& aState, PRInt32 aIndex, PRBool aIsHorizonta // someone who is not flexible and they aren't the rows immediately in // the grid. 3) Then we are not flexible - nsIBox* parent=nsnull; + box = GetScrollBox(box); + nsIBox* parent = box->GetParentBox(); nsIBox* parentsParent=nsnull; - box = GetScrollBox(box); - box->GetParentBox(&parent); - while(parent) { parent = GetScrollBox(parent); - parent->GetParentBox(&parentsParent); + parentsParent = parent->GetParentBox(); // if our parents parent is not a grid // the get its flex. If its 0 then we are @@ -1334,12 +1326,10 @@ nsGrid::GetScrollBox(nsIBox* aChild) return nsnull; // get parent - nsIBox* parent = nsnull; + nsIBox* parent = aChild->GetParentBox(); nsCOMPtr layout; nsCOMPtr parentGridRow; - aChild->GetParentBox(&parent); - // walk up until we find a scrollframe or a part // if it's a scrollframe return it. // if it's a parent then the child passed does not @@ -1356,7 +1346,7 @@ nsGrid::GetScrollBox(nsIBox* aChild) if (parentGridRow) break; - parent->GetParentBox(&parent); + parent = parent->GetParentBox(); } return aChild; diff --git a/mozilla/layout/xul/base/src/grid/nsGridRowGroupFrame.cpp b/mozilla/layout/xul/base/src/grid/nsGridRowGroupFrame.cpp index 408adf24992..ee11601857a 100644 --- a/mozilla/layout/xul/base/src/grid/nsGridRowGroupFrame.cpp +++ b/mozilla/layout/xul/base/src/grid/nsGridRowGroupFrame.cpp @@ -79,12 +79,11 @@ nsGridRowGroupFrame::GetFlex(nsBoxLayoutState& aState) // ok we are flexible add up our children nscoord totalFlex = 0; - nsIBox* child = nsnull; - GetChildBox(&child); + nsIBox* child = GetChildBox(); while (child) { totalFlex += child->GetFlex(aState); - child->GetNextBox(&child); + child = child->GetNextBox(); } mFlex = totalFlex; diff --git a/mozilla/layout/xul/base/src/grid/nsGridRowGroupLayout.cpp b/mozilla/layout/xul/base/src/grid/nsGridRowGroupLayout.cpp index c6913c2c619..60efe19b014 100644 --- a/mozilla/layout/xul/base/src/grid/nsGridRowGroupLayout.cpp +++ b/mozilla/layout/xul/base/src/grid/nsGridRowGroupLayout.cpp @@ -191,8 +191,7 @@ nsGridRowGroupLayout::DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState) // XXXldb We probably don't want to walk up the ancestor chain // calling MarkIntrinsicWidthsDirty for every row group. aState.PresShell()->FrameNeedsReflow(aBox, nsIPresShell::eTreeChange); - nsIBox* child = nsnull; - aBox->GetChildBox(&child); + nsIBox* child = aBox->GetChildBox(); while(child) { @@ -208,7 +207,7 @@ nsGridRowGroupLayout::DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState) monument->DirtyRows(deepChild, aState); } - child->GetNextBox(&child); + child = child->GetNextBox(); } } } @@ -220,8 +219,7 @@ nsGridRowGroupLayout::CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32 if (aBox) { PRInt32 startCount = aRowCount; - nsIBox* child = nsnull; - aBox->GetChildBox(&child); + nsIBox* child = aBox->GetChildBox(); while(child) { @@ -234,13 +232,13 @@ nsGridRowGroupLayout::CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32 nsCOMPtr monument( do_QueryInterface(layout) ); if (monument) { monument->CountRowsColumns(deepChild, aRowCount, aComputedColumnCount); - child->GetNextBox(&child); + child = child->GetNextBox(); deepChild = child; continue; } } - child->GetNextBox(&child); + child = child->GetNextBox(); // if not a monument. Then count it. It will be a bogus row aRowCount++; @@ -260,8 +258,7 @@ nsGridRowGroupLayout::BuildRows(nsIBox* aBox, nsGridRow* aRows) PRInt32 rowCount = 0; if (aBox) { - nsIBox* child = nsnull; - aBox->GetChildBox(&child); + nsIBox* child = aBox->GetChildBox(); while(child) { @@ -274,7 +271,7 @@ nsGridRowGroupLayout::BuildRows(nsIBox* aBox, nsGridRow* aRows) nsCOMPtr monument( do_QueryInterface(layout) ); if (monument) { rowCount += monument->BuildRows(deepChild, &aRows[rowCount]); - child->GetNextBox(&child); + child = child->GetNextBox(); deepChild = child; continue; } @@ -282,7 +279,7 @@ nsGridRowGroupLayout::BuildRows(nsIBox* aBox, nsGridRow* aRows) aRows[rowCount].Init(child, PR_TRUE); - child->GetNextBox(&child); + child = child->GetNextBox(); // if not a monument. Then count it. It will be a bogus row rowCount++; @@ -308,9 +305,6 @@ nsGridRowGroupLayout::GetTotalMargin(nsIBox* aBox, PRBool aIsHorizontal) aBox->GetBorderAndPadding(borderPadding); margin += borderPadding; - aBox->GetInset(borderPadding); - margin += borderPadding; - return margin; } diff --git a/mozilla/layout/xul/base/src/grid/nsGridRowLayout.cpp b/mozilla/layout/xul/base/src/grid/nsGridRowLayout.cpp index f1ccd48549b..426b29752ab 100644 --- a/mozilla/layout/xul/base/src/grid/nsGridRowLayout.cpp +++ b/mozilla/layout/xul/base/src/grid/nsGridRowLayout.cpp @@ -94,7 +94,7 @@ nsGridRowLayout::GetParentGridPart(nsIBox* aBox, nsIBox** aParentBox, nsIGridPar // get the parent if (aBox) - aBox->GetParentBox(&aBox); + aBox = aBox->GetParentBox(); if (aBox) { @@ -126,8 +126,7 @@ nsGridRowLayout::GetGrid(nsIBox* aBox, PRInt32* aIndex, nsGridRowLayout* aReques nsresult rv = NS_OK; PRInt32 index = -1; - nsIBox* child = nsnull; - aBox->GetChildBox(&child); + nsIBox* child = aBox->GetChildBox(); PRInt32 count = 0; while(child) { @@ -149,7 +148,7 @@ nsGridRowLayout::GetGrid(nsIBox* aBox, PRInt32* aIndex, nsGridRowLayout* aReques } else count++; - child->GetNextBox(&child); + child = child->GetNextBox(); } // if we didn't find ourselves then the tree isn't properly formed yet @@ -184,17 +183,14 @@ nsGridRowLayout::GetTotalMargin(nsIBox* aBox, PRBool aIsHorizontal) if (part && parent) { // if we are the first or last child walk upward and add margins. - nsIBox* next = nsnull; - nsIBox* child = nsnull; - // make sure we check for a scrollbox aBox = nsGrid::GetScrollBox(aBox); // see if we have a next to see if we are last - aBox->GetNextBox(&next); + nsIBox* next = aBox->GetNextBox(); // get the parent first child to see if we are first - parent->GetChildBox(&child); + nsIBox* child = parent->GetChildBox(); margin = part->GetTotalMargin(parent, aIsHorizontal); diff --git a/mozilla/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp b/mozilla/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp index 86cd423de62..3f0a7a1e13c 100644 --- a/mozilla/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp +++ b/mozilla/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp @@ -83,7 +83,6 @@ nsGridRowLeafLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& else { aSize = grid->GetPrefRowSize(aState, index, isHorizontal); //AddBorderAndPadding(aBox, aSize); - //AddInset(aBox, aSize); return NS_OK; } } @@ -100,7 +99,6 @@ nsGridRowLeafLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& else { aSize = grid->GetMinRowSize(aState, index, isHorizontal); AddBorderAndPadding(aBox, aSize); - AddInset(aBox, aSize); return NS_OK; } } @@ -117,7 +115,6 @@ nsGridRowLeafLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& else { aSize = grid->GetMaxRowSize(aState, index, isHorizontal); AddBorderAndPadding(aBox, aSize); - AddInset(aBox, aSize); return NS_OK; } } @@ -151,8 +148,7 @@ nsGridRowLeafLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, ns nsBoxSize* start = nsnull; nsBoxSize* last = nsnull; nsBoxSize* current = nsnull; - nsIBox* child = nsnull; - aBox->GetChildBox(&child); + nsIBox* child = aBox->GetChildBox(); for (int i=0; i < count; i++) { column = grid->GetColumnAt(i,isHorizontal); @@ -243,7 +239,7 @@ nsGridRowLeafLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, ns } if (child) - child->GetNextBox(&child); + child = child->GetNextBox(); } aBoxSizes = start; @@ -264,9 +260,8 @@ nsGridRowLeafLayout::ComputeChildSizes(nsIBox* aBox, if (aBox) { // go up the parent chain looking for scrollframes - nsIBox* scrollbox = nsnull; - aBox->GetParentBox(&aBox); - scrollbox = nsGrid::GetScrollBox(aBox); + aBox = aBox->GetParentBox(); + nsIBox* scrollbox = nsGrid::GetScrollBox(aBox); nsCOMPtr scrollable = do_QueryInterface(scrollbox); if (scrollable) { @@ -276,8 +271,6 @@ nsGridRowLeafLayout::ComputeChildSizes(nsIBox* aBox, nsMargin padding(0,0,0,0); scrollbox->GetBorderAndPadding(padding); ourRect.Deflate(padding); - scrollbox->GetInset(padding); - ourRect.Deflate(padding); nscoord diff; if (aBox->IsHorizontal()) { @@ -333,13 +326,12 @@ void nsGridRowLeafLayout::CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount) { if (aBox) { - nsIBox* child = nsnull; - aBox->GetChildBox(&child); + nsIBox* child = aBox->GetChildBox(); // count the children PRInt32 columnCount = 0; while(child) { - child->GetNextBox(&child); + child = child->GetNextBox(); columnCount++; } diff --git a/mozilla/layout/xul/base/src/nsBox.cpp b/mozilla/layout/xul/base/src/nsBox.cpp index 08e4385e177..e19ee815dfa 100644 --- a/mozilla/layout/xul/base/src/nsBox.cpp +++ b/mozilla/layout/xul/base/src/nsBox.cpp @@ -175,7 +175,7 @@ nsBox::BeginLayout(nsBoxLayoutState& aState) // If the parent is dirty, all the children are dirty (nsHTMLReflowState // does this too). nsIFrame* box; - for (GetChildBox(&box); box; box->GetNextBox(&box)) + for (box = GetChildBox(); box; box = box->GetNextBox()) box->AddStateBits(NS_FRAME_IS_DIRTY); } @@ -238,20 +238,6 @@ nsBox::RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild) return NS_OK; } -NS_IMETHODIMP -nsBox::GetVAlign(Valignment& aAlign) -{ - aAlign = vAlign_Top; - return NS_OK; -} - -NS_IMETHODIMP -nsBox::GetHAlign(Halignment& aAlign) -{ - aAlign = hAlign_Left; - return NS_OK; -} - nsresult nsIFrame::GetClientRect(nsRect& aClientRect) { @@ -263,10 +249,6 @@ nsIFrame::GetClientRect(nsRect& aClientRect) aClientRect.Deflate(borderPadding); - nsMargin insets; - GetInset(insets); - - aClientRect.Deflate(insets); if (aClientRect.width < 0) aClientRect.width = 0; @@ -278,7 +260,7 @@ nsIFrame::GetClientRect(nsRect& aClientRect) return NS_OK; } -NS_IMETHODIMP +void nsBox::SetBounds(nsBoxLayoutState& aState, const nsRect& aRect, PRBool aRemoveOverflowArea) { NS_BOX_ASSERTION(this, aRect.width >=0 && aRect.height >= 0, "SetBounds Size < 0"); @@ -325,9 +307,6 @@ nsBox::SetBounds(nsBoxLayoutState& aState, const nsRect& aRect, PRBool aRemoveOv } } */ - - - return NS_OK; } void @@ -420,13 +399,6 @@ nsBox::GetMargin(nsMargin& aMargin) return NS_OK; } -nsresult -nsIFrame::GetParentBox(nsIBox** aParent) -{ - *aParent = (mParent && mParent->IsBoxFrame()) ? mParent : nsnull; - return NS_OK; -} - void nsBox::SizeNeedsRecalc(nsSize& aSize) { @@ -491,7 +463,6 @@ nsBox::GetPrefSize(nsBoxLayoutState& aState) return pref; AddBorderAndPadding(pref); - AddInset(pref); nsIBox::AddCSSPrefSize(aState, this, pref); nsSize minSize = GetMinSize(aState); @@ -511,7 +482,6 @@ nsBox::GetMinSize(nsBoxLayoutState& aState) return min; AddBorderAndPadding(min); - AddInset(min); nsIBox::AddCSSMinSize(aState, this, min); return min; } @@ -532,7 +502,6 @@ nsBox::GetMaxSize(nsBoxLayoutState& aState) return max; AddBorderAndPadding(max); - AddInset(max); nsIBox::AddCSSMaxSize(aState, this, max); return max; } @@ -642,15 +611,14 @@ nsBox::SyncLayout(nsBoxLayoutState& aState) // in XUL, but it can happen with the CSS 'outline' property and // possibly with other exotic stuff (e.g. relatively positioned // frames in HTML inside XUL). - nsIFrame* box; - GetChildBox(&box); + nsIFrame* box = GetChildBox(); while (box) { nsRect* overflowArea = box->GetOverflowAreaProperty(); nsRect bounds = overflowArea ? *overflowArea + box->GetPosition() : box->GetRect(); rect.UnionRect(rect, bounds); - box->GetNextBox(&box); + box = box->GetNextBox(); } } @@ -1011,16 +979,6 @@ nsBox::AddMargin(nsSize& aSize, const nsMargin& aMargin) aSize.height += aMargin.top + aMargin.bottom; } -#ifdef DEBUG_LAYOUT -void -nsBox::AddInset(nsIBox* aBox, nsSize& aSize) -{ - nsMargin margin(0,0,0,0); - aBox->GetInset(margin); - AddMargin(aSize, margin); -} -#endif - void nsBox::BoundsCheck(nscoord& aMin, nscoord& aPref, nscoord& aMax) { @@ -1067,9 +1025,8 @@ nsBox::GetDebugBoxAt( const nsPoint& aPoint, if (!thisRect.Contains(aPoint)) return NS_ERROR_FAILURE; - nsIBox* child = nsnull; + nsIBox* child = GetChildBox(); nsIBox* hit = nsnull; - GetChildBox(&child); *aBox = nsnull; while (nsnull != child) { @@ -1078,7 +1035,7 @@ nsBox::GetDebugBoxAt( const nsPoint& aPoint, if (NS_SUCCEEDED(rv) && hit) { *aBox = hit; } - child->GetNextBox(&child); + child = child->GetNextBox(); } // found a child @@ -1086,21 +1043,6 @@ nsBox::GetDebugBoxAt( const nsPoint& aPoint, return NS_OK; } - // see if it is in our in our insets - nsMargin m; - GetBorderAndPadding(m); - - nsRect rect(thisRect); - rect.Deflate(m); - if (rect.Contains(aPoint)) { - GetInset(m); - rect.Deflate(m); - if (!rect.Contains(aPoint)) { - *aBox = this; - return NS_OK; - } - } - return NS_ERROR_FAILURE; } @@ -1112,14 +1054,6 @@ nsBox::GetDebug(PRBool& aDebug) return NS_OK; } - -NS_IMETHODIMP -nsBox::GetInset(nsMargin& margin) -{ - margin.SizeTo(0,0,0,0); - return NS_OK; -} - #endif PRBool diff --git a/mozilla/layout/xul/base/src/nsBox.h b/mozilla/layout/xul/base/src/nsBox.h index d8a4be5e381..4c1d5e695f7 100644 --- a/mozilla/layout/xul/base/src/nsBox.h +++ b/mozilla/layout/xul/base/src/nsBox.h @@ -67,8 +67,8 @@ public: virtual PRBool IsCollapsed(nsBoxLayoutState& aBoxLayoutState); - NS_IMETHOD SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect, - PRBool aRemoveOverflowArea = PR_FALSE); + virtual void SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect, + PRBool aRemoveOverflowArea = PR_FALSE); NS_IMETHOD GetBorder(nsMargin& aBorderAndPadding); NS_IMETHOD GetPadding(nsMargin& aBorderAndPadding); @@ -77,8 +77,8 @@ public: NS_IMETHOD SetLayoutManager(nsIBoxLayout* aLayout); NS_IMETHOD GetLayoutManager(nsIBoxLayout** aLayout); - NS_IMETHOD GetVAlign(Valignment& aAlign); - NS_IMETHOD GetHAlign(Halignment& aAlign); + virtual Valignment GetVAlign() const { return vAlign_Top; } + virtual Halignment GetHAlign() const { return hAlign_Left; } NS_IMETHOD RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild); @@ -86,7 +86,6 @@ public: virtual PRBool GetMouseThrough() const; #ifdef DEBUG_LAYOUT - NS_IMETHOD GetInset(nsMargin& aInset); NS_IMETHOD GetDebugBoxAt(const nsPoint& aPoint, nsIBox** aBox); NS_IMETHOD GetDebug(PRBool& aDebug); NS_IMETHOD SetDebug(nsBoxLayoutState& aState, PRBool aDebug); @@ -113,15 +112,9 @@ rollbox. void CoordNeedsRecalc(nscoord& aCoord); void AddBorderAndPadding(nsSize& aSize); - void AddInset(nsSize& aSize) { AddInset(this, aSize); } void AddMargin(nsSize& aSize); static void AddBorderAndPadding(nsIBox* aBox, nsSize& aSize); -#ifdef DEBUG_LAYOUT - static void AddInset(nsIBox* aBox, nsSize& aSize); -#else - static void AddInset(nsIBox* aBox, nsSize& aSize) {} -#endif static void AddMargin(nsIBox* aChild, nsSize& aSize); static void AddMargin(nsSize& aSize, const nsMargin& aMargin); diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.cpp b/mozilla/layout/xul/base/src/nsBoxFrame.cpp index 67d774294c0..cc0d0c958dd 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsBoxFrame.cpp @@ -163,20 +163,6 @@ nsBoxFrame::~nsBoxFrame() { } -NS_IMETHODIMP -nsBoxFrame::GetVAlign(Valignment& aAlign) -{ - aAlign = mValign; - return NS_OK; -} - -NS_IMETHODIMP -nsBoxFrame::GetHAlign(Halignment& aAlign) -{ - aAlign = mHalign; - return NS_OK; -} - NS_IMETHODIMP nsBoxFrame::SetInitialChildList(nsIAtom* aListName, nsIFrame* aChildList) @@ -1228,8 +1214,7 @@ nsBoxFrame::AttributeChanged(PRInt32 aNameSpaceID, NS_ASSERTION(frameToMove, "Out of flow without placeholder?"); } - nsIBox* parent; - frameToMove->GetParentBox(&parent); + nsIBox* parent = frameToMove->GetParentBox(); // If our parent is not a box, there's not much we can do... but in that // case our ordinal doesn't matter anyway, so that's ok. if (parent) { @@ -1439,7 +1424,7 @@ nsBoxFrame::PaintXULDebugOverlay(nsIRenderingContext& aRenderingContext, nscoord onePixel = GetPresContext()->IntScaledPixelsToTwips(1); - GetChildBox(&kid); + kid = GetChildBox(); while (nsnull != kid) { PRBool isHorizontal = IsHorizontal(); @@ -1477,7 +1462,7 @@ nsBoxFrame::PaintXULDebugOverlay(nsIRenderingContext& aRenderingContext, DrawSpacer(GetPresContext(), aRenderingContext, isHorizontal, flex, x, y, borderSize, spacerSize); } - kid->GetNextBox(&kid); + kid = kid->GetNextBox(); } } #endif @@ -1674,30 +1659,6 @@ nsBoxFrame::GetDebugPadding(nsMargin& aPadding) { aPadding.SizeTo(2,2,2,2); } - -NS_IMETHODIMP -nsBoxFrame::GetInset(nsMargin& margin) -{ - margin.SizeTo(0,0,0,0); - - if (mState & NS_STATE_CURRENTLY_IN_DEBUG) { - nsPresContext* presContext = GetPresContext(); - nsMargin debugMargin(0,0,0,0); - nsMargin debugBorder(0,0,0,0); - nsMargin debugPadding(0,0,0,0); - GetDebugBorder(debugBorder); - PixelMarginToTwips(presContext, debugBorder); - GetDebugMargin(debugMargin); - PixelMarginToTwips(presContext, debugMargin); - GetDebugMargin(debugPadding); - PixelMarginToTwips(presContext, debugPadding); - margin += debugBorder; - margin += debugMargin; - margin += debugPadding; - } - - return NS_OK; -} #endif void @@ -1769,8 +1730,7 @@ nsBoxFrame::DisplayDebugInfoFor(nsIBox* aBox, //printf("%%%%%% inside box %%%%%%%\n"); int count = 0; - nsIBox* child = nsnull; - aBox->GetChildBox(&child); + nsIBox* child = aBox->GetChildBox(); nsMargin m; nsMargin m2; @@ -1858,7 +1818,7 @@ nsBoxFrame::DisplayDebugInfoFor(nsIBox* aBox, return NS_OK; } - child->GetNextBox(&child); + child = child->GetNextBox(); count++; } } else { @@ -1872,12 +1832,11 @@ nsBoxFrame::DisplayDebugInfoFor(nsIBox* aBox, void nsBoxFrame::SetDebugOnChildList(nsBoxLayoutState& aState, nsIBox* aChild, PRBool aDebug) { - nsIBox* child = nsnull; - GetChildBox(&child); + nsIBox* child = GetChildBox(); while (child) { child->SetDebug(aState, aDebug); - child->GetNextBox(&child); + child = child->GetNextBox(); } } #endif @@ -2208,7 +2167,7 @@ nsBoxFrame::RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild) else if (!foundNewPrevSib && child != aChild) newPrevSib = child; - child->GetNextBox(&child); + child = child->GetNextBox(); } NS_ASSERTION(foundPrevSib, "aChild not in frame list?"); diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.h b/mozilla/layout/xul/base/src/nsBoxFrame.h index eb8b8e28a08..10d649dbe9f 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.h +++ b/mozilla/layout/xul/base/src/nsBoxFrame.h @@ -107,11 +107,9 @@ public: #ifdef DEBUG_LAYOUT NS_IMETHOD SetDebug(nsBoxLayoutState& aBoxLayoutState, PRBool aDebug); NS_IMETHOD GetDebug(PRBool& aDebug); - - NS_IMETHOD GetInset(nsMargin& aInset); #endif - NS_IMETHOD GetVAlign(Valignment& aAlign); - NS_IMETHOD GetHAlign(Halignment& aAlign); + virtual Valignment GetVAlign() const { return mValign; } + virtual Halignment GetHAlign() const { return mHalign; } NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState); virtual PRBool GetMouseThrough() const; diff --git a/mozilla/layout/xul/base/src/nsBoxLayout.cpp b/mozilla/layout/xul/base/src/nsBoxLayout.cpp index 2dea7d9ff36..1a75ab1ad9a 100644 --- a/mozilla/layout/xul/base/src/nsBoxLayout.cpp +++ b/mozilla/layout/xul/base/src/nsBoxLayout.cpp @@ -59,8 +59,7 @@ nsBoxLayout::nsBoxLayout() void nsBoxLayout::GetParentLayout(nsIBox* aBox, nsIBoxLayout** aParent) { - nsIBox* parent = nsnull; - aBox->GetParentBox(&parent); + nsIBox* parent = aBox->GetParentBox(); if (parent) { parent->GetLayoutManager(aParent); @@ -88,12 +87,6 @@ nsBoxLayout::AddMargin(nsSize& aSize, const nsMargin& aMargin) nsBox::AddMargin(aSize, aMargin); } -void -nsBoxLayout::AddInset(nsIBox* aBox, nsSize& aSize) -{ - nsBox::AddInset(aBox, aSize); -} - NS_IMETHODIMP nsBoxLayout::GetFlex(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aFlex) { @@ -115,7 +108,6 @@ nsBoxLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize aSize.width = 0; aSize.height = 0; AddBorderAndPadding(aBox, aSize); - AddInset(aBox, aSize); return NS_OK; } @@ -126,7 +118,6 @@ nsBoxLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize.width = 0; aSize.height = 0; AddBorderAndPadding(aBox, aSize); - AddInset(aBox, aSize); return NS_OK; } @@ -136,7 +127,6 @@ nsBoxLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize.width = NS_INTRINSICSIZE; aSize.height = NS_INTRINSICSIZE; AddBorderAndPadding(aBox, aSize); - AddInset(aBox, aSize); return NS_OK; } diff --git a/mozilla/layout/xul/base/src/nsBoxLayout.h b/mozilla/layout/xul/base/src/nsBoxLayout.h index 327ea13182c..e2c171e0e65 100644 --- a/mozilla/layout/xul/base/src/nsBoxLayout.h +++ b/mozilla/layout/xul/base/src/nsBoxLayout.h @@ -65,7 +65,6 @@ public: virtual void GetParentLayout(nsIBox* aBox, nsIBoxLayout** aParent); virtual void AddBorderAndPadding(nsIBox* aBox, nsSize& aSize); - virtual void AddInset(nsIBox* aBox, nsSize& aSize); virtual void AddMargin(nsIBox* aChild, nsSize& aSize); virtual void AddMargin(nsSize& aSize, const nsMargin& aMargin); diff --git a/mozilla/layout/xul/base/src/nsDeckFrame.cpp b/mozilla/layout/xul/base/src/nsDeckFrame.cpp index 202cf0bc8c6..05730c19728 100644 --- a/mozilla/layout/xul/base/src/nsDeckFrame.cpp +++ b/mozilla/layout/xul/base/src/nsDeckFrame.cpp @@ -226,8 +226,7 @@ nsDeckFrame::DoLayout(nsBoxLayoutState& aState) nsresult rv = nsBoxFrame::DoLayout(aState); // run though each child. Hide all but the selected one - nsIBox* box = nsnull; - GetChildBox(&box); + nsIBox* box = GetChildBox(); nscoord count = 0; while (box) @@ -238,8 +237,7 @@ nsDeckFrame::DoLayout(nsBoxLayoutState& aState) else HideBox(aState.PresContext(), box); - nsresult rv2 = box->GetNextBox(&box); - NS_ASSERTION(NS_SUCCEEDED(rv2), "failed to get next child"); + box = box->GetNextBox(); count++; } diff --git a/mozilla/layout/xul/base/src/nsFrameNavigator.cpp b/mozilla/layout/xul/base/src/nsFrameNavigator.cpp index ae4408df8c0..ddb2860fe5c 100644 --- a/mozilla/layout/xul/base/src/nsFrameNavigator.cpp +++ b/mozilla/layout/xul/base/src/nsFrameNavigator.cpp @@ -51,8 +51,7 @@ nsIBox* nsFrameNavigator::GetChildBeforeAfter(nsPresContext* aPresContext, nsIBox* start, PRBool before) { - nsIBox* parent = nsnull; - start->GetParentBox(&parent); + nsIBox* parent = start->GetParentBox(); PRInt32 index = IndexOf(aPresContext, parent,start); PRInt32 count = CountFrames(aPresContext, parent); @@ -79,15 +78,13 @@ nsFrameNavigator::IndexOf(nsPresContext* aPresContext, nsIBox* parent, nsIBox* c { PRInt32 count = 0; - nsIBox* box = nsnull; - parent->GetChildBox(&box); - while (nsnull != box) + nsIBox* box = parent->GetChildBox(); + while (box) { if (box == child) return count; - nsresult rv = box->GetNextBox(&box); - NS_ASSERTION(rv == NS_OK,"failed to get next child"); + box = box->GetNextBox(); count++; } @@ -99,12 +96,10 @@ nsFrameNavigator::CountFrames(nsPresContext* aPresContext, nsIBox* aBox) { PRInt32 count = 0; - nsIBox* box; - aBox->GetChildBox(&box); - while (nsnull != box) + nsIBox* box = aBox->GetChildBox(); + while (box) { - nsresult rv = box->GetNextBox(&box); - NS_ASSERTION(rv == NS_OK,"failed to get next child"); + box = box->GetNextBox(); count++; } @@ -116,15 +111,13 @@ nsFrameNavigator::GetChildAt(nsPresContext* aPresContext, nsIBox* parent, PRInt3 { PRInt32 count = 0; - nsIBox* box; - parent->GetChildBox(&box); - while (nsnull != box) + nsIBox* box = parent->GetChildBox(); + while (box) { if (count == index) return box; - nsresult rv = box->GetNextBox(&box); - NS_ASSERTION(rv == NS_OK,"failed to get next child"); + box = box->GetNextBox(); count++; } diff --git a/mozilla/layout/xul/base/src/nsGroupBoxFrame.cpp b/mozilla/layout/xul/base/src/nsGroupBoxFrame.cpp index 80884cb9b90..d703c58a62a 100644 --- a/mozilla/layout/xul/base/src/nsGroupBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsGroupBoxFrame.cpp @@ -233,23 +233,21 @@ nsIBox* nsGroupBoxFrame::GetCaptionBox(nsPresContext* aPresContext, nsRect& aCaptionRect) { // first child is our grouped area - nsIBox* box; - GetChildBox(&box); + nsIBox* box = GetChildBox(); // no area fail. if (!box) return nsnull; // get the first child in the grouped area, that is the caption - box->GetChildBox(&box); + box = box->GetChildBox(); // nothing in the area? fail if (!box) return nsnull; // now get the caption itself. It is in the caption frame. - nsIBox* child = nsnull; - box->GetChildBox(&child); + nsIBox* child = box->GetChildBox(); if (child) { // convert to our coordinates. diff --git a/mozilla/layout/xul/base/src/nsImageBoxFrame.cpp b/mozilla/layout/xul/base/src/nsImageBoxFrame.cpp index b4f47cf7e99..a7b420516dd 100644 --- a/mozilla/layout/xul/base/src/nsImageBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsImageBoxFrame.cpp @@ -472,7 +472,6 @@ nsImageBoxFrame::GetPrefSize(nsBoxLayoutState& aState) else size = mImageSize; AddBorderAndPadding(size); - AddInset(size); nsIBox::AddCSSPrefSize(aState, this, size); nsSize minSize = GetMinSize(aState); @@ -489,16 +488,14 @@ nsImageBoxFrame::GetMinSize(nsBoxLayoutState& aState) nsSize size(0,0); DISPLAY_MIN_SIZE(this, size); AddBorderAndPadding(size); - AddInset(size); nsIBox::AddCSSMinSize(aState, this, size); return size; } -NS_IMETHODIMP -nsImageBoxFrame::GetAscent(nsBoxLayoutState& aState, nscoord& aCoord) +nscoord +nsImageBoxFrame::GetBoxAscent(nsBoxLayoutState& aState) { - aCoord = GetPrefSize(aState).height; - return NS_OK; + return GetPrefSize(aState).height; } nsIAtom* diff --git a/mozilla/layout/xul/base/src/nsImageBoxFrame.h b/mozilla/layout/xul/base/src/nsImageBoxFrame.h index 5a2119dfe37..2adfc907c90 100644 --- a/mozilla/layout/xul/base/src/nsImageBoxFrame.h +++ b/mozilla/layout/xul/base/src/nsImageBoxFrame.h @@ -75,7 +75,7 @@ public: // nsIBox virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState); virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState); - NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent); + virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState); virtual void MarkIntrinsicWidthsDirty(); friend nsIFrame* NS_NewImageBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); diff --git a/mozilla/layout/xul/base/src/nsListBoxBodyFrame.cpp b/mozilla/layout/xul/base/src/nsListBoxBodyFrame.cpp index 186555dc1ff..b0d28116452 100644 --- a/mozilla/layout/xul/base/src/nsListBoxBodyFrame.cpp +++ b/mozilla/layout/xul/base/src/nsListBoxBodyFrame.cpp @@ -384,8 +384,6 @@ nsListBoxBodyFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState) nsSize pref = nsBoxFrame::GetPrefSize(aBoxLayoutState); PRInt32 size = GetFixedRowSize(); - nsIBox* box = nsnull; - GetChildBox(&box); if (size > -1) pref.height = size*GetRowHeightAppUnits(); diff --git a/mozilla/layout/xul/base/src/nsListBoxLayout.cpp b/mozilla/layout/xul/base/src/nsListBoxLayout.cpp index dea641d55a2..cc8dab333c5 100644 --- a/mozilla/layout/xul/base/src/nsListBoxLayout.cpp +++ b/mozilla/layout/xul/base/src/nsListBoxLayout.cpp @@ -191,8 +191,7 @@ nsListBoxLayout::LayoutInternal(nsIBox* aBox, nsBoxLayoutState& aState) } // run through all our currently created children - nsIBox* box = nsnull; - body->GetChildBox(&box); + nsIBox* box = body->GetChildBox(); // if the reason is resize or initial we must relayout. nscoord rowHeight = body->GetRowHeightAppUnits(); @@ -241,7 +240,7 @@ nsListBoxLayout::LayoutInternal(nsIBox* aBox, nsBoxLayoutState& aState) yOffset += size; availableHeight -= size; - box->GetNextBox(&box); + box = box->GetNextBox(); } // We have enough available height left to add some more rows diff --git a/mozilla/layout/xul/base/src/nsMenuFrame.cpp b/mozilla/layout/xul/base/src/nsMenuFrame.cpp index 968a157d38a..75bb5cf27e1 100644 --- a/mozilla/layout/xul/base/src/nsMenuFrame.cpp +++ b/mozilla/layout/xul/base/src/nsMenuFrame.cpp @@ -705,8 +705,7 @@ nsMenuFrame::ActivateMenu(PRBool aActivateFlag) // make sure the scrolled window is at 0,0 if (mLastPref.height <= rect.height) { - nsIBox* child; - menuPopup->GetChildBox(&child); + nsIBox* child = menuPopup->GetChildBox(); nsCOMPtr scrollframe(do_QueryInterface(child)); if (scrollframe) { @@ -1061,8 +1060,7 @@ nsMenuFrame::DoLayout(nsBoxLayoutState& aState) } // is the new size too small? Make sure we handle scrollbars correctly - nsIBox* child; - popupChild->GetChildBox(&child); + nsIBox* child = popupChild->GetChildBox(); nsRect bounds(popupChild->GetRect()); diff --git a/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp b/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp index 504fbf73de9..b45231c6fe5 100644 --- a/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp +++ b/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp @@ -271,8 +271,7 @@ nsPopupSetFrame::DoLayout(nsBoxLayoutState& aState) // } // is the new size too small? Make sure we handle scrollbars correctly - nsIBox* child; - popupChild->GetChildBox(&child); + nsIBox* child = popupChild->GetChildBox(); nsRect bounds(popupChild->GetRect()); diff --git a/mozilla/layout/xul/base/src/nsScrollBoxObject.cpp b/mozilla/layout/xul/base/src/nsScrollBoxObject.cpp index 3496ab1b6a9..4d8471c367d 100644 --- a/mozilla/layout/xul/base/src/nsScrollBoxObject.cpp +++ b/mozilla/layout/xul/base/src/nsScrollBoxObject.cpp @@ -134,10 +134,7 @@ static nsIFrame* GetScrolledBox(nsBoxObject* aScrollBox) { nsIFrame* scrolledFrame = scrollFrame->GetScrolledFrame(); if (!scrolledFrame) return nsnull; - nsIBox* scrolledBox; - if (NS_FAILED(scrolledFrame->GetChildBox(&scrolledBox))) - return nsnull; - return scrolledBox; + return scrolledFrame->GetChildBox(); } /* void scrollByIndex (in long dindexes); */ @@ -151,10 +148,9 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollByIndex(PRInt32 dindexes) return NS_ERROR_FAILURE; nsRect rect; - nsIFrame* child; // now get the scrolled boxes first child. - scrolledBox->GetChildBox(&child); + nsIFrame* child = scrolledBox->GetChildBox(); PRBool horiz = scrolledBox->IsHorizontal(); nsPoint cp; @@ -194,7 +190,7 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollByIndex(PRInt32 dindexes) break; } } - child->GetNextBox(&child); + child = child->GetNextBox(); curIndex++; } @@ -205,7 +201,7 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollByIndex(PRInt32 dindexes) if (dindexes > 0) { while(child) { - child->GetNextBox(&child); + child = child->GetNextBox(); if (child) rect = child->GetRect(); count++; @@ -214,14 +210,14 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollByIndex(PRInt32 dindexes) } } else if (dindexes < 0) { - scrolledBox->GetChildBox(&child); + child = scrolledBox->GetChildBox(); while(child) { rect = child->GetRect(); if (count >= curIndex + dindexes) break; count++; - child->GetNextBox(&child); + child = child->GetNextBox(); } } diff --git a/mozilla/layout/xul/base/src/nsSliderFrame.cpp b/mozilla/layout/xul/base/src/nsSliderFrame.cpp index 424e5474048..cf648d698c3 100644 --- a/mozilla/layout/xul/base/src/nsSliderFrame.cpp +++ b/mozilla/layout/xul/base/src/nsSliderFrame.cpp @@ -296,8 +296,7 @@ nsSliderFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) { // if we are too small to have a thumb don't paint it. - nsIBox* thumb; - GetChildBox(&thumb); + nsIBox* thumb = GetChildBox(); if (thumb) { nsRect thumbRect(thumb->GetRect()); @@ -319,8 +318,7 @@ NS_IMETHODIMP nsSliderFrame::DoLayout(nsBoxLayoutState& aState) { // get the thumb should be our only child - nsIBox* thumbBox = nsnull; - GetChildBox(&thumbBox); + nsIBox* thumbBox = GetChildBox(); if (!thumbBox) { SyncLayout(aState); diff --git a/mozilla/layout/xul/base/src/nsSplitterFrame.cpp b/mozilla/layout/xul/base/src/nsSplitterFrame.cpp index 076887f46f8..e1ed7c702d9 100644 --- a/mozilla/layout/xul/base/src/nsSplitterFrame.cpp +++ b/mozilla/layout/xul/base/src/nsSplitterFrame.cpp @@ -384,7 +384,7 @@ nsSplitterFrame::DoLayout(nsBoxLayoutState& aState) { if (GetStateBits() & NS_FRAME_FIRST_REFLOW) { - GetParentBox(&mInner->mParentBox); + mInner->mParentBox = GetParentBox(); mInner->UpdateState(); } @@ -395,8 +395,7 @@ nsSplitterFrame::DoLayout(nsBoxLayoutState& aState) void nsSplitterFrame::GetInitialOrientation(PRBool& aIsHorizontal) { - nsIBox* box; - GetParentBox(&box); + nsIBox* box = GetParentBox(); if (box) { aIsHorizontal = !box->IsHorizontal(); } @@ -715,7 +714,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent) nsGkAtoms::_true, eCaseMatters)) return NS_OK; - mOuter->GetParentBox(&mParentBox); + mParentBox = mOuter->GetParentBox(); if (!mParentBox) return NS_OK; @@ -752,8 +751,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent) mChildInfosBeforeCount = 0; mChildInfosAfterCount = 0; - nsIBox* childBox = nsnull; - mParentBox->GetChildBox(&childBox); + nsIBox* childBox = mParentBox->GetChildBox(); while (nsnull != childBox) { @@ -815,8 +813,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent) } } - rv = childBox->GetNextBox(&childBox); - NS_ASSERTION(rv == NS_OK,"failed to get next child"); + childBox = childBox->GetNextBox(); count++; } @@ -1016,14 +1013,13 @@ nsSplitterFrameInner::AdjustChildren(nsPresContext* aPresContext) static nsIBox* GetChildBoxForContent(nsIBox* aParentBox, nsIContent* aContent) { - nsIBox* childBox = nsnull; - aParentBox->GetChildBox(&childBox); + nsIBox* childBox = aParentBox->GetChildBox(); while (nsnull != childBox) { if (childBox->GetContent() == aContent) { return childBox; } - childBox->GetNextBox(&childBox); + childBox = childBox->GetNextBox(); } return nsnull; } @@ -1038,12 +1034,11 @@ nsSplitterFrameInner::AdjustChildren(nsPresContext* aPresContext, nsSplitterInfo nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1); // first set all the widths. - nsIBox* child = nsnull; - mOuter->GetChildBox(&child); + nsIBox* child = mOuter->GetChildBox(); while(child) { SetPreferredSize(state, child, onePixel, aIsHorizontal, nsnull); - child->GetNextBox(&child); + child = child->GetNextBox(); } // now set our changed widths. diff --git a/mozilla/layout/xul/base/src/nsSprocketLayout.cpp b/mozilla/layout/xul/base/src/nsSprocketLayout.cpp index 255bfdf117b..e0a6fda2e48 100644 --- a/mozilla/layout/xul/base/src/nsSprocketLayout.cpp +++ b/mozilla/layout/xul/base/src/nsSprocketLayout.cpp @@ -146,10 +146,8 @@ HandleBoxPack(nsIBox* aBox, const nsFrameState& aFrameState, nscoord& aX, nscoor } // Get our pack/alignment information. - nsIBox::Halignment halign; - nsIBox::Valignment valign; - aBox->GetVAlign(valign); - aBox->GetHAlign(halign); + nsIBox::Halignment halign = aBox->GetHAlign(); + nsIBox::Valignment valign = aBox->GetVAlign(); // The following code handles box PACKING. Packing comes into play in the case where the computed size for // all of our children (now stored in our client rect) is smaller than the size available for @@ -207,12 +205,11 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState) // See if we are collapsed. If we are, then simply iterate over all our // children and give them a rect of 0 width and height. if (aBox->IsCollapsed(aState)) { - nsIBox* child; - aBox->GetChildBox(&child); + nsIBox* child = aBox->GetChildBox(); while(child) { nsBoxFrame::LayoutChildAt(aState, child, nsRect(0,0,0,0)); - child->GetNextBox(&child); + child = child->GetNextBox(); } return NS_OK; } @@ -339,8 +336,7 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState) nsComputedBoxSize* childComputedBoxSize = computedBoxSizes; nsBoxSize* childBoxSize = boxSizes; - nsIBox* child = nsnull; - aBox->GetChildBox(&child); + nsIBox* child = aBox->GetChildBox(); PRInt32 count = 0; while (child || (childBoxSize && childBoxSize->bogus)) @@ -622,7 +618,7 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState) childComputedBoxSize = childComputedBoxSize->next; childBoxSize = childBoxSize->next; - child->GetNextBox(&child); + child = child->GetNextBox(); count++; } @@ -654,8 +650,6 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState) nsMargin bp(0,0,0,0); aBox->GetBorderAndPadding(bp); tmpClientRect.Inflate(bp); - aBox->GetInset(bp); - tmpClientRect.Inflate(bp); if (tmpClientRect.width > originalSize.width || tmpClientRect.height > originalSize.height) { @@ -679,17 +673,16 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState) // we really did have to change the positions because of packing (typically for 'center' // or 'end' pack values). if (x != origX || y != origY) { - nsIBox* child = nsnull; - // reposition all our children - aBox->GetChildBox(&child); + nsIBox* child = aBox->GetChildBox(); + // reposition all our children while (child) { nsRect childRect(child->GetRect()); childRect.x += (x - origX); childRect.y += (y - origY); child->SetBounds(aState, childRect); - child->GetNextBox(&child); + child = child->GetNextBox(); } } @@ -738,8 +731,7 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox // so we can just optimize it out this way. // set flexes - nsIBox* child = nsnull; - aBox->GetChildBox(&child); + nsIBox* child = aBox->GetChildBox(); aFlexes = 0; nsBoxSize* currentBox = nsnull; @@ -776,12 +768,12 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox if (flex > 0) aFlexes++; - child->GetNextBox(&child); + child = child->GetNextBox(); } #endif // get pref, min, max - aBox->GetChildBox(&child); + child = aBox->GetChildBox(); currentBox = aBoxSizes; nsBoxSize* last = nsnull; @@ -897,7 +889,7 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox currentBox->collapsed = collapsed; aFlexes += currentBox->flex; - child->GetNextBox(&child); + child = child->GetNextBox(); last = currentBox; currentBox = currentBox->next; @@ -958,10 +950,8 @@ nsSprocketLayout::ComputeChildsNextPosition(nsIBox* aBox, nsFrameState frameState = 0; GetFrameState(aBox, frameState); - nsIBox::Halignment halign; - nsIBox::Valignment valign; - aBox->GetVAlign(valign); - aBox->GetHAlign(halign); + nsIBox::Halignment halign = aBox->GetHAlign(); + nsIBox::Valignment valign = aBox->GetVAlign(); if (IsHorizontal(aBox)) { // Handle alignment of a horizontal box's children. @@ -1324,12 +1314,10 @@ nsSprocketLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aS aSize.width = 0; aSize.height = 0; - // run through all the children and get there min, max, and preferred sizes + // run through all the children and get their min, max, and preferred sizes // return us the size of the box - nsIBox* child = nsnull; - aBox->GetChildBox(&child); - + nsIBox* child = aBox->GetChildBox(); nsFrameState frameState = 0; GetFrameState(aBox, frameState); PRBool isEqual = frameState & NS_STATE_EQUAL_SIZE; @@ -1358,7 +1346,7 @@ nsSprocketLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aS count++; } - child->GetNextBox(&child); + child = child->GetNextBox(); } if (isEqual) { @@ -1368,9 +1356,8 @@ nsSprocketLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aS aSize.height = biggestPref*count; } - // now add our border and padding and insets + // now add our border and padding AddBorderAndPadding(aBox, aSize); - AddInset(aBox, aSize); return NS_OK; } @@ -1385,11 +1372,10 @@ nsSprocketLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi aSize.width = 0; aSize.height = 0; - // run through all the children and get there min, max, and preferred sizes + // run through all the children and get their min, max, and preferred sizes // return us the size of the box - nsIBox* child = nsnull; - aBox->GetChildBox(&child); + nsIBox* child = aBox->GetChildBox(); nsFrameState frameState = 0; GetFrameState(aBox, frameState); PRBool isEqual = frameState & NS_STATE_EQUAL_SIZE; @@ -1429,7 +1415,7 @@ nsSprocketLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi count++; } - child->GetNextBox(&child); + child = child->GetNextBox(); } @@ -1440,9 +1426,8 @@ nsSprocketLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi aSize.height = biggestMin*count; } -// now add our border and padding and insets - AddBorderAndPadding(aBox, aSize); - AddInset(aBox,aSize); + // now add our border and padding + AddBorderAndPadding(aBox, aSize); return NS_OK; } @@ -1458,12 +1443,10 @@ nsSprocketLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi aSize.width = NS_INTRINSICSIZE; aSize.height = NS_INTRINSICSIZE; - // run through all the children and get there min, max, and preferred sizes + // run through all the children and get their min, max, and preferred sizes // return us the size of the box - - nsIBox* child = nsnull; - aBox->GetChildBox(&child); + nsIBox* child = aBox->GetChildBox(); nsFrameState frameState = 0; GetFrameState(aBox, frameState); PRBool isEqual = frameState & NS_STATE_EQUAL_SIZE; @@ -1495,7 +1478,7 @@ nsSprocketLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi count++; } - child->GetNextBox(&child); + child = child->GetNextBox(); } if (isEqual) { @@ -1512,9 +1495,8 @@ nsSprocketLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi } } - // now add our border and padding and insets - AddBorderAndPadding(aBox, aSize); - AddInset(aBox, aSize); + // now add our border and padding + AddBorderAndPadding(aBox, aSize); return NS_OK; } @@ -1528,11 +1510,10 @@ nsSprocketLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aAs aAscent = 0; - // run through all the children and get there min, max, and preferred sizes + // run through all the children and get their min, max, and preferred sizes // return us the size of the box - nsIBox* child = nsnull; - aBox->GetChildBox(&child); + nsIBox* child = aBox->GetChildBox(); while (child) { @@ -1555,8 +1536,8 @@ nsSprocketLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aAs aAscent = ascent; } //} - child->GetNextBox(&child); - + + child = child->GetNextBox(); } return NS_OK; diff --git a/mozilla/layout/xul/base/src/nsStackLayout.cpp b/mozilla/layout/xul/base/src/nsStackLayout.cpp index 9f1d2d1cb80..1fbd28b439a 100644 --- a/mozilla/layout/xul/base/src/nsStackLayout.cpp +++ b/mozilla/layout/xul/base/src/nsStackLayout.cpp @@ -84,9 +84,8 @@ nsStackLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize // we are as wide as the widest child plus its left offset // we are tall as the tallest child plus its top offset - nsIBox* child = nsnull; - aBox->GetChildBox(&child); - + + nsIBox* child = aBox->GetChildBox(); while (child) { nsSize pref = child->GetPrefSize(aState); @@ -94,12 +93,11 @@ nsStackLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize AddOffset(aState, child, pref); AddLargestSize(aSize, pref); - child->GetNextBox(&child); + child = child->GetNextBox(); } - // now add our border and padding and insets + // now add our border and padding AddBorderAndPadding(aBox, aSize); - AddInset(aBox, aSize); return NS_OK; } @@ -109,24 +107,21 @@ nsStackLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) { aSize.width = 0; aSize.height = 0; - - // run through all the children and get their min, max, and preferred sizes - - nsIBox* child = nsnull; - aBox->GetChildBox(&child); + // run through all the children and get their min, max, and preferred sizes + + nsIBox* child = aBox->GetChildBox(); while (child) { nsSize min = child->GetMinSize(aState); AddMargin(child, min); AddOffset(aState, child, min); AddLargestSize(aSize, min); - child->GetNextBox(&child); + child = child->GetNextBox(); } - // now add our border and padding and insets + // now add our border and padding AddBorderAndPadding(aBox, aSize); - AddInset(aBox,aSize); return NS_OK; } @@ -138,10 +133,8 @@ nsStackLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) aSize.height = NS_INTRINSICSIZE; // run through all the children and get their min, max, and preferred sizes - - nsIBox* child = nsnull; - aBox->GetChildBox(&child); - + + nsIBox* child = aBox->GetChildBox(); while (child) { nsSize max = child->GetMaxSize(aState); nsSize min = child->GetMinSize(aState); @@ -151,12 +144,11 @@ nsStackLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) AddOffset(aState, child, max); AddSmallestSize(aSize, max); - child->GetNextBox(&child); + child = child->GetNextBox(); } - // now add our border and padding and insets + // now add our border and padding AddBorderAndPadding(aBox, aSize); - AddInset(aBox, aSize); return NS_OK; } @@ -166,9 +158,8 @@ NS_IMETHODIMP nsStackLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aAscent) { aAscent = 0; - nsIBox* child = nsnull; - aBox->GetChildBox(&child); - + + nsIBox* child = aBox->GetChildBox(); while (child) { nscoord ascent = child->GetBoxAscent(aState); nsMargin margin; @@ -176,7 +167,8 @@ nsStackLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aAscen ascent += margin.top + margin.bottom; if (ascent > aAscent) aAscent = ascent; - child->GetNextBox(&child); + + child = child->GetNextBox(); } return NS_OK; @@ -254,8 +246,7 @@ nsStackLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState) PRBool grow; do { - nsIBox* child = nsnull; - aBox->GetChildBox(&child); + nsIBox* child = aBox->GetChildBox(); grow = PR_FALSE; while (child) @@ -337,7 +328,7 @@ nsStackLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState) } } - child->GetNextBox(&child); + child = child->GetNextBox(); } } while (grow); @@ -347,8 +338,6 @@ nsStackLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState) nsMargin bp; aBox->GetBorderAndPadding(bp); clientRect.Inflate(bp); - aBox->GetInset(bp); - clientRect.Inflate(bp); if (clientRect.width > bounds.width || clientRect.height > bounds.height) { diff --git a/mozilla/layout/xul/base/src/nsTextBoxFrame.cpp b/mozilla/layout/xul/base/src/nsTextBoxFrame.cpp index 4a2e75c5580..05d66cce42b 100644 --- a/mozilla/layout/xul/base/src/nsTextBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTextBoxFrame.cpp @@ -874,7 +874,6 @@ nsTextBoxFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState) DISPLAY_PREF_SIZE(this, size); AddBorderAndPadding(size); - AddInset(size); nsIBox::AddCSSPrefSize(aBoxLayoutState, this, size); return size; @@ -896,26 +895,23 @@ nsTextBoxFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState) size.width = 0; AddBorderAndPadding(size); - AddInset(size); nsIBox::AddCSSMinSize(aBoxLayoutState, this, size); return size; } -NS_IMETHODIMP -nsTextBoxFrame::GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent) +nscoord +nsTextBoxFrame::GetBoxAscent(nsBoxLayoutState& aBoxLayoutState) { CalcTextSize(aBoxLayoutState); - aAscent = mAscent; + nscoord ascent = mAscent; nsMargin m(0,0,0,0); GetBorderAndPadding(m); - aAscent += m.top; - GetInset(m); - aAscent += m.top; + ascent += m.top; - return NS_OK; + return ascent; } #ifdef DEBUG diff --git a/mozilla/layout/xul/base/src/nsTextBoxFrame.h b/mozilla/layout/xul/base/src/nsTextBoxFrame.h index 6a323ae0fb8..2ac7111f8d9 100644 --- a/mozilla/layout/xul/base/src/nsTextBoxFrame.h +++ b/mozilla/layout/xul/base/src/nsTextBoxFrame.h @@ -50,7 +50,7 @@ public: // nsIBox virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState); virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState); - NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent); + virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState); NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState); virtual void MarkIntrinsicWidthsDirty(); diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index 5c152bdca4d..0f069ddda79 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -262,7 +262,6 @@ nsTreeBodyFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState) min.height = mRowHeight * desiredRows; AddBorderAndPadding(min); - AddInset(min); nsIBox::AddCSSMinSize(aBoxLayoutState, this, min); return min; @@ -403,7 +402,7 @@ nsTreeBodyFrame::EnsureView() } } -NS_IMETHODIMP +void nsTreeBodyFrame::SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect, PRBool aRemoveOverflowArea) { @@ -415,7 +414,7 @@ nsTreeBodyFrame::SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRec mHorzWidth = horzWidth; - return nsLeafBoxFrame::SetBounds(aBoxLayoutState, aRect, aRemoveOverflowArea); + nsLeafBoxFrame::SetBounds(aBoxLayoutState, aRect, aRemoveOverflowArea); } diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.h b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.h index d1a7819fbe7..3ee160efbb9 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.h +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.h @@ -87,8 +87,8 @@ public: // nsIBox virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState); - NS_IMETHOD SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect, - PRBool aRemoveOverflowArea = PR_FALSE); + virtual void SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect, + PRBool aRemoveOverflowArea = PR_FALSE); // nsIReflowCallback NS_IMETHOD ReflowFinished(nsIPresShell* aPresShell, PRBool* aFlushFlag); diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.cpp b/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.cpp index 36a07efdd1f..be4823972aa 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.cpp +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.cpp @@ -184,21 +184,19 @@ nsTreeColFrame::AttributeChanged(PRInt32 aNameSpaceID, return rv; } -NS_IMETHODIMP +void nsTreeColFrame::SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect, PRBool aRemoveOverflowArea) { nscoord oldWidth = mRect.width; - nsresult rv = nsBoxFrame::SetBounds(aBoxLayoutState, aRect, - aRemoveOverflowArea); + nsBoxFrame::SetBounds(aBoxLayoutState, aRect, aRemoveOverflowArea); if (mRect.width != oldWidth) { nsITreeBoxObject* treeBoxObject = GetTreeBoxObject(); if (treeBoxObject) { treeBoxObject->Invalidate(); } } - return rv; } nsITreeBoxObject* diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.h b/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.h index a4119389ded..570676872bb 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.h +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.h @@ -70,8 +70,8 @@ public: nsIAtom* aAttribute, PRInt32 aModType); - NS_IMETHOD SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect, - PRBool aRemoveOverflowArea = PR_FALSE); + virtual void SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect, + PRBool aRemoveOverflowArea = PR_FALSE); friend nsIFrame* NS_NewTreeColFrame(nsIPresShell* aPresShell, PRBool aIsRoot,