Bug 1482665 Part 5 - Remove nsDeviceContext::AppUnitsPerCSSInch() and replace it with mozilla::AppUnitsPerCSSInch(). r=dholbert
authorTing-Yu Lin <tlin@mozilla.com>
Sat, 11 Aug 2018 15:25:59 -0700
changeset 486426 0bbf7aa0ab2e54adcd0f2234e77a4603b6c4dd2b
parent 486425 ed67e5b2479a9d37ccfeeb5d215acb89e37c3c45
child 486427 971b4826653d4461a155ea08a36411dece3ba9ed
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1482665
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1482665 Part 5 - Remove nsDeviceContext::AppUnitsPerCSSInch() and replace it with mozilla::AppUnitsPerCSSInch(). r=dholbert Differential Revision: https://phabricator.services.mozilla.com/D3158
gfx/src/nsDeviceContext.h
layout/base/nsDocumentViewer.cpp
layout/printing/nsPrintJob.cpp
--- a/gfx/src/nsDeviceContext.h
+++ b/gfx/src/nsDeviceContext.h
@@ -104,22 +104,16 @@ public:
     /**
      * Gets the number of app units in one physical inch; this is the
      * device's DPI times AppUnitsPerDevPixel().
      */
     int32_t AppUnitsPerPhysicalInch() const
     { return mAppUnitsPerPhysicalInch; }
 
     /**
-     * Gets the number of app units in one CSS inch; this is
-     * 96 times AppUnitsPerCSSPixel.
-     */
-    static int32_t AppUnitsPerCSSInch() { return mozilla::AppUnitsPerCSSInch(); }
-
-    /**
      * Get the ratio of app units to dev pixels that would be used at unit
      * (100%) full zoom.
      */
     int32_t AppUnitsPerDevPixelAtUnitFullZoom() const
     { return mAppUnitsPerDevPixelAtUnitFullZoom; }
 
     /**
      * Get the nsFontMetrics that describe the properties of
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -3923,17 +3923,17 @@ nsDocumentViewer::Print(nsIPrintSettings
   // Release()'d in Destroy().  Therefore, we need to grab the instance with
   // a local variable, so that it won't be deleted during its own method.
   RefPtr<nsPrintJob> printJob = mPrintJob;
   if (!printJob) {
     NS_ENSURE_STATE(mDeviceContext);
     printJob = new nsPrintJob();
 
     rv = printJob->Initialize(this, mContainer, mDocument,
-                              float(mDeviceContext->AppUnitsPerCSSInch()) /
+                              float(AppUnitsPerCSSInch()) /
                               float(mDeviceContext->AppUnitsPerDevPixel()) /
                               mPageZoom);
     if (NS_FAILED(rv)) {
       printJob->Destroy();
       return rv;
     }
     mPrintJob = printJob;
   }
@@ -4007,17 +4007,17 @@ nsDocumentViewer::PrintPreview(nsIPrintS
   // Our call to nsPrintJob::PrintPreview() may cause mPrintJob to be
   // Release()'d in Destroy().  Therefore, we need to grab the instance with
   // a local variable, so that it won't be deleted during its own method.
   RefPtr<nsPrintJob> printJob = mPrintJob;
   if (!printJob) {
     printJob = new nsPrintJob();
 
     rv = printJob->Initialize(this, mContainer, doc,
-                              float(mDeviceContext->AppUnitsPerCSSInch()) /
+                              float(AppUnitsPerCSSInch()) /
                               float(mDeviceContext->AppUnitsPerDevPixel()) /
                               mPageZoom);
     if (NS_FAILED(rv)) {
       printJob->Destroy();
       return rv;
     }
     mPrintJob = printJob;
   }
--- a/layout/printing/nsPrintJob.cpp
+++ b/layout/printing/nsPrintJob.cpp
@@ -1694,17 +1694,17 @@ nsPrintJob::ReconstructAndReflow(bool do
       "mPresContext and mPresShell shouldn't be nullptr when the print object "
       "has been marked as \"print the document\"");
 
     UpdateZoomRatio(po, doSetPixelScale);
 
     po->mPresContext->SetPageScale(po->mZoomRatio);
 
     // Calculate scale factor from printer to screen
-    float printDPI = float(printData->mPrintDC->AppUnitsPerCSSInch()) /
+    float printDPI = float(AppUnitsPerCSSInch()) /
                        float(printData->mPrintDC->AppUnitsPerDevPixel());
     po->mPresContext->SetPrintPreviewScale(mScreenDPI / printDPI);
 
     po->mPresShell->ReconstructFrames();
 
     // If the printing was canceled or restarted with different data,
     // let's stop doing this printing.
     if (NS_WARN_IF(mPrt != printData)) {
@@ -2383,17 +2383,17 @@ nsPrintJob::ReflowPrintObject(const Uniq
 
   aPO->mPresShell->BeginObservingDocument();
 
   aPO->mPresContext->SetPageSize(adjSize);
   aPO->mPresContext->SetVisibleArea(nsRect(0, 0, adjSize.width, adjSize.height));
   aPO->mPresContext->SetIsRootPaginatedDocument(documentIsTopLevel);
   aPO->mPresContext->SetPageScale(aPO->mZoomRatio);
   // Calculate scale factor from printer to screen
-  float printDPI = float(printData->mPrintDC->AppUnitsPerCSSInch()) /
+  float printDPI = float(AppUnitsPerCSSInch()) /
                      float(printData->mPrintDC->AppUnitsPerDevPixel());
   aPO->mPresContext->SetPrintPreviewScale(mScreenDPI / printDPI);
 
   if (mIsCreatingPrintPreview && documentIsTopLevel) {
     mDocViewerPrint->SetPrintPreviewPresentation(aPO->mViewManager,
                                                  aPO->mPresContext,
                                                  aPO->mPresShell);
   }