From df5341b795d00b8ba64eb94cd4b364cb2afcb1bb Mon Sep 17 00:00:00 2001 From: "dholbert%cs.stanford.edu" Date: Thu, 7 Feb 2008 23:08:00 +0000 Subject: [PATCH] Bug 415012: Fix deadSpaceGap computation and restore deadSpaceGap subtraction in PrintPreviewNavigate. r+sr=roc, a1.9=beltzner git-svn-id: svn://10.0.0.236/trunk@245182 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsDocumentViewer.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mozilla/layout/base/nsDocumentViewer.cpp b/mozilla/layout/base/nsDocumentViewer.cpp index 225741fdd33..ba9bd02ee06 100644 --- a/mozilla/layout/base/nsDocumentViewer.cpp +++ b/mozilla/layout/base/nsDocumentViewer.cpp @@ -3657,16 +3657,16 @@ DocumentViewerImpl::PrintPreviewNavigate(PRInt16 aType, PRInt32 aPageNum) if (NS_SUCCEEDED(CallQueryInterface(seqFrame, &sqf))) { sqf->GetDeadSpaceValue(&deadSpaceGapTwips); } - nscoord deadSpaceGap = mPresContext->TwipsToAppUnits(deadSpaceGapTwips); - // XXXdholbert: deadSpaceGap should be subtracted from - // fndPageFrame->GetPosition().y, before the scaling. However, - // deadSpaceGap isn't matching up to the actual visible dead space in Print - // Preview right now -- see bug 414075. Hence, ignoring deadSpaceGap for - // now -- instead, we'll navigate to exactly the top of the given page. + // To compute deadSpaceGap, use the same presContext as was used + // to layout the seqFrame. (That presContext may have different + // TwipsToAppUnits conversion from this->mPresContext) + nscoord deadSpaceGap = + seqFrame->PresContext()->TwipsToAppUnits(deadSpaceGapTwips); + nscoord newYPosn = nscoord(mPrintEngine->GetPrintPreviewScale() * - float(fndPageFrame->GetPosition().y)); + float(fndPageFrame->GetPosition().y - deadSpaceGap)); scrollableView->ScrollTo(0, newYPosn, PR_TRUE); } return NS_OK;