Bug 510465 - Initial zoom level of print preview depends on the zoom level of galley presentation, r=roc

This commit is contained in:
Olli Pettay 2009-08-24 12:55:28 +03:00
Родитель 7577eb3a8a
Коммит 7a7eb02706
3 изменённых файлов: 14 добавлений и 11 удалений

Просмотреть файл

@ -3687,7 +3687,10 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
NS_ENSURE_TRUE(mPrintEngine, NS_ERROR_OUT_OF_MEMORY);
rv = mPrintEngine->Initialize(this, docShell, mDocument,
mDeviceContext, mParentWidget,
float(mDeviceContext->AppUnitsPerInch()) /
float(mDeviceContext->AppUnitsPerDevPixel()) /
mPageZoom,
mParentWidget,
#ifdef NS_DEBUG
mDebugFile
#else
@ -3750,7 +3753,10 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings,
NS_ENSURE_TRUE(mPrintEngine, NS_ERROR_OUT_OF_MEMORY);
rv = mPrintEngine->Initialize(this, docShell, mDocument,
mDeviceContext, mParentWidget,
float(mDeviceContext->AppUnitsPerInch()) /
float(mDeviceContext->AppUnitsPerDevPixel()) /
mPageZoom,
mParentWidget,
#ifdef NS_DEBUG
mDebugFile
#else

Просмотреть файл

@ -258,7 +258,7 @@ nsPrintEngine::nsPrintEngine() :
mIsDoingPrintPreview(PR_FALSE),
mProgressDialogIsShown(PR_FALSE),
mContainer(nsnull),
mDeviceContext(nsnull),
mScreenDPI(115.0f),
mPrt(nsnull),
mPagePrintTimer(nsnull),
mPageSeqFrame(nsnull),
@ -316,20 +316,19 @@ void nsPrintEngine::DestroyPrintingData()
nsresult nsPrintEngine::Initialize(nsIDocumentViewerPrint* aDocViewerPrint,
nsISupports* aContainer,
nsIDocument* aDocument,
nsIDeviceContext* aDevContext,
float aScreenDPI,
nsIWidget* aParentWidget,
FILE* aDebugFile)
{
NS_ENSURE_ARG_POINTER(aDocViewerPrint);
NS_ENSURE_ARG_POINTER(aContainer);
NS_ENSURE_ARG_POINTER(aDocument);
NS_ENSURE_ARG_POINTER(aDevContext);
NS_ENSURE_ARG_POINTER(aParentWidget);
mDocViewerPrint = aDocViewerPrint;
mContainer = aContainer; // weak reference
mDocument = aDocument;
mDeviceContext = aDevContext; // weak reference
mScreenDPI = aScreenDPI;
mParentWidget = aParentWidget;
mDebugFile = aDebugFile; // ok to be NULL
@ -1991,9 +1990,7 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO)
// Calculate scale factor from printer to screen
float printDPI = float(mPrt->mPrintDC->AppUnitsPerInch()) /
float(mPrt->mPrintDC->AppUnitsPerDevPixel());
float screenDPI = float(mDeviceContext->AppUnitsPerInch()) /
float(mDeviceContext->AppUnitsPerDevPixel());
aPO->mPresContext->SetPrintPreviewScale(screenDPI / printDPI);
aPO->mPresContext->SetPrintPreviewScale(mScreenDPI / printDPI);
rv = aPO->mPresShell->InitialReflow(adjSize.width, adjSize.height);

Просмотреть файл

@ -104,7 +104,7 @@ public:
nsresult Initialize(nsIDocumentViewerPrint* aDocViewerPrint,
nsISupports* aContainer,
nsIDocument* aDocument,
nsIDeviceContext* aDevContext,
float aScreenDPI,
nsIWidget* aParentWidget,
FILE* aDebugFile);
@ -282,7 +282,7 @@ protected:
nsCOMPtr<nsIDocumentViewerPrint> mDocViewerPrint;
nsISupports* mContainer; // [WEAK] it owns me!
nsIDeviceContext* mDeviceContext; // not ref counted
float mScreenDPI;
nsPrintData* mPrt;
nsPagePrintTimer* mPagePrintTimer;