diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 97f5f61ff22..f8310f29d48 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -1530,36 +1530,14 @@ NS_IMETHODIMP nsDocShell::GetZoom(float *zoom) { NS_ENSURE_ARG_POINTER(zoom); - NS_ENSURE_SUCCESS(EnsureDeviceContext(), NS_ERROR_FAILURE); - - NS_ENSURE_SUCCESS(mDeviceContext->GetZoom(*zoom), NS_ERROR_FAILURE); - + *zoom = 1.0f; return NS_OK; } NS_IMETHODIMP nsDocShell::SetZoom(float zoom) { - NS_ENSURE_SUCCESS(EnsureDeviceContext(), NS_ERROR_FAILURE); - mDeviceContext->SetZoom(zoom); - - // get the pres shell - nsCOMPtr presShell; - NS_ENSURE_SUCCESS(GetPresShell(getter_AddRefs(presShell)), - NS_ERROR_FAILURE); - NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); - - // get the view manager - nsIViewManager* vm = presShell->GetViewManager(); - NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE); - - // get the root view - nsIView *rootView = nsnull; // views are not ref counted - vm->GetRootView(rootView); - if (rootView) - vm->UpdateView(rootView, 0); - - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP diff --git a/gfx/public/nsDeviceContext.h b/gfx/public/nsDeviceContext.h index 94176e1938d..c0a68427194 100644 --- a/gfx/public/nsDeviceContext.h +++ b/gfx/public/nsDeviceContext.h @@ -107,9 +107,6 @@ public: nsIFontMetrics*& aMetrics); NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics*& aMetrics); - NS_IMETHOD SetZoom(float aZoom); - NS_IMETHOD GetZoom(float &aZoom) const; - NS_IMETHOD FirstExistingFont(const nsFont& aFont, nsString& aFaceName); NS_IMETHOD GetLocalFontName(const nsString& aFaceName, nsString& aLocalName, @@ -154,7 +151,6 @@ protected: nsFontCache *mFontCache; nsCOMPtr mLocaleLangGroup; // XXX temp fix for performance bug - erik - float mZoom; nsHashtable* mFontAliasTable; float mCPixelScale; diff --git a/gfx/public/nsIDeviceContext.h b/gfx/public/nsIDeviceContext.h index ac72bcea637..36b87c7d526 100644 --- a/gfx/public/nsIDeviceContext.h +++ b/gfx/public/nsIDeviceContext.h @@ -401,11 +401,6 @@ public: */ NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics*& aMetrics) = 0; - //get and set the document zoom value used for display-time - //scaling. default is 1.0 (no zoom) - NS_IMETHOD SetZoom(float aZoom) = 0; - NS_IMETHOD GetZoom(float &aZoom) const = 0; - /** * Check to see if a particular named font exists. * @param aFontName character string of font face name diff --git a/gfx/src/nsDeviceContext.cpp b/gfx/src/nsDeviceContext.cpp index 7e299a00bd8..e4310e094ee 100644 --- a/gfx/src/nsDeviceContext.cpp +++ b/gfx/src/nsDeviceContext.cpp @@ -55,11 +55,13 @@ NS_IMPL_ISUPPORTS3(DeviceContextImpl, nsIDeviceContext, nsIObserver, nsISupports DeviceContextImpl::DeviceContextImpl() { - mFontCache = nsnull; + mDevUnitsToAppUnits = 1.0f; mAppUnitsToDevUnits = 1.0f; + mTwipsToPixels = 1.0f; + mPixelsToTwips = 1.0f; + mFontCache = nsnull; mCPixelScale = 1.0f; - mZoom = 1.0f; mWidget = nsnull; mFontAliasTable = nsnull; @@ -341,18 +343,6 @@ NS_IMETHODIMP DeviceContextImpl::GetMetricsFor(const nsFont& aFont, nsIFontMetri return mFontCache->GetMetricsFor(aFont, mLocaleLangGroup, aMetrics); } -NS_IMETHODIMP DeviceContextImpl::SetZoom(float aZoom) -{ - mZoom = aZoom; - return NS_OK; -} - -NS_IMETHODIMP DeviceContextImpl::GetZoom(float &aZoom) const -{ - aZoom = mZoom; - return NS_OK; -} - NS_IMETHODIMP DeviceContextImpl::GetDepth(PRUint32& aDepth) { aDepth = 24; diff --git a/gfx/src/thebes/nsThebesDeviceContext.cpp b/gfx/src/thebes/nsThebesDeviceContext.cpp index 4d0c65ea1bd..aec0fbb63e5 100644 --- a/gfx/src/thebes/nsThebesDeviceContext.cpp +++ b/gfx/src/thebes/nsThebesDeviceContext.cpp @@ -106,14 +106,10 @@ nsThebesDeviceContext::nsThebesDeviceContext() PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("#### Creating DeviceContext %p\n", this)); - mDevUnitsToAppUnits = 1.0f; - mAppUnitsToDevUnits = 1.0f; - mCPixelScale = 1.0f; - mZoom = 1.0f; mDepth = 0; - mDpi = -1; + mWidth = 0; + mHeight = 0; - mWidget = nsnull; mPrinter = PR_FALSE; mWidgetSurfaceCache.Init(); @@ -140,7 +136,7 @@ nsThebesDeviceContext::SetDPI(PRInt32 aPrefDPI) PRInt32 OSVal; PRBool do_round = PR_TRUE; - mDpi = 96; + PRInt32 dpi = 96; #if defined(MOZ_ENABLE_GTK2) float screenWidthIn = float(::gdk_screen_width_mm()) / 25.4f; @@ -149,22 +145,22 @@ nsThebesDeviceContext::SetDPI(PRInt32 aPrefDPI) if (aPrefDPI > 0) { // If there's a valid pref value for the logical resolution, // use it. - mDpi = aPrefDPI; + dpi = aPrefDPI; } else if ((aPrefDPI == 0) || (OSVal > 96)) { // Either if the pref is 0 (force use of OS value) or the OS // value is bigger than 96, use the OS value. - mDpi = OSVal; + dpi = OSVal; } else { // if we couldn't get the pref or it's negative, and the OS // value is under 96ppi, then use 96. - mDpi = 96; + dpi = 96; } if (mPrinter) { // cairo printing doesn't really have the // notion of DPI so we have to use 72... // XXX is this an issue? we force everything else to be 96+ - mDpi = 72; + dpi = 72; do_round = PR_FALSE; } @@ -180,13 +176,13 @@ nsThebesDeviceContext::SetDPI(PRInt32 aPrefDPI) ReleaseDC((HWND)nsnull, dc); if (OSVal != 0) - mDpi = OSVal; + dpi = OSVal; #endif int in2pt = 72; // make p2t a nice round number - this prevents rounding problems - mPixelsToTwips = float(NSIntPointsToTwips(in2pt)) / float(mDpi); + mPixelsToTwips = float(NSIntPointsToTwips(in2pt)) / float(dpi); if (do_round) mPixelsToTwips = float(NSToIntRound(mPixelsToTwips)); mTwipsToPixels = 1.0f / mPixelsToTwips; diff --git a/gfx/src/thebes/nsThebesDeviceContext.h b/gfx/src/thebes/nsThebesDeviceContext.h index f384a7c61c5..e44ff5d72c6 100644 --- a/gfx/src/thebes/nsThebesDeviceContext.h +++ b/gfx/src/thebes/nsThebesDeviceContext.h @@ -137,15 +137,10 @@ protected: PRUint32 mDepth; private: - nsNativeWidget mWidget; - nsCOMPtr mScreenManager; - float mWidthFloat; - float mHeightFloat; PRInt32 mWidth; PRInt32 mHeight; - PRInt32 mDpi; PRBool mPrinter; diff --git a/layout/printing/nsPrintData.cpp b/layout/printing/nsPrintData.cpp index b7f55c19033..42759078009 100644 --- a/layout/printing/nsPrintData.cpp +++ b/layout/printing/nsPrintData.cpp @@ -80,7 +80,7 @@ nsPrintData::nsPrintData(ePrintDataType aType) : mIsAborted(PR_FALSE), mPreparingForPrint(PR_FALSE), mDocWasToBeDestroyed(PR_FALSE), mShrinkToFit(PR_FALSE), mPrintFrameType(nsIPrintSettings::kFramesAsIs), mNumPrintableDocs(0), mNumDocsPrinted(0), mNumPrintablePages(0), mNumPagesPrinted(0), - mShrinkRatio(1.0), mOrigDCScale(1.0), mOrigZoom(1.0), mPPEventListeners(NULL), + mShrinkRatio(1.0), mOrigDCScale(1.0), mPPEventListeners(NULL), mBrandName(nsnull) { @@ -101,12 +101,6 @@ nsPrintData::nsPrintData(ePrintDataType aType) : nsPrintData::~nsPrintData() { - - // Set the cached Zoom value back into the DC - if (mPrintDC) { - mPrintDC->SetZoom(mOrigZoom); - } - // remove the event listeners if (mPPEventListeners) { mPPEventListeners->RemoveListeners(); diff --git a/layout/printing/nsPrintData.h b/layout/printing/nsPrintData.h index 52652fa55a2..042ebc6530c 100644 --- a/layout/printing/nsPrintData.h +++ b/layout/printing/nsPrintData.h @@ -158,7 +158,6 @@ public: PRInt32 mNumPagesPrinted; float mShrinkRatio; float mOrigDCScale; - float mOrigZoom; nsCOMPtr mPrintSettings; nsCOMPtr mPrintOptions; diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index a1540c300d0..d5d41b3af24 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -931,9 +931,7 @@ nsPrintEngine::PrintPreview(nsIPrintSettings* aPrintSettings, // Check to see if we need to transfer any of our old values // over to the new PrintData object if (mOldPrtPreview) { - mPrt->mOrigZoom = mOldPrtPreview->mOrigZoom; mPrt->mOrigDCScale = mOldPrtPreview->mOrigDCScale; - } else { // Get the Original PixelScale in case we need to start changing it mDeviceContext->GetCanonicalPixelScale(mPrt->mOrigDCScale); @@ -1084,10 +1082,6 @@ nsPrintEngine::PrintPreview(nsIPrintSettings* aPrintSettings, mPrt->mPrintDC = mDeviceContext; - // Cache original Zoom value and then set it to 1.0 - mPrt->mPrintDC->GetZoom(mPrt->mOrigZoom); - mPrt->mPrintDC->SetZoom(1.0f); - if (mDeviceContext) { mDeviceContext->SetUseAltDC(kUseAltDCFor_FONTMETRICS, PR_TRUE); mDeviceContext->SetUseAltDC(kUseAltDCFor_CREATERC_REFLOW, PR_TRUE);