diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index a8d1ceb0a5e..cb0d16d1ca1 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -5433,9 +5433,12 @@ nsDocShell::RestoreFromHistory() nsCOMPtr oldMUDV(do_QueryInterface(mContentViewer)); nsCOMPtr newMUDV(do_QueryInterface(viewer)); - float zoom = 1.0; - if (oldMUDV && newMUDV) - oldMUDV->GetTextZoom(&zoom); + float textZoom = 1.0f; + float pageZoom = 1.0f; + if (oldMUDV && newMUDV) { + oldMUDV->GetTextZoom(&textZoom); + oldMUDV->GetFullZoom(&pageZoom); + } // Protect against mLSHE going away via a load triggered from // pagehide or unload. @@ -5614,8 +5617,10 @@ nsDocShell::RestoreFromHistory() FavorPerformanceHint(PR_TRUE, NS_EVENT_STARVATION_DELAY_HINT); - if (oldMUDV && newMUDV) - newMUDV->SetTextZoom(zoom); + if (oldMUDV && newMUDV) { + newMUDV->SetTextZoom(textZoom); + newMUDV->SetFullZoom(pageZoom); + } nsCOMPtr document = do_QueryInterface(domDoc); if (document) { @@ -5947,6 +5952,7 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer) PRInt32 hintCharsetSource; nsCAutoString prevDocCharset; float textZoom; + float pageZoom; PRBool styleDisabled; // |newMUDV| also serves as a flag to set the data from the above vars nsCOMPtr newMUDV; @@ -5996,6 +6002,9 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer) NS_ENSURE_SUCCESS(oldMUDV-> GetTextZoom(&textZoom), NS_ERROR_FAILURE); + NS_ENSURE_SUCCESS(oldMUDV-> + GetFullZoom(&pageZoom), + NS_ERROR_FAILURE); NS_ENSURE_SUCCESS(oldMUDV-> GetAuthorStyleDisabled(&styleDisabled), NS_ERROR_FAILURE); @@ -6130,6 +6139,8 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer) NS_ERROR_FAILURE); NS_ENSURE_SUCCESS(newMUDV->SetTextZoom(textZoom), NS_ERROR_FAILURE); + NS_ENSURE_SUCCESS(newMUDV->SetFullZoom(pageZoom), + NS_ERROR_FAILURE); NS_ENSURE_SUCCESS(newMUDV->SetAuthorStyleDisabled(styleDisabled), NS_ERROR_FAILURE); } diff --git a/mozilla/layout/base/nsDocumentViewer.cpp b/mozilla/layout/base/nsDocumentViewer.cpp index 5904f02915d..4ca42f4ac65 100644 --- a/mozilla/layout/base/nsDocumentViewer.cpp +++ b/mozilla/layout/base/nsDocumentViewer.cpp @@ -412,6 +412,7 @@ protected: nsIWidget* mParentWidget; // purposely won't be ref counted float mTextZoom; // Text zoom, defaults to 1.0 + float mPageZoom; PRInt16 mNumURLStarts; PRInt16 mDestroyRefCount; // a second "refcount" for the document viewer's "destroy" @@ -507,7 +508,7 @@ void DocumentViewerImpl::PrepareToStartLoad() // Note: operator new zeros our memory, so no need to init things to null. DocumentViewerImpl::DocumentViewerImpl() - : mTextZoom(1.0), + : mTextZoom(1.0), mPageZoom(1.0), mIsSticky(PR_TRUE), mHintCharsetSource(kCharsetUninitialized) { @@ -682,12 +683,13 @@ DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow) nsRect bounds; mWindow->GetBounds(bounds); - nscoord width = mPresContext->DevPixelsToAppUnits(bounds.width); - nscoord height = mPresContext->DevPixelsToAppUnits(bounds.height); + nscoord width = mPresContext->DeviceContext()->UnscaledAppUnitsPerDevPixel() * bounds.width; + nscoord height = mPresContext->DeviceContext()->UnscaledAppUnitsPerDevPixel() * bounds.height; mViewManager->DisableRefresh(); mViewManager->SetWindowDimensions(width, height); mPresContext->SetTextZoom(mTextZoom); + mPresContext->SetFullZoom(mPageZoom); // Setup default view manager background color @@ -2716,6 +2718,7 @@ DocumentViewerImpl::GetTextZoom(float* aTextZoom) NS_IMETHODIMP DocumentViewerImpl::SetFullZoom(float aFullZoom) { + mPageZoom = aFullZoom; struct ZoomInfo ZoomInfo = { aFullZoom }; CallChildren(SetChildFullZoom, &ZoomInfo); if (mPresContext) { @@ -2729,7 +2732,9 @@ NS_IMETHODIMP DocumentViewerImpl::GetFullZoom(float* aFullZoom) { NS_ENSURE_ARG_POINTER(aFullZoom); - *aFullZoom = mPresContext ? mPresContext->GetFullZoom() : 1.0; + NS_ASSERTION(!mPresContext || mPresContext->GetFullZoom() == mPageZoom, + "mPresContext->GetFullZoom() != mPageZoom"); + *aFullZoom = mPresContext ? mPresContext->GetFullZoom() : 1.0f; return NS_OK; }