Loading gfx/src/nsDeviceContext.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -327,14 +327,14 @@ nsresult nsDeviceContext::AbortDocument() { return rv; } nsresult nsDeviceContext::BeginPage(const IntSize& aSizeInPoints) { nsresult nsDeviceContext::BeginPage() { MOZ_DIAGNOSTIC_ASSERT(!mIsCurrentlyPrintingDoc || mPrintTarget, "What nulled out our print target while printing?"); if (mDeviceContextSpec) { MOZ_TRY(mDeviceContextSpec->BeginPage(aSizeInPoints)); MOZ_TRY(mDeviceContextSpec->BeginPage()); } if (mPrintTarget) { MOZ_TRY(mPrintTarget->BeginPage(aSizeInPoints)); MOZ_TRY(mPrintTarget->BeginPage()); } return NS_OK; } Loading gfx/src/nsDeviceContext.h +2 −12 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ #include "nscore.h" // for char16_t, nsAString #include "mozilla/AppUnits.h" // for AppUnits #include "nsFontMetrics.h" // for nsFontMetrics::Params #include "mozilla/gfx/Point.h" // for IntSize #include "mozilla/gfx/PrintTarget.h" // for PrintTarget::PageDoneCallback #include "mozilla/gfx/PrintPromise.h" Loading Loading @@ -49,8 +48,7 @@ class Screen; class nsDeviceContext final { public: using IntSize = mozilla::gfx::IntSize; using PrintTarget = mozilla::gfx::PrintTarget; typedef mozilla::gfx::PrintTarget PrintTarget; nsDeviceContext(); Loading Loading @@ -225,17 +223,9 @@ class nsDeviceContext final { * Inform the output device that output of a page is beginning * Used for print related device contexts. Must be matched 1:1 with * EndPage() and within a BeginDocument()/EndDocument() pair. * * @param aSizeInPoints - The physical dimensions of the page in points. * Currently only supported (used) by print-to-PDF * print targets, and then only to switch the * orientation for a specific page (arbitrary page * sizes are not supported by the Core Graphics print- * to-PDF APIs, for example). * * @return error status */ nsresult BeginPage(const IntSize& aSizeInPoints); nsresult BeginPage(); /** * Inform the output device that output of a page is ending Loading gfx/thebes/PrintTarget.h +1 −5 Original line number Diff line number Diff line Loading @@ -43,11 +43,7 @@ class PrintTarget { #endif return NS_OK; } /** * Note: not all print devices implement mixed page sizing. Most PrintTarget * subclasses will ignore `aSizeInPoints`. */ virtual nsresult BeginPage(const IntSize& aSizeInPoints) { virtual nsresult BeginPage() { #ifdef DEBUG MOZ_ASSERT(!mHasActivePage, "Missing EndPage() call"); mHasActivePage = true; Loading gfx/thebes/PrintTargetCG.h +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ class PrintTargetCG final : public PrintTarget { int32_t aEndPage) final; nsresult EndPrinting() final; nsresult AbortPrinting() final; nsresult BeginPage(const IntSize& aSizeInPoints) final; nsresult BeginPage() final; nsresult EndPage() final; already_AddRefed<DrawTarget> GetReferenceDrawTarget() final; Loading gfx/thebes/PrintTargetCG.mm +4 −20 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ #include "cairo.h" #include "cairo-quartz.h" #include "mozilla/gfx/HelpersCairo.h" #include "mozilla/StaticPrefs_layout.h" #include "nsObjCExceptions.h" #include "nsString.h" #include "nsIOutputStream.h" Loading Loading @@ -211,7 +210,7 @@ nsresult PrintTargetCG::AbortPrinting() { return EndPrinting(); } nsresult PrintTargetCG::BeginPage(const IntSize& aSizeInPoints) { nsresult PrintTargetCG::BeginPage() { NS_OBJC_BEGIN_TRY_BLOCK_RETURN; CGContextRef context; Loading @@ -219,15 +218,7 @@ nsresult PrintTargetCG::BeginPage(const IntSize& aSizeInPoints) { CGContextBeginPage(mPrintToStreamContext, nullptr); context = mPrintToStreamContext; } else { // XXX Why are we calling this if we don't check the return value? PMSessionError(mPrintSession); if (StaticPrefs::layout_css_page_orientation_enabled()) { ::PMOrientation pageOrientation = aSizeInPoints.width < aSizeInPoints.height ? kPMPortrait : kPMLandscape; ::PMSetOrientation(mPageFormat, pageOrientation, kPMUnlocked); // We don't need to reset the orientation, since we set it for every page. } OSStatus status = ::PMSessionBeginPageNoDialog(mPrintSession, mPageFormat, nullptr); if (status != noErr) { return NS_ERROR_ABORT; Loading @@ -242,15 +233,8 @@ nsresult PrintTargetCG::BeginPage(const IntSize& aSizeInPoints) { } } unsigned int width; unsigned int height; if (StaticPrefs::layout_css_page_orientation_enabled()) { width = static_cast<unsigned int>(aSizeInPoints.width); height = static_cast<unsigned int>(aSizeInPoints.height); } else { width = static_cast<unsigned int>(mSize.width); height = static_cast<unsigned int>(mSize.height); } unsigned int width = static_cast<unsigned int>(mSize.width); unsigned int height = static_cast<unsigned int>(mSize.height); // Initially, origin is at bottom-left corner of the paper. // Here, we translate it to top-left corner of the paper. Loading @@ -265,7 +249,7 @@ nsresult PrintTargetCG::BeginPage(const IntSize& aSizeInPoints) { mCairoSurface = surface; return PrintTarget::BeginPage(aSizeInPoints); return PrintTarget::BeginPage(); NS_OBJC_END_TRY_BLOCK_RETURN(NS_ERROR_FAILURE); } Loading Loading
gfx/src/nsDeviceContext.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -327,14 +327,14 @@ nsresult nsDeviceContext::AbortDocument() { return rv; } nsresult nsDeviceContext::BeginPage(const IntSize& aSizeInPoints) { nsresult nsDeviceContext::BeginPage() { MOZ_DIAGNOSTIC_ASSERT(!mIsCurrentlyPrintingDoc || mPrintTarget, "What nulled out our print target while printing?"); if (mDeviceContextSpec) { MOZ_TRY(mDeviceContextSpec->BeginPage(aSizeInPoints)); MOZ_TRY(mDeviceContextSpec->BeginPage()); } if (mPrintTarget) { MOZ_TRY(mPrintTarget->BeginPage(aSizeInPoints)); MOZ_TRY(mPrintTarget->BeginPage()); } return NS_OK; } Loading
gfx/src/nsDeviceContext.h +2 −12 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ #include "nscore.h" // for char16_t, nsAString #include "mozilla/AppUnits.h" // for AppUnits #include "nsFontMetrics.h" // for nsFontMetrics::Params #include "mozilla/gfx/Point.h" // for IntSize #include "mozilla/gfx/PrintTarget.h" // for PrintTarget::PageDoneCallback #include "mozilla/gfx/PrintPromise.h" Loading Loading @@ -49,8 +48,7 @@ class Screen; class nsDeviceContext final { public: using IntSize = mozilla::gfx::IntSize; using PrintTarget = mozilla::gfx::PrintTarget; typedef mozilla::gfx::PrintTarget PrintTarget; nsDeviceContext(); Loading Loading @@ -225,17 +223,9 @@ class nsDeviceContext final { * Inform the output device that output of a page is beginning * Used for print related device contexts. Must be matched 1:1 with * EndPage() and within a BeginDocument()/EndDocument() pair. * * @param aSizeInPoints - The physical dimensions of the page in points. * Currently only supported (used) by print-to-PDF * print targets, and then only to switch the * orientation for a specific page (arbitrary page * sizes are not supported by the Core Graphics print- * to-PDF APIs, for example). * * @return error status */ nsresult BeginPage(const IntSize& aSizeInPoints); nsresult BeginPage(); /** * Inform the output device that output of a page is ending Loading
gfx/thebes/PrintTarget.h +1 −5 Original line number Diff line number Diff line Loading @@ -43,11 +43,7 @@ class PrintTarget { #endif return NS_OK; } /** * Note: not all print devices implement mixed page sizing. Most PrintTarget * subclasses will ignore `aSizeInPoints`. */ virtual nsresult BeginPage(const IntSize& aSizeInPoints) { virtual nsresult BeginPage() { #ifdef DEBUG MOZ_ASSERT(!mHasActivePage, "Missing EndPage() call"); mHasActivePage = true; Loading
gfx/thebes/PrintTargetCG.h +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ class PrintTargetCG final : public PrintTarget { int32_t aEndPage) final; nsresult EndPrinting() final; nsresult AbortPrinting() final; nsresult BeginPage(const IntSize& aSizeInPoints) final; nsresult BeginPage() final; nsresult EndPage() final; already_AddRefed<DrawTarget> GetReferenceDrawTarget() final; Loading
gfx/thebes/PrintTargetCG.mm +4 −20 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ #include "cairo.h" #include "cairo-quartz.h" #include "mozilla/gfx/HelpersCairo.h" #include "mozilla/StaticPrefs_layout.h" #include "nsObjCExceptions.h" #include "nsString.h" #include "nsIOutputStream.h" Loading Loading @@ -211,7 +210,7 @@ nsresult PrintTargetCG::AbortPrinting() { return EndPrinting(); } nsresult PrintTargetCG::BeginPage(const IntSize& aSizeInPoints) { nsresult PrintTargetCG::BeginPage() { NS_OBJC_BEGIN_TRY_BLOCK_RETURN; CGContextRef context; Loading @@ -219,15 +218,7 @@ nsresult PrintTargetCG::BeginPage(const IntSize& aSizeInPoints) { CGContextBeginPage(mPrintToStreamContext, nullptr); context = mPrintToStreamContext; } else { // XXX Why are we calling this if we don't check the return value? PMSessionError(mPrintSession); if (StaticPrefs::layout_css_page_orientation_enabled()) { ::PMOrientation pageOrientation = aSizeInPoints.width < aSizeInPoints.height ? kPMPortrait : kPMLandscape; ::PMSetOrientation(mPageFormat, pageOrientation, kPMUnlocked); // We don't need to reset the orientation, since we set it for every page. } OSStatus status = ::PMSessionBeginPageNoDialog(mPrintSession, mPageFormat, nullptr); if (status != noErr) { return NS_ERROR_ABORT; Loading @@ -242,15 +233,8 @@ nsresult PrintTargetCG::BeginPage(const IntSize& aSizeInPoints) { } } unsigned int width; unsigned int height; if (StaticPrefs::layout_css_page_orientation_enabled()) { width = static_cast<unsigned int>(aSizeInPoints.width); height = static_cast<unsigned int>(aSizeInPoints.height); } else { width = static_cast<unsigned int>(mSize.width); height = static_cast<unsigned int>(mSize.height); } unsigned int width = static_cast<unsigned int>(mSize.width); unsigned int height = static_cast<unsigned int>(mSize.height); // Initially, origin is at bottom-left corner of the paper. // Here, we translate it to top-left corner of the paper. Loading @@ -265,7 +249,7 @@ nsresult PrintTargetCG::BeginPage(const IntSize& aSizeInPoints) { mCairoSurface = surface; return PrintTarget::BeginPage(aSizeInPoints); return PrintTarget::BeginPage(); NS_OBJC_END_TRY_BLOCK_RETURN(NS_ERROR_FAILURE); } Loading