Bug 1551688. Make it clearer that nsIContentViewer.setPageMode() is for testing only by renaming it. r=bobowen
authorJonathan Watt <jwatt@jwatt.org>
Mon, 29 Apr 2019 14:53:25 +0100
changeset 532870 4a51777a5592e666753a6b0c84a4900f5cfe1913
parent 532869 946206b6d05bf1c42683f57249043e1eec87ec4f
child 532871 8e07958a53a27c09737a770979a19874bbb38161
push id11276
push userrgurzau@mozilla.com
push dateMon, 20 May 2019 13:11:24 +0000
treeherdermozilla-beta@847755a7c325 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbobowen
bugs1551688
milestone68.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 1551688. Make it clearer that nsIContentViewer.setPageMode() is for testing only by renaming it. r=bobowen Differential Revision: https://phabricator.services.mozilla.com/D31126
docshell/base/nsIContentViewer.idl
layout/base/nsDocumentViewer.cpp
layout/tools/reftest/reftest-content.js
--- a/docshell/base/nsIContentViewer.idl
+++ b/docshell/base/nsIContentViewer.idl
@@ -185,17 +185,18 @@ interface nsIContentViewer : nsISupports
    * the saved presentation state.
    */
   void clearHistoryEntry();
 
   /**
    * Change the layout to view the document with page layout (like print preview), but
    * dynamic and editable (like Galley layout).
    */
-  void setPageMode(in boolean aPageMode, in nsIPrintSettings aPrintSettings);
+  void setPageModeForTesting(in boolean aPageMode,
+                             in nsIPrintSettings aPrintSettings);
 
   /**
    * Get the history entry that this viewer will save itself into when
    * destroyed.  Can return null
    */
   readonly attribute nsISHEntry historyEntry;
 
   /**
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -847,17 +847,17 @@ static nsPresContext* CreatePresContext(
 // all the new objects or just initialize the existing ones
 nsresult nsDocumentViewer::InitInternal(nsIWidget* aParentWidget,
                                         nsISupports* aState,
                                         const nsIntRect& aBounds,
                                         bool aDoCreation,
                                         bool aNeedMakeCX /*= true*/,
                                         bool aForceSetNewDocument /* = true*/) {
   if (mIsPageMode) {
-    // XXXbz should the InitInternal in SetPageMode just pass false
+    // XXXbz should the InitInternal in SetPageModeForTesting just pass false
     // here itself?
     aForceSetNewDocument = false;
   }
 
   // We don't want any scripts to run here. That can cause flushing,
   // which can cause reentry into initialization of this document viewer,
   // which would be disastrous.
   nsAutoScriptBlocker blockScripts;
@@ -880,18 +880,18 @@ nsresult nsDocumentViewer::InitInternal(
     // it in one place (Show()) and require that callers call init(), open(),
     // show() in that order or something.
     if (!mPresContext &&
         (aParentWidget || containerView || mDocument->IsBeingUsedAsImage() ||
          (mDocument->GetDisplayDocument() &&
           mDocument->GetDisplayDocument()->GetPresShell()))) {
       // Create presentation context
       if (mIsPageMode) {
-        // Presentation context already created in SetPageMode which is calling
-        // this method
+        // Presentation context already created in SetPageModeForTesting which
+        // is calling this method
       } else {
         mPresContext = CreatePresContext(
             mDocument, nsPresContext::eContext_Galley, containerView);
       }
       NS_ENSURE_TRUE(mPresContext, NS_ERROR_OUT_OF_MEMORY);
 
       nsresult rv = mPresContext->Init(mDeviceContext);
       if (NS_FAILED(rv)) {
@@ -4098,18 +4098,18 @@ void nsDocumentViewer::OnDonePrinting() 
         mDocument = nullptr;
       }
       mClosingWhilePrinting = false;
     }
   }
 #endif  // NS_PRINTING && NS_PRINT_PREVIEW
 }
 
-NS_IMETHODIMP nsDocumentViewer::SetPageMode(bool aPageMode,
-                                            nsIPrintSettings* aPrintSettings) {
+NS_IMETHODIMP nsDocumentViewer::SetPageModeForTesting(
+    bool aPageMode, nsIPrintSettings* aPrintSettings) {
   // XXX Page mode is only partially working; it's currently used for
   // reftests that require a paginated context
   mIsPageMode = aPageMode;
 
   // The DestroyPresShell call requires a script blocker, since the
   // PresShell::Destroy call it does can cause scripts to run, which could
   // re-entrantly call methods on the nsDocumentViewer.
   nsAutoScriptBlocker scriptBlocker;
--- a/layout/tools/reftest/reftest-content.js
+++ b/layout/tools/reftest/reftest-content.js
@@ -214,17 +214,17 @@ function setupPrintMode() {
    ps.unwriteableMarginRight = 0;
 
    ps.headerStrLeft = "";
    ps.headerStrCenter = "";
    ps.headerStrRight = "";
    ps.footerStrLeft = "";
    ps.footerStrCenter = "";
    ps.footerStrRight = "";
-   docShell.contentViewer.setPageMode(true, ps);
+   docShell.contentViewer.setPageModeForTesting(/* aPageMode */ true, ps);
 }
 
 // Prints current page to a PDF file and calls callback when sucessfully
 // printed and written.
 function printToPdf(callback) {
     let currentDoc = content.document;
     let isPrintSelection = false;
     let printRange = '';