Some incremental reflow changes
git-svn-id: svn://10.0.0.236/trunk@4391 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
9451bc42a8
commit
45ccdb4fb7
@ -1108,7 +1108,10 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
||||
// assign table width
|
||||
SetTableWidth(aPresContext);
|
||||
|
||||
aStatus = ResizeReflowPass2(aPresContext, aDesiredSize, aReflowState, 0, 0);
|
||||
// Constrain our reflow width to the computed table width
|
||||
nsReflowState reflowState(aReflowState);
|
||||
reflowState.maxSize.width = mRect.width;
|
||||
aStatus = ResizeReflowPass2(aPresContext, aDesiredSize, reflowState, 0, 0);
|
||||
|
||||
if (gsTiming) {
|
||||
PRIntervalTime endTime = PR_IntervalNow();
|
||||
|
||||
@ -188,9 +188,6 @@ nsresult nsTableOuterFrame::RecoverState(OuterTableReflowState& aState,
|
||||
aState.innerTableMaxSize.width = innerTableSize.width;
|
||||
aState.innerTableMaxSize.height = aState.reflowState.maxSize.height;
|
||||
|
||||
// The available space is the width of the inner table
|
||||
aState.availSize.width = aState.innerTableMaxSize.width;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -293,8 +290,11 @@ nsresult nsTableOuterFrame::IncrementalReflow(nsIPresContext* aPresContext,
|
||||
aState.y += topMargin;
|
||||
kidFrame->WillReflow(*aPresContext);
|
||||
kidFrame->MoveTo(kidMargin.left, aState.y);
|
||||
nsReflowState kidReflowState(kidFrame, aState.reflowState, kidFrame == mInnerTableFrame ?
|
||||
aState.innerTableMaxSize : aState.availSize);
|
||||
nsReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize);
|
||||
if (kidFrame != mInnerTableFrame) {
|
||||
// Reflow captions to the width of the inner table
|
||||
kidReflowState.maxSize.width = aState.innerTableMaxSize.width;
|
||||
}
|
||||
mInnerTableFrame->SetReflowPass(nsTableFrame::kPASS_INCREMENTAL);
|
||||
aStatus = ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState,
|
||||
pKidMaxElementSize, aState);
|
||||
|
||||
@ -1081,17 +1081,39 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext,
|
||||
nsSize kidMaxElementSize;
|
||||
nsReflowMetrics desiredSize(&kidMaxElementSize);
|
||||
// XXX Correctly compute the available height...
|
||||
nsSize availSpace(NS_UNCONSTRAINEDSIZE, aReflowState.maxSize.height);
|
||||
nsSize availSpace(aReflowState.maxSize);
|
||||
nsReflowState kidReflowState(kidFrame, aReflowState, availSpace);
|
||||
kidFrame->WillReflow(*aPresContext);
|
||||
|
||||
// XXX Unfortunately we need to reflow the child several times.
|
||||
// The first time is for the incremental reflow command. We can't pass in
|
||||
// a max width of NS_UNCONSTRAINEDSIZE, because the max width must match
|
||||
// the width of the previous reflow...
|
||||
aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
|
||||
|
||||
// Update the cell layout data
|
||||
nsCellLayoutData *kidLayoutData = new nsCellLayoutData((nsTableCellFrame *)kidFrame,
|
||||
&desiredSize, &kidMaxElementSize);
|
||||
((nsTableCellFrame *)kidFrame)->SetCellLayoutData(kidLayoutData);
|
||||
// XXX The equivalent of incrementally updating the column cache
|
||||
state.tableFrame->SetCellLayoutData(aPresContext, kidLayoutData, (nsTableCellFrame*)kidFrame);
|
||||
// Now do the regular pass 1 reflow and gather the max width and max element
|
||||
// size.
|
||||
// XXX It would be nice if we could skip this step and the next step if the
|
||||
// column width isn't dependent on the max cell width...
|
||||
kidReflowState.reason = eReflowReason_Resize;
|
||||
kidReflowState.reflowCommand = nsnull;
|
||||
kidReflowState.maxSize.width = NS_UNCONSTRAINEDSIZE;
|
||||
aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
|
||||
|
||||
// Update the cell layout data. Note that we need to do this for both
|
||||
// the data the cell maintains AND the data the table maintains...
|
||||
nsCellLayoutData *kidLayoutData = ((nsTableCellFrame *)kidFrame)->GetCellLayoutData();
|
||||
|
||||
kidLayoutData->SetDesiredSize(&desiredSize);
|
||||
kidLayoutData->SetMaxElementSize(&kidMaxElementSize);
|
||||
|
||||
kidLayoutData = state.tableFrame->GetCellLayoutData((nsTableCellFrame*)kidFrame);
|
||||
kidLayoutData->SetDesiredSize(&desiredSize);
|
||||
kidLayoutData->SetMaxElementSize(&kidMaxElementSize);
|
||||
|
||||
// Now reflow the cell again this time constraining the width
|
||||
// XXX Skip this for the time being, because the table code is going to
|
||||
// reflow the entire table anyway...
|
||||
|
||||
// XXX Compute desired size...
|
||||
|
||||
|
||||
@ -1108,7 +1108,10 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
||||
// assign table width
|
||||
SetTableWidth(aPresContext);
|
||||
|
||||
aStatus = ResizeReflowPass2(aPresContext, aDesiredSize, aReflowState, 0, 0);
|
||||
// Constrain our reflow width to the computed table width
|
||||
nsReflowState reflowState(aReflowState);
|
||||
reflowState.maxSize.width = mRect.width;
|
||||
aStatus = ResizeReflowPass2(aPresContext, aDesiredSize, reflowState, 0, 0);
|
||||
|
||||
if (gsTiming) {
|
||||
PRIntervalTime endTime = PR_IntervalNow();
|
||||
|
||||
@ -188,9 +188,6 @@ nsresult nsTableOuterFrame::RecoverState(OuterTableReflowState& aState,
|
||||
aState.innerTableMaxSize.width = innerTableSize.width;
|
||||
aState.innerTableMaxSize.height = aState.reflowState.maxSize.height;
|
||||
|
||||
// The available space is the width of the inner table
|
||||
aState.availSize.width = aState.innerTableMaxSize.width;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -293,8 +290,11 @@ nsresult nsTableOuterFrame::IncrementalReflow(nsIPresContext* aPresContext,
|
||||
aState.y += topMargin;
|
||||
kidFrame->WillReflow(*aPresContext);
|
||||
kidFrame->MoveTo(kidMargin.left, aState.y);
|
||||
nsReflowState kidReflowState(kidFrame, aState.reflowState, kidFrame == mInnerTableFrame ?
|
||||
aState.innerTableMaxSize : aState.availSize);
|
||||
nsReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize);
|
||||
if (kidFrame != mInnerTableFrame) {
|
||||
// Reflow captions to the width of the inner table
|
||||
kidReflowState.maxSize.width = aState.innerTableMaxSize.width;
|
||||
}
|
||||
mInnerTableFrame->SetReflowPass(nsTableFrame::kPASS_INCREMENTAL);
|
||||
aStatus = ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState,
|
||||
pKidMaxElementSize, aState);
|
||||
|
||||
@ -1081,17 +1081,39 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext,
|
||||
nsSize kidMaxElementSize;
|
||||
nsReflowMetrics desiredSize(&kidMaxElementSize);
|
||||
// XXX Correctly compute the available height...
|
||||
nsSize availSpace(NS_UNCONSTRAINEDSIZE, aReflowState.maxSize.height);
|
||||
nsSize availSpace(aReflowState.maxSize);
|
||||
nsReflowState kidReflowState(kidFrame, aReflowState, availSpace);
|
||||
kidFrame->WillReflow(*aPresContext);
|
||||
|
||||
// XXX Unfortunately we need to reflow the child several times.
|
||||
// The first time is for the incremental reflow command. We can't pass in
|
||||
// a max width of NS_UNCONSTRAINEDSIZE, because the max width must match
|
||||
// the width of the previous reflow...
|
||||
aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
|
||||
|
||||
// Update the cell layout data
|
||||
nsCellLayoutData *kidLayoutData = new nsCellLayoutData((nsTableCellFrame *)kidFrame,
|
||||
&desiredSize, &kidMaxElementSize);
|
||||
((nsTableCellFrame *)kidFrame)->SetCellLayoutData(kidLayoutData);
|
||||
// XXX The equivalent of incrementally updating the column cache
|
||||
state.tableFrame->SetCellLayoutData(aPresContext, kidLayoutData, (nsTableCellFrame*)kidFrame);
|
||||
// Now do the regular pass 1 reflow and gather the max width and max element
|
||||
// size.
|
||||
// XXX It would be nice if we could skip this step and the next step if the
|
||||
// column width isn't dependent on the max cell width...
|
||||
kidReflowState.reason = eReflowReason_Resize;
|
||||
kidReflowState.reflowCommand = nsnull;
|
||||
kidReflowState.maxSize.width = NS_UNCONSTRAINEDSIZE;
|
||||
aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
|
||||
|
||||
// Update the cell layout data. Note that we need to do this for both
|
||||
// the data the cell maintains AND the data the table maintains...
|
||||
nsCellLayoutData *kidLayoutData = ((nsTableCellFrame *)kidFrame)->GetCellLayoutData();
|
||||
|
||||
kidLayoutData->SetDesiredSize(&desiredSize);
|
||||
kidLayoutData->SetMaxElementSize(&kidMaxElementSize);
|
||||
|
||||
kidLayoutData = state.tableFrame->GetCellLayoutData((nsTableCellFrame*)kidFrame);
|
||||
kidLayoutData->SetDesiredSize(&desiredSize);
|
||||
kidLayoutData->SetMaxElementSize(&kidMaxElementSize);
|
||||
|
||||
// Now reflow the cell again this time constraining the width
|
||||
// XXX Skip this for the time being, because the table code is going to
|
||||
// reflow the entire table anyway...
|
||||
|
||||
// XXX Compute desired size...
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user