diff --git a/mozilla/layout/base/nsDisplayList.cpp b/mozilla/layout/base/nsDisplayList.cpp index 4bdbe99a432..ff4bc6c6e44 100644 --- a/mozilla/layout/base/nsDisplayList.cpp +++ b/mozilla/layout/base/nsDisplayList.cpp @@ -346,9 +346,7 @@ nsIFrame* nsDisplayList::HitTest(nsDisplayListBuilder* aBuilder, nsPoint aPt) co nsIFrame* f = item->HitTest(aBuilder, aPt); // Handle the XUL 'mousethrough' feature. if (f) { - PRBool mouseThrough = PR_FALSE; - f->GetMouseThrough(mouseThrough); - if (!mouseThrough) + if (!f->GetMouseThrough()) return f; } } diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp index 4d4277fd74c..74182521be2 100644 --- a/mozilla/layout/forms/nsTextControlFrame.cpp +++ b/mozilla/layout/forms/nsTextControlFrame.cpp @@ -1821,28 +1821,25 @@ nsTextControlFrame::GetMaxSize(nsBoxLayoutState& aState) return nsBox::GetMaxSize(aState); } -NS_IMETHODIMP -nsTextControlFrame::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent) +nscoord +nsTextControlFrame::GetBoxAscent(nsBoxLayoutState& aState) { // First calculate the ascent of the text inside - nsresult rv = nsStackFrame::GetAscent(aState, aAscent); - NS_ENSURE_SUCCESS(rv, rv); + nscoord ascent = nsStackFrame::GetBoxAscent(aState); // Now adjust the ascent for our borders and padding nsMargin borderPadding; GetBorderAndPadding(borderPadding); - aAscent += borderPadding.top; + ascent += borderPadding.top; - return NS_OK; + return ascent; } -NS_IMETHODIMP -nsTextControlFrame::IsCollapsed(nsBoxLayoutState& aBoxLayoutState, - PRBool& aCollapsed) +PRBool +nsTextControlFrame::IsCollapsed(nsBoxLayoutState& aBoxLayoutState) { // We're never collapsed in the box sense. - aCollapsed = PR_FALSE; - return NS_OK; + return PR_FALSE; } PRBool diff --git a/mozilla/layout/forms/nsTextControlFrame.h b/mozilla/layout/forms/nsTextControlFrame.h index 3e19c525430..c2adf0cb7e4 100644 --- a/mozilla/layout/forms/nsTextControlFrame.h +++ b/mozilla/layout/forms/nsTextControlFrame.h @@ -89,9 +89,8 @@ public: virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState); virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState); virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState); - NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent); - NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, - PRBool& aCollapsed); + virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState); + virtual PRBool IsCollapsed(nsBoxLayoutState& aBoxLayoutState); DECL_DO_GLOBAL_REFLOW_COUNT_DSP(nsTextControlFrame, nsStackFrame) diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index 7e2249e9e3f..dc4ef994c28 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -146,9 +146,7 @@ struct nsBoxLayoutMetrics nscoord mAscent; nsSize mLastSize; - nsSize mOverflow; - PRPackedBool mIncludeOverflow; PRPackedBool mWasCollapsed; }; @@ -5772,20 +5770,6 @@ void nsFrame::FillCursorInformationFromStyle(const nsStyleUserInterface* ui, } } -NS_IMETHODIMP -nsFrame::GetOverflow(nsSize& aOverflow) -{ - aOverflow = BoxMetrics()->mOverflow; - return NS_OK; -} - -NS_IMETHODIMP -nsFrame::SetIncludeOverflow(PRBool aInclude) -{ - BoxMetrics()->mIncludeOverflow = aInclude; - return NS_OK; -} - NS_IMETHODIMP nsFrame::RefreshSizeCache(nsBoxLayoutState& aState) { @@ -5900,9 +5884,7 @@ nsFrame::GetPrefSize(nsBoxLayoutState& aState) return size; } - PRBool isCollapsed = PR_FALSE; - IsCollapsed(aState, isCollapsed); - if (isCollapsed) + if (IsCollapsed(aState)) return size; // get our size in CSS. @@ -5936,9 +5918,7 @@ nsFrame::GetMinSize(nsBoxLayoutState& aState) return size; } - PRBool isCollapsed = PR_FALSE; - IsCollapsed(aState, isCollapsed); - if (isCollapsed) + if (IsCollapsed(aState)) return size; // get our size in CSS. @@ -5968,9 +5948,7 @@ nsFrame::GetMaxSize(nsBoxLayoutState& aState) return size; } - PRBool isCollapsed = PR_FALSE; - IsCollapsed(aState, isCollapsed); - if (isCollapsed) + if (IsCollapsed(aState)) return size; size = nsBox::GetMaxSize(aState); @@ -5979,35 +5957,26 @@ nsFrame::GetMaxSize(nsBoxLayoutState& aState) return size; } -NS_IMETHODIMP -nsFrame::GetFlex(nsBoxLayoutState& aState, nscoord& aFlex) +nscoord +nsFrame::GetFlex(nsBoxLayoutState& aState) { nsBoxLayoutMetrics *metrics = BoxMetrics(); - if (!DoesNeedRecalc(metrics->mFlex)) { - aFlex = metrics->mFlex; - return NS_OK; - } + if (!DoesNeedRecalc(metrics->mFlex)) + return metrics->mFlex; - metrics->mFlex = 0; - nsBox::GetFlex(aState, metrics->mFlex); + metrics->mFlex = nsBox::GetFlex(aState); - aFlex = metrics->mFlex; - - return NS_OK; + return metrics->mFlex; } -NS_IMETHODIMP -nsFrame::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent) +nscoord +nsFrame::GetBoxAscent(nsBoxLayoutState& aState) { nsBoxLayoutMetrics *metrics = BoxMetrics(); - if (!DoesNeedRecalc(metrics->mAscent)) { - aAscent = metrics->mAscent; - return NS_OK; - } + if (!DoesNeedRecalc(metrics->mAscent)) + return metrics->mAscent; - PRBool isCollapsed = PR_FALSE; - IsCollapsed(aState, isCollapsed); - if (isCollapsed) { + if (IsCollapsed(aState)) { metrics->mAscent = 0; } else { // Refresh our caches with new sizes. @@ -6018,9 +5987,7 @@ nsFrame::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent) metrics->mAscent += m.top; } - aAscent = metrics->mAscent; - - return NS_OK; + return metrics->mAscent; } nsresult @@ -6038,9 +6005,7 @@ nsFrame::DoLayout(nsBoxLayoutState& aState) rv = BoxReflow(aState, presContext, desiredSize, rendContext, ourRect.x, ourRect.y, ourRect.width, ourRect.height); - PRBool collapsed = PR_FALSE; - IsCollapsed(aState, collapsed); - if (collapsed) { + if (IsCollapsed(aState)) { SetSize(nsSize(0, 0)); } else { @@ -6242,48 +6207,40 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState, // see if the overflow option is set. If it is then if our child's bounds overflow then // we will set the child's rect to include the overflow size. - if (GetStateBits() & NS_FRAME_OUTSIDE_CHILDREN) { - // make sure we store the overflow size + if (GetStateBits() & NS_FRAME_OUTSIDE_CHILDREN) { + // make sure we store the overflow size + + // This kinda sucks. We should be able to handle the case + // where there's overflow above or to the left of the + // origin. But for now just chop that stuff off. - // This kinda sucks. We should be able to handle the case - // where there's overflow above or to the left of the - // origin. But for now just chop that stuff off. - metrics->mOverflow.width = aDesiredSize.mOverflowArea.XMost(); - metrics->mOverflow.height = aDesiredSize.mOverflowArea.YMost(); + //printf("OutsideChildren width=%d, height=%d\n", aDesiredSize.mOverflowArea.width, aDesiredSize.mOverflowArea.height); + aDesiredSize.width = aDesiredSize.mOverflowArea.XMost(); + if (aDesiredSize.width <= aWidth) + aDesiredSize.height = aDesiredSize.mOverflowArea.YMost(); + else { + if (aDesiredSize.width > aWidth) + { + nscoord computedWidth = aDesiredSize.width - + reflowState.mComputedBorderPadding.LeftRight(); + computedWidth = PR_MAX(computedWidth, 0); + reflowState.SetComputedWidth(computedWidth); + reflowState.availableWidth = aDesiredSize.width; + DidReflow(aPresContext, &reflowState, NS_FRAME_REFLOW_FINISHED); + #ifdef DEBUG_REFLOW + nsAdaptorAddIndents(); + nsAdaptorPrintReason(reflowState); + printf("\n"); + #endif + AddStateBits(NS_FRAME_IS_DIRTY); + WillReflow(aPresContext); + Reflow(aPresContext, aDesiredSize, reflowState, status); + if (GetStateBits() & NS_FRAME_OUTSIDE_CHILDREN) + aDesiredSize.height = aDesiredSize.mOverflowArea.YMost(); - // include the overflow size in our child's rect? - if (metrics->mIncludeOverflow) { - //printf("OutsideChildren width=%d, height=%d\n", aDesiredSize.mOverflowArea.width, aDesiredSize.mOverflowArea.height); - aDesiredSize.width = aDesiredSize.mOverflowArea.XMost(); - if (aDesiredSize.width <= aWidth) - aDesiredSize.height = aDesiredSize.mOverflowArea.YMost(); - else { - if (aDesiredSize.width > aWidth) - { - nscoord computedWidth = aDesiredSize.width - - reflowState.mComputedBorderPadding.LeftRight(); - computedWidth = PR_MAX(computedWidth, 0); - reflowState.SetComputedWidth(computedWidth); - reflowState.availableWidth = aDesiredSize.width; - DidReflow(aPresContext, &reflowState, NS_FRAME_REFLOW_FINISHED); - #ifdef DEBUG_REFLOW - nsAdaptorAddIndents(); - nsAdaptorPrintReason(reflowState); - printf("\n"); - #endif - AddStateBits(NS_FRAME_IS_DIRTY); - WillReflow(aPresContext); - Reflow(aPresContext, aDesiredSize, reflowState, status); - if (GetStateBits() & NS_FRAME_OUTSIDE_CHILDREN) - aDesiredSize.height = aDesiredSize.mOverflowArea.YMost(); - - } - } - } - } else { - metrics->mOverflow.width = aDesiredSize.width; - metrics->mOverflow.height = aDesiredSize.height; - } + } + } + } if (redrawAfterReflow) { nsRect r = GetRect(); @@ -6302,9 +6259,7 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState, aDesiredSize, aX, aY, layoutFlags | NS_FRAME_NO_MOVE_FRAME); // Save the ascent. (bug 103925) - PRBool isCollapsed = PR_FALSE; - IsCollapsed(aState, isCollapsed); - if (isCollapsed) { + if (IsCollapsed(aState)) { metrics->mAscent = 0; } else { if (aDesiredSize.ascent == nsHTMLReflowMetrics::ASK_FOR_BASELINE) { @@ -6381,9 +6336,7 @@ nsFrame::SetParent(const nsIFrame* aParent) DeleteProperty(nsGkAtoms::boxMetricsProperty); if (aParent && aParent->IsBoxFrame()) { - PRBool needsWidget = PR_FALSE; - aParent->ChildrenMustHaveWidgets(needsWidget); - if (needsWidget) { + if (aParent->ChildrenMustHaveWidgets()) { nsHTMLContainerFrame::CreateViewForFrame(this, nsnull, PR_TRUE); nsIView* view = GetView(); if (!view->HasWidget()) @@ -6415,8 +6368,6 @@ nsFrame::InitBoxMetrics(PRBool aClear) nsFrame::MarkIntrinsicWidthsDirty(); metrics->mBlockAscent = 0; metrics->mLastSize.SizeTo(0, 0); - metrics->mOverflow.SizeTo(0, 0); - metrics->mIncludeOverflow = PR_TRUE; metrics->mWasCollapsed = PR_FALSE; } diff --git a/mozilla/layout/generic/nsFrame.h b/mozilla/layout/generic/nsFrame.h index 7a7ab624181..286c135635c 100644 --- a/mozilla/layout/generic/nsFrame.h +++ b/mozilla/layout/generic/nsFrame.h @@ -363,10 +363,8 @@ public: virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState); virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState); virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState); - NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex); - NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent); - NS_IMETHOD SetIncludeOverflow(PRBool aInclude); - NS_IMETHOD GetOverflow(nsSize& aOverflow); + virtual nscoord GetFlex(nsBoxLayoutState& aBoxLayoutState); + virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState); //-------------------------------------------------- // Additional methods diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp index 73f0d615a01..b5cf3fcd0ac 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.cpp +++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp @@ -1041,23 +1041,22 @@ nsXULScrollFrame::GetType() const return nsGkAtoms::scrollFrame; } -NS_IMETHODIMP -nsXULScrollFrame::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent) +nscoord +nsXULScrollFrame::GetBoxAscent(nsBoxLayoutState& aState) { - aAscent = 0; if (!mInner.mScrolledFrame) - return NS_OK; + return 0; - nsresult rv = mInner.mScrolledFrame->GetAscent(aState, aAscent); + nscoord ascent = mInner.mScrolledFrame->GetBoxAscent(aState); nsMargin m(0,0,0,0); GetBorderAndPadding(m); - aAscent += m.top; + ascent += m.top; GetMargin(m); - aAscent += m.top; + ascent += m.top; GetInset(m); - aAscent += m.top; + ascent += m.top; - return rv; + return ascent; } nsSize diff --git a/mozilla/layout/generic/nsGfxScrollFrame.h b/mozilla/layout/generic/nsGfxScrollFrame.h index 47c8dfa3e84..565e5a6e34d 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.h +++ b/mozilla/layout/generic/nsGfxScrollFrame.h @@ -478,7 +478,7 @@ public: virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState); virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState); virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState); - NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent); + virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState); NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState); NS_IMETHOD GetPadding(nsMargin& aPadding); diff --git a/mozilla/layout/generic/nsIFrame.h b/mozilla/layout/generic/nsIFrame.h index 46d0cab0fa3..018d92200cf 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 -// f02b2868-ac80-4e38-978c-02df6477d294 +// 4ea7876f-1550-40d4-a764-739a0e4289a1 #define NS_IFRAME_IID \ -{ 0xf02b2868, 0xac80, 0x4e38, \ - { 0x97, 0x8c, 0x02, 0xdf, 0x64, 0x77, 0xd2, 0x94 } } +{ 0x4ea7876f, 0x1550, 0x40d4, \ + { 0xa7, 0x64, 0x73, 0x9a, 0x0e, 0x42, 0x89, 0xa1 } } /** * Indication of how the frame can be split. This is used when doing runaround @@ -1845,18 +1845,18 @@ NS_PTR_TO_INT32(frame->GetProperty(nsGkAtoms::embeddingLevel)) */ virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState) = 0; - NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex)=0; - NS_HIDDEN_(nsresult) - GetOrdinal(nsBoxLayoutState& aBoxLayoutState, PRUint32& aOrdinal); - /** * This returns the minimum size for the scroll area if this frame is * being scrolled. Usually it's (0,0). */ virtual nsSize GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState) = 0; - NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent)=0; - NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed)=0; + // Implemented in nsBox, used in nsBoxFrame + PRUint32 GetOrdinal(nsBoxLayoutState& aBoxLayoutState); + + virtual nscoord GetFlex(nsBoxLayoutState& aBoxLayoutState) = 0; + virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState) = 0; + virtual PRBool IsCollapsed(nsBoxLayoutState& aBoxLayoutState) = 0; // This does not alter the overflow area. If the caller is changing // the box size, the caller is responsible for updating the overflow // area. It's enough to just call Layout or SyncLayout on the @@ -1891,24 +1891,16 @@ NS_PTR_TO_INT32(frame->GetProperty(nsGkAtoms::embeddingLevel)) NS_IMETHOD GetMargin(nsMargin& aMargin)=0; NS_IMETHOD SetLayoutManager(nsIBoxLayout* aLayout)=0; NS_IMETHOD GetLayoutManager(nsIBoxLayout** aLayout)=0; - NS_HIDDEN_(nsresult) GetContentRect(nsRect& aContentRect); NS_HIDDEN_(nsresult) GetClientRect(nsRect& aContentRect); NS_IMETHOD GetVAlign(Valignment& aAlign) = 0; NS_IMETHOD GetHAlign(Halignment& aAlign) = 0; PRBool IsHorizontal() const { return (mState & NS_STATE_IS_HORIZONTAL) != 0; } - nsresult GetOrientation(PRBool& aIsHorizontal) /// XXX to be removed - { aIsHorizontal = IsHorizontal(); return NS_OK; } - PRBool IsNormalDirection() const { return (mState & NS_STATE_IS_DIRECTION_NORMAL) != 0; } - nsresult GetDirection(PRBool& aIsNormal) /// XXX to be removed - { aIsNormal = IsNormalDirection(); return NS_OK; } NS_HIDDEN_(nsresult) Redraw(nsBoxLayoutState& aState, const nsRect* aRect = nsnull, PRBool aImmediate = PR_FALSE); NS_IMETHOD RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild)=0; - NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough)=0; - NS_IMETHOD SetIncludeOverflow(PRBool aInclude) = 0; - NS_IMETHOD GetOverflow(nsSize& aOverflow) = 0; + virtual PRBool GetMouseThrough() const = 0; #ifdef DEBUG_LAYOUT NS_IMETHOD SetDebug(nsBoxLayoutState& aState, PRBool aDebug)=0; @@ -1916,8 +1908,9 @@ NS_PTR_TO_INT32(frame->GetProperty(nsGkAtoms::embeddingLevel)) NS_IMETHOD DumpBox(FILE* out)=0; #endif - NS_IMETHOD ChildrenMustHaveWidgets(PRBool& aMust) const=0; - NS_IMETHOD GetIndexOf(nsIBox* aChild, PRInt32* aIndex)=0; + + // Only nsDeckFrame requires that all its children have widgets + virtual PRBool ChildrenMustHaveWidgets() const { return PR_FALSE; } /** * @return PR_TRUE if this text frame ends with a newline character. It diff --git a/mozilla/layout/xul/base/src/grid/nsGrid.cpp b/mozilla/layout/xul/base/src/grid/nsGrid.cpp index 0a4369cb50f..1a434a69035 100644 --- a/mozilla/layout/xul/base/src/grid/nsGrid.cpp +++ b/mozilla/layout/xul/base/src/grid/nsGrid.cpp @@ -749,12 +749,8 @@ nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, n // borders padding and insets into account if (box && !row->mIsBogus) { - PRBool isCollapsed = PR_FALSE; - box->IsCollapsed(aState, isCollapsed); - - if (!isCollapsed) - { - + if (!box->IsCollapsed(aState)) + { box->GetInset(inset); // get real border and padding. GetBorderAndPadding @@ -823,9 +819,7 @@ nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, n if (box) { // ignore collapsed children - box->IsCollapsed(aState, isCollapsed); - - if (!isCollapsed) + if (!box->IsCollapsed(aState)) { // include the margin of the columns. To the row // at this point border/padding and margins all added @@ -1222,8 +1216,7 @@ nsGrid::GetRowFlex(nsBoxLayoutState& aState, PRInt32 aIndex, PRBool aIsHorizonta // not flexible. if (parentsParent) { if (!IsGrid(parentsParent)) { - nscoord flex = 0; - parent->GetFlex(aState, flex); + nscoord flex = parent->GetFlex(aState); nsIBox::AddCSSFlex(aState, parent, flex); if (flex == 0) { row->mFlex = 0; @@ -1237,9 +1230,8 @@ nsGrid::GetRowFlex(nsBoxLayoutState& aState, PRInt32 aIndex, PRBool aIsHorizonta } // get the row flex. - box->GetFlex(aState, row->mFlex); + row->mFlex = box->GetFlex(aState); nsIBox::AddCSSFlex(aState, box, row->mFlex); - } return row->mFlex; diff --git a/mozilla/layout/xul/base/src/grid/nsGridCell.cpp b/mozilla/layout/xul/base/src/grid/nsGridCell.cpp index d5e2bd41e72..9cca284b421 100644 --- a/mozilla/layout/xul/base/src/grid/nsGridCell.cpp +++ b/mozilla/layout/xul/base/src/grid/nsGridCell.cpp @@ -152,15 +152,8 @@ nsGridCell::GetMaxSize(nsBoxLayoutState& aState) PRBool nsGridCell::IsCollapsed(nsBoxLayoutState& aState) { - PRBool c1 = PR_FALSE, c2 = PR_FALSE; - - if (mBoxInColumn) - mBoxInColumn->IsCollapsed(aState, c1); - - if (mBoxInRow) - mBoxInRow->IsCollapsed(aState, c2); - - return (c1 || c2); + return ((mBoxInColumn && mBoxInColumn->IsCollapsed(aState)) || + (mBoxInRow && mBoxInRow->IsCollapsed(aState))); } diff --git a/mozilla/layout/xul/base/src/grid/nsGridRow.cpp b/mozilla/layout/xul/base/src/grid/nsGridRow.cpp index 7f49a28e427..202d331fe85 100644 --- a/mozilla/layout/xul/base/src/grid/nsGridRow.cpp +++ b/mozilla/layout/xul/base/src/grid/nsGridRow.cpp @@ -100,11 +100,6 @@ nsGridRow::MarkDirty(nsBoxLayoutState& aState) PRBool nsGridRow::IsCollapsed(nsBoxLayoutState& aState) { - PRBool isCollapsed = PR_FALSE; - - if (mBox) - mBox->IsCollapsed(aState,isCollapsed); - - return isCollapsed; + return mBox && mBox->IsCollapsed(aState); } diff --git a/mozilla/layout/xul/base/src/grid/nsGridRowGroupFrame.cpp b/mozilla/layout/xul/base/src/grid/nsGridRowGroupFrame.cpp index 0743f872cd6..408adf24992 100644 --- a/mozilla/layout/xul/base/src/grid/nsGridRowGroupFrame.cpp +++ b/mozilla/layout/xul/base/src/grid/nsGridRowGroupFrame.cpp @@ -64,23 +64,18 @@ NS_NewGridRowGroupFrame (nsIPresShell* aPresShell, * This is redefined because row groups have a funny property. If they are flexible * then their flex must be equal to the sum of their children's flexes. */ -NS_IMETHODIMP -nsGridRowGroupFrame::GetFlex(nsBoxLayoutState& aState, nscoord& aFlex) +nscoord +nsGridRowGroupFrame::GetFlex(nsBoxLayoutState& aState) { // if we are flexible out flexibility is determined by our columns. // so first get the our flex. If not 0 then our flex is the sum of // our columns flexes. - if (!DoesNeedRecalc(mFlex)) { - aFlex = mFlex; - return NS_OK; - } + if (!DoesNeedRecalc(mFlex)) + return mFlex; - nsBoxFrame::GetFlex(aState, aFlex); - - - if (aFlex == 0) - return NS_OK; + if (nsBoxFrame::GetFlex(aState) == 0) + return 0; // ok we are flexible add up our children nscoord totalFlex = 0; @@ -88,16 +83,13 @@ nsGridRowGroupFrame::GetFlex(nsBoxLayoutState& aState, nscoord& aFlex) GetChildBox(&child); while (child) { - PRInt32 flex = 0; - child->GetFlex(aState, flex); - totalFlex += flex;; + totalFlex += child->GetFlex(aState); child->GetNextBox(&child); } - aFlex = totalFlex; - mFlex = aFlex; + mFlex = totalFlex; - return NS_OK; + return totalFlex; } diff --git a/mozilla/layout/xul/base/src/grid/nsGridRowGroupFrame.h b/mozilla/layout/xul/base/src/grid/nsGridRowGroupFrame.h index d1b2c1d1659..ec432f16e05 100644 --- a/mozilla/layout/xul/base/src/grid/nsGridRowGroupFrame.h +++ b/mozilla/layout/xul/base/src/grid/nsGridRowGroupFrame.h @@ -75,7 +75,7 @@ public: nsIBoxLayout* aLayoutManager): nsBoxFrame(aPresShell, aContext, aIsRoot, aLayoutManager) {} - NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex); + virtual nscoord GetFlex(nsBoxLayoutState& aBoxLayoutState); }; // class nsGridRowGroupFrame diff --git a/mozilla/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp b/mozilla/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp index df8eaa766b1..86cd423de62 100644 --- a/mozilla/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp +++ b/mozilla/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp @@ -176,7 +176,7 @@ nsGridRowLeafLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, ns nscoord bottomMargin = column->mBottomMargin; if (box) - box->IsCollapsed(aState, collapsed); + collapsed = box->IsCollapsed(aState); pref = pref - (left + right); if (pref < 0) @@ -264,9 +264,6 @@ nsGridRowLeafLayout::ComputeChildSizes(nsIBox* aBox, if (aBox) { // go up the parent chain looking for scrollframes - PRBool isHorizontal = PR_FALSE; - aBox->GetOrientation(isHorizontal); - nsIBox* scrollbox = nsnull; aBox->GetParentBox(&aBox); scrollbox = nsGrid::GetScrollBox(aBox); @@ -283,7 +280,7 @@ nsGridRowLeafLayout::ComputeChildSizes(nsIBox* aBox, ourRect.Deflate(padding); nscoord diff; - if (isHorizontal) { + if (aBox->IsHorizontal()) { diff = scrollbarSizes.left + scrollbarSizes.right; } else { diff = scrollbarSizes.top + scrollbarSizes.bottom; diff --git a/mozilla/layout/xul/base/src/nsBox.cpp b/mozilla/layout/xul/base/src/nsBox.cpp index 2841a0e0c31..ad1aa786bd8 100644 --- a/mozilla/layout/xul/base/src/nsBox.cpp +++ b/mozilla/layout/xul/base/src/nsBox.cpp @@ -151,16 +151,6 @@ nsBox::PropagateDebug(nsBoxLayoutState& aState) } #endif -/** - * Hack for deck who requires that all its children has widgets - */ -NS_IMETHODIMP -nsBox::ChildrenMustHaveWidgets(PRBool& aMust) const -{ - aMust = PR_FALSE; - return NS_OK; -} - #ifdef DEBUG_LAYOUT void nsBox::GetBoxName(nsAutoString& aName) @@ -280,7 +270,8 @@ nsBox::GetHAlign(Halignment& aAlign) nsresult nsIFrame::GetClientRect(nsRect& aClientRect) { - GetContentRect(aClientRect); + aClientRect = mRect; + aClientRect.MoveTo(0,0); nsMargin borderPadding; GetBorderAndPadding(borderPadding); @@ -302,16 +293,6 @@ nsIFrame::GetClientRect(nsRect& aClientRect) return NS_OK; } -nsresult -nsIFrame::GetContentRect(nsRect& aContentRect) -{ - aContentRect = mRect; - aContentRect.x = 0; - aContentRect.y = 0; - NS_BOX_ASSERTION(this, aContentRect.width >=0 && aContentRect.height >= 0, "Content Size < 0"); - return NS_OK; -} - NS_IMETHODIMP nsBox::SetBounds(nsBoxLayoutState& aState, const nsRect& aRect, PRBool aRemoveOverflowArea) { @@ -523,9 +504,7 @@ nsBox::GetPrefSize(nsBoxLayoutState& aState) nsSize pref(0,0); DISPLAY_PREF_SIZE(this, pref); - PRBool collapsed = PR_FALSE; - IsCollapsed(aState, collapsed); - if (collapsed) + if (IsCollapsed(aState)) return pref; AddBorderAndPadding(pref); @@ -545,9 +524,7 @@ nsBox::GetMinSize(nsBoxLayoutState& aState) nsSize min(0,0); DISPLAY_MIN_SIZE(this, min); - PRBool collapsed = PR_FALSE; - IsCollapsed(aState, collapsed); - if (collapsed) + if (IsCollapsed(aState)) return min; AddBorderAndPadding(min); @@ -568,9 +545,7 @@ nsBox::GetMaxSize(nsBoxLayoutState& aState) nsSize max(NS_INTRINSICSIZE, NS_INTRINSICSIZE); DISPLAY_MAX_SIZE(this, max); - PRBool collapsed = PR_FALSE; - IsCollapsed(aState, collapsed); - if (collapsed) + if (IsCollapsed(aState)) return max; AddBorderAndPadding(max); @@ -579,46 +554,42 @@ nsBox::GetMaxSize(nsBoxLayoutState& aState) return max; } -NS_IMETHODIMP -nsBox::GetFlex(nsBoxLayoutState& aState, nscoord& aFlex) +nscoord +nsBox::GetFlex(nsBoxLayoutState& aState) { - aFlex = 0; + nscoord flex = 0; - GetDefaultFlex(aFlex); - nsIBox::AddCSSFlex(aState, this, aFlex); + GetDefaultFlex(flex); + nsIBox::AddCSSFlex(aState, this, flex); - return NS_OK; + return flex; } -nsresult -nsIFrame::GetOrdinal(nsBoxLayoutState& aState, PRUint32& aOrdinal) +PRUint32 +nsIFrame::GetOrdinal(nsBoxLayoutState& aState) { - aOrdinal = DEFAULT_ORDINAL_GROUP; - nsIBox::AddCSSOrdinal(aState, this, aOrdinal); + PRUint32 ordinal = DEFAULT_ORDINAL_GROUP; + nsIBox::AddCSSOrdinal(aState, this, ordinal); - return NS_OK; + return ordinal; } -NS_IMETHODIMP -nsBox::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent) +nscoord +nsBox::GetBoxAscent(nsBoxLayoutState& aState) +{ + if (IsCollapsed(aState)) + return 0; + + return GetPrefSize(aState).height; +} + +PRBool +nsBox::IsCollapsed(nsBoxLayoutState& aState) { - aAscent = 0; PRBool collapsed = PR_FALSE; - IsCollapsed(aState, collapsed); - if (collapsed) - return NS_OK; + nsIBox::AddCSSCollapsed(aState, this, collapsed); - aAscent = GetPrefSize(aState).height; - return NS_OK; -} - -NS_IMETHODIMP -nsBox::IsCollapsed(nsBoxLayoutState& aState, PRBool& aCollapsed) -{ - aCollapsed = PR_FALSE; - nsIBox::AddCSSCollapsed(aState, this, aCollapsed); - - return NS_OK; + return collapsed; } nsresult @@ -1168,14 +1139,13 @@ nsBox::GetInset(nsMargin& margin) #endif -NS_IMETHODIMP -nsBox::GetMouseThrough(PRBool& aMouseThrough) +PRBool +nsBox::GetMouseThrough() const { if (mParent && mParent->IsBoxFrame()) - return mParent->GetMouseThrough(aMouseThrough); + return mParent->GetMouseThrough(); - aMouseThrough = PR_FALSE; - return NS_OK; + return PR_FALSE; } PRBool @@ -1184,11 +1154,3 @@ nsBox::GetDefaultFlex(PRInt32& aFlex) aFlex = 0; return PR_TRUE; } - -NS_IMETHODIMP -nsBox::GetIndexOf(nsIBox* aChild, PRInt32* aIndex) -{ - // return -1. We have no children - *aIndex = -1; - return NS_OK; -} diff --git a/mozilla/layout/xul/base/src/nsBox.h b/mozilla/layout/xul/base/src/nsBox.h index 7d184934bfb..d8a4be5e381 100644 --- a/mozilla/layout/xul/base/src/nsBox.h +++ b/mozilla/layout/xul/base/src/nsBox.h @@ -60,12 +60,12 @@ public: virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState); virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState); virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState); - NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex); - NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent); + virtual nscoord GetFlex(nsBoxLayoutState& aBoxLayoutState); + virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState); virtual nsSize GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState); - NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed); + virtual PRBool IsCollapsed(nsBoxLayoutState& aBoxLayoutState); NS_IMETHOD SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect, PRBool aRemoveOverflowArea = PR_FALSE); @@ -83,7 +83,7 @@ public: NS_IMETHOD RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild); - NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough); + virtual PRBool GetMouseThrough() const; #ifdef DEBUG_LAYOUT NS_IMETHOD GetInset(nsMargin& aInset); @@ -94,8 +94,6 @@ public: NS_IMETHOD DumpBox(FILE* out); NS_HIDDEN_(void) PropagateDebug(nsBoxLayoutState& aState); #endif - NS_IMETHOD ChildrenMustHaveWidgets(PRBool& aMust) const; - NS_IMETHOD GetIndexOf(nsIBox* aChild, PRInt32* aIndex); nsBox(); virtual ~nsBox(); diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.cpp b/mozilla/layout/xul/base/src/nsBoxFrame.cpp index f978947b8be..b90da765916 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsBoxFrame.cpp @@ -220,9 +220,7 @@ nsBoxFrame::Init(nsIContent* aContent, // see if we need a widget if (aParent && aParent->IsBoxFrame()) { - PRBool needsWidget = PR_FALSE; - aParent->ChildrenMustHaveWidgets(needsWidget); - if (needsWidget) { + if (aParent->ChildrenMustHaveWidgets()) { nsHTMLContainerFrame::CreateViewForFrame(this, nsnull, PR_TRUE); nsIView* view = GetView(); @@ -263,29 +261,21 @@ void nsBoxFrame::UpdateMouseThrough() } } -NS_IMETHODIMP -nsBoxFrame::GetMouseThrough(PRBool& aMouseThrough) +PRBool +nsBoxFrame::GetMouseThrough() const { switch(mMouseThrough) { case always: - aMouseThrough = PR_TRUE; - return NS_OK; + return PR_TRUE; case never: - aMouseThrough = PR_FALSE; - return NS_OK; + return PR_FALSE; case unset: - { if (mParent && mParent->IsBoxFrame()) - return mParent->GetMouseThrough(aMouseThrough); - else { - aMouseThrough = PR_FALSE; - return NS_OK; - } - } + return mParent->GetMouseThrough(); } - return NS_ERROR_FAILURE; + return PR_FALSE; } void @@ -793,7 +783,7 @@ nsBoxFrame::Reflow(nsPresContext* aPresContext, // getting the ascent could be a lot of work. Don't get it if // we are the root. The viewport doesn't care about it. if (!(mState & NS_STATE_IS_ROOT)) { - GetAscent(state, ascent); + ascent = GetBoxAscent(state); } aDesiredSize.width = mRect.width; @@ -840,9 +830,7 @@ nsBoxFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState) PropagateDebug(aBoxLayoutState); #endif - PRBool collapsed = PR_FALSE; - IsCollapsed(aBoxLayoutState, collapsed); - if (collapsed) + if (IsCollapsed(aBoxLayoutState)) return size; // if the size was not completely redefined in CSS then ask our children @@ -863,34 +851,25 @@ nsBoxFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState) return size; } -NS_IMETHODIMP -nsBoxFrame::GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent) +nscoord +nsBoxFrame::GetBoxAscent(nsBoxLayoutState& aBoxLayoutState) { - if (!DoesNeedRecalc(mAscent)) { - aAscent = mAscent; - return NS_OK; - } + if (!DoesNeedRecalc(mAscent)) + return mAscent; #ifdef DEBUG_LAYOUT PropagateDebug(aBoxLayoutState); #endif - nsresult rv = NS_OK; - aAscent = 0; - - PRBool collapsed = PR_FALSE; - IsCollapsed(aBoxLayoutState, collapsed); - if (collapsed) - return NS_OK; + if (IsCollapsed(aBoxLayoutState)) + return 0; if (mLayoutManager) - rv = mLayoutManager->GetAscent(this, aBoxLayoutState, aAscent); + mLayoutManager->GetAscent(this, aBoxLayoutState, mAscent); else - rv = nsBox::GetAscent(aBoxLayoutState, aAscent); + mAscent = nsBox::GetBoxAscent(aBoxLayoutState); - mAscent = aAscent; - - return rv; + return mAscent; } nsSize @@ -907,9 +886,7 @@ nsBoxFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState) PropagateDebug(aBoxLayoutState); #endif - PRBool collapsed = PR_FALSE; - IsCollapsed(aBoxLayoutState, collapsed); - if (collapsed) + if (IsCollapsed(aBoxLayoutState)) return size; // if the size was not completely redefined in CSS then ask our children @@ -942,9 +919,7 @@ nsBoxFrame::GetMaxSize(nsBoxLayoutState& aBoxLayoutState) PropagateDebug(aBoxLayoutState); #endif - PRBool collapsed = PR_FALSE; - IsCollapsed(aBoxLayoutState, collapsed); - if (collapsed) + if (IsCollapsed(aBoxLayoutState)) return size; // if the size was not completely redefined in CSS then ask our children @@ -963,21 +938,15 @@ nsBoxFrame::GetMaxSize(nsBoxLayoutState& aBoxLayoutState) return size; } -NS_IMETHODIMP -nsBoxFrame::GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex) +nscoord +nsBoxFrame::GetFlex(nsBoxLayoutState& aBoxLayoutState) { - if (!DoesNeedRecalc(mFlex)) { - aFlex = mFlex; - return NS_OK; - } + if (!DoesNeedRecalc(mFlex)) + return mFlex; - nsresult rv = NS_OK; + mFlex = nsBox::GetFlex(aBoxLayoutState); - mFlex = 0; - rv = nsBox::GetFlex(aBoxLayoutState, mFlex); - aFlex = mFlex; - - return rv; + return mFlex; } /** @@ -1394,8 +1363,6 @@ nsBoxFrame::PaintXULDebugBackground(nsIRenderingContext& aRenderingContext, nsPoint aPt) { nsMargin border; - nsRect inner; - GetBorder(border); nsMargin debugBorder; @@ -1413,8 +1380,8 @@ nsBoxFrame::PaintXULDebugBackground(nsIRenderingContext& aRenderingContext, GetDebugPadding(debugPadding); PixelMarginToTwips(GetPresContext(), debugPadding); - GetContentRect(inner); - inner += aPt; + nsRect inner(mRect); + inner.MoveTo(aPt); inner.Deflate(debugMargin); inner.Deflate(border); //nsRect borderRect(inner); @@ -1471,14 +1438,12 @@ nsBoxFrame::PaintXULDebugOverlay(nsIRenderingContext& aRenderingContext, GetDebugMargin(debugMargin); PixelMarginToTwips(GetPresContext(), debugMargin); - nsRect inner; - GetContentRect(inner); - inner += aPt; + nsRect inner(mRect); + inner.MoveTo(aPt); inner.Deflate(debugMargin); inner.Deflate(border); nscoord onePixel = GetPresContext()->IntScaledPixelsToTwips(1); - GetContentRect(r); GetChildBox(&kid); while (nsnull != kid) { @@ -1505,14 +1470,9 @@ nsBoxFrame::PaintXULDebugOverlay(nsIRenderingContext& aRenderingContext, } nsBoxLayoutState state(GetPresContext()); - nscoord flex = 0; - kid->GetFlex(state, flex); + nscoord flex = kid->GetFlex(state); - - PRBool isCollapsed = PR_FALSE; - kid->IsCollapsed(state, isCollapsed); - - if (!isCollapsed) { + if (!kid->IsCollapsed(state)) { aRenderingContext.SetColor(NS_RGB(255,255,255)); if (isHorizontal) @@ -1801,8 +1761,8 @@ nsBoxFrame::DisplayDebugInfoFor(nsIBox* aBox, nscoord y = aPoint.y; // get the area inside our border but not our debug margins. - nsRect insideBorder; - aBox->GetContentRect(insideBorder); + nsRect insideBorder(aBox->mRect); + insideBorder.MoveTo(0,0): nsMargin border(0,0,0,0); aBox->GetBorderAndPadding(border); insideBorder.Deflate(border); @@ -1862,10 +1822,6 @@ nsBoxFrame::DisplayDebugInfoFor(nsIBox* aBox, nsSize maxSizeCSS (NS_INTRINSICSIZE, NS_INTRINSICSIZE); nscoord flexCSS = NS_INTRINSICSIZE; - nscoord flexSize = 0; - nscoord ascentSize = 0; - - nsIBox::AddCSSPrefSize(state, child, prefSizeCSS); nsIBox::AddCSSMinSize (state, child, minSizeCSS); nsIBox::AddCSSMaxSize (state, child, maxSizeCSS); @@ -1874,8 +1830,8 @@ nsBoxFrame::DisplayDebugInfoFor(nsIBox* aBox, nsSize prefSize = child->GetPrefSize(state); nsSize minSize = child->GetMinSize(state); nsSize maxSize = child->GetMaxSize(state); - child->GetFlex(state, flexSize); - child->GetAscent(state, ascentSize); + nscoord flexSize = child->GetFlex(state); + nscoord ascentSize = child->GetBoxAscent(state); char min[100]; char pref[100]; @@ -2159,8 +2115,7 @@ nsBoxFrame::CheckBoxOrder(nsBoxLayoutState& aState) while (child) { ++childCount; - PRUint32 ordinal; - child->GetOrdinal(aState, ordinal); + PRUint32 ordinal = child->GetOrdinal(aState); if (ordinal != DEFAULT_ORDINAL_GROUP) orderBoxes = PR_TRUE; @@ -2185,9 +2140,9 @@ nsBoxFrame::CheckBoxOrder(nsBoxLayoutState& aState) PRUint32 minOrd, jOrd; for(i = 0; i < childCount; i++) { min = i; - boxes[min]->GetOrdinal(aState, minOrd); + minOrd = boxes[min]->GetOrdinal(aState); for(j = i + 1; j < childCount; j++) { - boxes[j]->GetOrdinal(aState, jOrd); + jOrd = boxes[j]->GetOrdinal(aState); if (jOrd < minOrd) { min = j; minOrd = jOrd; @@ -2241,8 +2196,7 @@ nsBoxFrame::LayoutChildAt(nsBoxLayoutState& aState, nsIBox* aBox, const nsRect& NS_IMETHODIMP nsBoxFrame::RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild) { - PRUint32 ord; - aChild->GetOrdinal(aState, ord); + PRUint32 ord = aChild->GetOrdinal(aState); nsIFrame *child = mFrames.FirstChild(); nsIFrame *curPrevSib = nsnull, *newPrevSib = nsnull; @@ -2254,8 +2208,7 @@ nsBoxFrame::RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild) else if (!foundPrevSib) curPrevSib = child; - PRUint32 ordCmp; - child->GetOrdinal(aState, ordCmp); + PRUint32 ordCmp = child->GetOrdinal(aState); if (ord < ordCmp) foundNewPrevSib = PR_TRUE; else if (!foundNewPrevSib && child != aChild) @@ -2293,27 +2246,6 @@ nsBoxFrame::RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild) return NS_OK; } -NS_IMETHODIMP -nsBoxFrame::GetIndexOf(nsIBox* aBox, PRInt32* aIndex) -{ - nsIBox* child = mFrames.FirstChild(); - PRInt32 count = 0; - while (child) - { - if (aBox == child) { - *aIndex = count; - return NS_OK; - } - - child->GetNextBox(&child); - count++; - } - - *aIndex = -1; - - return NS_OK; -} - PRBool nsBoxFrame::GetWasCollapsed(nsBoxLayoutState& aState) { diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.h b/mozilla/layout/xul/base/src/nsBoxFrame.h index 6a49b032b1b..eb8b8e28a08 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.h +++ b/mozilla/layout/xul/base/src/nsBoxFrame.h @@ -98,13 +98,12 @@ public: NS_IMETHOD SetLayoutManager(nsIBoxLayout* aLayout); NS_IMETHOD GetLayoutManager(nsIBoxLayout** aLayout); NS_IMETHOD RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild); - NS_IMETHOD GetIndexOf(nsIBox* aChild, PRInt32* aIndex); virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState); virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState); virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState); - NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex); - NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent); + virtual nscoord GetFlex(nsBoxLayoutState& aBoxLayoutState); + virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState); #ifdef DEBUG_LAYOUT NS_IMETHOD SetDebug(nsBoxLayoutState& aBoxLayoutState, PRBool aDebug); NS_IMETHOD GetDebug(PRBool& aDebug); @@ -115,7 +114,7 @@ public: NS_IMETHOD GetHAlign(Halignment& aAlign); NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState); - NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough); + virtual PRBool GetMouseThrough() const; virtual PRBool ComputesOwnOverflowArea() { return PR_FALSE; } // ----- child and sibling operations --- diff --git a/mozilla/layout/xul/base/src/nsBoxLayout.cpp b/mozilla/layout/xul/base/src/nsBoxLayout.cpp index f9b2cbbeae2..1eed2652e22 100644 --- a/mozilla/layout/xul/base/src/nsBoxLayout.cpp +++ b/mozilla/layout/xul/base/src/nsBoxLayout.cpp @@ -99,14 +99,16 @@ nsBoxLayout::AddInset(nsIBox* aBox, nsSize& aSize) NS_IMETHODIMP nsBoxLayout::GetFlex(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aFlex) { - return aBox->GetFlex(aState, aFlex); + aFlex = aBox->GetFlex(aState); + return NS_OK; } NS_IMETHODIMP nsBoxLayout::IsCollapsed(nsIBox* aBox, nsBoxLayoutState& aState, PRBool& aCollapsed) { - return aBox->IsCollapsed(aState, aCollapsed); + aCollapsed = aBox->IsCollapsed(aState); + return NS_OK; } NS_IMETHODIMP diff --git a/mozilla/layout/xul/base/src/nsButtonBoxFrame.cpp b/mozilla/layout/xul/base/src/nsButtonBoxFrame.cpp index d7266fd3de4..be3dab1baef 100644 --- a/mozilla/layout/xul/base/src/nsButtonBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsButtonBoxFrame.cpp @@ -63,13 +63,6 @@ NS_NewButtonBoxFrame (nsIPresShell* aPresShell, nsStyleContext* aContext) return new (aPresShell) nsButtonBoxFrame(aPresShell, aContext); } // NS_NewXULButtonFrame -NS_IMETHODIMP -nsButtonBoxFrame::GetMouseThrough(PRBool& aMouseThrough) -{ - aMouseThrough = PR_FALSE; - return NS_OK; -} - NS_IMETHODIMP nsButtonBoxFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, diff --git a/mozilla/layout/xul/base/src/nsButtonBoxFrame.h b/mozilla/layout/xul/base/src/nsButtonBoxFrame.h index efc3f798b0a..023db51c590 100644 --- a/mozilla/layout/xul/base/src/nsButtonBoxFrame.h +++ b/mozilla/layout/xul/base/src/nsButtonBoxFrame.h @@ -56,7 +56,7 @@ public: nsGUIEvent* aEvent, nsEventStatus* aEventStatus); - NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough); + virtual PRBool GetMouseThrough() const { return PR_FALSE; } virtual void MouseClicked (nsPresContext* aPresContext, nsGUIEvent* aEvent) { DoMouseClick(aEvent, PR_FALSE); } diff --git a/mozilla/layout/xul/base/src/nsDeckFrame.cpp b/mozilla/layout/xul/base/src/nsDeckFrame.cpp index b428fc6da1a..202cf0bc8c6 100644 --- a/mozilla/layout/xul/base/src/nsDeckFrame.cpp +++ b/mozilla/layout/xul/base/src/nsDeckFrame.cpp @@ -80,16 +80,6 @@ nsDeckFrame::nsDeckFrame(nsIPresShell* aPresShell, SetLayoutManager(layout); } -/** - * Hack for deck who requires that all its children has widgets - */ -NS_IMETHODIMP -nsDeckFrame::ChildrenMustHaveWidgets(PRBool& aMust) const -{ - aMust = PR_TRUE; - return NS_OK; -} - NS_IMETHODIMP nsDeckFrame::AttributeChanged(PRInt32 aNameSpaceID, nsIAtom* aAttribute, diff --git a/mozilla/layout/xul/base/src/nsDeckFrame.h b/mozilla/layout/xul/base/src/nsDeckFrame.h index 1399d254add..8397cb8f718 100644 --- a/mozilla/layout/xul/base/src/nsDeckFrame.h +++ b/mozilla/layout/xul/base/src/nsDeckFrame.h @@ -74,7 +74,7 @@ public: nsIFrame* aParent, nsIFrame* aPrevInFlow); - NS_IMETHOD ChildrenMustHaveWidgets(PRBool& aMust) const; + virtual PRBool ChildrenMustHaveWidgets() const { return PR_TRUE; } #ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const diff --git a/mozilla/layout/xul/base/src/nsLeafBoxFrame.cpp b/mozilla/layout/xul/base/src/nsLeafBoxFrame.cpp index 931f70a9f3a..75838ec30ee 100644 --- a/mozilla/layout/xul/base/src/nsLeafBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsLeafBoxFrame.cpp @@ -100,9 +100,7 @@ nsLeafBoxFrame::Init( // see if we need a widget if (aParent && aParent->IsBoxFrame()) { - PRBool needsWidget = PR_FALSE; - aParent->ChildrenMustHaveWidgets(needsWidget); - if (needsWidget) { + if (aParent->ChildrenMustHaveWidgets()) { nsHTMLContainerFrame::CreateViewForFrame(this, nsnull, PR_TRUE); nsIView* view = GetView(); @@ -146,29 +144,21 @@ void nsLeafBoxFrame::UpdateMouseThrough() } } -NS_IMETHODIMP -nsLeafBoxFrame::GetMouseThrough(PRBool& aMouseThrough) +PRBool +nsLeafBoxFrame::GetMouseThrough() const { switch (mMouseThrough) { case always: - aMouseThrough = PR_TRUE; - return NS_OK; + return PR_TRUE; case never: - aMouseThrough = PR_FALSE; - return NS_OK; + return PR_FALSE; case unset: - { if (mParent && mParent->IsBoxFrame()) - return mParent->GetMouseThrough(aMouseThrough); - else { - aMouseThrough = PR_FALSE; - return NS_OK; - } - } + return mParent->GetMouseThrough(); } - return NS_ERROR_FAILURE; + return PR_FALSE; } NS_IMETHODIMP @@ -344,14 +334,9 @@ nsLeafBoxFrame::Reflow(nsPresContext* aPresContext, Layout(state); // ok our child could have gotten bigger. So lets get its bounds - - // get the ascent - nscoord ascent = mRect.height; - GetAscent(state, ascent); - aDesiredSize.width = mRect.width; aDesiredSize.height = mRect.height; - aDesiredSize.ascent = ascent; + aDesiredSize.ascent = GetBoxAscent(state); // NS_FRAME_OUTSIDE_CHILDREN is set in SetBounds() above if (mState & NS_FRAME_OUTSIDE_CHILDREN) { @@ -432,16 +417,16 @@ nsLeafBoxFrame::GetMaxSize(nsBoxLayoutState& aState) return nsBox::GetMaxSize(aState); } -NS_IMETHODIMP -nsLeafBoxFrame::GetFlex(nsBoxLayoutState& aState, nscoord& aFlex) +/* virtual */ nscoord +nsLeafBoxFrame::GetFlex(nsBoxLayoutState& aState) { - return nsBox::GetFlex(aState, aFlex); + return nsBox::GetFlex(aState); } -NS_IMETHODIMP -nsLeafBoxFrame::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent) +/* virtual */ nscoord +nsLeafBoxFrame::GetBoxAscent(nsBoxLayoutState& aState) { - return nsBox::GetAscent(aState, aAscent); + return nsBox::GetBoxAscent(aState); } /* virtual */ void diff --git a/mozilla/layout/xul/base/src/nsLeafBoxFrame.h b/mozilla/layout/xul/base/src/nsLeafBoxFrame.h index 7b258832500..216b364fcb4 100644 --- a/mozilla/layout/xul/base/src/nsLeafBoxFrame.h +++ b/mozilla/layout/xul/base/src/nsLeafBoxFrame.h @@ -55,8 +55,8 @@ public: virtual nsSize GetPrefSize(nsBoxLayoutState& aState); virtual nsSize GetMinSize(nsBoxLayoutState& aState); virtual nsSize GetMaxSize(nsBoxLayoutState& aState); - NS_IMETHOD GetFlex(nsBoxLayoutState& aState, nscoord& aFlex); - NS_IMETHOD GetAscent(nsBoxLayoutState& aState, nscoord& aAscent); + virtual nscoord GetFlex(nsBoxLayoutState& aState); + virtual nscoord GetBoxAscent(nsBoxLayoutState& aState); virtual PRBool IsFrameOfType(PRUint32 aFlags) const; #ifdef DEBUG @@ -91,7 +91,7 @@ public: nsIAtom* aAttribute, PRInt32 aModType); - NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough); + virtual PRBool GetMouseThrough() const; virtual PRBool ComputesOwnOverflowArea() { return PR_FALSE; } protected: diff --git a/mozilla/layout/xul/base/src/nsMenuFrame.cpp b/mozilla/layout/xul/base/src/nsMenuFrame.cpp index 385c2e1723c..2f780df0e8f 100644 --- a/mozilla/layout/xul/base/src/nsMenuFrame.cpp +++ b/mozilla/layout/xul/base/src/nsMenuFrame.cpp @@ -1031,9 +1031,6 @@ nsMenuFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState) NS_IMETHODIMP nsMenuFrame::DoLayout(nsBoxLayoutState& aState) { - nsRect contentRect; - GetContentRect(contentRect); - // lay us out nsresult rv = nsBoxFrame::DoLayout(aState); @@ -1053,7 +1050,7 @@ nsMenuFrame::DoLayout(nsBoxLayoutState& aState) BoundsCheck(minSize, prefSize, maxSize); if (sizeToPopup) - prefSize.width = contentRect.width; + prefSize.width = mRect.width; // if the pref size changed then set bounds to be the pref size // and sync the view. And set new pref size. @@ -1952,10 +1949,8 @@ public: NS_IMETHOD Run() { nsIFrame* frame = mWeakFrame.GetFrame(); if (frame) { - PRBool collapsed = PR_FALSE; nsBoxLayoutState state(frame->GetPresContext()); - frame->IsCollapsed(state, collapsed); - if (!collapsed) { + if (!frame->IsCollapsed(state)) { nsIMenuFrame* imenu = nsnull; CallQueryInterface(frame, &imenu); if (imenu) { @@ -1976,14 +1971,10 @@ public: PRBool nsMenuFrame::SizeToPopup(nsBoxLayoutState& aState, nsSize& aSize) { - PRBool collapsed = PR_FALSE; - IsCollapsed(aState, collapsed); - if (!collapsed) { + if (!IsCollapsed(aState)) { nsSize tmpSize(-1, 0); nsIBox::AddCSSPrefSize(aState, this, tmpSize); - nscoord flex; - GetFlex(aState, flex); - if (tmpSize.width == -1 && flex == 0) { + if (tmpSize.width == -1 && GetFlex(aState) == 0) { nsIFrame* frame = mPopupFrames.FirstChild(); if (!frame) { nsCOMPtr child; diff --git a/mozilla/layout/xul/base/src/nsScrollBoxObject.cpp b/mozilla/layout/xul/base/src/nsScrollBoxObject.cpp index ec2811b5c61..cfb6781b112 100644 --- a/mozilla/layout/xul/base/src/nsScrollBoxObject.cpp +++ b/mozilla/layout/xul/base/src/nsScrollBoxObject.cpp @@ -163,8 +163,7 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollByIndex(PRInt32 dindexes) // now get the scrolled boxes first child. scrolledBox->GetChildBox(&child); - PRBool horiz = PR_FALSE; - scrolledBox->GetOrientation(horiz); + PRBool horiz = scrolledBox->IsHorizontal(); nsPoint cp; scrollableView->GetScrollPosition(cp.x,cp.y); nscoord diff = 0; @@ -303,8 +302,6 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollToElement(nsIDOMElement *child) // TODO: make sure the child is inside the box // get our current info - PRBool horiz = PR_FALSE; - scrolledBox->GetOrientation(horiz); nsPoint cp; scrollableView->GetScrollPosition(cp.x,cp.y); @@ -315,7 +312,7 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollToElement(nsIDOMElement *child) // we only scroll in the direction of the scrollbox orientation // always scroll to left or top edge of child element - if (horiz) { + if (scrolledBox->IsHorizontal()) { newx = rect.x - crect.x; } else { newy = rect.y - crect.y; @@ -429,9 +426,6 @@ NS_IMETHODIMP nsScrollBoxObject::EnsureElementIsVisible(nsIDOMElement *child) // TODO: make sure the child is inside the box // get our current info - PRBool horiz = PR_FALSE; - scrolledBox->GetOrientation(horiz); - nsPoint cp; scrollableView->GetScrollPosition(cp.x,cp.y); GetOffsetRect(crect); @@ -440,11 +434,10 @@ NS_IMETHODIMP nsScrollBoxObject::EnsureElementIsVisible(nsIDOMElement *child) crect.width = NSToIntRound(crect.width * pixelsToTwips); crect.height = NSToIntRound(crect.height * pixelsToTwips); - nscoord newx=cp.x, newy=cp.y; // we only scroll in the direction of the scrollbox orientation - if (horiz) { + if (scrolledBox->IsHorizontal()) { if ((rect.x - crect.x) + rect.width > cp.x + crect.width) { newx = cp.x + (((rect.x - crect.x) + rect.width)-(cp.x + crect.width)); } else if (rect.x - crect.x < cp.x) { diff --git a/mozilla/layout/xul/base/src/nsSliderFrame.cpp b/mozilla/layout/xul/base/src/nsSliderFrame.cpp index 6cd9608ab29..b18f91e0145 100644 --- a/mozilla/layout/xul/base/src/nsSliderFrame.cpp +++ b/mozilla/layout/xul/base/src/nsSliderFrame.cpp @@ -387,10 +387,7 @@ nsSliderFrame::DoLayout(nsBoxLayoutState& aState) if ((pageIncrement + maxpospx - minpospx) > 0) { // if the thumb is flexible make the thumb bigger. - nscoord flex = 0; - thumbBox->GetFlex(aState, flex); - - if (flex > 0) + if (thumbBox->GetFlex(aState) > 0) { mRatio = float(pageIncrement) / float(maxpospx - minpospx + pageIncrement); nscoord thumbsize = NSToCoordRound(ourmaxpos * mRatio); diff --git a/mozilla/layout/xul/base/src/nsSplitterFrame.cpp b/mozilla/layout/xul/base/src/nsSplitterFrame.cpp index c73a5103fcf..3b3d189d521 100644 --- a/mozilla/layout/xul/base/src/nsSplitterFrame.cpp +++ b/mozilla/layout/xul/base/src/nsSplitterFrame.cpp @@ -344,9 +344,7 @@ nsSplitterFrame::Init(nsIContent* aContent, // |newContext| to Release the reference after the call to nsBoxFrame::Init nsRefPtr newContext; if (aParent && aParent->IsBoxFrame()) { - PRBool isHorizontal; - aParent->GetOrientation(isHorizontal); - if (!isHorizontal) { + if (!aParent->IsHorizontal()) { if (!nsContentUtils::HasNonEmptyAttr(aContent, kNameSpaceID_None, nsGkAtoms::orient)) { aContent->SetAttr(kNameSpaceID_None, nsGkAtoms::orient, @@ -400,9 +398,7 @@ nsSplitterFrame::GetInitialOrientation(PRBool& aIsHorizontal) nsIBox* box; GetParentBox(&box); if (box) { - PRBool horizontal; - box->GetOrientation(horizontal); - aIsHorizontal = !horizontal; + aIsHorizontal = !box->IsHorizontal(); } else nsBoxFrame::GetInitialOrientation(aIsHorizontal); @@ -784,8 +780,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent) mOuter->AddMargin(childBox, prefSize); mOuter->AddMargin(childBox, maxSize); - nscoord flex = 0; - childBox->GetFlex(state, flex); + nscoord flex = childBox->GetFlex(state); nsMargin margin(0,0,0,0); childBox->GetMargin(margin); @@ -825,9 +820,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent) count++; } - PRBool isNormalDirection = PR_TRUE; - mParentBox->GetDirection(isNormalDirection); - if (!isNormalDirection) { + if (!mParentBox->IsNormalDirection()) { // The before array is really the after array, and the order needs to be reversed. // First reverse both arrays. Reverse(mChildInfosBefore, mChildInfosBeforeCount); diff --git a/mozilla/layout/xul/base/src/nsSprocketLayout.cpp b/mozilla/layout/xul/base/src/nsSprocketLayout.cpp index cd828ff6064..8b0ecd9def4 100644 --- a/mozilla/layout/xul/base/src/nsSprocketLayout.cpp +++ b/mozilla/layout/xul/base/src/nsSprocketLayout.cpp @@ -208,9 +208,7 @@ 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. - PRBool collapsed = PR_FALSE; - aBox->IsCollapsed(aState, collapsed); - if (collapsed) { + if (aBox->IsCollapsed(aState)) { nsIBox* child; aBox->GetChildBox(&child); while(child) @@ -224,8 +222,7 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState) aState.PushStackMemory(); // ----- figure out our size ---------- - nsRect contentRect; - aBox->GetContentRect(contentRect); + nsSize originalSize = aBox->GetSize(); // -- make sure we remove our border and padding ---- nsRect clientRect; @@ -249,8 +246,7 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState) nsBoxSize* boxSizes = nsnull; nsComputedBoxSize* computedBoxSizes = nsnull; - nscoord maxAscent = 0; - aBox->GetAscent(aState, maxAscent); + nscoord maxAscent = aBox->GetBoxAscent(aState); nscoord min = 0; nscoord max = 0; @@ -663,14 +659,14 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState) aBox->GetInset(bp); tmpClientRect.Inflate(bp); - if (tmpClientRect.width > contentRect.width || tmpClientRect.height > contentRect.height) + if (tmpClientRect.width > originalSize.width || tmpClientRect.height > originalSize.height) { // if it did reset our bounds. nsRect bounds(aBox->GetRect()); - if (tmpClientRect.width > contentRect.width) + if (tmpClientRect.width > originalSize.width) bounds.width = tmpClientRect.width; - if (tmpClientRect.height > contentRect.height) + if (tmpClientRect.height > originalSize.height) bounds.height = tmpClientRect.height; aBox->SetBounds(aState, bounds); @@ -770,12 +766,10 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox } - child->GetFlex(aState, flex); - PRBool collapsed = PR_FALSE; - child->IsCollapsed(aState, collapsed); + flex = child->GetFlex(aState); currentBox->flex = flex; - currentBox->collapsed = collapsed; + currentBox->collapsed = child->IsCollapsed(aState); } else { flex = start->flex; start = start->next; @@ -803,9 +797,7 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox nsSize min(0,0); nsSize max(NS_INTRINSICSIZE,NS_INTRINSICSIZE); nscoord ascent = 0; - - PRBool collapsed = PR_FALSE; - child->IsCollapsed(aState, collapsed); + PRBool collapsed = child->IsCollapsed(aState); if (!collapsed) { // only one flexible child? Cool we will just make its preferred size @@ -815,7 +807,7 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox pref = child->GetPrefSize(aState); min = child->GetMinSize(aState); max = child->GetMaxSize(aState); - child->GetAscent(aState, ascent); + ascent = child->GetBoxAscent(aState); nsMargin margin; child->GetMargin(margin); ascent += margin.top; @@ -854,8 +846,7 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox prefWidth = pref.height; } - nscoord flex = 0; - child->GetFlex(aState, flex); + nscoord flex = child->GetFlex(aState); // set them if you collapsed you are not flexible. if (collapsed) { @@ -1349,10 +1340,7 @@ nsSprocketLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aS while (child) { // ignore collapsed children - PRBool isCollapsed = PR_FALSE; - child->IsCollapsed(aState, isCollapsed); - - if (!isCollapsed) + if (!child->IsCollapsed(aState)) { nsSize pref = child->GetPrefSize(aState); AddMargin(child, pref); @@ -1412,20 +1400,14 @@ nsSprocketLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi while (child) { // ignore collapsed children - PRBool isCollapsed = PR_FALSE; - aBox->IsCollapsed(aState, isCollapsed); - - if (!isCollapsed) + if (!aBox->IsCollapsed(aState)) { nsSize min = child->GetMinSize(aState); nsSize pref(0,0); - nscoord flex = 0; - - child->GetFlex(aState, flex); // if the child is not flexible then // its min size is its pref size. - if (flex == 0) { + if (child->GetFlex(aState) == 0) { pref = child->GetPrefSize(aState); if (isHorizontal) min.width = pref.width; @@ -1492,10 +1474,7 @@ nsSprocketLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi while (child) { // ignore collapsed children - PRBool isCollapsed = PR_FALSE; - aBox->IsCollapsed(aState, isCollapsed); - - if (!isCollapsed) + if (!aBox->IsCollapsed(aState)) { // if completely redefined don't even ask our child for its size. nsSize max = child->GetMaxSize(aState); @@ -1560,14 +1539,10 @@ nsSprocketLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aAs while (child) { // ignore collapsed children - //PRBool isCollapsed = PR_FALSE; - //aBox->IsCollapsed(aState, isCollapsed); - - //if (!isCollapsed) + //if (!aBox->IsCollapsed(aStatew)) //{ // if completely redefined don't even ask our child for its size. - nscoord ascent = 0; - child->GetAscent(aState, ascent); + nscoord ascent = child->GetBoxAscent(aState); nsMargin margin; child->GetMargin(margin); @@ -1592,14 +1567,16 @@ nsSprocketLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aAs NS_IMETHODIMP nsSprocketLayout::GetFlex(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aFlex) { - return aBox->GetFlex(aState, aFlex); + aFlex = aBox->GetFlex(aState); + return NS_OK; } NS_IMETHODIMP nsSprocketLayout::IsCollapsed(nsIBox* aBox, nsBoxLayoutState& aState, PRBool& aIsCollapsed) { - return aBox->IsCollapsed(aState, aIsCollapsed); + aIsCollapsed = aBox->IsCollapsed(aState); + return NS_OK; } void diff --git a/mozilla/layout/xul/base/src/nsStackLayout.cpp b/mozilla/layout/xul/base/src/nsStackLayout.cpp index 6b4fa126d00..b0d26619fbf 100644 --- a/mozilla/layout/xul/base/src/nsStackLayout.cpp +++ b/mozilla/layout/xul/base/src/nsStackLayout.cpp @@ -170,8 +170,7 @@ nsStackLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aAscen aBox->GetChildBox(&child); while (child) { - nscoord ascent = 0; - child->GetAscent(aState, ascent); + nscoord ascent = child->GetBoxAscent(aState); nsMargin margin; child->GetMargin(margin); ascent += margin.top + margin.bottom; diff --git a/mozilla/layout/xul/base/src/nsTitleBarFrame.cpp b/mozilla/layout/xul/base/src/nsTitleBarFrame.cpp index 703867b5772..8416b3ddd1e 100644 --- a/mozilla/layout/xul/base/src/nsTitleBarFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTitleBarFrame.cpp @@ -82,16 +82,6 @@ nsTitleBarFrame::Init(nsIContent* aContent, return rv; } - - - -NS_IMETHODIMP -nsTitleBarFrame::GetMouseThrough(PRBool& aMouseThrough) -{ - aMouseThrough = PR_FALSE; - return NS_OK; -} - NS_IMETHODIMP nsTitleBarFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, diff --git a/mozilla/layout/xul/base/src/nsTitleBarFrame.h b/mozilla/layout/xul/base/src/nsTitleBarFrame.h index 8bb2e56f809..01156ebd080 100644 --- a/mozilla/layout/xul/base/src/nsTitleBarFrame.h +++ b/mozilla/layout/xul/base/src/nsTitleBarFrame.h @@ -60,7 +60,7 @@ public: nsGUIEvent* aEvent, nsEventStatus* aEventStatus); - NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough); + virtual PRBool GetMouseThrough() const { return PR_FALSE; } virtual void MouseClicked(nsPresContext* aPresContext, nsGUIEvent* aEvent); diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index deb4766849e..28d3ac4e912 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -759,16 +759,13 @@ FindScrollParts(nsIFrame* aCurrFrame, nsTreeBodyFrame::ScrollParts* aResult) nsIScrollbarFrame *sf = nsnull; CallQueryInterface(aCurrFrame, &sf); if (sf) { - PRBool isHorizontal = PR_FALSE; - if (NS_SUCCEEDED(aCurrFrame->GetOrientation(isHorizontal))) { - if (!isHorizontal) { - if (!aResult->mVScrollbar) { - aResult->mVScrollbar = sf; - } - } else { - if (!aResult->mHScrollbar) { - aResult->mHScrollbar = sf; - } + if (!aCurrFrame->IsHorizontal()) { + if (!aResult->mVScrollbar) { + aResult->mVScrollbar = sf; + } + } else { + if (!aResult->mHScrollbar) { + aResult->mHScrollbar = sf; } } // don't bother searching inside a scrollbar