author | Jonathan Watt <jwatt@jwatt.org> |
Mon, 24 Oct 2016 13:58:20 +0100 | |
changeset 319880 | e84c02971f372880904cdd7456bb895f00604ecd |
parent 319879 | 04ee6f23fb6f13061acad21a0e57b1a0f7664615 |
child 319881 | 1145a10a2fd5e23d0191ae9e1c22a6fa6e47ec0a |
push id | 30882 |
push user | ryanvm@gmail.com |
push date | Sat, 29 Oct 2016 13:12:06 +0000 |
treeherder | mozilla-central@16cdd6273c48 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mstange |
bugs | 1313375 |
milestone | 52.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
|
--- a/gfx/src/nsDeviceContext.cpp +++ b/gfx/src/nsDeviceContext.cpp @@ -233,19 +233,23 @@ nsDeviceContext::FontMetricsDeleted(cons { if (mFontCache) { mFontCache->FontMetricsDeleted(aFontMetrics); } return NS_OK; } bool -nsDeviceContext::IsPrinterSurface() +nsDeviceContext::IsPrinterContext() { - return mPrintTarget != nullptr; + return mPrintTarget != nullptr +#ifdef XP_MACOSX + || mCachedPrintTarget != nullptr +#endif + ; } void nsDeviceContext::SetDPI(double* aScale) { float dpi = -1.0f; // Use the printing DC to determine DPI values, if we have one. @@ -323,17 +327,17 @@ nsDeviceContext::Init(nsIWidget *aWidget return rv; } // XXX This is only for printing. We should make that obvious in the name. already_AddRefed<gfxContext> nsDeviceContext::CreateRenderingContext() { - MOZ_ASSERT(IsPrinterSurface()); + MOZ_ASSERT(IsPrinterContext()); MOZ_ASSERT(mWidth > 0 && mHeight > 0); RefPtr<PrintTarget> printingTarget = mPrintTarget; #ifdef XP_MACOSX // CreateRenderingContext() can be called (on reflow) after EndPage() // but before BeginPage(). On OS X (and only there) mPrintTarget // will in this case be null, because OS X printing surfaces are // per-page, and therefore only truly valid between calls to BeginPage() @@ -393,50 +397,47 @@ nsDeviceContext::GetDepth(uint32_t& aDep aDepth = mDepth; return NS_OK; } nsresult nsDeviceContext::GetDeviceSurfaceDimensions(nscoord &aWidth, nscoord &aHeight) { - if (mPrintTarget) { - // we have a printer device + if (IsPrinterContext()) { aWidth = mWidth; aHeight = mHeight; } else { nsRect area; ComputeFullAreaUsingScreen(&area); aWidth = area.width; aHeight = area.height; } return NS_OK; } nsresult nsDeviceContext::GetRect(nsRect &aRect) { - if (mPrintTarget) { - // we have a printer device + if (IsPrinterContext()) { aRect.x = 0; aRect.y = 0; aRect.width = mWidth; aRect.height = mHeight; } else ComputeFullAreaUsingScreen ( &aRect ); return NS_OK; } nsresult nsDeviceContext::GetClientRect(nsRect &aRect) { - if (mPrintTarget) { - // we have a printer device + if (IsPrinterContext()) { aRect.x = 0; aRect.y = 0; aRect.width = mWidth; aRect.height = mHeight; } else ComputeClientRectUsingScreen(&aRect);
--- a/gfx/src/nsDeviceContext.h +++ b/gfx/src/nsDeviceContext.h @@ -249,17 +249,17 @@ public: /** * Returns the page full zoom factor applied. */ float GetFullZoom() const { return mFullZoom; } /** * True if this device context was created for printing. */ - bool IsPrinterSurface(); + bool IsPrinterContext(); mozilla::DesktopToLayoutDeviceScale GetDesktopToDeviceScale(); private: // Private destructor, to discourage deletion outside of Release(): ~nsDeviceContext(); void SetDPI(double* aScale = nullptr);
--- a/gfx/src/nsFontMetrics.cpp +++ b/gfx/src/nsFontMetrics.cpp @@ -124,17 +124,17 @@ nsFontMetrics::nsFontMetrics(const nsFon gfxFontStyle style(aFont.style, aFont.weight, aFont.stretch, gfxFloat(aFont.size) / mP2A, aParams.language, aParams.explicitLanguage, aFont.sizeAdjust, aFont.systemFont, - mDeviceContext->IsPrinterSurface(), + mDeviceContext->IsPrinterContext(), aFont.synthesis & NS_FONT_SYNTHESIS_WEIGHT, aFont.synthesis & NS_FONT_SYNTHESIS_STYLE, aFont.languageOverride); aFont.AddFontFeaturesToStyle(&style); gfxFloat devToCssSize = gfxFloat(mP2A) / gfxFloat(mDeviceContext->AppUnitsPerCSSPixel());