Bug 1309272, part 6 - Add page start/end arguments to the PrintTarget::BeginPrinting virtual method and overloads. r=lsalzman
authorJonathan Watt <jwatt@jwatt.org>
Tue, 29 Nov 2016 07:54:30 +0000
changeset 324643 2ed482c5658daf17a53da846596258348fbf74a2
parent 324642 40e828d5ac43ca22a27c3adea2b01ffa4e062dec
child 324644 39c61d16e30fa69c87833e721cb7d5c119c0cd6d
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewerslsalzman
bugs1309272
milestone53.0a1
Bug 1309272, part 6 - Add page start/end arguments to the PrintTarget::BeginPrinting virtual method and overloads. r=lsalzman
gfx/src/nsDeviceContext.cpp
gfx/thebes/PrintTarget.h
gfx/thebes/PrintTargetPS.cpp
gfx/thebes/PrintTargetPS.h
gfx/thebes/PrintTargetThebes.cpp
gfx/thebes/PrintTargetThebes.h
gfx/thebes/PrintTargetWindows.cpp
gfx/thebes/PrintTargetWindows.h
--- a/gfx/src/nsDeviceContext.cpp
+++ b/gfx/src/nsDeviceContext.cpp
@@ -476,17 +476,18 @@ nsDeviceContext::InitForPrinting(nsIDevi
 }
 
 nsresult
 nsDeviceContext::BeginDocument(const nsAString& aTitle,
                                const nsAString& aPrintToFileName,
                                int32_t          aStartPage,
                                int32_t          aEndPage)
 {
-    nsresult rv = mPrintTarget->BeginPrinting(aTitle, aPrintToFileName);
+    nsresult rv = mPrintTarget->BeginPrinting(aTitle, aPrintToFileName,
+                                              aStartPage, aEndPage);
 
     if (NS_SUCCEEDED(rv) && mDeviceContextSpec) {
       rv = mDeviceContextSpec->BeginDocument(aTitle, aPrintToFileName,
                                              aStartPage, aEndPage);
     }
 
     return rv;
 }
--- a/gfx/thebes/PrintTarget.h
+++ b/gfx/thebes/PrintTarget.h
@@ -25,17 +25,19 @@ class DrawEventRecorder;
  */
 class PrintTarget {
 public:
 
   NS_INLINE_DECL_REFCOUNTING(PrintTarget);
 
   /// Must be matched 1:1 by an EndPrinting/AbortPrinting call.
   virtual nsresult BeginPrinting(const nsAString& aTitle,
-                                 const nsAString& aPrintToFileName) {
+                                 const nsAString& aPrintToFileName,
+                                 int32_t aStartPage,
+                                 int32_t aEndPage) {
     return NS_OK;
   }
   virtual nsresult EndPrinting() {
     return NS_OK;
   }
   virtual nsresult AbortPrinting() {
 #ifdef DEBUG
     mHasActivePage = false;
--- a/gfx/thebes/PrintTargetPS.cpp
+++ b/gfx/thebes/PrintTargetPS.cpp
@@ -74,17 +74,19 @@ PrintTargetPS::CreateOrNull(nsIOutputStr
   // The new object takes ownership of our surface reference.
   RefPtr<PrintTargetPS> target = new PrintTargetPS(surface, aSizeInPoints,
                                                    aStream, aOrientation);
   return target.forget();
 }
 
 nsresult
 PrintTargetPS::BeginPrinting(const nsAString& aTitle,
-                             const nsAString& aPrintToFileName)
+                             const nsAString& aPrintToFileName,
+                             int32_t aStartPage,
+                             int32_t aEndPage)
 {
   if (mOrientation == PORTRAIT) {
     cairo_ps_surface_dsc_comment(mCairoSurface, "%%Orientation: Portrait");
   } else {
     cairo_ps_surface_dsc_comment(mCairoSurface, "%%Orientation: Landscape");
   }
   return NS_OK;
 }
--- a/gfx/thebes/PrintTargetPS.h
+++ b/gfx/thebes/PrintTargetPS.h
@@ -24,17 +24,19 @@ public:
   };
 
   static already_AddRefed<PrintTargetPS>
   CreateOrNull(nsIOutputStream *aStream,
                IntSize aSizeInPoints,
                PageOrientation aOrientation);
 
   virtual nsresult BeginPrinting(const nsAString& aTitle,
-                                 const nsAString& aPrintToFileName) override;
+                                 const nsAString& aPrintToFileName,
+                                 int32_t aStartPage,
+                                 int32_t aEndPage) override;
   virtual nsresult EndPage() override;
   virtual void Finish() override;
 
   virtual bool GetRotateForLandscape() {
     return (mOrientation == LANDSCAPE);
   }
 
 private:
--- a/gfx/thebes/PrintTargetThebes.cpp
+++ b/gfx/thebes/PrintTargetThebes.cpp
@@ -73,17 +73,19 @@ PrintTargetThebes::GetReferenceDrawTarge
     }
     mRefDT = dt->CreateSimilarDrawTarget(IntSize(1,1), dt->GetFormat());
   }
   return do_AddRef(mRefDT);
 }
 
 nsresult
 PrintTargetThebes::BeginPrinting(const nsAString& aTitle,
-                                 const nsAString& aPrintToFileName)
+                                 const nsAString& aPrintToFileName,
+                                 int32_t aStartPage,
+                                 int32_t aEndPage)
 {
   return mGfxSurface->BeginPrinting(aTitle, aPrintToFileName);
 }
 
 nsresult
 PrintTargetThebes::EndPrinting()
 {
   return mGfxSurface->EndPrinting();
--- a/gfx/thebes/PrintTargetThebes.h
+++ b/gfx/thebes/PrintTargetThebes.h
@@ -25,17 +25,19 @@ namespace gfx {
  */
 class PrintTargetThebes final : public PrintTarget {
 public:
 
   static already_AddRefed<PrintTargetThebes>
   CreateOrNull(gfxASurface* aSurface);
 
   virtual nsresult BeginPrinting(const nsAString& aTitle,
-                                 const nsAString& aPrintToFileName) override;
+                                 const nsAString& aPrintToFileName,
+                                 int32_t aStartPage,
+                                 int32_t aEndPage) override;
   virtual nsresult EndPrinting() override;
   virtual nsresult AbortPrinting() override;
   virtual nsresult BeginPage() override;
   virtual nsresult EndPage() override;
   virtual void Finish() override;
 
   virtual already_AddRefed<DrawTarget>
   MakeDrawTarget(const IntSize& aSize,
--- a/gfx/thebes/PrintTargetWindows.cpp
+++ b/gfx/thebes/PrintTargetWindows.cpp
@@ -50,17 +50,19 @@ PrintTargetWindows::CreateOrNull(HDC aDC
   RefPtr<PrintTargetWindows> target =
     new PrintTargetWindows(surface, size, aDC);
 
   return target.forget();
 }
 
 nsresult
 PrintTargetWindows::BeginPrinting(const nsAString& aTitle,
-                                  const nsAString& aPrintToFileName)
+                                  const nsAString& aPrintToFileName,
+                                  int32_t aStartPage,
+                                  int32_t aEndPage)
 {
   const uint32_t DOC_TITLE_LENGTH = MAX_PATH - 1;
 
   DOCINFOW docinfo;
 
   nsString titleStr(aTitle);
   if (titleStr.Length() > DOC_TITLE_LENGTH) {
     titleStr.SetLength(DOC_TITLE_LENGTH - 3);
--- a/gfx/thebes/PrintTargetWindows.h
+++ b/gfx/thebes/PrintTargetWindows.h
@@ -19,17 +19,19 @@ namespace gfx {
  */
 class PrintTargetWindows final : public PrintTarget
 {
 public:
   static already_AddRefed<PrintTargetWindows>
   CreateOrNull(HDC aDC);
 
   virtual nsresult BeginPrinting(const nsAString& aTitle,
-                                 const nsAString& aPrintToFileName) override;
+                                 const nsAString& aPrintToFileName,
+                                 int32_t aStartPage,
+                                 int32_t aEndPage) override;
   virtual nsresult EndPrinting() override;
   virtual nsresult AbortPrinting() override;
   virtual nsresult BeginPage() override;
   virtual nsresult EndPage() override;
 
 private:
   PrintTargetWindows(cairo_surface_t* aCairoSurface,
                      const IntSize& aSize,