Bug 389359: In print-preview jump-to-page, scale page-position so we arrive at correct spot. r+sr=roc, a=blocking1.9+

This commit is contained in:
dholbert@cs.stanford.edu 2008-01-29 12:14:51 -08:00
parent bf3813bca3
commit 122cc4ab89
2 changed files with 12 additions and 2 deletions

View File

@ -3659,8 +3659,15 @@ DocumentViewerImpl::PrintPreviewNavigate(PRInt16 aType, PRInt32 aPageNum)
}
nscoord deadSpaceGap = mPresContext->TwipsToAppUnits(deadSpaceGapTwips);
// scroll so that top of page (plus the gray area) is at the top of the scroll area
scrollableView->ScrollTo(0, fndPageFrame->GetPosition().y-deadSpaceGap, PR_TRUE);
// 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.
nscoord newYPosn =
nscoord(mPrintEngine->GetPrintPreviewScale() *
float(fndPageFrame->GetPosition().y));
scrollableView->ScrollTo(0, newYPosn, PR_TRUE);
}
return NS_OK;

View File

@ -199,6 +199,9 @@ public:
nsIViewManager* GetPrintPreviewViewManager() {return mPrtPreview->mPrintObject->mViewManager;}
float GetPrintPreviewScale() { return mPrtPreview->mPrintObject->
mPresContext->GetPrintPreviewScale(); }
static nsIPresShell* GetPresShellFor(nsIDocShell* aDocShell);
// These calls also update the DocViewer