diff --git a/mozilla/layout/xul/base/src/grid/nsGridLayout2.cpp b/mozilla/layout/xul/base/src/grid/nsGridLayout2.cpp index d8ee6898f5a..199f9947e2c 100644 --- a/mozilla/layout/xul/base/src/grid/nsGridLayout2.cpp +++ b/mozilla/layout/xul/base/src/grid/nsGridLayout2.cpp @@ -83,15 +83,14 @@ nsGridLayout2::Layout(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState) return rv; } -NS_IMETHODIMP +void nsGridLayout2::IntrinsicWidthsDirty(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState) { - nsresult rv = nsStackLayout::IntrinsicWidthsDirty(aBox, aBoxLayoutState); + nsStackLayout::IntrinsicWidthsDirty(aBox, aBoxLayoutState); // XXXldb We really don't need to do all the work that NeedsRebuild // does; we just need to mark intrinsic widths dirty on the // (row/column)(s/-groups). mGrid.NeedsRebuild(aBoxLayoutState); - return rv; } nsGrid* @@ -123,12 +122,10 @@ nsGridLayout2::AddWidth(nsSize& aSize, nscoord aSize2, PRBool aIsHorizontal) } } -NS_IMETHODIMP -nsGridLayout2::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) +nsSize +nsGridLayout2::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState) { - nsresult rv = nsStackLayout::GetMinSize(aBox, aState, aSize); - if (NS_FAILED(rv)) - return rv; + nsSize minSize = nsStackLayout::GetMinSize(aBox, aState); // if there are no tags that will sum up our columns, // sum up our columns here. @@ -158,18 +155,16 @@ nsGridLayout2::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) AddMargin(aBox, total); AddOffset(aState, aBox, total); - AddLargestSize(aSize, total); + AddLargestSize(minSize, total); } - return rv; + return minSize; } -NS_IMETHODIMP -nsGridLayout2::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) +nsSize +nsGridLayout2::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState) { - nsresult rv = nsStackLayout::GetPrefSize(aBox, aState, aSize); - if (NS_FAILED(rv)) - return rv; + nsSize pref = nsStackLayout::GetPrefSize(aBox, aState); // if there are no tags that will sum up our columns, // sum up our columns here. @@ -199,18 +194,16 @@ nsGridLayout2::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize AddMargin(aBox, total); AddOffset(aState, aBox, total); - AddLargestSize(aSize, total); + AddLargestSize(pref, total); } - return rv; + return pref; } -NS_IMETHODIMP -nsGridLayout2::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) +nsSize +nsGridLayout2::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState) { - nsresult rv = nsStackLayout::GetMaxSize(aBox, aState, aSize); - if (NS_FAILED(rv)) - return rv; + nsSize maxSize = nsStackLayout::GetMaxSize(aBox, aState); // if there are no tags that will sum up our columns, // sum up our columns here. @@ -242,10 +235,10 @@ nsGridLayout2::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) AddMargin(aBox, total); AddOffset(aState, aBox, total); - AddSmallestSize(aSize, total); + AddSmallestSize(maxSize, total); } - return rv; + return maxSize; } PRInt32 @@ -265,36 +258,32 @@ nsGridLayout2::GetTotalMargin(nsIBox* aBox, PRBool aIsHorizontal) return margin; } -NS_IMETHODIMP +void nsGridLayout2::ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aPrevBox, nsIBox* aChildList) { mGrid.NeedsRebuild(aState); - return NS_OK; } -NS_IMETHODIMP +void nsGridLayout2::ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList) { mGrid.NeedsRebuild(aState); - return NS_OK; } -NS_IMETHODIMP +void nsGridLayout2::ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList) { mGrid.NeedsRebuild(aState); - return NS_OK; } -NS_IMETHODIMP +void nsGridLayout2::ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList) { mGrid.NeedsRebuild(aState); - return NS_OK; } NS_IMPL_ADDREF_INHERITED(nsGridLayout2, nsStackLayout) diff --git a/mozilla/layout/xul/base/src/grid/nsGridLayout2.h b/mozilla/layout/xul/base/src/grid/nsGridLayout2.h index c1b8592f239..5eb934a87bb 100644 --- a/mozilla/layout/xul/base/src/grid/nsGridLayout2.h +++ b/mozilla/layout/xul/base/src/grid/nsGridLayout2.h @@ -65,27 +65,27 @@ public: NS_DECL_ISUPPORTS_INHERITED NS_IMETHOD Layout(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); - NS_IMETHOD IntrinsicWidthsDirty(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual void IntrinsicWidthsDirty(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); virtual nsGridRowGroupLayout* CastToRowGroupLayout() { return nsnull; } virtual nsGridLayout2* CastToGridLayout() { return this; } virtual nsGrid* GetGrid(nsIBox* aBox, PRInt32* aIndex, nsGridRowLayout* aRequestor=nsnull); virtual void GetParentGridPart(nsIBox* aBox, nsIBox** aParentBox, nsIGridPart** aParentGridPart) { NS_NOTREACHED("Should not be called"); } - NS_IMETHOD GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); - NS_IMETHOD GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); - NS_IMETHOD GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); + virtual nsSize GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual nsSize GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual nsSize GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); virtual void CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount) { aRowCount++; } virtual void DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState) { } virtual PRInt32 BuildRows(nsIBox* aBox, nsGridRow* aRows); virtual nsMargin GetTotalMargin(nsIBox* aBox, PRBool aIsHorizontal); virtual Type GetType() { return eGrid; } - NS_IMETHOD ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, + virtual void ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aPrevBox, nsIBox* aChildList); - NS_IMETHOD ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, + virtual void ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList); - NS_IMETHOD ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, + virtual void ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList); - NS_IMETHOD ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, + virtual void ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList); protected: diff --git a/mozilla/layout/xul/base/src/grid/nsGridRowGroupLayout.cpp b/mozilla/layout/xul/base/src/grid/nsGridRowGroupLayout.cpp index b029935b0de..a4c7607e197 100644 --- a/mozilla/layout/xul/base/src/grid/nsGridRowGroupLayout.cpp +++ b/mozilla/layout/xul/base/src/grid/nsGridRowGroupLayout.cpp @@ -94,10 +94,10 @@ nsGridRowGroupLayout::AddWidth(nsSize& aSize, nscoord aSize2, PRBool aIsHorizont size += aSize2; } -NS_IMETHODIMP -nsGridRowGroupLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) +nsSize +nsGridRowGroupLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState) { - nsresult rv = nsGridRowLayout::GetPrefSize(aBox, aState, aSize); + nsSize vpref = nsGridRowLayout::GetPrefSize(aBox, aState); /* It is possible that we could have some extra columns. This is when less columns in XUL were @@ -121,17 +121,17 @@ nsGridRowGroupLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize nscoord pref = grid->GetPrefRowHeight(aState, i+start, !isHorizontal); // GetPrefColumnWidth - AddWidth(aSize, pref, isHorizontal); + AddWidth(vpref, pref, isHorizontal); } } - return rv; + return vpref; } -NS_IMETHODIMP -nsGridRowGroupLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) +nsSize +nsGridRowGroupLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState) { - nsresult rv = nsGridRowLayout::GetMaxSize(aBox, aState, aSize); + nsSize maxSize = nsGridRowLayout::GetMaxSize(aBox, aState); PRInt32 index = 0; nsGrid* grid = GetGrid(aBox, &index); @@ -147,17 +147,17 @@ nsGridRowGroupLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& nscoord max = grid->GetMaxRowHeight(aState, i+start, !isHorizontal); // GetMaxColumnWidth - AddWidth(aSize, max, isHorizontal); + AddWidth(maxSize, max, isHorizontal); } } - return rv; + return maxSize; } -NS_IMETHODIMP -nsGridRowGroupLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) +nsSize +nsGridRowGroupLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState) { - nsresult rv = nsGridRowLayout::GetMinSize(aBox, aState, aSize); + nsSize minSize = nsGridRowLayout::GetMinSize(aBox, aState); PRInt32 index = 0; nsGrid* grid = GetGrid(aBox, &index); @@ -172,11 +172,11 @@ nsGridRowGroupLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& { nscoord min = grid->GetMinRowHeight(aState, i+start, !isHorizontal); // GetMinColumnWidth - AddWidth(aSize, min, isHorizontal); + AddWidth(minSize, min, isHorizontal); } } - return rv; + return minSize; } /* diff --git a/mozilla/layout/xul/base/src/grid/nsGridRowGroupLayout.h b/mozilla/layout/xul/base/src/grid/nsGridRowGroupLayout.h index 4bd0ceb7b80..124c9a784f3 100644 --- a/mozilla/layout/xul/base/src/grid/nsGridRowGroupLayout.h +++ b/mozilla/layout/xul/base/src/grid/nsGridRowGroupLayout.h @@ -57,9 +57,9 @@ public: friend nsresult NS_NewGridRowGroupLayout(nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout); virtual nsGridRowGroupLayout* CastToRowGroupLayout() { return this; } - NS_IMETHOD GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); - NS_IMETHOD GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); - NS_IMETHOD GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); + virtual nsSize GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual nsSize GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual nsSize GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); virtual void CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount); virtual void DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState); virtual PRInt32 BuildRows(nsIBox* aBox, nsGridRow* aRows); diff --git a/mozilla/layout/xul/base/src/grid/nsGridRowLayout.cpp b/mozilla/layout/xul/base/src/grid/nsGridRowLayout.cpp index 426b29752ab..b3f872a18db 100644 --- a/mozilla/layout/xul/base/src/grid/nsGridRowLayout.cpp +++ b/mozilla/layout/xul/base/src/grid/nsGridRowLayout.cpp @@ -53,32 +53,28 @@ nsGridRowLayout::nsGridRowLayout(nsIPresShell* aPresShell):nsSprocketLayout() { } -NS_IMETHODIMP +void nsGridRowLayout::ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aPrevBox, nsIBox* aChildList) { ChildAddedOrRemoved(aBox, aState); - return NS_OK; } -NS_IMETHODIMP +void nsGridRowLayout::ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList) { ChildAddedOrRemoved(aBox, aState); - return NS_OK; } -NS_IMETHODIMP +void nsGridRowLayout::ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList) { ChildAddedOrRemoved(aBox, aState); - return NS_OK; } -NS_IMETHODIMP +void nsGridRowLayout::ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList) { ChildAddedOrRemoved(aBox, aState); - return NS_OK; } void diff --git a/mozilla/layout/xul/base/src/grid/nsGridRowLayout.h b/mozilla/layout/xul/base/src/grid/nsGridRowLayout.h index e4ec27ecfd8..7f9fa87c40e 100644 --- a/mozilla/layout/xul/base/src/grid/nsGridRowLayout.h +++ b/mozilla/layout/xul/base/src/grid/nsGridRowLayout.h @@ -70,10 +70,10 @@ public: virtual nsGridLayout2* CastToGridLayout() { return nsnull; } virtual nsGrid* GetGrid(nsIBox* aBox, PRInt32* aIndex, nsGridRowLayout* aRequestor=nsnull); virtual void GetParentGridPart(nsIBox* aBox, nsIBox** aParentBox, nsIGridPart** aParentGridRow); - NS_IMETHOD ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aPrevBox, nsIBox* aChildList); - NS_IMETHOD ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList); - NS_IMETHOD ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList); - NS_IMETHOD ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList); + virtual void ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aPrevBox, nsIBox* aChildList); + virtual void ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList); + virtual void ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList); + virtual void ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList); virtual nsMargin GetTotalMargin(nsIBox* aBox, PRBool aIsHorizontal); protected: diff --git a/mozilla/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp b/mozilla/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp index dd088a1c9e4..318eea49bb0 100644 --- a/mozilla/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp +++ b/mozilla/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp @@ -69,8 +69,8 @@ nsGridRowLeafLayout::~nsGridRowLeafLayout() { } -NS_IMETHODIMP -nsGridRowLeafLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) +nsSize +nsGridRowLeafLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState) { PRInt32 index = 0; nsGrid* grid = GetGrid(aBox, &index); @@ -78,44 +78,45 @@ nsGridRowLeafLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& // If we are not in a grid. Then we just work like a box. But if we are in a grid // ask the grid for our size. - if (!grid) - return nsGridRowLayout::GetPrefSize(aBox, aState, aSize); + if (!grid) { + return nsGridRowLayout::GetPrefSize(aBox, aState); + } else { - aSize = grid->GetPrefRowSize(aState, index, isHorizontal); - //AddBorderAndPadding(aBox, aSize); - return NS_OK; + return grid->GetPrefRowSize(aState, index, isHorizontal); + //AddBorderAndPadding(aBox, pref); } } -NS_IMETHODIMP -nsGridRowLeafLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) +nsSize +nsGridRowLeafLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState) { PRInt32 index = 0; nsGrid* grid = GetGrid(aBox, &index); PRBool isHorizontal = IsHorizontal(aBox); if (!grid) - return nsGridRowLayout::GetMinSize(aBox, aState, aSize); + return nsGridRowLayout::GetMinSize(aBox, aState); else { - aSize = grid->GetMinRowSize(aState, index, isHorizontal); - AddBorderAndPadding(aBox, aSize); - return NS_OK; + nsSize minSize = grid->GetMinRowSize(aState, index, isHorizontal); + AddBorderAndPadding(aBox, minSize); + return minSize; } } -NS_IMETHODIMP -nsGridRowLeafLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) +nsSize +nsGridRowLeafLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState) { PRInt32 index = 0; nsGrid* grid = GetGrid(aBox, &index); PRBool isHorizontal = IsHorizontal(aBox); if (!grid) - return nsGridRowLayout::GetMaxSize(aBox, aState, aSize); + return nsGridRowLayout::GetMaxSize(aBox, aState); else { - aSize = grid->GetMaxRowSize(aState, index, isHorizontal); - AddBorderAndPadding(aBox, aSize); - return NS_OK; + nsSize maxSize; + maxSize = grid->GetMaxRowSize(aState, index, isHorizontal); + AddBorderAndPadding(aBox, maxSize); + return maxSize; } } diff --git a/mozilla/layout/xul/base/src/grid/nsGridRowLeafLayout.h b/mozilla/layout/xul/base/src/grid/nsGridRowLeafLayout.h index 6404363e86c..5defd9cf1ad 100644 --- a/mozilla/layout/xul/base/src/grid/nsGridRowLeafLayout.h +++ b/mozilla/layout/xul/base/src/grid/nsGridRowLeafLayout.h @@ -59,9 +59,9 @@ public: friend nsresult NS_NewGridRowLeafLayout(nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout); - NS_IMETHOD GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); - NS_IMETHOD GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); - NS_IMETHOD GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); + virtual nsSize GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual nsSize GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual nsSize GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); virtual void ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState); NS_IMETHOD Layout(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); virtual void CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount); diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.cpp b/mozilla/layout/xul/base/src/nsBoxFrame.cpp index 4ae8fdf4f11..42981d20d5f 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsBoxFrame.cpp @@ -813,7 +813,7 @@ nsBoxFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState) if (!nsIBox::AddCSSPrefSize(aBoxLayoutState, this, size)) { if (mLayoutManager) { - mLayoutManager->GetPrefSize(this, aBoxLayoutState, size); + size = mLayoutManager->GetPrefSize(this, aBoxLayoutState); nsIBox::AddCSSPrefSize(aBoxLayoutState, this, size); } else size = nsBox::GetPrefSize(aBoxLayoutState); @@ -840,7 +840,7 @@ nsBoxFrame::GetBoxAscent(nsBoxLayoutState& aBoxLayoutState) return 0; if (mLayoutManager) - mLayoutManager->GetAscent(this, aBoxLayoutState, mAscent); + mAscent = mLayoutManager->GetAscent(this, aBoxLayoutState); else mAscent = nsBox::GetBoxAscent(aBoxLayoutState); @@ -871,7 +871,7 @@ nsBoxFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState) if (!nsIBox::AddCSSMinSize(aBoxLayoutState, this, size)) { if (mLayoutManager) { - mLayoutManager->GetMinSize(this, aBoxLayoutState, size); + size = mLayoutManager->GetMinSize(this, aBoxLayoutState); nsIBox::AddCSSMinSize(aBoxLayoutState, this, size); } else { size = nsBox::GetMinSize(aBoxLayoutState); @@ -907,7 +907,7 @@ nsBoxFrame::GetMaxSize(nsBoxLayoutState& aBoxLayoutState) if (!nsIBox::AddCSSMaxSize(aBoxLayoutState, this, size)) { if (mLayoutManager) { - mLayoutManager->GetMaxSize(this, aBoxLayoutState, size); + size = mLayoutManager->GetMaxSize(this, aBoxLayoutState); nsIBox::AddCSSMaxSize(aBoxLayoutState, this, size); } else { size = nsBox::GetMaxSize(aBoxLayoutState); diff --git a/mozilla/layout/xul/base/src/nsBoxLayout.cpp b/mozilla/layout/xul/base/src/nsBoxLayout.cpp index 1a75ab1ad9a..f242b0d171b 100644 --- a/mozilla/layout/xul/base/src/nsBoxLayout.cpp +++ b/mozilla/layout/xul/base/src/nsBoxLayout.cpp @@ -87,58 +87,38 @@ nsBoxLayout::AddMargin(nsSize& aSize, const nsMargin& aMargin) nsBox::AddMargin(aSize, aMargin); } -NS_IMETHODIMP -nsBoxLayout::GetFlex(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aFlex) +nsSize +nsBoxLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState) { - aFlex = aBox->GetFlex(aState); - return NS_OK; + nsSize pref (0, 0); + AddBorderAndPadding(aBox, pref); + + return pref; +} + +nsSize +nsBoxLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState) +{ + nsSize minSize (0,0); + AddBorderAndPadding(aBox, minSize); + return minSize; +} + +nsSize +nsBoxLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState) +{ + //AddBorderAndPadding () never changes maxSize (NS_INTRINSICSIZE) + //AddBorderAndPadding(aBox, maxSize); + return nsSize (NS_INTRINSICSIZE,NS_INTRINSICSIZE); } -NS_IMETHODIMP -nsBoxLayout::IsCollapsed(nsIBox* aBox, nsBoxLayoutState& aState, PRBool& aCollapsed) +nscoord +nsBoxLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState) { - aCollapsed = aBox->IsCollapsed(aState); - return NS_OK; + return 0; } -NS_IMETHODIMP -nsBoxLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize) -{ - aSize.width = 0; - aSize.height = 0; - AddBorderAndPadding(aBox, aSize); - - return NS_OK; -} - -NS_IMETHODIMP -nsBoxLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize) -{ - aSize.width = 0; - aSize.height = 0; - AddBorderAndPadding(aBox, aSize); - return NS_OK; -} - -NS_IMETHODIMP -nsBoxLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize) -{ - aSize.width = NS_INTRINSICSIZE; - aSize.height = NS_INTRINSICSIZE; - AddBorderAndPadding(aBox, aSize); - return NS_OK; -} - - -NS_IMETHODIMP -nsBoxLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent) -{ - aAscent = 0; - return NS_OK; -} - - NS_IMETHODIMP nsBoxLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState) { @@ -165,34 +145,29 @@ nsBoxLayout::AddSmallestSize(nsSize& aSize, const nsSize& aSize2) aSize.height = aSize2.height; } -NS_IMETHODIMP +void nsBoxLayout::ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aPrevBox, nsIBox* aChildList) { - return NS_OK; } -NS_IMETHODIMP +void nsBoxLayout::ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList) { - return NS_OK; } -NS_IMETHODIMP +void nsBoxLayout::ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList) { - return NS_OK; } -NS_IMETHODIMP +void nsBoxLayout::ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList) { - return NS_OK; } -NS_IMETHODIMP +void nsBoxLayout::IntrinsicWidthsDirty(nsIBox* aBox, nsBoxLayoutState& aState) { - return NS_OK; } // nsISupports diff --git a/mozilla/layout/xul/base/src/nsBoxLayout.h b/mozilla/layout/xul/base/src/nsBoxLayout.h index 750092fc922..9e88f3f34c4 100644 --- a/mozilla/layout/xul/base/src/nsBoxLayout.h +++ b/mozilla/layout/xul/base/src/nsBoxLayout.h @@ -51,17 +51,15 @@ public: NS_IMETHOD Layout(nsIBox* aBox, nsBoxLayoutState& aState); - NS_IMETHOD GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); - NS_IMETHOD GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); - NS_IMETHOD GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); - NS_IMETHOD GetFlex(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex); - NS_IMETHOD GetAscent(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent); - NS_IMETHOD IsCollapsed(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed); - NS_IMETHOD ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aPrevBox, nsIBox* aChildList); - NS_IMETHOD ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList); - NS_IMETHOD ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList); - NS_IMETHOD ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList); - NS_IMETHOD IntrinsicWidthsDirty(nsIBox* aBox, nsBoxLayoutState& aState); + virtual nsSize GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual nsSize GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual nsSize GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual nscoord GetAscent(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual void ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aPrevBox, nsIBox* aChildList); + virtual void ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList); + virtual void ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList); + virtual void ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList); + virtual void IntrinsicWidthsDirty(nsIBox* aBox, nsBoxLayoutState& aState); virtual void GetParentLayout(nsIBox* aBox, nsIBoxLayout** aParent); virtual void AddBorderAndPadding(nsIBox* aBox, nsSize& aSize); diff --git a/mozilla/layout/xul/base/src/nsIBoxLayout.h b/mozilla/layout/xul/base/src/nsIBoxLayout.h index 33841b2e604..54ecc0ec81d 100644 --- a/mozilla/layout/xul/base/src/nsIBoxLayout.h +++ b/mozilla/layout/xul/base/src/nsIBoxLayout.h @@ -47,10 +47,10 @@ class nsBoxLayoutState; class nsIRenderingContext; struct nsRect; -// d0f7955e-7cae-4213-9e08-ad1d512f396f +// c9bf9fe7-a2f4-4f38-bbed-11a05633d676 #define NS_IBOX_LAYOUT_IID \ -{ 0xd0f7955e, 0x7cae, 0x4213, \ - { 0x9e, 0x08, 0xad, 0x1d, 0x51, 0x2f, 0x39, 0x6f } } +{ 0xc9bf9fe7, 0xa2f4, 0x4f38, \ + {0xbb, 0xed 0x11, 0xa0, 0x56, 0x33, 0xd6, 0x76} } class nsIBoxLayout : public nsISupports { @@ -60,18 +60,16 @@ public: NS_IMETHOD Layout(nsIBox* aBox, nsBoxLayoutState& aState)=0; - NS_IMETHOD GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)=0; - NS_IMETHOD GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)=0; - NS_IMETHOD GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)=0; - NS_IMETHOD GetFlex(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex)=0; - NS_IMETHOD GetAscent(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent)=0; - NS_IMETHOD IsCollapsed(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed)=0; + virtual nsSize GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState)=0; + virtual nsSize GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState)=0; + virtual nsSize GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState)=0; + virtual nscoord GetAscent(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState)=0; - NS_IMETHOD ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aPrevBox, nsIBox* aChildList)=0; - NS_IMETHOD ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList)=0; - NS_IMETHOD ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList)=0; - NS_IMETHOD ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList)=0; - NS_IMETHOD IntrinsicWidthsDirty(nsIBox* aBox, nsBoxLayoutState& aState)=0; + virtual void ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aPrevBox, nsIBox* aChildList)=0; + virtual void ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList)=0; + virtual void ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList)=0; + virtual void ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList)=0; + virtual void IntrinsicWidthsDirty(nsIBox* aBox, nsBoxLayoutState& aState)=0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIBoxLayout, NS_IBOX_LAYOUT_IID) diff --git a/mozilla/layout/xul/base/src/nsListBoxLayout.cpp b/mozilla/layout/xul/base/src/nsListBoxLayout.cpp index 08ad0e756d8..6f62cb6e868 100644 --- a/mozilla/layout/xul/base/src/nsListBoxLayout.cpp +++ b/mozilla/layout/xul/base/src/nsListBoxLayout.cpp @@ -56,76 +56,76 @@ nsListBoxLayout::nsListBoxLayout(nsIPresShell* aPresShell) ////////// nsIBoxLayout ////////////// -NS_IMETHODIMP -nsListBoxLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize) +nsSize +nsListBoxLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState) { - nsresult rv = nsGridRowGroupLayout::GetPrefSize(aBox, aBoxLayoutState, aSize); + nsSize pref = nsGridRowGroupLayout::GetPrefSize(aBox, aBoxLayoutState); nsListBoxBodyFrame* frame = static_cast(aBox); if (frame) { nscoord rowheight = frame->GetRowHeightAppUnits(); - aSize.height = frame->GetRowCount() * rowheight; + pref.height = frame->GetRowCount() * rowheight; // Pad the height. nscoord y = frame->GetAvailableHeight(); - if (aSize.height > y && y > 0 && rowheight > 0) { - nscoord m = (aSize.height-y)%rowheight; + if (pref.height > y && y > 0 && rowheight > 0) { + nscoord m = (pref.height-y)%rowheight; nscoord remainder = m == 0 ? 0 : rowheight - m; - aSize.height += remainder; + pref.height += remainder; } if (nsContentUtils::HasNonEmptyAttr(frame->GetContent(), kNameSpaceID_None, nsGkAtoms::sizemode)) { nscoord width = frame->ComputeIntrinsicWidth(aBoxLayoutState); - if (width > aSize.width) - aSize.width = width; + if (width > pref.width) + pref.width = width; } } - return rv; + return pref; } -NS_IMETHODIMP -nsListBoxLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize) +nsSize +nsListBoxLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState) { - nsresult rv = nsGridRowGroupLayout::GetMinSize(aBox, aBoxLayoutState, aSize); + nsSize minSize = nsGridRowGroupLayout::GetMinSize(aBox, aBoxLayoutState); nsListBoxBodyFrame* frame = static_cast(aBox); if (frame) { nscoord rowheight = frame->GetRowHeightAppUnits(); - aSize.height = frame->GetRowCount() * rowheight; + minSize.height = frame->GetRowCount() * rowheight; // Pad the height. nscoord y = frame->GetAvailableHeight(); - if (aSize.height > y && y > 0 && rowheight > 0) { - nscoord m = (aSize.height-y)%rowheight; + if (minSize.height > y && y > 0 && rowheight > 0) { + nscoord m = (minSize.height-y)%rowheight; nscoord remainder = m == 0 ? 0 : rowheight - m; - aSize.height += remainder; + minSize.height += remainder; } if (nsContentUtils::HasNonEmptyAttr(frame->GetContent(), kNameSpaceID_None, nsGkAtoms::sizemode)) { nscoord width = frame->ComputeIntrinsicWidth(aBoxLayoutState); - if (width > aSize.width) - aSize.width = width; + if (width > minSize.width) + minSize.width = width; } } - return rv; + return minSize; } -NS_IMETHODIMP -nsListBoxLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize) +nsSize +nsListBoxLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState) { - nsresult rv = nsGridRowGroupLayout::GetMaxSize(aBox, aBoxLayoutState, aSize); + nsSize maxSize = nsGridRowGroupLayout::GetMaxSize(aBox, aBoxLayoutState); nsListBoxBodyFrame* frame = static_cast(aBox); if (frame) { nscoord rowheight = frame->GetRowHeightAppUnits(); - aSize.height = frame->GetRowCount() * rowheight; + maxSize.height = frame->GetRowCount() * rowheight; // Pad the height. nscoord y = frame->GetAvailableHeight(); - if (aSize.height > y && y > 0 && rowheight > 0) { - nscoord m = (aSize.height-y)%rowheight; + if (maxSize.height > y && y > 0 && rowheight > 0) { + nscoord m = (maxSize.height-y)%rowheight; nscoord remainder = m == 0 ? 0 : rowheight - m; - aSize.height += remainder; + maxSize.height += remainder; } } - return rv; + return maxSize; } NS_IMETHODIMP diff --git a/mozilla/layout/xul/base/src/nsListBoxLayout.h b/mozilla/layout/xul/base/src/nsListBoxLayout.h index 10717f44743..4b2c16cff5f 100644 --- a/mozilla/layout/xul/base/src/nsListBoxLayout.h +++ b/mozilla/layout/xul/base/src/nsListBoxLayout.h @@ -52,9 +52,9 @@ public: // nsIBoxLayout NS_IMETHOD Layout(nsIBox* aBox, nsBoxLayoutState& aState); - NS_IMETHOD GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); - NS_IMETHOD GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); - NS_IMETHOD GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); + virtual nsSize GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual nsSize GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual nsSize GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); protected: NS_IMETHOD LayoutInternal(nsIBox* aBox, nsBoxLayoutState& aState); diff --git a/mozilla/layout/xul/base/src/nsSprocketLayout.cpp b/mozilla/layout/xul/base/src/nsSprocketLayout.cpp index 5184821e5fc..638783feb46 100644 --- a/mozilla/layout/xul/base/src/nsSprocketLayout.cpp +++ b/mozilla/layout/xul/base/src/nsSprocketLayout.cpp @@ -1311,16 +1311,14 @@ nsSprocketLayout::ComputeChildSizes(nsIBox* aBox, } -NS_IMETHODIMP -nsSprocketLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) +nsSize +nsSprocketLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState) { + nsSize vpref (0, 0); PRBool isHorizontal = IsHorizontal(aBox); nscoord biggestPref = 0; - aSize.width = 0; - aSize.height = 0; - // run through all the children and get their min, max, and preferred sizes // return us the size of the box @@ -1349,7 +1347,7 @@ nsSprocketLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aS } } - AddLargestSize(aSize, pref, isHorizontal); + AddLargestSize(vpref, pref, isHorizontal); count++; } @@ -1358,26 +1356,25 @@ nsSprocketLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aS if (isEqual) { if (isHorizontal) - aSize.width = biggestPref*count; + vpref.width = biggestPref*count; else - aSize.height = biggestPref*count; + vpref.height = biggestPref*count; } // now add our border and padding - AddBorderAndPadding(aBox, aSize); + AddBorderAndPadding(aBox, vpref); - return NS_OK; + return vpref; } -NS_IMETHODIMP -nsSprocketLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) +nsSize +nsSprocketLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState) { + nsSize minSize (0, 0); PRBool isHorizontal = IsHorizontal(aBox); nscoord biggestMin = 0; - aSize.width = 0; - aSize.height = 0; // run through all the children and get their min, max, and preferred sizes // return us the size of the box @@ -1418,7 +1415,7 @@ nsSprocketLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi } AddMargin(child, min); - AddLargestSize(aSize, min, isHorizontal); + AddLargestSize(minSize, min, isHorizontal); count++; } @@ -1428,27 +1425,25 @@ nsSprocketLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi if (isEqual) { if (isHorizontal) - aSize.width = biggestMin*count; + minSize.width = biggestMin*count; else - aSize.height = biggestMin*count; + minSize.height = biggestMin*count; } // now add our border and padding - AddBorderAndPadding(aBox, aSize); + AddBorderAndPadding(aBox, minSize); - return NS_OK; + return minSize; } -NS_IMETHODIMP -nsSprocketLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) +nsSize +nsSprocketLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState) { PRBool isHorizontal = IsHorizontal(aBox); nscoord smallestMax = NS_INTRINSICSIZE; - - aSize.width = NS_INTRINSICSIZE; - aSize.height = NS_INTRINSICSIZE; + nsSize maxSize (NS_INTRINSICSIZE, NS_INTRINSICSIZE); // run through all the children and get their min, max, and preferred sizes // return us the size of the box @@ -1469,7 +1464,7 @@ nsSprocketLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi nsSize max = nsBox::BoundsCheckMinMax(min, child->GetMaxSize(aState)); AddMargin(child, max); - AddSmallestSize(aSize, max, isHorizontal); + AddSmallestSize(maxSize, max, isHorizontal); if (isEqual) { if (isHorizontal) @@ -1490,31 +1485,30 @@ nsSprocketLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi if (isEqual) { if (isHorizontal) { if (smallestMax != NS_INTRINSICSIZE) - aSize.width = smallestMax*count; + maxSize.width = smallestMax*count; else - aSize.width = NS_INTRINSICSIZE; + maxSize.width = NS_INTRINSICSIZE; } else { if (smallestMax != NS_INTRINSICSIZE) - aSize.height = smallestMax*count; + maxSize.height = smallestMax*count; else - aSize.height = NS_INTRINSICSIZE; + maxSize.height = NS_INTRINSICSIZE; } } // now add our border and padding - AddBorderAndPadding(aBox, aSize); + AddBorderAndPadding(aBox, maxSize); - return NS_OK; + return maxSize; } -NS_IMETHODIMP -nsSprocketLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aAscent) +nscoord +nsSprocketLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aState) { + nscoord vAscent = 0; - PRBool isHorizontal = IsHorizontal(aBox); - - aAscent = 0; + PRBool isHorizontal = IsHorizontal(aBox); // run through all the children and get their min, max, and preferred sizes // return us the size of the box @@ -1535,33 +1529,18 @@ nsSprocketLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aAs if (isHorizontal) { - if (ascent > aAscent) - aAscent = ascent; + if (ascent > vAscent) + vAscent = ascent; } else { - if (aAscent == 0) - aAscent = ascent; + if (vAscent == 0) + vAscent = ascent; } //} child = child->GetNextBox(); } - return NS_OK; -} - -NS_IMETHODIMP -nsSprocketLayout::GetFlex(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aFlex) -{ - aFlex = aBox->GetFlex(aState); - return NS_OK; -} - - -NS_IMETHODIMP -nsSprocketLayout::IsCollapsed(nsIBox* aBox, nsBoxLayoutState& aState, PRBool& aIsCollapsed) -{ - aIsCollapsed = aBox->IsCollapsed(aState); - return NS_OK; + return vAscent; } void diff --git a/mozilla/layout/xul/base/src/nsSprocketLayout.h b/mozilla/layout/xul/base/src/nsSprocketLayout.h index 9662b2bd1a5..04aa4e81595 100644 --- a/mozilla/layout/xul/base/src/nsSprocketLayout.h +++ b/mozilla/layout/xul/base/src/nsSprocketLayout.h @@ -113,12 +113,10 @@ public: NS_IMETHOD Layout(nsIBox* aBox, nsBoxLayoutState& aState); - NS_IMETHOD GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); - NS_IMETHOD GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); - NS_IMETHOD GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); - NS_IMETHOD GetFlex(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex); - NS_IMETHOD GetAscent(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent); - NS_IMETHOD IsCollapsed(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed); + virtual nsSize GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual nsSize GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual nsSize GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual nscoord GetAscent(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); nsSprocketLayout(); diff --git a/mozilla/layout/xul/base/src/nsStackLayout.cpp b/mozilla/layout/xul/base/src/nsStackLayout.cpp index c992440362c..e90a229f144 100644 --- a/mozilla/layout/xul/base/src/nsStackLayout.cpp +++ b/mozilla/layout/xul/base/src/nsStackLayout.cpp @@ -76,11 +76,10 @@ nsStackLayout::nsStackLayout() { } -NS_IMETHODIMP -nsStackLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) +nsSize +nsStackLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState) { - aSize.width = 0; - aSize.height = 0; + nsSize rpref (0, 0); // we are as wide as the widest child plus its left offset // we are tall as the tallest child plus its top offset @@ -91,23 +90,22 @@ nsStackLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize AddMargin(child, pref); AddOffset(aState, child, pref); - AddLargestSize(aSize, pref); + AddLargestSize(rpref, pref); child = child->GetNextBox(); } // now add our border and padding - AddBorderAndPadding(aBox, aSize); + AddBorderAndPadding(aBox, rpref); - return NS_OK; + return rpref; } -NS_IMETHODIMP -nsStackLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) +nsSize +nsStackLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState) { - aSize.width = 0; - aSize.height = 0; - + nsSize minSize (0, 0); + // run through all the children and get their min, max, and preferred sizes nsIBox* child = aBox->GetChildBox(); @@ -115,22 +113,21 @@ nsStackLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) nsSize min = child->GetMinSize(aState); AddMargin(child, min); AddOffset(aState, child, min); - AddLargestSize(aSize, min); + AddLargestSize(minSize, min); child = child->GetNextBox(); } // now add our border and padding - AddBorderAndPadding(aBox, aSize); + AddBorderAndPadding(aBox, minSize); - return NS_OK; + return minSize; } -NS_IMETHODIMP -nsStackLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) +nsSize +nsStackLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState) { - aSize.width = NS_INTRINSICSIZE; - aSize.height = NS_INTRINSICSIZE; + nsSize maxSize (NS_INTRINSICSIZE, NS_INTRINSICSIZE); // run through all the children and get their min, max, and preferred sizes @@ -141,22 +138,22 @@ nsStackLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize) AddMargin(child, max); AddOffset(aState, child, max); - AddSmallestSize(aSize, max); + AddSmallestSize(maxSize, max); child = child->GetNextBox(); } // now add our border and padding - AddBorderAndPadding(aBox, aSize); + AddBorderAndPadding(aBox, maxSize); - return NS_OK; + return maxSize; } -NS_IMETHODIMP -nsStackLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aAscent) +nscoord +nsStackLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aState) { - aAscent = 0; + nscoord vAscent = 0; nsIBox* child = aBox->GetChildBox(); while (child) { @@ -164,13 +161,13 @@ nsStackLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aAscen nsMargin margin; child->GetMargin(margin); ascent += margin.top + margin.bottom; - if (ascent > aAscent) - aAscent = ascent; + if (ascent > vAscent) + vAscent = ascent; child = child->GetNextBox(); } - return NS_OK; + return vAscent; } PRBool diff --git a/mozilla/layout/xul/base/src/nsStackLayout.h b/mozilla/layout/xul/base/src/nsStackLayout.h index 3396abd63b2..6d88aafe54d 100644 --- a/mozilla/layout/xul/base/src/nsStackLayout.h +++ b/mozilla/layout/xul/base/src/nsStackLayout.h @@ -63,10 +63,10 @@ public: NS_IMETHOD Layout(nsIBox* aBox, nsBoxLayoutState& aState); - NS_IMETHOD GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); - NS_IMETHOD GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); - NS_IMETHOD GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); - NS_IMETHOD GetAscent(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent); + virtual nsSize GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual nsSize GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual nsSize GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); + virtual nscoord GetAscent(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); static PRBool AddOffset(nsBoxLayoutState& aState, nsIBox* aChild, nsSize& aSize); private: