From b4d19704fd4888f4ba43a080bdc4a8879cd83d5d Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Fri, 5 Mar 1999 04:19:09 +0000 Subject: [PATCH] use new nsHTMLReflowState ctors git-svn-id: svn://10.0.0.236/trunk@22833 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/forms/nsComboboxControlFrame.cpp | 1 - mozilla/layout/forms/nsFieldSetFrame.cpp | 12 ++--- mozilla/layout/forms/nsFileControlFrame.cpp | 2 +- mozilla/layout/forms/nsFormControlHelper.cpp | 2 - .../layout/forms/nsHTMLButtonControlFrame.cpp | 6 ++- mozilla/layout/forms/nsLegendFrame.cpp | 2 +- mozilla/layout/forms/nsListControlFrame.cpp | 4 +- mozilla/layout/generic/nsAreaFrame.cpp | 2 +- mozilla/layout/generic/nsFrameFrame.cpp | 2 +- mozilla/layout/generic/nsFrameSetFrame.cpp | 5 +- mozilla/layout/html/base/src/nsAreaFrame.cpp | 2 +- .../layout/html/document/src/nsFrameFrame.cpp | 2 +- .../html/document/src/nsFrameSetFrame.cpp | 5 +- .../html/forms/src/nsComboboxControlFrame.cpp | 1 - .../layout/html/forms/src/nsFieldSetFrame.cpp | 12 ++--- .../html/forms/src/nsFileControlFrame.cpp | 2 +- .../html/forms/src/nsFormControlHelper.cpp | 2 - .../forms/src/nsHTMLButtonControlFrame.cpp | 6 ++- .../layout/html/forms/src/nsLabelFrame.cpp | 2 +- .../layout/html/forms/src/nsLegendFrame.cpp | 2 +- .../html/forms/src/nsListControlFrame.cpp | 4 +- .../html/table/src/nsTableCellFrame.cpp | 2 +- .../html/table/src/nsTableColGroupFrame.cpp | 8 +-- .../layout/html/table/src/nsTableFrame.cpp | 53 +++++++------------ .../html/table/src/nsTableOuterFrame.cpp | 33 ++++++++---- .../layout/html/table/src/nsTableRowFrame.cpp | 49 +++++++++-------- .../html/table/src/nsTableRowGroupFrame.cpp | 16 +++--- mozilla/layout/tables/nsTableCellFrame.cpp | 2 +- .../layout/tables/nsTableColGroupFrame.cpp | 8 +-- mozilla/layout/tables/nsTableFrame.cpp | 53 +++++++------------ mozilla/layout/tables/nsTableOuterFrame.cpp | 33 ++++++++---- mozilla/layout/tables/nsTableRowFrame.cpp | 49 +++++++++-------- .../layout/tables/nsTableRowGroupFrame.cpp | 16 +++--- .../layout/xul/base/src/nsToolboxFrame.cpp | 4 +- 34 files changed, 203 insertions(+), 201 deletions(-) diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index aab2aa97287..fd66aeb3119 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -318,7 +318,6 @@ NS_IMETHODIMP nsComboboxControlFrame::Reflow(nsIPresContext& aPresConte } // nsSize maxSize(aReflowState.availableWidth, aReflowState.availableHeight); - nsHTMLReflowMetrics desiredSize = aDesiredSize; //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// { diff --git a/mozilla/layout/forms/nsFieldSetFrame.cpp b/mozilla/layout/forms/nsFieldSetFrame.cpp index 9d9ad11a8a0..f20243cea7b 100644 --- a/mozilla/layout/forms/nsFieldSetFrame.cpp +++ b/mozilla/layout/forms/nsFieldSetFrame.cpp @@ -321,8 +321,8 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, // Try to reflow the legend into the available space. It might not fit nsSize legendSize(0,0); if (mLegendFrame) { - nsHTMLReflowState legendReflowState(aPresContext, mLegendFrame, - aReflowState, availSize); + nsHTMLReflowState legendReflowState(aPresContext, aReflowState, + mLegendFrame, availSize); // XXX remove when reflow state is fixed FieldSetHack((nsHTMLReflowState&)legendReflowState, "fieldset's legend", PR_FALSE); ReflowChild(mLegendFrame, aPresContext, aDesiredSize, legendReflowState, aStatus); @@ -351,8 +351,8 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, PRBool needAnotherLegendReflow = PR_FALSE; // Try to reflow the area frame into the available space. It might not fit - nsHTMLReflowState contentReflowState(aPresContext, mContentFrame, - aReflowState, availSize); + nsHTMLReflowState contentReflowState(aPresContext, aReflowState, + mContentFrame, availSize); // XXX remove when reflow state is fixed FieldSetHack(contentReflowState, "fieldset's area", PR_FALSE); @@ -378,8 +378,8 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, // need to reflow the legend a 2nd time if (needAnotherLegendReflow && mLegendFrame) { - nsHTMLReflowState legendReflowState(aPresContext, mLegendFrame, - aReflowState, availSize); + nsHTMLReflowState legendReflowState(aPresContext, aReflowState, + mLegendFrame, availSize); // XXX remove when reflow state is fixed FieldSetHack(legendReflowState, "fieldset's legend frame", PR_FALSE); ReflowChild(mLegendFrame, aPresContext, aDesiredSize, legendReflowState, aStatus); diff --git a/mozilla/layout/forms/nsFileControlFrame.cpp b/mozilla/layout/forms/nsFileControlFrame.cpp index 6808f81715e..1b5b96c3428 100644 --- a/mozilla/layout/forms/nsFileControlFrame.cpp +++ b/mozilla/layout/forms/nsFileControlFrame.cpp @@ -255,7 +255,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext& aPresContext, childFrame = mFrames.FirstChild(); nsPoint offset(0,0); while (nsnull != childFrame) { // reflow, place, size the children - nsHTMLReflowState reflowState(aPresContext, childFrame, aReflowState, + nsHTMLReflowState reflowState(aPresContext, aReflowState, childFrame, maxSize); nsIHTMLReflow* htmlReflow; diff --git a/mozilla/layout/forms/nsFormControlHelper.cpp b/mozilla/layout/forms/nsFormControlHelper.cpp index 501a1dbf99c..344b2ba58ee 100644 --- a/mozilla/layout/forms/nsFormControlHelper.cpp +++ b/mozilla/layout/forms/nsFormControlHelper.cpp @@ -186,14 +186,12 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext, nscoord& aRowHeight) { nscoord charWidth = 0; - nscoord charHeight = 0; PRInt32 numRows = ATTR_NOTSET; aWidthExplicit = PR_FALSE; aHeightExplicit = PR_FALSE; aDesiredSize.width = CSS_NOTSET; aDesiredSize.height = CSS_NOTSET; - nsSize textSize(0,0); nsIContent* iContent = nsnull; aFrame->GetFormContent((nsIContent*&) iContent); diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp index 5e58f919c29..ec77ef9baca 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp @@ -335,6 +335,7 @@ nsHTMLButtonControlFrame::MouseClicked(nsIPresContext* aPresContext) } } +#if 0 // XXX temporary hack code until new style rules are added static void ReflowTemp(nsIPresContext& aPresContext, nsHTMLButtonControlFrame* aFrame, nsRect& aRect) @@ -377,6 +378,7 @@ void ReflowTemp(nsIPresContext& aPresContext, nsHTMLButtonControlFrame* aFrame, } #endif } +#endif void nsHTMLButtonControlFrame::SetFocus(PRBool aOn, PRBool aRepaint) @@ -443,7 +445,7 @@ nsHTMLButtonControlFrame::ShiftContents(nsIPresContext& aPresContext, PRBool aDo mStyleContext->RecalcAutomaticData(&aPresContext); - nsRect rect(0, 0, mRect.width, mRect.height); + //nsRect rect(0, 0, mRect.width, mRect.height); //ReflowTemp(aPresContext, this, rect); } @@ -686,7 +688,7 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext, availSize.height = PR_MAX(availSize.height,0); } - nsHTMLReflowState reflowState(aPresContext, firstKid, aReflowState, availSize); + nsHTMLReflowState reflowState(aPresContext, aReflowState, firstKid, availSize); // XXX remove the following when the reflow state is fixed ButtonHack(reflowState, "html4 button's area"); diff --git a/mozilla/layout/forms/nsLegendFrame.cpp b/mozilla/layout/forms/nsLegendFrame.cpp index c48409a9927..79e0ff41177 100644 --- a/mozilla/layout/forms/nsLegendFrame.cpp +++ b/mozilla/layout/forms/nsLegendFrame.cpp @@ -174,7 +174,7 @@ nsLegendFrame::Reflow(nsIPresContext& aPresContext, // reflow the child nsIFrame* firstKid = mFrames.FirstChild(); - nsHTMLReflowState reflowState(aPresContext, firstKid, aReflowState, + nsHTMLReflowState reflowState(aPresContext, aReflowState, firstKid, availSize); //XXX remove when reflow state is fixed LegendHack(reflowState, "legend's area"); diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index 0c0dc2e1991..cb422974359 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -290,7 +290,7 @@ nsListControlFrame::Reflow(nsIPresContext& aPresContext, desiredSize = aDesiredSize; nsIFrame * firstChild = mFrames.FirstChild(); - nsHTMLReflowState reflowState(aPresContext, firstChild, aReflowState, maxSize); + nsHTMLReflowState reflowState(aPresContext, aReflowState, firstChild, maxSize); nsIHTMLReflow* htmlReflow; if (NS_OK == firstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) { htmlReflow->WillReflow(aPresContext); @@ -321,7 +321,7 @@ nsListControlFrame::Reflow(nsIPresContext& aPresContext, mContentFrame->FirstChild(nsnull, &childFrame); nsPoint offset(0,0); while (nsnull != childFrame) { // reflow, place, size the children - nsHTMLReflowState reflowState(aPresContext, childFrame, aReflowState, maxSize); + nsHTMLReflowState reflowState(aPresContext, aReflowState, childFrame, maxSize); nsIHTMLReflow* htmlReflow; if (NS_OK == childFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) { diff --git a/mozilla/layout/generic/nsAreaFrame.cpp b/mozilla/layout/generic/nsAreaFrame.cpp index 785a6b784fd..e5e38745b75 100644 --- a/mozilla/layout/generic/nsAreaFrame.cpp +++ b/mozilla/layout/generic/nsAreaFrame.cpp @@ -614,7 +614,7 @@ nsAreaFrame::ReflowAbsoluteFrame(nsIPresContext& aPresContext, nsSize availSize(aReflowState.computedWidth, NS_UNCONSTRAINEDSIZE); nsHTMLReflowMetrics kidDesiredSize(nsnull); - nsHTMLReflowState kidReflowState(aPresContext, aKidFrame, aReflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, aKidFrame, availSize); // If it's the initial reflow, then override the reflow reason. This is diff --git a/mozilla/layout/generic/nsFrameFrame.cpp b/mozilla/layout/generic/nsFrameFrame.cpp index b1d36d13cd5..f85834df77f 100644 --- a/mozilla/layout/generic/nsFrameFrame.cpp +++ b/mozilla/layout/generic/nsFrameFrame.cpp @@ -338,7 +338,7 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext& aPresContext, // Reflow the child and get its desired size nsHTMLReflowMetrics kidMetrics(aDesiredSize.maxElementSize); - nsHTMLReflowState kidReflowState(aPresContext, firstChild, aReflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, firstChild, innerSize); nsIHTMLReflow* htmlReflow; diff --git a/mozilla/layout/generic/nsFrameSetFrame.cpp b/mozilla/layout/generic/nsFrameSetFrame.cpp index 78319ed8609..b52b061fd33 100644 --- a/mozilla/layout/generic/nsFrameSetFrame.cpp +++ b/mozilla/layout/generic/nsFrameSetFrame.cpp @@ -654,7 +654,7 @@ nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild, } } - nsHTMLReflowState reflowState(aPresContext, aChild, aReflowState, aSize); + nsHTMLReflowState reflowState(aPresContext, aReflowState, aChild, aSize); nsIHTMLReflow* htmlReflow; if (NS_OK == aChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) { @@ -1416,8 +1416,9 @@ nsHTMLFramesetFrame::MouseDrag(nsIPresContext& aPresContext, nsGUIEvent* aEvent) nsIRenderingContext *acx; aPresContext.GetShell(getter_AddRefs(shell)); shell->CreateRenderingContext(this, &acx); + // XXX this can't possibly be right, but oh well... nsHTMLReflowState state(aPresContext, this, eReflowReason_Initial, - size, acx); + acx, size); state.reason = eReflowReason_Incremental; nsReflowStatus status; nsDidReflowStatus didStatus = 0; diff --git a/mozilla/layout/html/base/src/nsAreaFrame.cpp b/mozilla/layout/html/base/src/nsAreaFrame.cpp index 785a6b784fd..e5e38745b75 100644 --- a/mozilla/layout/html/base/src/nsAreaFrame.cpp +++ b/mozilla/layout/html/base/src/nsAreaFrame.cpp @@ -614,7 +614,7 @@ nsAreaFrame::ReflowAbsoluteFrame(nsIPresContext& aPresContext, nsSize availSize(aReflowState.computedWidth, NS_UNCONSTRAINEDSIZE); nsHTMLReflowMetrics kidDesiredSize(nsnull); - nsHTMLReflowState kidReflowState(aPresContext, aKidFrame, aReflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, aKidFrame, availSize); // If it's the initial reflow, then override the reflow reason. This is diff --git a/mozilla/layout/html/document/src/nsFrameFrame.cpp b/mozilla/layout/html/document/src/nsFrameFrame.cpp index b1d36d13cd5..f85834df77f 100644 --- a/mozilla/layout/html/document/src/nsFrameFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameFrame.cpp @@ -338,7 +338,7 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext& aPresContext, // Reflow the child and get its desired size nsHTMLReflowMetrics kidMetrics(aDesiredSize.maxElementSize); - nsHTMLReflowState kidReflowState(aPresContext, firstChild, aReflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, firstChild, innerSize); nsIHTMLReflow* htmlReflow; diff --git a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp index 78319ed8609..b52b061fd33 100644 --- a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp @@ -654,7 +654,7 @@ nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild, } } - nsHTMLReflowState reflowState(aPresContext, aChild, aReflowState, aSize); + nsHTMLReflowState reflowState(aPresContext, aReflowState, aChild, aSize); nsIHTMLReflow* htmlReflow; if (NS_OK == aChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) { @@ -1416,8 +1416,9 @@ nsHTMLFramesetFrame::MouseDrag(nsIPresContext& aPresContext, nsGUIEvent* aEvent) nsIRenderingContext *acx; aPresContext.GetShell(getter_AddRefs(shell)); shell->CreateRenderingContext(this, &acx); + // XXX this can't possibly be right, but oh well... nsHTMLReflowState state(aPresContext, this, eReflowReason_Initial, - size, acx); + acx, size); state.reason = eReflowReason_Incremental; nsReflowStatus status; nsDidReflowStatus didStatus = 0; diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp index aab2aa97287..fd66aeb3119 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -318,7 +318,6 @@ NS_IMETHODIMP nsComboboxControlFrame::Reflow(nsIPresContext& aPresConte } // nsSize maxSize(aReflowState.availableWidth, aReflowState.availableHeight); - nsHTMLReflowMetrics desiredSize = aDesiredSize; //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// { diff --git a/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp b/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp index 9d9ad11a8a0..f20243cea7b 100644 --- a/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp @@ -321,8 +321,8 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, // Try to reflow the legend into the available space. It might not fit nsSize legendSize(0,0); if (mLegendFrame) { - nsHTMLReflowState legendReflowState(aPresContext, mLegendFrame, - aReflowState, availSize); + nsHTMLReflowState legendReflowState(aPresContext, aReflowState, + mLegendFrame, availSize); // XXX remove when reflow state is fixed FieldSetHack((nsHTMLReflowState&)legendReflowState, "fieldset's legend", PR_FALSE); ReflowChild(mLegendFrame, aPresContext, aDesiredSize, legendReflowState, aStatus); @@ -351,8 +351,8 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, PRBool needAnotherLegendReflow = PR_FALSE; // Try to reflow the area frame into the available space. It might not fit - nsHTMLReflowState contentReflowState(aPresContext, mContentFrame, - aReflowState, availSize); + nsHTMLReflowState contentReflowState(aPresContext, aReflowState, + mContentFrame, availSize); // XXX remove when reflow state is fixed FieldSetHack(contentReflowState, "fieldset's area", PR_FALSE); @@ -378,8 +378,8 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, // need to reflow the legend a 2nd time if (needAnotherLegendReflow && mLegendFrame) { - nsHTMLReflowState legendReflowState(aPresContext, mLegendFrame, - aReflowState, availSize); + nsHTMLReflowState legendReflowState(aPresContext, aReflowState, + mLegendFrame, availSize); // XXX remove when reflow state is fixed FieldSetHack(legendReflowState, "fieldset's legend frame", PR_FALSE); ReflowChild(mLegendFrame, aPresContext, aDesiredSize, legendReflowState, aStatus); diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp index 6808f81715e..1b5b96c3428 100644 --- a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp @@ -255,7 +255,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext& aPresContext, childFrame = mFrames.FirstChild(); nsPoint offset(0,0); while (nsnull != childFrame) { // reflow, place, size the children - nsHTMLReflowState reflowState(aPresContext, childFrame, aReflowState, + nsHTMLReflowState reflowState(aPresContext, aReflowState, childFrame, maxSize); nsIHTMLReflow* htmlReflow; diff --git a/mozilla/layout/html/forms/src/nsFormControlHelper.cpp b/mozilla/layout/html/forms/src/nsFormControlHelper.cpp index 501a1dbf99c..344b2ba58ee 100644 --- a/mozilla/layout/html/forms/src/nsFormControlHelper.cpp +++ b/mozilla/layout/html/forms/src/nsFormControlHelper.cpp @@ -186,14 +186,12 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext, nscoord& aRowHeight) { nscoord charWidth = 0; - nscoord charHeight = 0; PRInt32 numRows = ATTR_NOTSET; aWidthExplicit = PR_FALSE; aHeightExplicit = PR_FALSE; aDesiredSize.width = CSS_NOTSET; aDesiredSize.height = CSS_NOTSET; - nsSize textSize(0,0); nsIContent* iContent = nsnull; aFrame->GetFormContent((nsIContent*&) iContent); diff --git a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index 5e58f919c29..ec77ef9baca 100644 --- a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -335,6 +335,7 @@ nsHTMLButtonControlFrame::MouseClicked(nsIPresContext* aPresContext) } } +#if 0 // XXX temporary hack code until new style rules are added static void ReflowTemp(nsIPresContext& aPresContext, nsHTMLButtonControlFrame* aFrame, nsRect& aRect) @@ -377,6 +378,7 @@ void ReflowTemp(nsIPresContext& aPresContext, nsHTMLButtonControlFrame* aFrame, } #endif } +#endif void nsHTMLButtonControlFrame::SetFocus(PRBool aOn, PRBool aRepaint) @@ -443,7 +445,7 @@ nsHTMLButtonControlFrame::ShiftContents(nsIPresContext& aPresContext, PRBool aDo mStyleContext->RecalcAutomaticData(&aPresContext); - nsRect rect(0, 0, mRect.width, mRect.height); + //nsRect rect(0, 0, mRect.width, mRect.height); //ReflowTemp(aPresContext, this, rect); } @@ -686,7 +688,7 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext, availSize.height = PR_MAX(availSize.height,0); } - nsHTMLReflowState reflowState(aPresContext, firstKid, aReflowState, availSize); + nsHTMLReflowState reflowState(aPresContext, aReflowState, firstKid, availSize); // XXX remove the following when the reflow state is fixed ButtonHack(reflowState, "html4 button's area"); diff --git a/mozilla/layout/html/forms/src/nsLabelFrame.cpp b/mozilla/layout/html/forms/src/nsLabelFrame.cpp index 3ed1430bd79..fb844dfb3cd 100644 --- a/mozilla/layout/html/forms/src/nsLabelFrame.cpp +++ b/mozilla/layout/html/forms/src/nsLabelFrame.cpp @@ -472,7 +472,7 @@ nsLabelFrame::Reflow(nsIPresContext& aPresContext, // reflow the child nsIFrame* firstKid = mFrames.FirstChild(); - nsHTMLReflowState reflowState(aPresContext, firstKid, aReflowState, availSize); + nsHTMLReflowState reflowState(aPresContext, aReflowState, firstKid, availSize); // XXX remove when reflow state is fixed LabelHack(reflowState, "label's area"); ReflowChild(firstKid, aPresContext, aDesiredSize, reflowState, aStatus); diff --git a/mozilla/layout/html/forms/src/nsLegendFrame.cpp b/mozilla/layout/html/forms/src/nsLegendFrame.cpp index c48409a9927..79e0ff41177 100644 --- a/mozilla/layout/html/forms/src/nsLegendFrame.cpp +++ b/mozilla/layout/html/forms/src/nsLegendFrame.cpp @@ -174,7 +174,7 @@ nsLegendFrame::Reflow(nsIPresContext& aPresContext, // reflow the child nsIFrame* firstKid = mFrames.FirstChild(); - nsHTMLReflowState reflowState(aPresContext, firstKid, aReflowState, + nsHTMLReflowState reflowState(aPresContext, aReflowState, firstKid, availSize); //XXX remove when reflow state is fixed LegendHack(reflowState, "legend's area"); diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.cpp b/mozilla/layout/html/forms/src/nsListControlFrame.cpp index 0c0dc2e1991..cb422974359 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsListControlFrame.cpp @@ -290,7 +290,7 @@ nsListControlFrame::Reflow(nsIPresContext& aPresContext, desiredSize = aDesiredSize; nsIFrame * firstChild = mFrames.FirstChild(); - nsHTMLReflowState reflowState(aPresContext, firstChild, aReflowState, maxSize); + nsHTMLReflowState reflowState(aPresContext, aReflowState, firstChild, maxSize); nsIHTMLReflow* htmlReflow; if (NS_OK == firstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) { htmlReflow->WillReflow(aPresContext); @@ -321,7 +321,7 @@ nsListControlFrame::Reflow(nsIPresContext& aPresContext, mContentFrame->FirstChild(nsnull, &childFrame); nsPoint offset(0,0); while (nsnull != childFrame) { // reflow, place, size the children - nsHTMLReflowState reflowState(aPresContext, childFrame, aReflowState, maxSize); + nsHTMLReflowState reflowState(aPresContext, aReflowState, childFrame, maxSize); nsIHTMLReflow* htmlReflow; if (NS_OK == childFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) { diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp index ca80076b731..706fd884ca5 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp @@ -475,7 +475,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext, kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0; SetPriorAvailWidth(aReflowState.availableWidth); nsIFrame* firstKid = mFrames.FirstChild(); - nsHTMLReflowState kidReflowState(aPresContext, firstKid, aReflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, firstKid, availSize); ReflowChild(firstKid, aPresContext, kidSize, kidReflowState, aStatus); diff --git a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp index a16c8e80d2f..9a3f05485b9 100644 --- a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp @@ -179,7 +179,7 @@ NS_METHOD nsTableColGroupFrame::Reflow(nsIPresContext& aPresContext, // Give the child frame a chance to reflow, even though we know it'll have 0 size nsHTMLReflowMetrics kidSize(nsnull); // XXX Use a valid reason... - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame, nsSize(0,0), eReflowReason_Initial); nsReflowStatus status; @@ -468,9 +468,9 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsChild(nsIPresContext& aPresC // Pass along the reflow command nsHTMLReflowMetrics desiredSize(nsnull); - nsHTMLReflowState kidReflowState(aPresContext, aNextFrame, - aReflowState, - nsSize(aReflowState.availableWidth, aReflowState.availableHeight)); + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, aNextFrame, + nsSize(aReflowState.availableWidth, + aReflowState.availableHeight)); rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index 9dd82822c70..f9bb336facc 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -49,12 +49,12 @@ #ifdef NS_DEBUG static PRBool gsDebug = PR_FALSE; -static PRBool gsDebugCLD = PR_FALSE; +//static PRBool gsDebugCLD = PR_FALSE; static PRBool gsDebugNT = PR_FALSE; static PRBool gsDebugIR = PR_FALSE; #else static const PRBool gsDebug = PR_FALSE; -static const PRBool gsDebugCLD = PR_FALSE; +//static const PRBool gsDebugCLD = PR_FALSE; static const PRBool gsDebugNT = PR_FALSE; static const PRBool gsDebugIR = PR_FALSE; #endif @@ -279,15 +279,15 @@ nsTableFrame::GetFrameType(nsIAtom** aType) const nsTableFrame::nsTableFrame() : nsHTMLContainerFrame(), - mCellMap(nsnull), - mColCache(nsnull), - mTableLayoutStrategy(nsnull), - mFirstPassValid(PR_FALSE), mColumnWidthsValid(PR_FALSE), + mFirstPassValid(PR_FALSE), mColumnCacheValid(PR_FALSE), mCellMapValid(PR_TRUE), mIsInvariantWidth(PR_FALSE), - mHasScrollableRowGroup(PR_FALSE) + mHasScrollableRowGroup(PR_FALSE), + mCellMap(nsnull), + mColCache(nsnull), + mTableLayoutStrategy(nsnull) { mEffectiveColCount = -1; // -1 means uninitialized mColumnWidthsSet=PR_FALSE; @@ -697,7 +697,6 @@ PRInt32 nsTableFrame::GetEffectiveCOLSAttribute() nsCellMap *cellMap = GetCellMap(); NS_PRECONDITION (nsnull!=cellMap, "null cellMap."); PRInt32 result; - nsIFrame *tableFrame = this; const nsStyleTable *tableStyle=nsnull; GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle); result = tableStyle->mCols; @@ -2565,10 +2564,6 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext& aPresContext, nsSize kidMaxSize(0,0); nsHTMLReflowMetrics kidSize(&kidMaxSize); nscoord y = 0; - nscoord maxAscent = 0; - nscoord maxDescent = 0; - PRInt32 contentOffset=0; - nsIFrame* prevKidFrame = nsnull;/* XXX incremental reflow! */ // Compute the insets (sum of border and padding) // XXX: since this is pass1 reflow and where we place the rowgroup frames is irrelevant, insets are probably a waste @@ -2586,7 +2581,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext& aPresContext, (NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP != childDisplay->mDisplay) && (NS_STYLE_DISPLAY_TABLE_ROW_GROUP != childDisplay->mDisplay) ) { // it's an unknown frame type, give it a generic reflow and ignore the results - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame, availSize, aReason); if (PR_TRUE==gsDebugIR) printf("\nTIF IR: Reflow Pass 1 of unknown frame %p of type %d with reason=%d\n", kidFrame, childDisplay->mDisplay, aReason); @@ -2594,8 +2589,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext& aPresContext, ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, aStatus); continue; } - nsSize maxKidElementSize(0,0); - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame, availSize, aReason); // Note: we don't bother checking here for whether we should clear the // isTopOfPage reflow state flag, because we're dealing with an unconstrained @@ -2635,8 +2629,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext& aPresContext, kidFrame=mColGroups.FirstChild(); for ( ; nsnull != kidFrame; kidFrame->GetNextSibling(&kidFrame)) { - nsSize maxKidElementSize(0,0); - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame, availSize, aReason); if (PR_TRUE==gsDebugIR) printf("\nTIF IR: Reflow Pass 1 of colgroup frame %p with reason=%d\n", kidFrame, aReason); ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, aStatus); @@ -2680,8 +2673,6 @@ NS_METHOD nsTableFrame::ResizeReflowPass2(nsIPresContext& aPresContext, InnerTableReflowState state(aPresContext, aReflowState, borderPadding); // now that we've computed the column width information, reflow all children - nsSize kidMaxSize(0,0); - nsIFrame* prevKidFrame = nsnull;/* XXX incremental reflow! */ #ifdef NS_DEBUG //PreReflowCheck(); @@ -2895,7 +2886,6 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext& aPresContext, const nsStyleDisplay* groupDisplay; groupFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)groupDisplay)); PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupDisplay->mVisible); - nsRect zeroRect(0, 0, 0, 0); nsIFrame* colFrame; groupFrame->FirstChild(nsnull, &colFrame); while (nsnull != colFrame) { @@ -3088,6 +3078,7 @@ NS_METHOD nsTableFrame::IR_TargetIsMe(nsIPresContext& aPresContext, case nsIReflowCommand::PushReflow: case nsIReflowCommand::CheckPullupReflow : case nsIReflowCommand::UserDefined : + default: NS_NOTYETIMPLEMENTED("unimplemented reflow command type"); rv = NS_ERROR_NOT_IMPLEMENTED; if (PR_TRUE==gsDebugIR) printf("TIF IR: reflow command not implemented.\n"); @@ -3390,9 +3381,8 @@ NS_METHOD nsTableFrame::IR_TargetIsChild(nsIPresContext& aPresContext, nsHTMLReflowMetrics desiredSize(nsnull); // XXX Correctly compute the available space... nsSize availSpace(aReflowState.reflowState.availableWidth, aReflowState.reflowState.availableHeight); - nsHTMLReflowState kidReflowState(aPresContext, aNextFrame, - aReflowState.reflowState, - availSpace); + nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, + aNextFrame, availSpace); rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus); @@ -3573,9 +3563,8 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext& aPresContext, borderPadding += padding; // Reflow the child into the available space - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, - aReflowState.reflowState, kidAvailSize, - reason); + nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, + kidFrame, kidAvailSize, reason); if ((nsnull != firstRowGroupFrame) && (kidFrame != firstRowGroupFrame)) { // If this isn't the first row group frame or the header or footer, then // we can't be at the top of the page anymore... @@ -3653,7 +3642,8 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext& aPresContext, } else {// it's an unknown frame type, give it a generic reflow and ignore the results - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState.reflowState, + nsHTMLReflowState kidReflowState(aPresContext, + aReflowState.reflowState, kidFrame, nsSize(0,0), eReflowReason_Resize); nsHTMLReflowMetrics desiredSize(nsnull); if (PR_TRUE==gsDebug) printf("\nTIF : Reflow Pass 2 of unknown frame %p of type %d with reason=%d\n", @@ -3729,8 +3719,8 @@ NS_METHOD nsTableFrame::PullUpChildren(nsIPresContext& aPresContext, aStatus = NS_FRAME_NOT_COMPLETE; break; } - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, - aReflowState.reflowState, aReflowState.availSize, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, + kidFrame, aReflowState.availSize, eReflowReason_Resize); rv = ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, aStatus); @@ -4014,7 +4004,6 @@ nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext& aPresContext, if (PR_TRUE==IsRowGroup(rowGroupDisplay->mDisplay)) { // the rows in rowGroupFrame need to be expanded by rowHeightDelta[i] // and the rowgroup itself needs to be expanded by SUM(row height deltas) - nscoord excessForRowGroup=0; nsIFrame * rowFrame=nsnull; rv = rowGroupFrame->FirstChild(nsnull, &rowFrame); while ((NS_SUCCEEDED(rv)) && (nsnull!=rowFrame)) @@ -4180,7 +4169,7 @@ nsTableFrame::SetColumnStyleFromCell(nsIPresContext & aPresContext, float width = cellPosition->mWidth.GetPercentValue(); colPosition->mWidth.SetPercentValue(width); if (PR_TRUE==gsDebug) - printf("TIF SetCSFromCell: col percent width set to %d from cell", width); + printf("TIF SetCSFromCell: col percent width set to %g from cell", width); } colFrame->SetWidthSource(nsTableColFrame::eWIDTH_SOURCE_CELL); } @@ -4584,8 +4573,6 @@ void nsTableFrame::MapHTMLBorderStyle(nsStyleSpacing& aSpacingStyle, nscoord aBo PRBool nsTableFrame::ConvertToPixelValue(nsHTMLValue& aValue, PRInt32 aDefault, PRInt32& aResult) { - PRInt32 result = 0; - if (aValue.GetUnit() == eHTMLUnit_Pixel) aResult = aValue.GetPixelValue(); else if (aValue.GetUnit() == eHTMLUnit_Empty) diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp index c246f3c8ef9..84396441f30 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp @@ -291,8 +291,9 @@ nsresult nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext& aPres if (PR_TRUE==gsDebugIR) printf("TOF IR: passing down incremental reflow command to caption.\n"); nsSize captionMES(0,0); nsHTMLReflowMetrics captionSize(&captionMES); - nsHTMLReflowState captionReflowState(aPresContext, mCaptionFrame, + nsHTMLReflowState captionReflowState(aPresContext, aReflowState.reflowState, + mCaptionFrame, nsSize(mRect.width, aReflowState.reflowState.availableHeight), aReflowState.reflowState.reason); @@ -333,8 +334,9 @@ nsresult nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext& aPres tableWidth = mMinCaptionWidth; } nsHTMLReflowMetrics innerSize(aDesiredSize.maxElementSize); - nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, + nsHTMLReflowState innerReflowState(aPresContext, aReflowState.reflowState, + mInnerTableFrame, nsSize(tableWidth, aReflowState.reflowState.availableHeight), eReflowReason_Resize); rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus); @@ -449,6 +451,7 @@ nsresult nsTableOuterFrame::IR_TargetIsMe(nsIPresContext& aPresContext, case nsIReflowCommand::PushReflow: case nsIReflowCommand::CheckPullupReflow : case nsIReflowCommand::UserDefined : + default: NS_NOTYETIMPLEMENTED("unimplemented reflow command type"); rv = NS_ERROR_NOT_IMPLEMENTED; if (PR_TRUE==gsDebugIR) printf("TOF IR: reflow command not implemented.\n"); @@ -476,8 +479,9 @@ nsresult nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext& aPresCont nsHTMLReflowMetrics innerSize(aDesiredSize.maxElementSize); nscoord tableMaxWidth = PR_MAX(aReflowState.reflowState.availableWidth, mMinCaptionWidth); if (PR_TRUE==gsDebugIR) printf("TOF IR: mincaptionWidth=%d, tableMaxWidth=%d.\n", mMinCaptionWidth, tableMaxWidth); - nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, + nsHTMLReflowState innerReflowState(aPresContext, aReflowState.reflowState, + mInnerTableFrame, nsSize(tableMaxWidth, aReflowState.reflowState.availableHeight)); rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus); if (PR_TRUE==gsDebugIR) printf("TOF IR: inner table reflow returned %d with width=%d height=%d\n", @@ -495,8 +499,9 @@ nsresult nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext& aPresCont PRBool captionWasReflowed=PR_FALSE; if (priorInnerTableRect.width!=innerSize.width) { // the table width changed, so reflow the caption - nsHTMLReflowState captionReflowState(aPresContext, mCaptionFrame, + nsHTMLReflowState captionReflowState(aPresContext, aReflowState.reflowState, + mCaptionFrame, nsSize(innerSize.width, aReflowState.reflowState.availableHeight), eReflowReason_Resize); @@ -616,8 +621,9 @@ nsresult nsTableOuterFrame::IR_CaptionInserted(nsIPresContext& aPresConte if (PR_TRUE==gsDebugIR) printf("TOF IR: initial-reflowing caption\n"); nsSize maxElementSize; nsHTMLReflowMetrics captionSize(&maxElementSize); - nsHTMLReflowState captionReflowState(aPresContext, mCaptionFrame, + nsHTMLReflowState captionReflowState(aPresContext, aReflowState.reflowState, + mCaptionFrame, nsSize(mRect.width, aReflowState.reflowState.availableHeight), eReflowReason_Initial); nsIHTMLReflow* htmlReflow; @@ -646,8 +652,9 @@ nsresult nsTableOuterFrame::IR_CaptionInserted(nsIPresContext& aPresConte if ((oldCaptionMES != mMinCaptionWidth) && (mMinCaptionWidth > mRect.width)) { if (PR_TRUE==gsDebugIR) printf("TOF IR: resize-reflowing inner table\n"); - nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, + nsHTMLReflowState innerReflowState(aPresContext, aReflowState.reflowState, + mInnerTableFrame, nsSize(mMinCaptionWidth, aReflowState.reflowState.availableHeight), eReflowReason_Resize); rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus); @@ -700,8 +707,9 @@ nsresult nsTableOuterFrame::IR_CaptionRemoved(nsIPresContext& aPresContex if (oldMinCaptionWidth > mRect.width) { // the old caption width had an effect on the inner table width, so reflow the inner table if (PR_TRUE==gsDebugIR) printf("TOF IR: reflowing inner table\n"); - nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, + nsHTMLReflowState innerReflowState(aPresContext, aReflowState.reflowState, + mInnerTableFrame, nsSize(aReflowState.reflowState.availableWidth, aReflowState.reflowState.availableHeight)); // ReflowChild sets MES @@ -907,8 +915,9 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext, if (nsnull != mCaptionFrame) { nsSize maxElementSize; nsHTMLReflowMetrics captionSize(&maxElementSize); - nsHTMLReflowState captionReflowState(aPresContext, mCaptionFrame, + nsHTMLReflowState captionReflowState(aPresContext, aReflowState, + mCaptionFrame, nsSize(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE), eReflowReason_Initial); nsIHTMLReflow* htmlReflow; @@ -936,8 +945,9 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext, } // First reflow the inner table - nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, + nsHTMLReflowState innerReflowState(aPresContext, aReflowState, + mInnerTableFrame, nsSize(tableWidth, aReflowState.availableHeight)); nsHTMLReflowMetrics innerSize(aDesiredSize.maxElementSize); @@ -972,8 +982,9 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext, } // Reflow the caption. Let it be as high as it wants - nsHTMLReflowState captionReflowState(aPresContext, mCaptionFrame, + nsHTMLReflowState captionReflowState(aPresContext, state.reflowState, + mCaptionFrame, nsSize(innerSize.width, NS_UNCONSTRAINEDSIZE), eReflowReason_Resize); nsHTMLReflowMetrics captionSize(nsnull); @@ -1039,7 +1050,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext, if (gsTiming) { PRIntervalTime endTime = PR_IntervalNow(); - printf("Table reflow took %ld ticks for frame %d\n", + printf("Table reflow took %d ticks for frame %p\n", endTime-startTime, this);/* XXX need to use LL_* macros! */ } diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp index ba4aba08a75..603ed604c24 100644 --- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp @@ -224,10 +224,11 @@ nsTableRowFrame::DidResize(nsIPresContext& aPresContext, cellFrame->SizeTo(cellFrameSize.width, cellHeight); if (gsDebug) printf("given height %d\n", cellHeight); // realign cell content based on the new height - nsHTMLReflowMetrics desiredSize(nsnull); - nsHTMLReflowState kidReflowState(aPresContext, cellFrame, - aReflowState, nsSize(cellFrameSize.width, cellHeight), - eReflowReason_Resize); + /*nsHTMLReflowMetrics desiredSize(nsnull); + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, + cellFrame, + nsSize(cellFrameSize.width, cellHeight), + eReflowReason_Resize);*/ //XXX: the following reflow is necessary for any content of the cell // whose height is a percent of the cell's height (maybe indirectly.) // But some content crashes when this reflow is issued, to be investigated @@ -536,7 +537,7 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, const nsStyleDisplay *rowDisplay; GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)rowDisplay); nsIFrame* kidFrame=GetFirstChildForDirection(rowDisplay->mDirection); - for (kidFrame; nsnull != kidFrame; ) + while (nsnull != kidFrame) { const nsStyleDisplay *kidDisplay; kidFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)kidDisplay)); @@ -560,8 +561,8 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, aReflowState.x += aReflowState.tableFrame->GetColumnWidth(colIndex); aReflowState.x += cellSpacingX; if (PR_TRUE==gsDebug) - printf(" Row: in loop, aReflowState.x set to %d from cellSpacing %d and col width\n", - aReflowState.x, aReflowState.tableFrame->GetColumnWidth(colIndex), cellSpacingX); + printf(" Row: in loop, aReflowState.x set to %d from cellSpacing %d and col width %d\n", + aReflowState.x, cellSpacingX, aReflowState.tableFrame->GetColumnWidth(colIndex)); } } aReflowState.x += cellSpacingX; @@ -583,7 +584,7 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, } if (PR_TRUE==gsDebug) printf(" Row: in loop, availWidth set to %d from colIndex %d width %d and cellSpacing\n", - availWidth, cellColIndex, aReflowState.tableFrame->GetColumnWidth(cellColIndex+numColSpan), cellSpacingX); + availWidth, cellColIndex, aReflowState.tableFrame->GetColumnWidth(cellColIndex+numColSpan)); } if (PR_TRUE==gsDebug) printf(" Row: availWidth for this cell is %d\n", availWidth); @@ -606,8 +607,9 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, nsSize kidAvailSize(availWidth, aReflowState.reflowState.availableHeight); // Reflow the child - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, - aReflowState.reflowState, kidAvailSize, + nsHTMLReflowState kidReflowState(aPresContext, + aReflowState.reflowState, kidFrame, + kidAvailSize, eReflowReason_Resize); if (gsDebug) printf ("Row %p RR: avail=%d\n", this, availWidth); nsReflowStatus status; @@ -686,7 +688,8 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, } else {// it's an unknown frame type, give it a generic reflow and ignore the results - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState.reflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, + kidFrame, nsSize(0,0), eReflowReason_Resize); nsHTMLReflowMetrics desiredSize(nsnull); if (PR_TRUE==gsDebug) printf("\nRow: Resize Reflow of unknown frame %p of type %d with reason=%d\n", @@ -741,13 +744,9 @@ nsTableRowFrame::InitialReflow(nsIPresContext& aPresContext, { // Place our children, one at a time, until we are out of children nsSize kidMaxElementSize(0,0); - PRInt32 kidIndex = 0; - PRInt32 colIndex = 0; - nsIFrame* prevKidFrame = nsnull; nscoord maxTopMargin = 0; nscoord maxBottomMargin = 0; nscoord x = 0; - PRBool isFirst=PR_TRUE; PRBool tableLayoutStrategy=NS_STYLE_TABLE_LAYOUT_AUTO; nsTableFrame* table = aReflowState.tableFrame; nsresult rv = NS_OK; @@ -800,8 +799,9 @@ nsTableRowFrame::InitialReflow(nsIPresContext& aPresContext, kidAvailSize.SizeTo(table->GetColumnWidth(colIndex), NS_UNCONSTRAINEDSIZE); } - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, - aReflowState.reflowState, kidAvailSize, + nsHTMLReflowState kidReflowState(aPresContext, + aReflowState.reflowState, + kidFrame, kidAvailSize, eReflowReason_Initial); if (gsDebug) printf ("%p InitR: avail=%d\n", this, kidAvailSize.width); @@ -841,8 +841,8 @@ nsTableRowFrame::InitialReflow(nsIPresContext& aPresContext, } else {// it's an unknown frame type, give it a generic reflow and ignore the results - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState.reflowState, - nsSize(0,0), eReflowReason_Initial); + nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, + kidFrame, nsSize(0,0), eReflowReason_Initial); nsHTMLReflowMetrics desiredSize(nsnull); if (PR_TRUE==gsDebug) printf("\nTIF : Reflow Pass 2 of unknown frame %p of type %d with reason=%d\n", kidFrame, kidDisplay->mDisplay, eReflowReason_Initial); @@ -1059,6 +1059,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsMe(nsIPresContext& aPresContext, case nsIReflowCommand::PushReflow: case nsIReflowCommand::CheckPullupReflow : case nsIReflowCommand::UserDefined : + default: NS_NOTYETIMPLEMENTED("unimplemented reflow command type"); rv = NS_ERROR_NOT_IMPLEMENTED; if (PR_TRUE==gsDebugIR) printf("TRF IR: reflow command not implemented.\n"); @@ -1284,8 +1285,9 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext, // Pass along the reflow command nsSize kidMaxElementSize; nsHTMLReflowMetrics desiredSize(&kidMaxElementSize); - nsHTMLReflowState kidReflowState(aPresContext, aNextFrame, aReflowState.reflowState, - kidAvailSize); + nsHTMLReflowState kidReflowState(aPresContext, + aReflowState.reflowState, + aNextFrame, kidAvailSize); // XXX Unfortunately we need to reflow the child several times. // The first time is for the incremental reflow command. We can't pass in @@ -1416,8 +1418,9 @@ nsTableRowFrame::Reflow(nsIPresContext& aPresContext, { // this resize reflow is necessary to place the cells correctly in the case of rowspans and colspans. // It is very efficient. It does not actually need to pass a reflow down to the cells. nsSize availSpace(aReflowState.availableWidth, aReflowState.availableHeight); - nsHTMLReflowState resizeReflowState(aPresContext, (nsIFrame *)this, + nsHTMLReflowState resizeReflowState(aPresContext, (const nsHTMLReflowState&)(*(aReflowState.parentReflowState)), + (nsIFrame *)this, availSpace, eReflowReason_Resize); RowReflowState rowResizeReflowState(resizeReflowState, tableFrame); @@ -1499,7 +1502,7 @@ void nsTableRowFrame::ReflowCellFrame(nsIPresContext& aPresContext, aCellFrame->GetSize(cellSize); nsSize availSize(cellSize.width, aAvailableHeight); - nsHTMLReflowState cellReflowState(aPresContext, aCellFrame, aReflowState, availSize, + nsHTMLReflowState cellReflowState(aPresContext, aReflowState, aCellFrame, availSize, eReflowReason_Resize); nsHTMLReflowMetrics desiredSize(nsnull); diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp index 6ba425ed36c..d0e2de41768 100644 --- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -406,7 +406,7 @@ NS_METHOD nsTableRowGroupFrame::ReflowMappedChildren(nsIPresContext& aPresC // it wants. We'll deal with splitting later after we've computed the row // heights, taking into account cells with row spans... kidAvailSize.height = NS_UNCONSTRAINEDSIZE; - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState.reflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, kidFrame, kidAvailSize, aReason); if (kidFrame != mFrames.FirstChild()) { // If this isn't the first row frame, then we can't be at the top of @@ -533,7 +533,6 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext, { if (gsDebug) printf("TRGF CalculateRowHeights begin\n"); // iterate children and for each row get its height - PRBool atLeastOneRowSpanningCell = PR_FALSE; PRInt32 numRows; GetRowCount(numRows); PRInt32 *rowHeights = new PRInt32[numRows]; @@ -798,7 +797,7 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext& aPresContext, // Reflow the row in the available space and have it split nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight - bounds.y); - nsHTMLReflowState rowReflowState(aPresContext, rowFrame, aReflowState, + nsHTMLReflowState rowReflowState(aPresContext, aReflowState, rowFrame, availSize, eReflowReason_Resize); nsHTMLReflowMetrics desiredSize(nsnull); @@ -867,13 +866,15 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext& aPresContext, // of whether it's complete) // - add the continuing frame to the row frame we're pushing nsIFrame* parentFrame; - nsSize rowFrameSize; nsPoint firstRowOrigin, lastRowOrigin; +/* + nsSize rowFrameSize; nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight); - nsHTMLReflowState rowReflowState(aPresContext, rowFrame, aReflowState, + nsHTMLReflowState rowReflowState(aPresContext, aReflowState, rowFrame, availSize, eReflowReason_Resize); +*/ nsReflowStatus status; // Ask the cell frame's parent to reflow it to the height of all the @@ -950,8 +951,6 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext, if (eReflowReason_Incremental == aReflowState.reason) { rv = IncrementalReflow(aPresContext, aDesiredSize, state, aStatus); } else { - PRBool reflowMappedOK = PR_TRUE; - aStatus = NS_FRAME_COMPLETE; // Check for an overflow list @@ -1132,6 +1131,7 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsMe(nsIPresContext& aPresContext, case nsIReflowCommand::PushReflow: case nsIReflowCommand::CheckPullupReflow : case nsIReflowCommand::UserDefined : + default: NS_NOTYETIMPLEMENTED("unimplemented reflow command type"); rv = NS_ERROR_NOT_IMPLEMENTED; if (PR_TRUE==gsDebugIR) printf("TRGF IR: reflow command not implemented.\n"); @@ -1311,7 +1311,7 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext& aPresConte // Pass along the reflow command // XXX Correctly compute the available space... nsSize availSpace(aReflowState.reflowState.availableWidth, aReflowState.reflowState.availableHeight); - nsHTMLReflowState kidReflowState(aPresContext, aNextFrame, aReflowState.reflowState, availSpace); + nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, aNextFrame, availSpace); nsHTMLReflowMetrics desiredSize(nsnull); rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus); diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp index ca80076b731..706fd884ca5 100644 --- a/mozilla/layout/tables/nsTableCellFrame.cpp +++ b/mozilla/layout/tables/nsTableCellFrame.cpp @@ -475,7 +475,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext, kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0; SetPriorAvailWidth(aReflowState.availableWidth); nsIFrame* firstKid = mFrames.FirstChild(); - nsHTMLReflowState kidReflowState(aPresContext, firstKid, aReflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, firstKid, availSize); ReflowChild(firstKid, aPresContext, kidSize, kidReflowState, aStatus); diff --git a/mozilla/layout/tables/nsTableColGroupFrame.cpp b/mozilla/layout/tables/nsTableColGroupFrame.cpp index a16c8e80d2f..9a3f05485b9 100644 --- a/mozilla/layout/tables/nsTableColGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableColGroupFrame.cpp @@ -179,7 +179,7 @@ NS_METHOD nsTableColGroupFrame::Reflow(nsIPresContext& aPresContext, // Give the child frame a chance to reflow, even though we know it'll have 0 size nsHTMLReflowMetrics kidSize(nsnull); // XXX Use a valid reason... - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame, nsSize(0,0), eReflowReason_Initial); nsReflowStatus status; @@ -468,9 +468,9 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsChild(nsIPresContext& aPresC // Pass along the reflow command nsHTMLReflowMetrics desiredSize(nsnull); - nsHTMLReflowState kidReflowState(aPresContext, aNextFrame, - aReflowState, - nsSize(aReflowState.availableWidth, aReflowState.availableHeight)); + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, aNextFrame, + nsSize(aReflowState.availableWidth, + aReflowState.availableHeight)); rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index 9dd82822c70..f9bb336facc 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -49,12 +49,12 @@ #ifdef NS_DEBUG static PRBool gsDebug = PR_FALSE; -static PRBool gsDebugCLD = PR_FALSE; +//static PRBool gsDebugCLD = PR_FALSE; static PRBool gsDebugNT = PR_FALSE; static PRBool gsDebugIR = PR_FALSE; #else static const PRBool gsDebug = PR_FALSE; -static const PRBool gsDebugCLD = PR_FALSE; +//static const PRBool gsDebugCLD = PR_FALSE; static const PRBool gsDebugNT = PR_FALSE; static const PRBool gsDebugIR = PR_FALSE; #endif @@ -279,15 +279,15 @@ nsTableFrame::GetFrameType(nsIAtom** aType) const nsTableFrame::nsTableFrame() : nsHTMLContainerFrame(), - mCellMap(nsnull), - mColCache(nsnull), - mTableLayoutStrategy(nsnull), - mFirstPassValid(PR_FALSE), mColumnWidthsValid(PR_FALSE), + mFirstPassValid(PR_FALSE), mColumnCacheValid(PR_FALSE), mCellMapValid(PR_TRUE), mIsInvariantWidth(PR_FALSE), - mHasScrollableRowGroup(PR_FALSE) + mHasScrollableRowGroup(PR_FALSE), + mCellMap(nsnull), + mColCache(nsnull), + mTableLayoutStrategy(nsnull) { mEffectiveColCount = -1; // -1 means uninitialized mColumnWidthsSet=PR_FALSE; @@ -697,7 +697,6 @@ PRInt32 nsTableFrame::GetEffectiveCOLSAttribute() nsCellMap *cellMap = GetCellMap(); NS_PRECONDITION (nsnull!=cellMap, "null cellMap."); PRInt32 result; - nsIFrame *tableFrame = this; const nsStyleTable *tableStyle=nsnull; GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle); result = tableStyle->mCols; @@ -2565,10 +2564,6 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext& aPresContext, nsSize kidMaxSize(0,0); nsHTMLReflowMetrics kidSize(&kidMaxSize); nscoord y = 0; - nscoord maxAscent = 0; - nscoord maxDescent = 0; - PRInt32 contentOffset=0; - nsIFrame* prevKidFrame = nsnull;/* XXX incremental reflow! */ // Compute the insets (sum of border and padding) // XXX: since this is pass1 reflow and where we place the rowgroup frames is irrelevant, insets are probably a waste @@ -2586,7 +2581,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext& aPresContext, (NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP != childDisplay->mDisplay) && (NS_STYLE_DISPLAY_TABLE_ROW_GROUP != childDisplay->mDisplay) ) { // it's an unknown frame type, give it a generic reflow and ignore the results - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame, availSize, aReason); if (PR_TRUE==gsDebugIR) printf("\nTIF IR: Reflow Pass 1 of unknown frame %p of type %d with reason=%d\n", kidFrame, childDisplay->mDisplay, aReason); @@ -2594,8 +2589,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext& aPresContext, ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, aStatus); continue; } - nsSize maxKidElementSize(0,0); - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame, availSize, aReason); // Note: we don't bother checking here for whether we should clear the // isTopOfPage reflow state flag, because we're dealing with an unconstrained @@ -2635,8 +2629,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext& aPresContext, kidFrame=mColGroups.FirstChild(); for ( ; nsnull != kidFrame; kidFrame->GetNextSibling(&kidFrame)) { - nsSize maxKidElementSize(0,0); - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame, availSize, aReason); if (PR_TRUE==gsDebugIR) printf("\nTIF IR: Reflow Pass 1 of colgroup frame %p with reason=%d\n", kidFrame, aReason); ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, aStatus); @@ -2680,8 +2673,6 @@ NS_METHOD nsTableFrame::ResizeReflowPass2(nsIPresContext& aPresContext, InnerTableReflowState state(aPresContext, aReflowState, borderPadding); // now that we've computed the column width information, reflow all children - nsSize kidMaxSize(0,0); - nsIFrame* prevKidFrame = nsnull;/* XXX incremental reflow! */ #ifdef NS_DEBUG //PreReflowCheck(); @@ -2895,7 +2886,6 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext& aPresContext, const nsStyleDisplay* groupDisplay; groupFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)groupDisplay)); PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupDisplay->mVisible); - nsRect zeroRect(0, 0, 0, 0); nsIFrame* colFrame; groupFrame->FirstChild(nsnull, &colFrame); while (nsnull != colFrame) { @@ -3088,6 +3078,7 @@ NS_METHOD nsTableFrame::IR_TargetIsMe(nsIPresContext& aPresContext, case nsIReflowCommand::PushReflow: case nsIReflowCommand::CheckPullupReflow : case nsIReflowCommand::UserDefined : + default: NS_NOTYETIMPLEMENTED("unimplemented reflow command type"); rv = NS_ERROR_NOT_IMPLEMENTED; if (PR_TRUE==gsDebugIR) printf("TIF IR: reflow command not implemented.\n"); @@ -3390,9 +3381,8 @@ NS_METHOD nsTableFrame::IR_TargetIsChild(nsIPresContext& aPresContext, nsHTMLReflowMetrics desiredSize(nsnull); // XXX Correctly compute the available space... nsSize availSpace(aReflowState.reflowState.availableWidth, aReflowState.reflowState.availableHeight); - nsHTMLReflowState kidReflowState(aPresContext, aNextFrame, - aReflowState.reflowState, - availSpace); + nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, + aNextFrame, availSpace); rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus); @@ -3573,9 +3563,8 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext& aPresContext, borderPadding += padding; // Reflow the child into the available space - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, - aReflowState.reflowState, kidAvailSize, - reason); + nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, + kidFrame, kidAvailSize, reason); if ((nsnull != firstRowGroupFrame) && (kidFrame != firstRowGroupFrame)) { // If this isn't the first row group frame or the header or footer, then // we can't be at the top of the page anymore... @@ -3653,7 +3642,8 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext& aPresContext, } else {// it's an unknown frame type, give it a generic reflow and ignore the results - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState.reflowState, + nsHTMLReflowState kidReflowState(aPresContext, + aReflowState.reflowState, kidFrame, nsSize(0,0), eReflowReason_Resize); nsHTMLReflowMetrics desiredSize(nsnull); if (PR_TRUE==gsDebug) printf("\nTIF : Reflow Pass 2 of unknown frame %p of type %d with reason=%d\n", @@ -3729,8 +3719,8 @@ NS_METHOD nsTableFrame::PullUpChildren(nsIPresContext& aPresContext, aStatus = NS_FRAME_NOT_COMPLETE; break; } - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, - aReflowState.reflowState, aReflowState.availSize, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, + kidFrame, aReflowState.availSize, eReflowReason_Resize); rv = ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, aStatus); @@ -4014,7 +4004,6 @@ nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext& aPresContext, if (PR_TRUE==IsRowGroup(rowGroupDisplay->mDisplay)) { // the rows in rowGroupFrame need to be expanded by rowHeightDelta[i] // and the rowgroup itself needs to be expanded by SUM(row height deltas) - nscoord excessForRowGroup=0; nsIFrame * rowFrame=nsnull; rv = rowGroupFrame->FirstChild(nsnull, &rowFrame); while ((NS_SUCCEEDED(rv)) && (nsnull!=rowFrame)) @@ -4180,7 +4169,7 @@ nsTableFrame::SetColumnStyleFromCell(nsIPresContext & aPresContext, float width = cellPosition->mWidth.GetPercentValue(); colPosition->mWidth.SetPercentValue(width); if (PR_TRUE==gsDebug) - printf("TIF SetCSFromCell: col percent width set to %d from cell", width); + printf("TIF SetCSFromCell: col percent width set to %g from cell", width); } colFrame->SetWidthSource(nsTableColFrame::eWIDTH_SOURCE_CELL); } @@ -4584,8 +4573,6 @@ void nsTableFrame::MapHTMLBorderStyle(nsStyleSpacing& aSpacingStyle, nscoord aBo PRBool nsTableFrame::ConvertToPixelValue(nsHTMLValue& aValue, PRInt32 aDefault, PRInt32& aResult) { - PRInt32 result = 0; - if (aValue.GetUnit() == eHTMLUnit_Pixel) aResult = aValue.GetPixelValue(); else if (aValue.GetUnit() == eHTMLUnit_Empty) diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp index c246f3c8ef9..84396441f30 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.cpp +++ b/mozilla/layout/tables/nsTableOuterFrame.cpp @@ -291,8 +291,9 @@ nsresult nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext& aPres if (PR_TRUE==gsDebugIR) printf("TOF IR: passing down incremental reflow command to caption.\n"); nsSize captionMES(0,0); nsHTMLReflowMetrics captionSize(&captionMES); - nsHTMLReflowState captionReflowState(aPresContext, mCaptionFrame, + nsHTMLReflowState captionReflowState(aPresContext, aReflowState.reflowState, + mCaptionFrame, nsSize(mRect.width, aReflowState.reflowState.availableHeight), aReflowState.reflowState.reason); @@ -333,8 +334,9 @@ nsresult nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext& aPres tableWidth = mMinCaptionWidth; } nsHTMLReflowMetrics innerSize(aDesiredSize.maxElementSize); - nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, + nsHTMLReflowState innerReflowState(aPresContext, aReflowState.reflowState, + mInnerTableFrame, nsSize(tableWidth, aReflowState.reflowState.availableHeight), eReflowReason_Resize); rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus); @@ -449,6 +451,7 @@ nsresult nsTableOuterFrame::IR_TargetIsMe(nsIPresContext& aPresContext, case nsIReflowCommand::PushReflow: case nsIReflowCommand::CheckPullupReflow : case nsIReflowCommand::UserDefined : + default: NS_NOTYETIMPLEMENTED("unimplemented reflow command type"); rv = NS_ERROR_NOT_IMPLEMENTED; if (PR_TRUE==gsDebugIR) printf("TOF IR: reflow command not implemented.\n"); @@ -476,8 +479,9 @@ nsresult nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext& aPresCont nsHTMLReflowMetrics innerSize(aDesiredSize.maxElementSize); nscoord tableMaxWidth = PR_MAX(aReflowState.reflowState.availableWidth, mMinCaptionWidth); if (PR_TRUE==gsDebugIR) printf("TOF IR: mincaptionWidth=%d, tableMaxWidth=%d.\n", mMinCaptionWidth, tableMaxWidth); - nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, + nsHTMLReflowState innerReflowState(aPresContext, aReflowState.reflowState, + mInnerTableFrame, nsSize(tableMaxWidth, aReflowState.reflowState.availableHeight)); rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus); if (PR_TRUE==gsDebugIR) printf("TOF IR: inner table reflow returned %d with width=%d height=%d\n", @@ -495,8 +499,9 @@ nsresult nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext& aPresCont PRBool captionWasReflowed=PR_FALSE; if (priorInnerTableRect.width!=innerSize.width) { // the table width changed, so reflow the caption - nsHTMLReflowState captionReflowState(aPresContext, mCaptionFrame, + nsHTMLReflowState captionReflowState(aPresContext, aReflowState.reflowState, + mCaptionFrame, nsSize(innerSize.width, aReflowState.reflowState.availableHeight), eReflowReason_Resize); @@ -616,8 +621,9 @@ nsresult nsTableOuterFrame::IR_CaptionInserted(nsIPresContext& aPresConte if (PR_TRUE==gsDebugIR) printf("TOF IR: initial-reflowing caption\n"); nsSize maxElementSize; nsHTMLReflowMetrics captionSize(&maxElementSize); - nsHTMLReflowState captionReflowState(aPresContext, mCaptionFrame, + nsHTMLReflowState captionReflowState(aPresContext, aReflowState.reflowState, + mCaptionFrame, nsSize(mRect.width, aReflowState.reflowState.availableHeight), eReflowReason_Initial); nsIHTMLReflow* htmlReflow; @@ -646,8 +652,9 @@ nsresult nsTableOuterFrame::IR_CaptionInserted(nsIPresContext& aPresConte if ((oldCaptionMES != mMinCaptionWidth) && (mMinCaptionWidth > mRect.width)) { if (PR_TRUE==gsDebugIR) printf("TOF IR: resize-reflowing inner table\n"); - nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, + nsHTMLReflowState innerReflowState(aPresContext, aReflowState.reflowState, + mInnerTableFrame, nsSize(mMinCaptionWidth, aReflowState.reflowState.availableHeight), eReflowReason_Resize); rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus); @@ -700,8 +707,9 @@ nsresult nsTableOuterFrame::IR_CaptionRemoved(nsIPresContext& aPresContex if (oldMinCaptionWidth > mRect.width) { // the old caption width had an effect on the inner table width, so reflow the inner table if (PR_TRUE==gsDebugIR) printf("TOF IR: reflowing inner table\n"); - nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, + nsHTMLReflowState innerReflowState(aPresContext, aReflowState.reflowState, + mInnerTableFrame, nsSize(aReflowState.reflowState.availableWidth, aReflowState.reflowState.availableHeight)); // ReflowChild sets MES @@ -907,8 +915,9 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext, if (nsnull != mCaptionFrame) { nsSize maxElementSize; nsHTMLReflowMetrics captionSize(&maxElementSize); - nsHTMLReflowState captionReflowState(aPresContext, mCaptionFrame, + nsHTMLReflowState captionReflowState(aPresContext, aReflowState, + mCaptionFrame, nsSize(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE), eReflowReason_Initial); nsIHTMLReflow* htmlReflow; @@ -936,8 +945,9 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext, } // First reflow the inner table - nsHTMLReflowState innerReflowState(aPresContext, mInnerTableFrame, + nsHTMLReflowState innerReflowState(aPresContext, aReflowState, + mInnerTableFrame, nsSize(tableWidth, aReflowState.availableHeight)); nsHTMLReflowMetrics innerSize(aDesiredSize.maxElementSize); @@ -972,8 +982,9 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext, } // Reflow the caption. Let it be as high as it wants - nsHTMLReflowState captionReflowState(aPresContext, mCaptionFrame, + nsHTMLReflowState captionReflowState(aPresContext, state.reflowState, + mCaptionFrame, nsSize(innerSize.width, NS_UNCONSTRAINEDSIZE), eReflowReason_Resize); nsHTMLReflowMetrics captionSize(nsnull); @@ -1039,7 +1050,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext, if (gsTiming) { PRIntervalTime endTime = PR_IntervalNow(); - printf("Table reflow took %ld ticks for frame %d\n", + printf("Table reflow took %d ticks for frame %p\n", endTime-startTime, this);/* XXX need to use LL_* macros! */ } diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp index ba4aba08a75..603ed604c24 100644 --- a/mozilla/layout/tables/nsTableRowFrame.cpp +++ b/mozilla/layout/tables/nsTableRowFrame.cpp @@ -224,10 +224,11 @@ nsTableRowFrame::DidResize(nsIPresContext& aPresContext, cellFrame->SizeTo(cellFrameSize.width, cellHeight); if (gsDebug) printf("given height %d\n", cellHeight); // realign cell content based on the new height - nsHTMLReflowMetrics desiredSize(nsnull); - nsHTMLReflowState kidReflowState(aPresContext, cellFrame, - aReflowState, nsSize(cellFrameSize.width, cellHeight), - eReflowReason_Resize); + /*nsHTMLReflowMetrics desiredSize(nsnull); + nsHTMLReflowState kidReflowState(aPresContext, aReflowState, + cellFrame, + nsSize(cellFrameSize.width, cellHeight), + eReflowReason_Resize);*/ //XXX: the following reflow is necessary for any content of the cell // whose height is a percent of the cell's height (maybe indirectly.) // But some content crashes when this reflow is issued, to be investigated @@ -536,7 +537,7 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, const nsStyleDisplay *rowDisplay; GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)rowDisplay); nsIFrame* kidFrame=GetFirstChildForDirection(rowDisplay->mDirection); - for (kidFrame; nsnull != kidFrame; ) + while (nsnull != kidFrame) { const nsStyleDisplay *kidDisplay; kidFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)kidDisplay)); @@ -560,8 +561,8 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, aReflowState.x += aReflowState.tableFrame->GetColumnWidth(colIndex); aReflowState.x += cellSpacingX; if (PR_TRUE==gsDebug) - printf(" Row: in loop, aReflowState.x set to %d from cellSpacing %d and col width\n", - aReflowState.x, aReflowState.tableFrame->GetColumnWidth(colIndex), cellSpacingX); + printf(" Row: in loop, aReflowState.x set to %d from cellSpacing %d and col width %d\n", + aReflowState.x, cellSpacingX, aReflowState.tableFrame->GetColumnWidth(colIndex)); } } aReflowState.x += cellSpacingX; @@ -583,7 +584,7 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, } if (PR_TRUE==gsDebug) printf(" Row: in loop, availWidth set to %d from colIndex %d width %d and cellSpacing\n", - availWidth, cellColIndex, aReflowState.tableFrame->GetColumnWidth(cellColIndex+numColSpan), cellSpacingX); + availWidth, cellColIndex, aReflowState.tableFrame->GetColumnWidth(cellColIndex+numColSpan)); } if (PR_TRUE==gsDebug) printf(" Row: availWidth for this cell is %d\n", availWidth); @@ -606,8 +607,9 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, nsSize kidAvailSize(availWidth, aReflowState.reflowState.availableHeight); // Reflow the child - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, - aReflowState.reflowState, kidAvailSize, + nsHTMLReflowState kidReflowState(aPresContext, + aReflowState.reflowState, kidFrame, + kidAvailSize, eReflowReason_Resize); if (gsDebug) printf ("Row %p RR: avail=%d\n", this, availWidth); nsReflowStatus status; @@ -686,7 +688,8 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, } else {// it's an unknown frame type, give it a generic reflow and ignore the results - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState.reflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, + kidFrame, nsSize(0,0), eReflowReason_Resize); nsHTMLReflowMetrics desiredSize(nsnull); if (PR_TRUE==gsDebug) printf("\nRow: Resize Reflow of unknown frame %p of type %d with reason=%d\n", @@ -741,13 +744,9 @@ nsTableRowFrame::InitialReflow(nsIPresContext& aPresContext, { // Place our children, one at a time, until we are out of children nsSize kidMaxElementSize(0,0); - PRInt32 kidIndex = 0; - PRInt32 colIndex = 0; - nsIFrame* prevKidFrame = nsnull; nscoord maxTopMargin = 0; nscoord maxBottomMargin = 0; nscoord x = 0; - PRBool isFirst=PR_TRUE; PRBool tableLayoutStrategy=NS_STYLE_TABLE_LAYOUT_AUTO; nsTableFrame* table = aReflowState.tableFrame; nsresult rv = NS_OK; @@ -800,8 +799,9 @@ nsTableRowFrame::InitialReflow(nsIPresContext& aPresContext, kidAvailSize.SizeTo(table->GetColumnWidth(colIndex), NS_UNCONSTRAINEDSIZE); } - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, - aReflowState.reflowState, kidAvailSize, + nsHTMLReflowState kidReflowState(aPresContext, + aReflowState.reflowState, + kidFrame, kidAvailSize, eReflowReason_Initial); if (gsDebug) printf ("%p InitR: avail=%d\n", this, kidAvailSize.width); @@ -841,8 +841,8 @@ nsTableRowFrame::InitialReflow(nsIPresContext& aPresContext, } else {// it's an unknown frame type, give it a generic reflow and ignore the results - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState.reflowState, - nsSize(0,0), eReflowReason_Initial); + nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, + kidFrame, nsSize(0,0), eReflowReason_Initial); nsHTMLReflowMetrics desiredSize(nsnull); if (PR_TRUE==gsDebug) printf("\nTIF : Reflow Pass 2 of unknown frame %p of type %d with reason=%d\n", kidFrame, kidDisplay->mDisplay, eReflowReason_Initial); @@ -1059,6 +1059,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsMe(nsIPresContext& aPresContext, case nsIReflowCommand::PushReflow: case nsIReflowCommand::CheckPullupReflow : case nsIReflowCommand::UserDefined : + default: NS_NOTYETIMPLEMENTED("unimplemented reflow command type"); rv = NS_ERROR_NOT_IMPLEMENTED; if (PR_TRUE==gsDebugIR) printf("TRF IR: reflow command not implemented.\n"); @@ -1284,8 +1285,9 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext, // Pass along the reflow command nsSize kidMaxElementSize; nsHTMLReflowMetrics desiredSize(&kidMaxElementSize); - nsHTMLReflowState kidReflowState(aPresContext, aNextFrame, aReflowState.reflowState, - kidAvailSize); + nsHTMLReflowState kidReflowState(aPresContext, + aReflowState.reflowState, + aNextFrame, kidAvailSize); // XXX Unfortunately we need to reflow the child several times. // The first time is for the incremental reflow command. We can't pass in @@ -1416,8 +1418,9 @@ nsTableRowFrame::Reflow(nsIPresContext& aPresContext, { // this resize reflow is necessary to place the cells correctly in the case of rowspans and colspans. // It is very efficient. It does not actually need to pass a reflow down to the cells. nsSize availSpace(aReflowState.availableWidth, aReflowState.availableHeight); - nsHTMLReflowState resizeReflowState(aPresContext, (nsIFrame *)this, + nsHTMLReflowState resizeReflowState(aPresContext, (const nsHTMLReflowState&)(*(aReflowState.parentReflowState)), + (nsIFrame *)this, availSpace, eReflowReason_Resize); RowReflowState rowResizeReflowState(resizeReflowState, tableFrame); @@ -1499,7 +1502,7 @@ void nsTableRowFrame::ReflowCellFrame(nsIPresContext& aPresContext, aCellFrame->GetSize(cellSize); nsSize availSize(cellSize.width, aAvailableHeight); - nsHTMLReflowState cellReflowState(aPresContext, aCellFrame, aReflowState, availSize, + nsHTMLReflowState cellReflowState(aPresContext, aReflowState, aCellFrame, availSize, eReflowReason_Resize); nsHTMLReflowMetrics desiredSize(nsnull); diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.cpp b/mozilla/layout/tables/nsTableRowGroupFrame.cpp index 6ba425ed36c..d0e2de41768 100644 --- a/mozilla/layout/tables/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableRowGroupFrame.cpp @@ -406,7 +406,7 @@ NS_METHOD nsTableRowGroupFrame::ReflowMappedChildren(nsIPresContext& aPresC // it wants. We'll deal with splitting later after we've computed the row // heights, taking into account cells with row spans... kidAvailSize.height = NS_UNCONSTRAINEDSIZE; - nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState.reflowState, + nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, kidFrame, kidAvailSize, aReason); if (kidFrame != mFrames.FirstChild()) { // If this isn't the first row frame, then we can't be at the top of @@ -533,7 +533,6 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext, { if (gsDebug) printf("TRGF CalculateRowHeights begin\n"); // iterate children and for each row get its height - PRBool atLeastOneRowSpanningCell = PR_FALSE; PRInt32 numRows; GetRowCount(numRows); PRInt32 *rowHeights = new PRInt32[numRows]; @@ -798,7 +797,7 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext& aPresContext, // Reflow the row in the available space and have it split nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight - bounds.y); - nsHTMLReflowState rowReflowState(aPresContext, rowFrame, aReflowState, + nsHTMLReflowState rowReflowState(aPresContext, aReflowState, rowFrame, availSize, eReflowReason_Resize); nsHTMLReflowMetrics desiredSize(nsnull); @@ -867,13 +866,15 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext& aPresContext, // of whether it's complete) // - add the continuing frame to the row frame we're pushing nsIFrame* parentFrame; - nsSize rowFrameSize; nsPoint firstRowOrigin, lastRowOrigin; +/* + nsSize rowFrameSize; nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight); - nsHTMLReflowState rowReflowState(aPresContext, rowFrame, aReflowState, + nsHTMLReflowState rowReflowState(aPresContext, aReflowState, rowFrame, availSize, eReflowReason_Resize); +*/ nsReflowStatus status; // Ask the cell frame's parent to reflow it to the height of all the @@ -950,8 +951,6 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext, if (eReflowReason_Incremental == aReflowState.reason) { rv = IncrementalReflow(aPresContext, aDesiredSize, state, aStatus); } else { - PRBool reflowMappedOK = PR_TRUE; - aStatus = NS_FRAME_COMPLETE; // Check for an overflow list @@ -1132,6 +1131,7 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsMe(nsIPresContext& aPresContext, case nsIReflowCommand::PushReflow: case nsIReflowCommand::CheckPullupReflow : case nsIReflowCommand::UserDefined : + default: NS_NOTYETIMPLEMENTED("unimplemented reflow command type"); rv = NS_ERROR_NOT_IMPLEMENTED; if (PR_TRUE==gsDebugIR) printf("TRGF IR: reflow command not implemented.\n"); @@ -1311,7 +1311,7 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext& aPresConte // Pass along the reflow command // XXX Correctly compute the available space... nsSize availSpace(aReflowState.reflowState.availableWidth, aReflowState.reflowState.availableHeight); - nsHTMLReflowState kidReflowState(aPresContext, aNextFrame, aReflowState.reflowState, availSpace); + nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, aNextFrame, availSpace); nsHTMLReflowMetrics desiredSize(nsnull); rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus); diff --git a/mozilla/layout/xul/base/src/nsToolboxFrame.cpp b/mozilla/layout/xul/base/src/nsToolboxFrame.cpp index af21ae3cfe0..dcae843d0b5 100644 --- a/mozilla/layout/xul/base/src/nsToolboxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsToolboxFrame.cpp @@ -217,7 +217,7 @@ nsToolboxFrame :: DrawGrippy ( nsIPresContext& aPresContext, nsIRenderingContex const nsStyleColor* grippyColor = (const nsStyleColor*)style->GetStyleData(eStyleStruct_Color); const nsStyleSpacing* grippySpacing = (const nsStyleSpacing*)style->GetStyleData(eStyleStruct_Spacing); - const nsStyleFont* grippyFont = (const nsStyleFont*)style->GetStyleData(eStyleStruct_Font); +// const nsStyleFont* grippyFont = (const nsStyleFont*)style->GetStyleData(eStyleStruct_Font); nsToolboxFrame* nonConstSelf = NS_CONST_CAST(nsToolboxFrame*, this); nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, nonConstSelf, @@ -321,7 +321,7 @@ nsToolboxFrame :: Reflow(nsIPresContext& aPresContext, // they are the same, so find the width/height desired by the toolbar frame. nsSize maxSize(aReflowState.availableWidth, aReflowState.availableHeight); - nsHTMLReflowState reflowState(aPresContext, childFrame, aReflowState, maxSize); + nsHTMLReflowState reflowState(aPresContext, aReflowState, childFrame, maxSize); nsIHTMLReflow* htmlReflow = nsnull; // can't use nsCOMPtr because of bad COM if ( childFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow) == NS_OK ) { htmlReflow->WillReflow(aPresContext);