Bug 430150: During print-selection, use zoom ratio to scale y-position and height of selection, so that it doesn't get shifted too far when we move it to top of page. r+sr=roc a1.9=damons

This commit is contained in:
dholbert@cs.stanford.edu 2008-04-21 18:22:48 -07:00
parent 7e014b1722
commit 0a13ac092b

View File

@ -2199,15 +2199,18 @@ nsPrintEngine::DoPrint(nsPrintObject * aPO)
{
startRect.y -= margin.top;
endRect.y -= margin.top;
nscoord selectionHgt = endRect.y + endRect.height - startRect.y;
// XXX This is temporary fix for printing more than one page of a selection
pageSequence->SetSelectionHeight(startRect.y, endRect.y+endRect.height-startRect.y);
pageSequence->SetSelectionHeight(startRect.y * aPO->mZoomRatio,
selectionHgt * aPO->mZoomRatio);
// calc total pages by getting calculating the selection's height
// and then dividing it by how page content frames will fit.
nscoord selectionHgt = endRect.y + endRect.height - startRect.y;
nscoord pageWidth, pageHeight;
mPrt->mPrintDC->GetDeviceSurfaceDimensions(pageWidth, pageHeight);
pageHeight -= margin.top + margin.bottom;
// XXXdholbert does this num-pages calculation need to take
// aPO->mZoomRatio into consideration?
PRInt32 totalPages = NSToIntCeil(float(selectionHgt) / float(pageHeight));
pageSequence->SetTotalNumPages(totalPages);
}