Change STF to use an unconstrainad reflow instead of searching for the widest frame

Bug 168961 r=dcone sr=kin


git-svn-id: svn://10.0.0.236/trunk@130082 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rods%netscape.com
2002-09-19 21:45:07 +00:00
parent 2b788f5bfc
commit 1b7abf58ea
21 changed files with 294 additions and 483 deletions

View File

@@ -47,6 +47,7 @@
#include "nsIDeviceContext.h"
#include "nsReadableUtils.h"
#include "nsIPrintPreviewContext.h"
#include "nsSimplePageSequence.h"
#include "nsIView.h"
@@ -90,9 +91,32 @@ NS_IMETHODIMP nsPageContentFrame::Reflow(nsIPresContext* aPresContext,
nsSize maxSize(aReflowState.availableWidth, aReflowState.availableHeight);
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, frame, maxSize);
// Get the child's desired size
// Check to see if we need to do an unconstrained reflow
// If so, then cache the size the page was SUPPOSE to be reflowed to
// so we can use it later to determine a percentage.
PRBool doUnconstrained = PR_FALSE;
if (mPD && mPD->mPrintOptions) {
mPD->mPrintOptions->GetDoUncontrainedReflow(&doUnconstrained);
if (doUnconstrained) {
mPD->mPageContextSize = aReflowState.availableWidth;
maxSize.width = NS_UNCONSTRAINEDSIZE;
kidReflowState.availableWidth = NS_UNCONSTRAINEDSIZE;
kidReflowState.mComputedWidth = NS_UNCONSTRAINEDSIZE;
}
}
// Reflow the page content area to get the child's desired size
ReflowChild(frame, aPresContext, aDesiredSize, kidReflowState, 0, 0, 0, aStatus);
// This is where we cache the true uncontrained size of the document
// each page may end up with a different constrained size,
// so we must only keep the largest size of all the pages
if (doUnconstrained) {
if (mPD->mPageContextSizeUC == 0 || mPD->mPageContextSizeUC < aDesiredSize.width) {
mPD->mPageContextSizeUC = aDesiredSize.width;
}
}
// Place and size the child
FinishReflowChild(frame, aPresContext, &kidReflowState, aDesiredSize, 0, 0, 0);