Bug 1416712 - Remove nsPaperPS as it seems to be dead code r?karlt draft
authorSylvestre Ledru <sledru@mozilla.com>
Mon, 13 Nov 2017 11:24:47 +0100
changeset 697101 e05d1bda0168dcfd92f15d262dd531a72a4ed36a
parent 697100 855a380bdb4d87351707d446c9d1afbeee3b3503
child 740018 0416b3e9d750ca34b21a8aab5b0dc8c761e58cb7
push id88891
push userbmo:sledru@mozilla.com
push dateMon, 13 Nov 2017 10:27:32 +0000
reviewerskarlt
bugs1416712
milestone59.0a1
Bug 1416712 - Remove nsPaperPS as it seems to be dead code r?karlt MozReview-Commit-ID: IWbo6cXDyiy
widget/gtk/moz.build
widget/gtk/nsDeviceContextSpecG.cpp
widget/gtk/nsPaperPS.cpp
widget/gtk/nsPaperPS.h
widget/gtk/nsSound.cpp
--- a/widget/gtk/moz.build
+++ b/widget/gtk/moz.build
@@ -65,17 +65,16 @@ if CONFIG['MOZ_X11']:
         'InProcessX11CompositorWidget.h',
         'X11CompositorWidget.h',
     ]
 
 if CONFIG['NS_PRINTING']:
     UNIFIED_SOURCES += [
         'nsCUPSShim.cpp',
         'nsDeviceContextSpecG.cpp',
-        'nsPaperPS.cpp',
         'nsPrintDialogGTK.cpp',
         'nsPrintOptionsGTK.cpp',
         'nsPrintSettingsGTK.cpp',
         'nsPSPrinters.cpp',
     ]
 
 if CONFIG['MOZ_X11']:
     UNIFIED_SOURCES += [
--- a/widget/gtk/nsDeviceContextSpecG.cpp
+++ b/widget/gtk/nsDeviceContextSpecG.cpp
@@ -14,17 +14,16 @@
 
 #include "nsPrintfCString.h"
 #include "nsReadableUtils.h"
 #include "nsStringEnumerator.h"
 #include "nsIServiceManager.h" 
 #include "nsThreadUtils.h"
 
 #include "nsPSPrinters.h"
-#include "nsPaperPS.h"  /* Paper size list */
 
 #include "nsPrintSettingsGTK.h"
 
 #include "nsIFileStreams.h"
 #include "nsIFile.h"
 #include "nsTArray.h"
 #include "nsThreadUtils.h"
 
deleted file mode 100644
--- a/widget/gtk/nsPaperPS.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ex: set tabstop=8 softtabstop=4 shiftwidth=4 expandtab: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/ArrayUtils.h"
- 
-#include "nsPaperPS.h"
-#include "plstr.h"
-#include "nsCoord.h"
-#include "nsMemory.h"
-
-using namespace mozilla;
-
-const nsPaperSizePS_ nsPaperSizePS::mList[] =
-{
-#define SIZE_MM(x)      (x)
-#define SIZE_INCH(x)    ((x) * MM_PER_INCH_FLOAT)
-    { "A5",             SIZE_MM(148),   SIZE_MM(210),   true },
-    { "A4",             SIZE_MM(210),   SIZE_MM(297),   true },
-    { "A3",             SIZE_MM(297),   SIZE_MM(420),   true },
-    { "Letter",         SIZE_INCH(8.5), SIZE_INCH(11),  false },
-    { "Legal",          SIZE_INCH(8.5), SIZE_INCH(14),  false },
-    { "Tabloid",        SIZE_INCH(11),  SIZE_INCH(17),  false },
-    { "Executive",      SIZE_INCH(7.5), SIZE_INCH(10),  false },
-#undef SIZE_INCH
-#undef SIZE_MM
-};
-
-const unsigned int nsPaperSizePS::mCount = ArrayLength(mList);
-
-bool
-nsPaperSizePS::Find(const char *aName)
-{
-    for (int i = mCount; i--; ) {
-        if (!PL_strcasecmp(aName, mList[i].name)) {
-            mCurrent = i;
-            return true;
-        }
-    }
-    return false;
-}
deleted file mode 100644
--- a/widget/gtk/nsPaperPS.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ex: set tabstop=8 softtabstop=4 shiftwidth=4 expandtab: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
- 
-#ifndef _PAPERPS_H_
-#define _PAPERPS_H_
-
-#include "nsDebug.h"
-
-struct nsPaperSizePS_ {
-    const char *name;
-    float width_mm;
-    float height_mm;
-    bool isMetric;        // Present to the user in metric, if possible
-};
-
-class nsPaperSizePS {
-    public:
-        /** ---------------------------------------------------
-         * Constructor
-         */
-        nsPaperSizePS() { mCurrent = 0; }
-
-        /** ---------------------------------------------------
-         * @return true if the cursor points past the last item.
-         */
-        bool AtEnd() { return mCurrent >= mCount; }
-
-        /** ---------------------------------------------------
-         * Position the cursor at the beginning of the paper size list.
-         * @return VOID
-         */
-        void First() { mCurrent = 0; }
-
-        /** ---------------------------------------------------
-         * Advance the cursor to the next item.
-         * @return VOID
-         */
-        void Next() {
-            NS_ASSERTION(!AtEnd(), "Invalid current item");
-            mCurrent++;
-        }
-
-        /** ---------------------------------------------------
-         * Point the cursor to the entry with the given paper name.
-         * @return true if pointing to a valid entry.
-         */
-        bool Find(const char *aName);
-
-        /** ---------------------------------------------------
-         * @return a pointer to the name of the current paper size
-         */
-        const char *Name() {
-            NS_PRECONDITION(!AtEnd(), "Invalid current item");
-            return mList[mCurrent].name;
-        }
-
-        /** ---------------------------------------------------
-         * @return the width of the page in millimeters
-         */
-        float Width_mm() {
-            NS_PRECONDITION(!AtEnd(), "Invalid current item");
-            return mList[mCurrent].width_mm;
-        }
-
-        /** ---------------------------------------------------
-         * @return the height of the page in millimeters
-         */
-        float Height_mm() {
-            NS_PRECONDITION(!AtEnd(), "Invalid current item");
-            return mList[mCurrent].height_mm;
-        }
-
-        /** ---------------------------------------------------
-         * @return true if the paper should be presented to
-         *                 the user in metric units.
-         */
-        bool IsMetric() {
-            NS_PRECONDITION(!AtEnd(), "Invalid current item");
-            return mList[mCurrent].isMetric;
-        }
-
-    private:
-        unsigned int mCurrent;
-        static const nsPaperSizePS_ mList[];
-        static const unsigned int mCount;
-};
-
-#endif
-
--- a/widget/gtk/nsSound.cpp
+++ b/widget/gtk/nsSound.cpp
@@ -121,17 +121,17 @@ ca_context_get_default()
         if (sound_theme_name) {
             ca_context_change_props(ctx, "canberra.xdg-theme.name",
                                     sound_theme_name, nullptr);
             g_free(sound_theme_name);
         }
     }
 
     nsAutoString wbrand;
-    WidgetUtils::GetBrandShortName(wbrand);
+    mozilla::widget::WidgetUtils::GetBrandShortName(wbrand);
     ca_context_change_props(ctx, "application.name",
                             NS_ConvertUTF16toUTF8(wbrand).get(),
                             nullptr);
 
     nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
     if (appInfo) {
         nsAutoCString version;
         appInfo->GetVersion(version);
@@ -220,17 +220,17 @@ StaticRefPtr<nsISound> sInstance;
 }
 /* static */ already_AddRefed<nsISound>
 nsSound::GetInstance()
 {
     using namespace mozilla::sound;
 
     if (!sInstance) {
         if (gfxPlatform::IsHeadless()) {
-            sInstance = new widget::HeadlessSound();
+            sInstance = new mozilla::widget::HeadlessSound();
         } else {
             sInstance = new nsSound();
         }
         ClearOnShutdown(&sInstance);
     }
 
     RefPtr<nsISound> service = sInstance.get();
     return service.forget();