From adb013669b1373881a93cb457258fe2d6b51ba49 Mon Sep 17 00:00:00 2001 From: Alexis Beingessner Date: Fri, 9 Jun 2017 15:14:53 -0400 Subject: [PATCH] Bug 1088760 - Remove nsRenderingContext, replacing all of its uses with gfxContext. r=jwatt,jrmuizel MozReview-Commit-ID: K1WUIOnvazF --- dom/canvas/DocumentRendererChild.cpp | 2 +- dom/canvas/DocumentRendererChild.h | 2 +- dom/canvas/DocumentRendererParent.h | 2 +- dom/plugins/ipc/PluginInstanceParent.cpp | 1 - gfx/layers/basic/BasicDisplayItemLayer.cpp | 3 +- gfx/layers/wr/WebRenderDisplayItemLayer.cpp | 3 +- gfx/src/moz.build | 1 - gfx/src/nsFontMetrics.cpp | 10 +- gfx/src/nsFontMetrics.h | 6 +- gfx/src/nsITheme.h | 4 +- gfx/src/nsRenderingContext.h | 41 -------- layout/base/GeckoRestyleManager.cpp | 2 +- layout/base/PresShell.cpp | 39 +++---- layout/base/PresShell.h | 2 +- layout/base/RestyleManager.cpp | 8 +- layout/base/nsBidiPresUtils.cpp | 8 +- layout/base/nsBidiPresUtils.h | 10 +- layout/base/nsDocumentViewer.cpp | 6 +- layout/base/nsIPresShell.h | 5 +- layout/base/nsLayoutUtils.cpp | 38 +++---- layout/base/nsLayoutUtils.h | 26 ++--- layout/forms/nsButtonFrameRenderer.cpp | 18 ++-- layout/forms/nsButtonFrameRenderer.h | 8 +- layout/forms/nsComboboxControlFrame.cpp | 12 +-- layout/forms/nsComboboxControlFrame.h | 6 +- layout/forms/nsDateTimeControlFrame.cpp | 4 +- layout/forms/nsDateTimeControlFrame.h | 4 +- layout/forms/nsFieldSetFrame.cpp | 22 ++-- layout/forms/nsFieldSetFrame.h | 8 +- layout/forms/nsFileControlFrame.cpp | 2 +- layout/forms/nsFileControlFrame.h | 2 +- layout/forms/nsFormControlFrame.cpp | 6 +- layout/forms/nsFormControlFrame.h | 6 +- layout/forms/nsGfxCheckboxControlFrame.cpp | 2 +- layout/forms/nsGfxRadioControlFrame.cpp | 2 +- layout/forms/nsHTMLButtonControlFrame.cpp | 4 +- layout/forms/nsHTMLButtonControlFrame.h | 6 +- layout/forms/nsListControlFrame.cpp | 4 +- layout/forms/nsListControlFrame.h | 4 +- layout/forms/nsMeterFrame.cpp | 6 +- layout/forms/nsMeterFrame.h | 6 +- layout/forms/nsNumberControlFrame.cpp | 4 +- layout/forms/nsNumberControlFrame.h | 4 +- layout/forms/nsProgressFrame.cpp | 6 +- layout/forms/nsProgressFrame.h | 6 +- layout/forms/nsRangeFrame.cpp | 12 +-- layout/forms/nsRangeFrame.h | 6 +- layout/forms/nsSelectsAreaFrame.cpp | 2 +- layout/forms/nsTextControlFrame.cpp | 10 +- layout/forms/nsTextControlFrame.h | 8 +- layout/generic/BRFrame.cpp | 18 ++-- layout/generic/BlockReflowInput.cpp | 2 +- layout/generic/ReflowInput.cpp | 4 +- layout/generic/ReflowInput.h | 10 +- layout/generic/TextOverflow.cpp | 28 ++--- layout/generic/ViewportFrame.cpp | 4 +- layout/generic/ViewportFrame.h | 4 +- layout/generic/nsBackdropFrame.cpp | 2 +- layout/generic/nsBackdropFrame.h | 2 +- layout/generic/nsBlockFrame.cpp | 9 +- layout/generic/nsBlockFrame.h | 6 +- layout/generic/nsBulletFrame.cpp | 44 ++++---- layout/generic/nsBulletFrame.h | 14 +-- layout/generic/nsCanvasFrame.cpp | 19 ++-- layout/generic/nsCanvasFrame.h | 12 +-- layout/generic/nsColumnSetFrame.cpp | 13 ++- layout/generic/nsColumnSetFrame.h | 6 +- layout/generic/nsContainerFrame.cpp | 6 +- layout/generic/nsContainerFrame.h | 6 +- layout/generic/nsFirstLetterFrame.cpp | 10 +- layout/generic/nsFirstLetterFrame.h | 10 +- layout/generic/nsFlexContainerFrame.cpp | 6 +- layout/generic/nsFlexContainerFrame.h | 4 +- layout/generic/nsFrame.cpp | 31 +++--- layout/generic/nsFrame.h | 18 ++-- layout/generic/nsFrameSetFrame.cpp | 9 +- layout/generic/nsGfxScrollFrame.cpp | 6 +- layout/generic/nsGfxScrollFrame.h | 16 +-- layout/generic/nsGridContainerFrame.cpp | 30 +++--- layout/generic/nsGridContainerFrame.h | 6 +- layout/generic/nsHTMLCanvasFrame.cpp | 6 +- layout/generic/nsHTMLCanvasFrame.h | 6 +- layout/generic/nsIFrame.h | 15 ++- layout/generic/nsIScrollableFrame.h | 6 +- layout/generic/nsImageFrame.cpp | 38 ++++--- layout/generic/nsImageFrame.h | 18 ++-- layout/generic/nsInlineFrame.cpp | 8 +- layout/generic/nsInlineFrame.h | 6 +- layout/generic/nsLeafFrame.cpp | 6 +- layout/generic/nsLeafFrame.h | 6 +- layout/generic/nsPageFrame.cpp | 25 +++-- layout/generic/nsPageFrame.h | 8 +- layout/generic/nsPlaceholderFrame.cpp | 6 +- layout/generic/nsPlaceholderFrame.h | 4 +- layout/generic/nsPluginFrame.cpp | 38 +++---- layout/generic/nsPluginFrame.h | 12 +-- layout/generic/nsRubyBaseContainerFrame.cpp | 8 +- layout/generic/nsRubyBaseContainerFrame.h | 6 +- layout/generic/nsRubyFrame.cpp | 4 +- layout/generic/nsRubyFrame.h | 4 +- layout/generic/nsSimplePageSequenceFrame.cpp | 5 +- layout/generic/nsSubDocumentFrame.cpp | 8 +- layout/generic/nsSubDocumentFrame.h | 8 +- layout/generic/nsTextFrame.cpp | 32 +++--- layout/generic/nsTextFrame.h | 16 +-- layout/generic/nsVideoFrame.cpp | 8 +- layout/generic/nsVideoFrame.h | 8 +- layout/mathml/nsIMathMLFrame.h | 2 +- layout/mathml/nsMathMLChar.cpp | 30 +++--- layout/mathml/nsMathMLChar.h | 8 +- layout/mathml/nsMathMLContainerFrame.cpp | 16 +-- layout/mathml/nsMathMLContainerFrame.h | 8 +- layout/mathml/nsMathMLFrame.cpp | 10 +- layout/mathml/nsMathMLSelectedFrame.cpp | 2 +- layout/mathml/nsMathMLSelectedFrame.h | 2 +- layout/mathml/nsMathMLmencloseFrame.cpp | 5 +- layout/mathml/nsMathMLmfencedFrame.cpp | 5 +- layout/mathml/nsMathMLmfencedFrame.h | 2 +- layout/mathml/nsMathMLmfracFrame.cpp | 5 +- layout/mathml/nsMathMLmmultiscriptsFrame.cpp | 2 +- layout/mathml/nsMathMLmoFrame.cpp | 4 +- layout/mathml/nsMathMLmoFrame.h | 2 +- layout/mathml/nsMathMLmrootFrame.cpp | 4 +- layout/mathml/nsMathMLmrootFrame.h | 2 +- layout/mathml/nsMathMLmtableFrame.cpp | 4 +- layout/mathml/nsMathMLmunderoverFrame.cpp | 2 +- layout/painting/FrameLayerBuilder.cpp | 15 ++- layout/painting/FrameLayerBuilder.h | 2 +- layout/painting/nsCSSRendering.cpp | 84 +++++++-------- layout/painting/nsCSSRendering.h | 18 ++-- layout/painting/nsCSSRenderingBorders.cpp | 11 +- layout/painting/nsCSSRenderingBorders.h | 2 +- layout/painting/nsCSSRenderingGradients.cpp | 1 - layout/painting/nsDisplayList.cpp | 55 +++++----- layout/painting/nsDisplayList.h | 44 ++++---- layout/painting/nsImageRenderer.cpp | 20 ++-- layout/painting/nsImageRenderer.h | 6 +- layout/printing/nsPrintEngine.cpp | 4 +- layout/style/nsRuleNode.cpp | 8 +- layout/svg/SVGGeometryFrame.cpp | 7 +- layout/svg/SVGTextFrame.cpp | 16 +-- layout/svg/nsCSSClipPathInstance.cpp | 2 +- layout/svg/nsCSSClipPathInstance.h | 2 +- layout/svg/nsSVGForeignObjectFrame.cpp | 10 +- layout/svg/nsSVGIntegrationUtils.cpp | 10 +- layout/svg/nsSVGOuterSVGFrame.cpp | 18 ++-- layout/svg/nsSVGOuterSVGFrame.h | 6 +- layout/tables/BasicTableLayoutStrategy.cpp | 14 +-- layout/tables/BasicTableLayoutStrategy.h | 8 +- layout/tables/FixedTableLayoutStrategy.cpp | 4 +- layout/tables/FixedTableLayoutStrategy.h | 4 +- layout/tables/nsITableLayoutStrategy.h | 6 +- layout/tables/nsTableCellFrame.cpp | 14 +-- layout/tables/nsTableCellFrame.h | 8 +- layout/tables/nsTableFrame.cpp | 18 ++-- layout/tables/nsTableFrame.h | 12 +-- layout/tables/nsTableWrapperFrame.cpp | 8 +- layout/tables/nsTableWrapperFrame.h | 8 +- layout/xul/nsBoxFrame.cpp | 8 +- layout/xul/nsBoxFrame.h | 6 +- layout/xul/nsBoxLayoutState.cpp | 2 +- layout/xul/nsBoxLayoutState.h | 8 +- layout/xul/nsGroupBoxFrame.cpp | 34 +++--- layout/xul/nsImageBoxFrame.cpp | 8 +- layout/xul/nsImageBoxFrame.h | 4 +- layout/xul/nsLeafBoxFrame.cpp | 6 +- layout/xul/nsLeafBoxFrame.h | 6 +- layout/xul/nsListBoxBodyFrame.cpp | 4 +- layout/xul/nsSplitterFrame.cpp | 8 +- layout/xul/nsTextBoxFrame.cpp | 32 +++--- layout/xul/nsTextBoxFrame.h | 12 +-- layout/xul/tree/nsTreeBodyFrame.cpp | 103 +++++++++---------- layout/xul/tree/nsTreeBodyFrame.h | 28 ++--- toolkit/components/browser/nsWebBrowser.cpp | 2 +- widget/cocoa/nsDragService.mm | 2 +- widget/cocoa/nsNativeThemeCocoa.h | 2 +- widget/cocoa/nsNativeThemeCocoa.mm | 3 +- widget/gtk/nsNativeThemeGTK.cpp | 5 +- widget/gtk/nsNativeThemeGTK.h | 2 +- widget/windows/nsDragService.cpp | 2 +- widget/windows/nsNativeThemeWin.cpp | 9 +- widget/windows/nsNativeThemeWin.h | 4 +- 182 files changed, 919 insertions(+), 1020 deletions(-) delete mode 100644 gfx/src/nsRenderingContext.h diff --git a/dom/canvas/DocumentRendererChild.cpp b/dom/canvas/DocumentRendererChild.cpp index 1d39fa6abbd4..edfc4746a72c 100644 --- a/dom/canvas/DocumentRendererChild.cpp +++ b/dom/canvas/DocumentRendererChild.cpp @@ -7,6 +7,7 @@ #include "base/basictypes.h" #include "gfx2DGlue.h" +#include "gfxContext.h" #include "gfxPattern.h" #include "mozilla/gfx/2D.h" #include "mozilla/RefPtr.h" @@ -19,7 +20,6 @@ #include "nsPresContext.h" #include "nsCOMPtr.h" #include "nsColor.h" -#include "gfxContext.h" #include "nsLayoutUtils.h" #include "nsContentUtils.h" #include "nsCSSValue.h" diff --git a/dom/canvas/DocumentRendererChild.h b/dom/canvas/DocumentRendererChild.h index 463ba27076a0..80fe0ddf64bc 100644 --- a/dom/canvas/DocumentRendererChild.h +++ b/dom/canvas/DocumentRendererChild.h @@ -5,9 +5,9 @@ #ifndef mozilla_dom_DocumentRendererChild #define mozilla_dom_DocumentRendererChild +#include "gfxContext.h" #include "mozilla/ipc/PDocumentRendererChild.h" #include "nsString.h" -#include "gfxContext.h" class nsIDOMWindow; diff --git a/dom/canvas/DocumentRendererParent.h b/dom/canvas/DocumentRendererParent.h index f1922825dc0d..7cfe5322795f 100644 --- a/dom/canvas/DocumentRendererParent.h +++ b/dom/canvas/DocumentRendererParent.h @@ -5,10 +5,10 @@ #ifndef mozilla_dom_DocumentRendererParent #define mozilla_dom_DocumentRendererParent +#include "gfxContext.h" #include "mozilla/ipc/PDocumentRendererParent.h" #include "nsCOMPtr.h" #include "nsString.h" -#include "gfxContext.h" class nsICanvasRenderingContextInternal; diff --git a/dom/plugins/ipc/PluginInstanceParent.cpp b/dom/plugins/ipc/PluginInstanceParent.cpp index 0d35fcf333f0..c5d33dc2da48 100644 --- a/dom/plugins/ipc/PluginInstanceParent.cpp +++ b/dom/plugins/ipc/PluginInstanceParent.cpp @@ -31,7 +31,6 @@ #ifdef MOZ_X11 #include "gfxXlibSurface.h" #endif -#include "gfxContext.h" #include "gfxUtils.h" #include "mozilla/gfx/2D.h" #include "Layers.h" diff --git a/gfx/layers/basic/BasicDisplayItemLayer.cpp b/gfx/layers/basic/BasicDisplayItemLayer.cpp index e2d897188b8e..8c7497b0c0c7 100644 --- a/gfx/layers/basic/BasicDisplayItemLayer.cpp +++ b/gfx/layers/basic/BasicDisplayItemLayer.cpp @@ -60,8 +60,7 @@ public: RefPtr context = gfxContext::CreateOrNull(aDT, aDeviceOffset); context->SetMatrix(ThebesMatrix(transform)); - nsRenderingContext ctx(context); - mItem->Paint(mBuilder, &ctx); + mItem->Paint(mBuilder, context); } protected: diff --git a/gfx/layers/wr/WebRenderDisplayItemLayer.cpp b/gfx/layers/wr/WebRenderDisplayItemLayer.cpp index 030a37874256..bf37fce9e09c 100644 --- a/gfx/layers/wr/WebRenderDisplayItemLayer.cpp +++ b/gfx/layers/wr/WebRenderDisplayItemLayer.cpp @@ -161,8 +161,7 @@ WebRenderDisplayItemLayer::PushItemAsBlobImage(wr::DisplayListBuilder& aBuilder, RefPtr context = gfxContext::CreateOrNull(dt, offset.ToUnknownPoint()); MOZ_ASSERT(context); - nsRenderingContext ctx(context); - mItem->Paint(mBuilder, &ctx); + mItem->Paint(mBuilder, context); } wr::ByteBuffer bytes; diff --git a/gfx/src/moz.build b/gfx/src/moz.build index 3678eee7abbd..dbfb4049dbb1 100644 --- a/gfx/src/moz.build +++ b/gfx/src/moz.build @@ -33,7 +33,6 @@ EXPORTS += [ 'nsRect.h', 'nsRegion.h', 'nsRegionFwd.h', - 'nsRenderingContext.h', 'nsSize.h', 'nsThemeConstants.h', 'nsTransform2D.h', diff --git a/gfx/src/nsFontMetrics.cpp b/gfx/src/nsFontMetrics.cpp index d3da66ccae03..d0deef87959a 100644 --- a/gfx/src/nsFontMetrics.cpp +++ b/gfx/src/nsFontMetrics.cpp @@ -6,6 +6,7 @@ #include "nsFontMetrics.h" #include // for floor, ceil #include // for max +#include "gfxContext.h" // for gfxContext #include "gfxFontConstants.h" // for NS_FONT_SYNTHESIS_* #include "gfxPlatform.h" // for gfxPlatform #include "gfxPoint.h" // for gfxPoint @@ -16,7 +17,6 @@ #include "nsDeviceContext.h" // for nsDeviceContext #include "nsIAtom.h" // for nsIAtom #include "nsMathUtils.h" // for NS_round -#include "nsRenderingContext.h" // for nsRenderingContext #include "nsString.h" // for nsString #include "nsStyleConsts.h" // for StyleHyphens::None #include "mozilla/Assertions.h" // for MOZ_ASSERT @@ -354,7 +354,7 @@ nsFontMetrics::GetWidth(const char16_t* aString, uint32_t aLength, void nsFontMetrics::DrawString(const char *aString, uint32_t aLength, nscoord aX, nscoord aY, - nsRenderingContext *aContext) + gfxContext *aContext) { if (aLength == 0) return; @@ -373,7 +373,7 @@ nsFontMetrics::DrawString(const char *aString, uint32_t aLength, pt.x += textRun->GetAdvanceWidth(range, &provider); } } - gfxTextRun::DrawParams params(aContext->ThebesContext()); + gfxTextRun::DrawParams params(aContext); params.provider = &provider; textRun->Draw(range, pt, params); } @@ -381,7 +381,7 @@ nsFontMetrics::DrawString(const char *aString, uint32_t aLength, void nsFontMetrics::DrawString(const char16_t* aString, uint32_t aLength, nscoord aX, nscoord aY, - nsRenderingContext *aContext, + gfxContext *aContext, DrawTarget* aTextRunConstructionDrawTarget) { if (aLength == 0) @@ -401,7 +401,7 @@ nsFontMetrics::DrawString(const char16_t* aString, uint32_t aLength, pt.x += textRun->GetAdvanceWidth(range, &provider); } } - gfxTextRun::DrawParams params(aContext->ThebesContext()); + gfxTextRun::DrawParams params(aContext); params.provider = &provider; textRun->Draw(range, pt, params); } diff --git a/gfx/src/nsFontMetrics.h b/gfx/src/nsFontMetrics.h index 49fc2c486e4d..e1c80f6561c4 100644 --- a/gfx/src/nsFontMetrics.h +++ b/gfx/src/nsFontMetrics.h @@ -18,11 +18,11 @@ #include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING #include "nscore.h" // for char16_t +class gfxContext; class gfxUserFontSet; class gfxTextPerfMetrics; class nsDeviceContext; class nsIAtom; -class nsRenderingContext; struct nsBoundingMetrics; /** @@ -200,10 +200,10 @@ public: // Draw a string using this font handle on the surface passed in. void DrawString(const char *aString, uint32_t aLength, nscoord aX, nscoord aY, - nsRenderingContext *aContext); + gfxContext *aContext); void DrawString(const char16_t* aString, uint32_t aLength, nscoord aX, nscoord aY, - nsRenderingContext *aContext, + gfxContext *aContext, DrawTarget* aTextRunConstructionDrawTarget); nsBoundingMetrics GetBoundingMetrics(const char16_t *aString, diff --git a/gfx/src/nsITheme.h b/gfx/src/nsITheme.h index 64352802c4d6..ae072c9eeb14 100644 --- a/gfx/src/nsITheme.h +++ b/gfx/src/nsITheme.h @@ -15,9 +15,9 @@ #include "Units.h" struct nsRect; +class gfxContext; class nsAttrValue; class nsPresContext; -class nsRenderingContext; class nsDeviceContext; class nsIFrame; class nsIAtom; @@ -55,7 +55,7 @@ public: * @param aRect the rectangle defining the area occupied by the widget * @param aDirtyRect the rectangle that needs to be drawn */ - NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext, + NS_IMETHOD DrawWidgetBackground(gfxContext* aContext, nsIFrame* aFrame, uint8_t aWidgetType, const nsRect& aRect, diff --git a/gfx/src/nsRenderingContext.h b/gfx/src/nsRenderingContext.h deleted file mode 100644 index 02bb397d655c..000000000000 --- a/gfx/src/nsRenderingContext.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* 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 NSRENDERINGCONTEXT__H__ -#define NSRENDERINGCONTEXT__H__ - -#include "gfxContext.h" -#include "mozilla/Attributes.h" -#include "nsCOMPtr.h" -#include "mozilla/RefPtr.h" - -namespace mozilla { -namespace gfx { -class DrawTarget; -} // namespace gfx -} // namespace mozilla - -class MOZ_STACK_CLASS nsRenderingContext final -{ - typedef mozilla::gfx::DrawTarget DrawTarget; - -public: - explicit nsRenderingContext(gfxContext* aThebesContext) - : mThebes(aThebesContext) - {} - - explicit nsRenderingContext(already_AddRefed&& aThebesContext) - : mThebes(aThebesContext) - {} - - // These accessors will never return null. - gfxContext *ThebesContext() { return mThebes; } - DrawTarget *GetDrawTarget() { return mThebes->GetDrawTarget(); } - -private: - RefPtr mThebes; -}; - -#endif // NSRENDERINGCONTEXT__H__ diff --git a/layout/base/GeckoRestyleManager.cpp b/layout/base/GeckoRestyleManager.cpp index a189462551d5..97dea208cabd 100644 --- a/layout/base/GeckoRestyleManager.cpp +++ b/layout/base/GeckoRestyleManager.cpp @@ -11,6 +11,7 @@ #include "mozilla/GeckoRestyleManager.h" #include // For std::max +#include "gfxContext.h" #include "mozilla/EffectSet.h" #include "mozilla/EventStates.h" #include "mozilla/ViewportFrame.h" @@ -31,7 +32,6 @@ #include "nsAnimationManager.h" #include "nsTransitionManager.h" #include "nsViewManager.h" -#include "nsRenderingContext.h" #include "nsSVGIntegrationUtils.h" #include "nsCSSAnonBoxes.h" #include "nsContainerFrame.h" diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 06549eb5f908..d730adf589a3 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -45,6 +45,7 @@ #include "winuser.h" #endif +#include "gfxContext.h" #include "gfxPrefs.h" #include "gfxUserFontSet.h" #include "nsPresContext.h" @@ -102,7 +103,6 @@ #include "prenv.h" #include "nsDisplayList.h" #include "nsRegion.h" -#include "nsRenderingContext.h" #include "nsAutoLayoutPhase.h" #ifdef MOZ_REFLOW_PERF #include "nsFontMetrics.h" @@ -118,7 +118,6 @@ #include "nsNetUtil.h" #include "nsThreadUtils.h" #include "nsStyleSheetService.h" -#include "gfxContext.h" #include "gfxUtils.h" #include "nsSMILAnimationController.h" #include "SVGContentUtils.h" @@ -381,7 +380,7 @@ public: void Add(const char * aName, nsIFrame * aFrame); ReflowCounter * LookUp(const char * aName); - void PaintCount(const char *aName, nsRenderingContext* aRenderingContext, + void PaintCount(const char *aName, gfxContext* aRenderingContext, nsPresContext *aPresContext, nsIFrame *aFrame, const nsPoint &aOffset, uint32_t aColor); @@ -4685,8 +4684,6 @@ PresShell::RenderDocument(const nsRect& aRect, uint32_t aFlags, AutoSaveRestoreRenderingState _(this); - nsRenderingContext rc(aThebesContext); - bool wouldFlushRetainedLayers = false; PaintFrameFlags flags = PaintFrameFlags::PAINT_IGNORE_SUPPRESSION; if (aThebesContext->CurrentMatrix().HasNonIntegerTranslation()) { @@ -4735,7 +4732,7 @@ PresShell::RenderDocument(const nsRect& aRect, uint32_t aFlags, flags &= ~PaintFrameFlags::PAINT_WIDGET_LAYERS; } - nsLayoutUtils::PaintFrame(&rc, rootFrame, nsRegion(aRect), + nsLayoutUtils::PaintFrame(aThebesContext, rootFrame, nsRegion(aRect), aBackgroundColor, nsDisplayListBuilderMode::PAINTING, flags); @@ -5075,8 +5072,6 @@ PresShell::PaintRangePaintInfo(const nsTArray>& aItems ctx->Clip(path); } - nsRenderingContext rc(ctx); - gfxMatrix initialTM = ctx->CurrentMatrix(); if (resize) @@ -5111,7 +5106,7 @@ PresShell::PaintRangePaintInfo(const nsTArray>& aItems aArea.MoveBy(-rangeInfo->mRootOffset.x, -rangeInfo->mRootOffset.y); nsRegion visible(aArea); RefPtr layerManager = - rangeInfo->mList.PaintRoot(&rangeInfo->mBuilder, &rc, + rangeInfo->mList.PaintRoot(&rangeInfo->mBuilder, ctx, nsDisplayList::PAINT_DEFAULT); aArea.MoveBy(rangeInfo->mRootOffset.x, rangeInfo->mRootOffset.y); } @@ -9243,7 +9238,7 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible) nsIFrame* rootFrame = mFrameConstructor->GetRootFrame(); // CreateReferenceRenderingContext can return nullptr - nsRenderingContext rcx(CreateReferenceRenderingContext()); + RefPtr rcx(CreateReferenceRenderingContext()); #ifdef DEBUG mCurrentReflowRoot = target; @@ -9266,7 +9261,7 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible) // Don't pass size directly to the reflow state, since a // constrained height implies page/column breaking. LogicalSize reflowSize(wm, size.ISize(wm), NS_UNCONSTRAINEDSIZE); - ReflowInput reflowInput(mPresContext, target, &rcx, reflowSize, + ReflowInput reflowInput(mPresContext, target, rcx, reflowSize, ReflowInput::CALLER_WILL_INIT); reflowInput.mOrthogonalLimit = size.BSize(wm); @@ -9347,7 +9342,7 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible) target->GetView(), boundsRelativeToTarget); nsContainerFrame::SyncWindowProperties(mPresContext, target, - target->GetView(), &rcx, + target->GetView(), rcx, nsContainerFrame::SET_ASYNC); target->DidReflow(mPresContext, nullptr, nsDidReflowStatus::FINISHED); @@ -10265,7 +10260,7 @@ PresShell::CountReflows(const char * aName, nsIFrame * aFrame) //------------------------------------------------------------- void PresShell::PaintCount(const char * aName, - nsRenderingContext* aRenderingContext, + gfxContext* aRenderingContext, nsPresContext* aPresContext, nsIFrame * aFrame, const nsPoint& aOffset, @@ -10458,7 +10453,7 @@ void ReflowCountMgr::Add(const char * aName, nsIFrame * aFrame) //------------------------------------------------------------------ void ReflowCountMgr::PaintCount(const char* aName, - nsRenderingContext* aRenderingContext, + gfxContext* aRenderingContext, nsPresContext* aPresContext, nsIFrame* aFrame, const nsPoint& aOffset, @@ -10475,11 +10470,11 @@ void ReflowCountMgr::PaintCount(const char* aName, DrawTarget* drawTarget = aRenderingContext->GetDrawTarget(); int32_t appUnitsPerDevPixel = aPresContext->AppUnitsPerDevPixel(); - aRenderingContext->ThebesContext()->Save(); + aRenderingContext->Save(); gfxPoint devPixelOffset = nsLayoutUtils::PointToGfxPoint(aOffset, appUnitsPerDevPixel); - aRenderingContext->ThebesContext()->SetMatrix( - aRenderingContext->ThebesContext()->CurrentMatrix().Translate(devPixelOffset)); + aRenderingContext->SetMatrix( + aRenderingContext->CurrentMatrix().Translate(devPixelOffset)); // We don't care about the document language or user fonts here; // just get a default Latin font. @@ -10522,12 +10517,12 @@ void ReflowCountMgr::PaintCount(const char* aName, ColorPattern black(ToDeviceColor(Color(0.f, 0.f, 0.f, 1.f))); drawTarget->FillRect(devPxRect, black); - aRenderingContext->ThebesContext()->SetColor(color2); + aRenderingContext->SetColor(color2); fm->DrawString(buf, len, x+15, y+15, aRenderingContext); - aRenderingContext->ThebesContext()->SetColor(color); + aRenderingContext->SetColor(color); fm->DrawString(buf, len, x, y, aRenderingContext); - aRenderingContext->ThebesContext()->Restore(); + aRenderingContext->Restore(); } } } @@ -11192,8 +11187,8 @@ nsIPresShell::SyncWindowProperties(nsView* aView) nsIFrame* frame = aView->GetFrame(); if (frame && mPresContext) { // CreateReferenceRenderingContext can return nullptr - nsRenderingContext rcx(CreateReferenceRenderingContext()); - nsContainerFrame::SyncWindowProperties(mPresContext, frame, aView, &rcx, 0); + RefPtr rcx(CreateReferenceRenderingContext()); + nsContainerFrame::SyncWindowProperties(mPresContext, frame, aView, rcx, 0); } } diff --git a/layout/base/PresShell.h b/layout/base/PresShell.h index 8cc607a2ab62..96a0114b750e 100644 --- a/layout/base/PresShell.h +++ b/layout/base/PresShell.h @@ -318,7 +318,7 @@ public: virtual void DumpReflows() override; virtual void CountReflows(const char * aName, nsIFrame * aFrame) override; virtual void PaintCount(const char * aName, - nsRenderingContext* aRenderingContext, + gfxContext* aRenderingContext, nsPresContext* aPresContext, nsIFrame * aFrame, const nsPoint& aOffset, diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index f38c6905a67a..f1b40d80f425 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -821,8 +821,8 @@ RecomputePosition(nsIFrame* aFrame) // the frame, and then get the offsets and size from it. If the frame's size // doesn't need to change, we can simply update the frame position. Otherwise // we fall back to a reflow. - nsRenderingContext rc( - aFrame->PresContext()->PresShell()->CreateReferenceRenderingContext()); + RefPtr rc = + aFrame->PresContext()->PresShell()->CreateReferenceRenderingContext(); // Construct a bogus parent reflow state so that there's a usable // containing block reflow state. @@ -832,7 +832,7 @@ RecomputePosition(nsIFrame* aFrame) LogicalSize parentSize = parentFrame->GetLogicalSize(); nsFrameState savedState = parentFrame->GetStateBits(); - ReflowInput parentReflowInput(aFrame->PresContext(), parentFrame, &rc, + ReflowInput parentReflowInput(aFrame->PresContext(), parentFrame, rc, parentSize); parentFrame->RemoveStateBits(~nsFrameState(0)); parentFrame->AddStateBits(savedState); @@ -846,7 +846,7 @@ RecomputePosition(nsIFrame* aFrame) if (cbFrame && (aFrame->GetContainingBlock() != parentFrame || parentFrame->IsTableFrame())) { LogicalSize cbSize = cbFrame->GetLogicalSize(); - cbReflowInput.emplace(cbFrame->PresContext(), cbFrame, &rc, cbSize); + cbReflowInput.emplace(cbFrame->PresContext(), cbFrame, rc, cbSize); cbReflowInput->ComputedPhysicalMargin() = cbFrame->GetUsedMargin(); cbReflowInput->ComputedPhysicalPadding() = cbFrame->GetUsedPadding(); cbReflowInput->ComputedPhysicalBorderPadding() = diff --git a/layout/base/nsBidiPresUtils.cpp b/layout/base/nsBidiPresUtils.cpp index 53f4022485ed..0b896d15f2b5 100644 --- a/layout/base/nsBidiPresUtils.cpp +++ b/layout/base/nsBidiPresUtils.cpp @@ -5,12 +5,12 @@ #include "mozilla/IntegerRange.h" +#include "gfxContext.h" #include "nsAutoPtr.h" #include "nsBidiPresUtils.h" #include "nsFontMetrics.h" #include "nsGkAtoms.h" #include "nsPresContext.h" -#include "nsRenderingContext.h" #include "nsBidiUtils.h" #include "nsCSSFrameConstructor.h" #include "nsContainerFrame.h" @@ -2300,7 +2300,7 @@ class MOZ_STACK_CLASS nsIRenderingContextBidiProcessor final public: typedef mozilla::gfx::DrawTarget DrawTarget; - nsIRenderingContextBidiProcessor(nsRenderingContext* aCtx, + nsIRenderingContextBidiProcessor(gfxContext* aCtx, DrawTarget* aTextRunConstructionDrawTarget, nsFontMetrics* aFontMetrics, const nsPoint& aPt) @@ -2344,7 +2344,7 @@ public: } private: - nsRenderingContext* mCtx; + gfxContext* mCtx; DrawTarget* mTextRunConstructionDrawTarget; nsFontMetrics* mFontMetrics; nsPoint mPt; @@ -2356,7 +2356,7 @@ nsresult nsBidiPresUtils::ProcessTextForRenderingContext(const char16_t* a int32_t aLength, nsBidiLevel aBaseLevel, nsPresContext* aPresContext, - nsRenderingContext& aRenderingContext, + gfxContext& aRenderingContext, DrawTarget* aTextRunConstructionDrawTarget, nsFontMetrics& aFontMetrics, Mode aMode, diff --git a/layout/base/nsBidiPresUtils.h b/layout/base/nsBidiPresUtils.h index 05435a3d6e72..d0b30e8cc7be 100644 --- a/layout/base/nsBidiPresUtils.h +++ b/layout/base/nsBidiPresUtils.h @@ -7,11 +7,11 @@ #ifndef nsBidiPresUtils_h___ #define nsBidiPresUtils_h___ +#include "gfxContext.h" #include "nsBidi.h" #include "nsBidiUtils.h" #include "nsHashKeys.h" #include "nsCoord.h" -#include "nsRenderingContext.h" #ifdef DrawText #undef DrawText @@ -19,11 +19,11 @@ struct BidiParagraphData; struct BidiLineData; +class gfxContext; class nsFontMetrics; class nsIFrame; class nsBlockFrame; class nsPresContext; -class nsRenderingContext; class nsBlockInFlowLineIterator; class nsStyleContext; struct nsSize; @@ -213,7 +213,7 @@ public: int32_t aLength, nsBidiLevel aBaseLevel, nsPresContext* aPresContext, - nsRenderingContext& aRenderingContext, + gfxContext& aRenderingContext, DrawTarget* aTextRunConstructionDrawTarget, nsFontMetrics& aFontMetrics, nscoord aX, @@ -231,7 +231,7 @@ public: int32_t aLength, nsBidiLevel aBaseLevel, nsPresContext* aPresContext, - nsRenderingContext& aRenderingContext, + gfxContext& aRenderingContext, nsFontMetrics& aFontMetrics) { nscoord length; @@ -379,7 +379,7 @@ private: int32_t aLength, nsBidiLevel aBaseLevel, nsPresContext* aPresContext, - nsRenderingContext& aRenderingContext, + gfxContext& aRenderingContext, DrawTarget* aTextRunConstructionDrawTarget, nsFontMetrics& aFontMetrics, Mode aMode, diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index d11b1971aabb..4455de03c9c7 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -6,6 +6,7 @@ /* container for a document and its presentation */ +#include "gfxContext.h" #include "mozilla/ServoRestyleManager.h" #include "mozilla/ServoStyleSet.h" #include "nsAutoPtr.h" @@ -82,7 +83,6 @@ #include "nsIScrollableFrame.h" #include "nsStyleSheetService.h" -#include "nsRenderingContext.h" #include "nsILoadContext.h" #include "nsIPrompt.h" @@ -3527,8 +3527,8 @@ nsDocumentViewer::GetContentSizeInternal(int32_t* aWidth, int32_t* aHeight, nscoord prefWidth; { - nsRenderingContext rcx(presShell->CreateReferenceRenderingContext()); - prefWidth = root->GetPrefISize(&rcx); + RefPtr rcx(presShell->CreateReferenceRenderingContext()); + prefWidth = root->GetPrefISize(rcx); } if (prefWidth > aMaxWidth) { prefWidth = aMaxWidth; diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 7337b37434f8..e8ecafcd67ea 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -51,13 +51,13 @@ #include "nsFrameState.h" #include "Units.h" +class gfxContext; class nsDocShell; class nsIDocument; class nsIFrame; class nsPresContext; class nsViewManager; class nsView; -class nsRenderingContext; class nsIPageSequenceFrame; class nsCanvasFrame; class nsAString; @@ -77,7 +77,6 @@ template class nsCOMArray; class AutoWeakFrame; class WeakFrame; class nsIScrollableFrame; -class gfxContext; class nsIDOMEvent; class nsDisplayList; class nsDisplayListBuilder; @@ -1021,7 +1020,7 @@ public: virtual void DumpReflows() = 0; virtual void CountReflows(const char * aName, nsIFrame * aFrame) = 0; virtual void PaintCount(const char * aName, - nsRenderingContext* aRenderingContext, + gfxContext* aRenderingContext, nsPresContext * aPresContext, nsIFrame * aFrame, const nsPoint& aOffset, diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index f678395b99e8..c0d374a22eac 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -50,7 +50,7 @@ #include "ImageRegion.h" #include "gfxRect.h" #include "gfxContext.h" -#include "nsRenderingContext.h" +#include "gfxContext.h" #include "nsIInterfaceRequestorUtils.h" #include "nsCSSRendering.h" #include "nsTextFragment.h" @@ -3420,7 +3420,7 @@ nsLayoutUtils::ExpireDisplayPortOnAsyncScrollableAncestor(nsIFrame* aFrame) } nsresult -nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFrame, +nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame, const nsRegion& aDirtyRegion, nscolor aBackstop, nsDisplayListBuilderMode aBuilderMode, PaintFrameFlags aFlags) @@ -3518,8 +3518,8 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram gfxPoint devPixelOffset = nsLayoutUtils::PointToGfxPoint(pos, presContext->AppUnitsPerDevPixel()); - aRenderingContext->ThebesContext()->SetMatrix( - aRenderingContext->ThebesContext()->CurrentMatrix().Translate(devPixelOffset)); + aRenderingContext->SetMatrix( + aRenderingContext->CurrentMatrix().Translate(devPixelOffset)); } } builder.SetIgnoreScrollFrame(rootScrollFrame); @@ -4857,7 +4857,7 @@ GetDefiniteSizeTakenByBoxSizing(StyleBoxSizing aBoxSizing, enum eWidthProperty { PROP_WIDTH, PROP_MAX_WIDTH, PROP_MIN_WIDTH }; static bool GetIntrinsicCoord(const nsStyleCoord& aStyle, - nsRenderingContext* aRenderingContext, + gfxContext* aRenderingContext, nsIFrame* aFrame, eWidthProperty aProperty, nscoord& aResult) @@ -4965,7 +4965,7 @@ FormControlShrinksForPercentISize(nsIFrame* aFrame) * @param aContainerWM the container's WM */ static nscoord -AddIntrinsicSizeOffset(nsRenderingContext* aRenderingContext, +AddIntrinsicSizeOffset(gfxContext* aRenderingContext, nsIFrame* aFrame, const nsIFrame::IntrinsicISizeOffsetData& aOffsets, nsLayoutUtils::IntrinsicISizeType aType, @@ -5110,7 +5110,7 @@ AddStateBitToAncestors(nsIFrame* aFrame, nsFrameState aBit) /* static */ nscoord nsLayoutUtils::IntrinsicForAxis(PhysicalAxis aAxis, - nsRenderingContext* aRenderingContext, + gfxContext* aRenderingContext, nsIFrame* aFrame, IntrinsicISizeType aType, const Maybe& aPercentageBasis, @@ -5364,7 +5364,7 @@ nsLayoutUtils::IntrinsicForAxis(PhysicalAxis aAxis, } /* static */ nscoord -nsLayoutUtils::IntrinsicForContainer(nsRenderingContext* aRenderingContext, +nsLayoutUtils::IntrinsicForContainer(gfxContext* aRenderingContext, nsIFrame* aFrame, IntrinsicISizeType aType, uint32_t aFlags) @@ -5378,7 +5378,7 @@ nsLayoutUtils::IntrinsicForContainer(nsRenderingContext* aRenderingContext, /* static */ nscoord nsLayoutUtils::MinSizeContributionForAxis(PhysicalAxis aAxis, - nsRenderingContext* aRC, + gfxContext* aRC, nsIFrame* aFrame, IntrinsicISizeType aType, uint32_t aFlags) @@ -5674,7 +5674,7 @@ nsLayoutUtils::ComputeAutoSizeWithIntrinsicDimensions(nscoord minWidth, nscoord /* static */ nscoord nsLayoutUtils::MinISizeFromInline(nsIFrame* aFrame, - nsRenderingContext* aRenderingContext) + gfxContext* aRenderingContext) { NS_ASSERTION(!aFrame->IsContainerForFontSizeInflation(), "should not be container for font size inflation"); @@ -5688,7 +5688,7 @@ nsLayoutUtils::MinISizeFromInline(nsIFrame* aFrame, /* static */ nscoord nsLayoutUtils::PrefISizeFromInline(nsIFrame* aFrame, - nsRenderingContext* aRenderingContext) + gfxContext* aRenderingContext) { NS_ASSERTION(!aFrame->IsContainerForFontSizeInflation(), "should not be container for font size inflation"); @@ -5821,7 +5821,7 @@ nsLayoutUtils::AppUnitWidthOfStringBidi(const char16_t* aString, uint32_t aLength, const nsIFrame* aFrame, nsFontMetrics& aFontMetrics, - nsRenderingContext& aContext) + gfxContext& aContext) { nsPresContext* presContext = aFrame->PresContext(); if (presContext->BidiEnabled()) { @@ -5890,7 +5890,7 @@ nsLayoutUtils::AppUnitBoundsOfString(const char16_t* aString, void nsLayoutUtils::DrawString(const nsIFrame* aFrame, nsFontMetrics& aFontMetrics, - nsRenderingContext* aContext, + gfxContext* aContext, const char16_t* aString, int32_t aLength, nsPoint aPoint, @@ -5934,7 +5934,7 @@ nsLayoutUtils::DrawUniDirString(const char16_t* aString, uint32_t aLength, nsPoint aPoint, nsFontMetrics& aFontMetrics, - nsRenderingContext& aContext) + gfxContext& aContext) { nscoord x = aPoint.x; nscoord y = aPoint.y; @@ -5972,7 +5972,7 @@ nsLayoutUtils::DrawUniDirString(const char16_t* aString, /* static */ void nsLayoutUtils::PaintTextShadow(const nsIFrame* aFrame, - nsRenderingContext* aContext, + gfxContext* aContext, const nsRect& aTextRect, const nsRect& aDirtyRect, const nscolor& aForegroundColor, @@ -5985,7 +5985,7 @@ nsLayoutUtils::PaintTextShadow(const nsIFrame* aFrame, // Text shadow happens with the last value being painted at the back, // ie. it is painted first. - gfxContext* aDestCtx = aContext->ThebesContext(); + gfxContext* aDestCtx = aContext; for (uint32_t i = textStyle->mTextShadow->Length(); i > 0; --i) { nsCSSShadowItem* shadowDetails = textStyle->mTextShadow->ShadowAt(i - 1); nsPoint shadowOffset(shadowDetails->mXOffset, @@ -6009,16 +6009,12 @@ nsLayoutUtils::PaintTextShadow(const nsIFrame* aFrame, else shadowColor = aForegroundColor; - // Conjure an nsRenderingContext from a gfxContext for drawing the text - // to blur. - nsRenderingContext renderingContext(shadowContext); - aDestCtx->Save(); aDestCtx->NewPath(); aDestCtx->SetColor(Color::FromABGR(shadowColor)); // The callback will draw whatever we want to blur as a shadow. - aCallback(&renderingContext, shadowOffset, shadowColor, aCallbackData); + aCallback(shadowContext, shadowOffset, shadowColor, aCallbackData); contextBoxBlur.DoPaint(); aDestCtx->Restore(); diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 71eb0bb6dc22..b4aa9ad350b3 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -35,6 +35,7 @@ #include #include +class gfxContext; class nsPresContext; class nsIContent; class nsIAtom; @@ -54,7 +55,6 @@ class nsView; class nsIFrame; class nsStyleCoord; class nsStyleCorners; -class gfxContext; class nsPIDOMWindowOuter; class imgIRequest; class nsIDocument; @@ -1094,7 +1094,7 @@ public: * necessarily correspond to what's visible in the window; we don't * want to mess up the widget's layer tree. */ - static nsresult PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFrame, + static nsresult PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame, const nsRegion& aDirtyRegion, nscolor aBackstop, nsDisplayListBuilderMode aBuilderMode, PaintFrameFlags aFlags = PaintFrameFlags(0)); @@ -1395,7 +1395,7 @@ public: }; static nscoord IntrinsicForAxis(mozilla::PhysicalAxis aAxis, - nsRenderingContext* aRenderingContext, + gfxContext* aRenderingContext, nsIFrame* aFrame, IntrinsicISizeType aType, const mozilla::Maybe& aPercentageBasis = mozilla::Nothing(), @@ -1404,7 +1404,7 @@ public: /** * Calls IntrinsicForAxis with aFrame's parent's inline physical axis. */ - static nscoord IntrinsicForContainer(nsRenderingContext* aRenderingContext, + static nscoord IntrinsicForContainer(gfxContext* aRenderingContext, nsIFrame* aFrame, IntrinsicISizeType aType, uint32_t aFlags = 0); @@ -1427,7 +1427,7 @@ public: * should be a grid/flex item. */ static nscoord MinSizeContributionForAxis(mozilla::PhysicalAxis aAxis, - nsRenderingContext* aRC, + gfxContext* aRC, nsIFrame* aFrame, IntrinsicISizeType aType, uint32_t aFlags = 0); @@ -1539,11 +1539,11 @@ public: // Implement nsIFrame::GetPrefISize in terms of nsIFrame::AddInlinePrefISize static nscoord PrefISizeFromInline(nsIFrame* aFrame, - nsRenderingContext* aRenderingContext); + gfxContext* aRenderingContext); // Implement nsIFrame::GetMinISize in terms of nsIFrame::AddInlineMinISize static nscoord MinISizeFromInline(nsIFrame* aFrame, - nsRenderingContext* aRenderingContext); + gfxContext* aRenderingContext); // Get a suitable foreground color for painting aColor for aFrame. static nscolor DarkenColorIfNeeded(nsIFrame* aFrame, nscolor aColor); @@ -1584,7 +1584,7 @@ public: static nscoord AppUnitWidthOfStringBidi(const nsString& aString, const nsIFrame* aFrame, nsFontMetrics& aFontMetrics, - nsRenderingContext& aContext) { + gfxContext& aContext) { return nsLayoutUtils::AppUnitWidthOfStringBidi(aString.get(), aString.Length(), aFrame, aFontMetrics, aContext); @@ -1593,7 +1593,7 @@ public: uint32_t aLength, const nsIFrame* aFrame, nsFontMetrics& aFontMetrics, - nsRenderingContext& aContext); + gfxContext& aContext); static bool StringWidthIsGreaterThan(const nsString& aString, nsFontMetrics& aFontMetrics, @@ -1607,7 +1607,7 @@ public: static void DrawString(const nsIFrame* aFrame, nsFontMetrics& aFontMetrics, - nsRenderingContext* aContext, + gfxContext* aContext, const char16_t* aString, int32_t aLength, nsPoint aPoint, @@ -1625,19 +1625,19 @@ public: uint32_t aLength, nsPoint aPoint, nsFontMetrics& aFontMetrics, - nsRenderingContext& aContext); + gfxContext& aContext); /** * Helper function for drawing text-shadow. The callback's job * is to draw whatever needs to be blurred onto the given context. */ - typedef void (* TextShadowCallback)(nsRenderingContext* aCtx, + typedef void (* TextShadowCallback)(gfxContext* aCtx, nsPoint aShadowOffset, const nscolor& aShadowColor, void* aData); static void PaintTextShadow(const nsIFrame* aFrame, - nsRenderingContext* aContext, + gfxContext* aContext, const nsRect& aTextRect, const nsRect& aDirtyRect, const nscolor& aForegroundColor, diff --git a/layout/forms/nsButtonFrameRenderer.cpp b/layout/forms/nsButtonFrameRenderer.cpp index e2214c494061..594f889a5921 100644 --- a/layout/forms/nsButtonFrameRenderer.cpp +++ b/layout/forms/nsButtonFrameRenderer.cpp @@ -88,7 +88,7 @@ public: #endif virtual void Paint(nsDisplayListBuilder* aBuilder, - nsRenderingContext* aCtx) override; + gfxContext* aCtx) override; virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) override; NS_DISPLAY_DECL_NAME("ButtonBoxShadowOuter", TYPE_BUTTON_BOX_SHADOW_OUTER) @@ -102,7 +102,7 @@ nsDisplayButtonBoxShadowOuter::GetBounds(nsDisplayListBuilder* aBuilder, bool* a void nsDisplayButtonBoxShadowOuter::Paint(nsDisplayListBuilder* aBuilder, - nsRenderingContext* aCtx) { + gfxContext* aCtx) { nsRect frameRect = nsRect(ToReferenceFrame(), mFrame->GetSize()); nsCSSRendering::PaintBoxShadowOuter(mFrame->PresContext(), *aCtx, mFrame, @@ -127,7 +127,7 @@ public: aOutFrames->AppendElement(mFrame); } virtual void Paint(nsDisplayListBuilder* aBuilder, - nsRenderingContext* aCtx) override; + gfxContext* aCtx) override; virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) override; virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) override; @@ -243,7 +243,7 @@ nsDisplayButtonBorder::ComputeInvalidationRegion( void nsDisplayButtonBorder::Paint(nsDisplayListBuilder* aBuilder, - nsRenderingContext* aCtx) + gfxContext* aCtx) { NS_ASSERTION(mFrame, "No frame?"); nsPresContext* pc = mFrame->PresContext(); @@ -281,7 +281,7 @@ public: const nsDisplayItemGeometry* aGeometry, nsRegion *aInvalidRegion) override; virtual void Paint(nsDisplayListBuilder* aBuilder, - nsRenderingContext* aCtx) override; + gfxContext* aCtx) override; virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aParameters) override; @@ -323,7 +323,7 @@ nsDisplayButtonForeground::ComputeInvalidationRegion( } void nsDisplayButtonForeground::Paint(nsDisplayListBuilder* aBuilder, - nsRenderingContext* aCtx) + gfxContext* aCtx) { nsPresContext *presContext = mFrame->PresContext(); const nsStyleDisplay *disp = mFrame->StyleDisplay(); @@ -427,7 +427,7 @@ DrawResult nsButtonFrameRenderer::PaintInnerFocusBorder( nsDisplayListBuilder* aBuilder, nsPresContext* aPresContext, - nsRenderingContext& aRenderingContext, + gfxContext& aRenderingContext, const nsRect& aDirtyRect, const nsRect& aRect) { @@ -457,7 +457,7 @@ Maybe nsButtonFrameRenderer::CreateInnerFocusBorderRenderer( nsDisplayListBuilder* aBuilder, nsPresContext* aPresContext, - nsRenderingContext* aRenderingContext, + gfxContext* aRenderingContext, const nsRect& aDirtyRect, const nsRect& aRect) { @@ -481,7 +481,7 @@ DrawResult nsButtonFrameRenderer::PaintBorder( nsDisplayListBuilder* aBuilder, nsPresContext* aPresContext, - nsRenderingContext& aRenderingContext, + gfxContext& aRenderingContext, const nsRect& aDirtyRect, const nsRect& aRect) { diff --git a/layout/forms/nsButtonFrameRenderer.h b/layout/forms/nsButtonFrameRenderer.h index 81b6693a9e4a..90b74a6e6abc 100644 --- a/layout/forms/nsButtonFrameRenderer.h +++ b/layout/forms/nsButtonFrameRenderer.h @@ -10,12 +10,12 @@ #include "nsMargin.h" #include "nsCSSRenderingBorders.h" +class gfxContext; class nsIFrame; class nsFrame; class nsDisplayList; class nsDisplayListBuilder; class nsPresContext; -class nsRenderingContext; struct nsRect; class nsStyleContext; @@ -40,19 +40,19 @@ public: DrawResult PaintInnerFocusBorder(nsDisplayListBuilder* aBuilder, nsPresContext* aPresContext, - nsRenderingContext& aRenderingContext, + gfxContext& aRenderingContext, const nsRect& aDirtyRect, const nsRect& aRect); mozilla::Maybe CreateInnerFocusBorderRenderer(nsDisplayListBuilder* aBuilder, nsPresContext* aPresContext, - nsRenderingContext* aRenderingContext, + gfxContext* aRenderingContext, const nsRect& aDirtyRect, const nsRect& aRect); DrawResult PaintBorder(nsDisplayListBuilder* aBuilder, nsPresContext* aPresContext, - nsRenderingContext& aRenderingContext, + gfxContext& aRenderingContext, const nsRect& aDirtyRect, const nsRect& aRect); diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index 08be1b238237..1f458ca29029 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -5,6 +5,7 @@ #include "nsComboboxControlFrame.h" +#include "gfxContext.h" #include "gfxUtils.h" #include "mozilla/gfx/2D.h" #include "mozilla/gfx/PathHelpers.h" @@ -38,7 +39,6 @@ #include "nsDisplayList.h" #include "nsITheme.h" #include "nsThemeConstants.h" -#include "nsRenderingContext.h" #include "mozilla/Likely.h" #include #include "nsTextNode.h" @@ -735,7 +735,7 @@ static void printSize(char * aDesc, nscoord aSize) //------------------------------------------------------------------- nscoord -nsComboboxControlFrame::GetIntrinsicISize(nsRenderingContext* aRenderingContext, +nsComboboxControlFrame::GetIntrinsicISize(gfxContext* aRenderingContext, nsLayoutUtils::IntrinsicISizeType aType) { // get the scrollbar width, we'll use this later @@ -791,7 +791,7 @@ nsComboboxControlFrame::GetIntrinsicISize(nsRenderingContext* aRenderingContext, } nscoord -nsComboboxControlFrame::GetMinISize(nsRenderingContext *aRenderingContext) +nsComboboxControlFrame::GetMinISize(gfxContext *aRenderingContext) { nscoord minISize; DISPLAY_MIN_WIDTH(this, minISize); @@ -800,7 +800,7 @@ nsComboboxControlFrame::GetMinISize(nsRenderingContext *aRenderingContext) } nscoord -nsComboboxControlFrame::GetPrefISize(nsRenderingContext *aRenderingContext) +nsComboboxControlFrame::GetPrefISize(gfxContext *aRenderingContext) { nscoord prefISize; DISPLAY_PREF_WIDTH(this, prefISize); @@ -1539,12 +1539,12 @@ public: #endif virtual void Paint(nsDisplayListBuilder* aBuilder, - nsRenderingContext* aCtx) override; + gfxContext* aCtx) override; NS_DISPLAY_DECL_NAME("ComboboxFocus", TYPE_COMBOBOX_FOCUS) }; void nsDisplayComboboxFocus::Paint(nsDisplayListBuilder* aBuilder, - nsRenderingContext* aCtx) + gfxContext* aCtx) { static_cast(mFrame) ->PaintFocus(*aCtx->GetDrawTarget(), ToReferenceFrame()); diff --git a/layout/forms/nsComboboxControlFrame.h b/layout/forms/nsComboboxControlFrame.h index aa04d6ee015e..c9250f160275 100644 --- a/layout/forms/nsComboboxControlFrame.h +++ b/layout/forms/nsComboboxControlFrame.h @@ -77,9 +77,9 @@ public: virtual mozilla::a11y::AccType AccessibleType() override; #endif - virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override; + virtual nscoord GetMinISize(gfxContext *aRenderingContext) override; - virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override; + virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override; virtual void Reflow(nsPresContext* aCX, ReflowOutput& aDesiredSize, @@ -249,7 +249,7 @@ protected: DropDownPositionState AbsolutelyPositionDropDown(); // Helper for GetMinISize/GetPrefISize - nscoord GetIntrinsicISize(nsRenderingContext* aRenderingContext, + nscoord GetIntrinsicISize(gfxContext* aRenderingContext, nsLayoutUtils::IntrinsicISizeType aType); class RedisplayTextEvent : public mozilla::Runnable { diff --git a/layout/forms/nsDateTimeControlFrame.cpp b/layout/forms/nsDateTimeControlFrame.cpp index 51c5c37f9f96..fdfb15182d9a 100644 --- a/layout/forms/nsDateTimeControlFrame.cpp +++ b/layout/forms/nsDateTimeControlFrame.cpp @@ -126,7 +126,7 @@ nsDateTimeControlFrame::HandleBlurEvent() } nscoord -nsDateTimeControlFrame::GetMinISize(nsRenderingContext* aRenderingContext) +nsDateTimeControlFrame::GetMinISize(gfxContext* aRenderingContext) { nscoord result; DISPLAY_MIN_WIDTH(this, result); @@ -144,7 +144,7 @@ nsDateTimeControlFrame::GetMinISize(nsRenderingContext* aRenderingContext) } nscoord -nsDateTimeControlFrame::GetPrefISize(nsRenderingContext* aRenderingContext) +nsDateTimeControlFrame::GetPrefISize(gfxContext* aRenderingContext) { nscoord result; DISPLAY_PREF_WIDTH(this, result); diff --git a/layout/forms/nsDateTimeControlFrame.h b/layout/forms/nsDateTimeControlFrame.h index e8ab5297455d..7958d373393e 100644 --- a/layout/forms/nsDateTimeControlFrame.h +++ b/layout/forms/nsDateTimeControlFrame.h @@ -56,9 +56,9 @@ public: } // Reflow - nscoord GetMinISize(nsRenderingContext* aRenderingContext) override; + nscoord GetMinISize(gfxContext* aRenderingContext) override; - nscoord GetPrefISize(nsRenderingContext* aRenderingContext) override; + nscoord GetPrefISize(gfxContext* aRenderingContext) override; void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize, diff --git a/layout/forms/nsFieldSetFrame.cpp b/layout/forms/nsFieldSetFrame.cpp index 83ba3d49724c..817f6ebc2615 100644 --- a/layout/forms/nsFieldSetFrame.cpp +++ b/layout/forms/nsFieldSetFrame.cpp @@ -6,6 +6,7 @@ #include "nsFieldSetFrame.h" #include +#include "gfxContext.h" #include "mozilla/gfx/2D.h" #include "mozilla/Likely.h" #include "mozilla/Maybe.h" @@ -16,7 +17,6 @@ #include "nsIFrameInlines.h" #include "nsLayoutUtils.h" #include "nsLegendFrame.h" -#include "nsRenderingContext.h" #include "nsStyleConsts.h" using namespace mozilla; @@ -91,7 +91,7 @@ public: } #endif virtual void Paint(nsDisplayListBuilder* aBuilder, - nsRenderingContext* aCtx) override; + gfxContext* aCtx) override; virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) override; virtual void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder, const nsDisplayItemGeometry* aGeometry, @@ -102,7 +102,7 @@ public: void nsDisplayFieldSetBorder::Paint(nsDisplayListBuilder* aBuilder, - nsRenderingContext* aCtx) + gfxContext* aCtx) { image::DrawResult result = static_cast(mFrame)-> PaintBorder(aBuilder, *aCtx, ToReferenceFrame(), mVisibleRect); @@ -204,7 +204,7 @@ nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, image::DrawResult nsFieldSetFrame::PaintBorder( nsDisplayListBuilder* aBuilder, - nsRenderingContext& aRenderingContext, + gfxContext& aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect) { @@ -255,14 +255,12 @@ nsFieldSetFrame::PaintBorder( false); RefPtr clipPath = pathBuilder->Finish(); - gfxContext* gfx = aRenderingContext.ThebesContext(); - - gfx->Save(); - gfx->Clip(clipPath); + aRenderingContext.Save(); + aRenderingContext.Clip(clipPath); result &= nsCSSRendering::PaintBorder(presContext, aRenderingContext, this, aDirtyRect, rect, mStyleContext, borderFlags); - gfx->Restore(); + aRenderingContext.Restore(); } else { result &= nsCSSRendering::PaintBorder(presContext, aRenderingContext, this, @@ -274,7 +272,7 @@ nsFieldSetFrame::PaintBorder( } nscoord -nsFieldSetFrame::GetIntrinsicISize(nsRenderingContext* aRenderingContext, +nsFieldSetFrame::GetIntrinsicISize(gfxContext* aRenderingContext, nsLayoutUtils::IntrinsicISizeType aType) { nscoord legendWidth = 0; @@ -298,7 +296,7 @@ nsFieldSetFrame::GetIntrinsicISize(nsRenderingContext* aRenderingContext, nscoord -nsFieldSetFrame::GetMinISize(nsRenderingContext* aRenderingContext) +nsFieldSetFrame::GetMinISize(gfxContext* aRenderingContext) { nscoord result = 0; DISPLAY_MIN_WIDTH(this, result); @@ -308,7 +306,7 @@ nsFieldSetFrame::GetMinISize(nsRenderingContext* aRenderingContext) } nscoord -nsFieldSetFrame::GetPrefISize(nsRenderingContext* aRenderingContext) +nsFieldSetFrame::GetPrefISize(gfxContext* aRenderingContext) { nscoord result = 0; DISPLAY_PREF_WIDTH(this, result); diff --git a/layout/forms/nsFieldSetFrame.h b/layout/forms/nsFieldSetFrame.h index e4c85932c799..c13f1ff51285 100644 --- a/layout/forms/nsFieldSetFrame.h +++ b/layout/forms/nsFieldSetFrame.h @@ -20,10 +20,10 @@ public: explicit nsFieldSetFrame(nsStyleContext* aContext); nscoord - GetIntrinsicISize(nsRenderingContext* aRenderingContext, + GetIntrinsicISize(gfxContext* aRenderingContext, nsLayoutUtils::IntrinsicISizeType); - virtual nscoord GetMinISize(nsRenderingContext* aRenderingContext) override; - virtual nscoord GetPrefISize(nsRenderingContext* aRenderingContext) override; + virtual nscoord GetMinISize(gfxContext* aRenderingContext) override; + virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override; /** * The area to paint box-shadows around. It's the border rect except @@ -48,7 +48,7 @@ public: const nsDisplayListSet& aLists) override; DrawResult PaintBorder(nsDisplayListBuilder* aBuilder, - nsRenderingContext& aRenderingContext, + gfxContext& aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect); #ifdef DEBUG diff --git a/layout/forms/nsFileControlFrame.cpp b/layout/forms/nsFileControlFrame.cpp index a654b438e154..52f66a62b3e3 100644 --- a/layout/forms/nsFileControlFrame.cpp +++ b/layout/forms/nsFileControlFrame.cpp @@ -422,7 +422,7 @@ nsFileControlFrame::DnDListener::CanDropTheseFiles(nsIDOMDataTransfer* aDOMDataT } nscoord -nsFileControlFrame::GetMinISize(nsRenderingContext *aRenderingContext) +nsFileControlFrame::GetMinISize(gfxContext *aRenderingContext) { nscoord result; DISPLAY_MIN_WIDTH(this, result); diff --git a/layout/forms/nsFileControlFrame.h b/layout/forms/nsFileControlFrame.h index 8c4e76d060b6..57f96ac0f447 100644 --- a/layout/forms/nsFileControlFrame.h +++ b/layout/forms/nsFileControlFrame.h @@ -43,7 +43,7 @@ public: virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) override; virtual void SetFocus(bool aOn, bool aRepaint) override; - virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override; + virtual nscoord GetMinISize(gfxContext *aRenderingContext) override; virtual void DestroyFrom(nsIFrame* aDestructRoot) override; diff --git a/layout/forms/nsFormControlFrame.cpp b/layout/forms/nsFormControlFrame.cpp index a5d0180413d0..e87691b46974 100644 --- a/layout/forms/nsFormControlFrame.cpp +++ b/layout/forms/nsFormControlFrame.cpp @@ -40,7 +40,7 @@ NS_QUERYFRAME_HEAD(nsFormControlFrame) NS_QUERYFRAME_TAIL_INHERITING(nsAtomicContainerFrame) /* virtual */ nscoord -nsFormControlFrame::GetMinISize(nsRenderingContext *aRenderingContext) +nsFormControlFrame::GetMinISize(gfxContext *aRenderingContext) { nscoord result; DISPLAY_MIN_WIDTH(this, result); @@ -53,7 +53,7 @@ nsFormControlFrame::GetMinISize(nsRenderingContext *aRenderingContext) } /* virtual */ nscoord -nsFormControlFrame::GetPrefISize(nsRenderingContext *aRenderingContext) +nsFormControlFrame::GetPrefISize(gfxContext *aRenderingContext) { nscoord result; DISPLAY_PREF_WIDTH(this, result); @@ -67,7 +67,7 @@ nsFormControlFrame::GetPrefISize(nsRenderingContext *aRenderingContext) /* virtual */ LogicalSize -nsFormControlFrame::ComputeAutoSize(nsRenderingContext* aRC, +nsFormControlFrame::ComputeAutoSize(gfxContext* aRC, WritingMode aWM, const LogicalSize& aCBSize, nscoord aAvailableISize, diff --git a/layout/forms/nsFormControlFrame.h b/layout/forms/nsFormControlFrame.h index ecfdaa4f3683..f7e8de260493 100644 --- a/layout/forms/nsFormControlFrame.h +++ b/layout/forms/nsFormControlFrame.h @@ -48,14 +48,14 @@ public: * Both GetMinISize and GetPrefISize will return whatever GetIntrinsicISize * returns. */ - virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override; - virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override; + virtual nscoord GetMinISize(gfxContext *aRenderingContext) override; + virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override; /** * Our auto size is just intrinsic width and intrinsic height. */ virtual mozilla::LogicalSize - ComputeAutoSize(nsRenderingContext* aRenderingContext, + ComputeAutoSize(gfxContext* aRenderingContext, mozilla::WritingMode aWM, const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize, diff --git a/layout/forms/nsGfxCheckboxControlFrame.cpp b/layout/forms/nsGfxCheckboxControlFrame.cpp index 101e3a4adf30..02a758dd5061 100644 --- a/layout/forms/nsGfxCheckboxControlFrame.cpp +++ b/layout/forms/nsGfxCheckboxControlFrame.cpp @@ -5,12 +5,12 @@ #include "nsGfxCheckboxControlFrame.h" +#include "gfxContext.h" #include "gfxUtils.h" #include "mozilla/gfx/2D.h" #include "nsIContent.h" #include "nsCOMPtr.h" #include "nsLayoutUtils.h" -#include "nsRenderingContext.h" #include "nsIDOMHTMLInputElement.h" #include "nsDisplayList.h" #include diff --git a/layout/forms/nsGfxRadioControlFrame.cpp b/layout/forms/nsGfxRadioControlFrame.cpp index a01bf492ab8a..da14f1a47581 100644 --- a/layout/forms/nsGfxRadioControlFrame.cpp +++ b/layout/forms/nsGfxRadioControlFrame.cpp @@ -6,11 +6,11 @@ #include "nsGfxRadioControlFrame.h" #include "gfx2DGlue.h" +#include "gfxContext.h" #include "gfxUtils.h" #include "mozilla/gfx/2D.h" #include "mozilla/gfx/PathHelpers.h" #include "nsLayoutUtils.h" -#include "nsRenderingContext.h" #include "nsDisplayList.h" using namespace mozilla; diff --git a/layout/forms/nsHTMLButtonControlFrame.cpp b/layout/forms/nsHTMLButtonControlFrame.cpp index 2d04562eef09..4606b46a9d6f 100644 --- a/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/layout/forms/nsHTMLButtonControlFrame.cpp @@ -142,7 +142,7 @@ nsHTMLButtonControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, } nscoord -nsHTMLButtonControlFrame::GetMinISize(nsRenderingContext* aRenderingContext) +nsHTMLButtonControlFrame::GetMinISize(gfxContext* aRenderingContext) { nscoord result; DISPLAY_MIN_WIDTH(this, result); @@ -156,7 +156,7 @@ nsHTMLButtonControlFrame::GetMinISize(nsRenderingContext* aRenderingContext) } nscoord -nsHTMLButtonControlFrame::GetPrefISize(nsRenderingContext* aRenderingContext) +nsHTMLButtonControlFrame::GetPrefISize(gfxContext* aRenderingContext) { nscoord result; DISPLAY_PREF_WIDTH(this, result); diff --git a/layout/forms/nsHTMLButtonControlFrame.h b/layout/forms/nsHTMLButtonControlFrame.h index 6736b5596efc..05b1f4f5cccf 100644 --- a/layout/forms/nsHTMLButtonControlFrame.h +++ b/layout/forms/nsHTMLButtonControlFrame.h @@ -11,7 +11,7 @@ #include "nsIFormControlFrame.h" #include "nsButtonFrameRenderer.h" -class nsRenderingContext; +class gfxContext; class nsPresContext; class nsHTMLButtonControlFrame : public nsContainerFrame, @@ -33,9 +33,9 @@ public: const nsRect& aDirtyRect, const nsDisplayListSet& aLists) override; - virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override; + virtual nscoord GetMinISize(gfxContext *aRenderingContext) override; - virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override; + virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override; virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize, diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index 9f77627a1cd4..dec2e65630a9 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -323,7 +323,7 @@ nsListControlFrame::CalcBSizeOfARow() } nscoord -nsListControlFrame::GetPrefISize(nsRenderingContext *aRenderingContext) +nsListControlFrame::GetPrefISize(gfxContext *aRenderingContext) { nscoord result; DISPLAY_PREF_WIDTH(this, result); @@ -341,7 +341,7 @@ nsListControlFrame::GetPrefISize(nsRenderingContext *aRenderingContext) } nscoord -nsListControlFrame::GetMinISize(nsRenderingContext *aRenderingContext) +nsListControlFrame::GetMinISize(gfxContext *aRenderingContext) { nscoord result; DISPLAY_MIN_WIDTH(this, result); diff --git a/layout/forms/nsListControlFrame.h b/layout/forms/nsListControlFrame.h index 5e4893f87035..eab82ecd5105 100644 --- a/layout/forms/nsListControlFrame.h +++ b/layout/forms/nsListControlFrame.h @@ -65,8 +65,8 @@ public: virtual void SetInitialChildList(ChildListID aListID, nsFrameList& aChildList) override; - virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override; - virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override; + virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override; + virtual nscoord GetMinISize(gfxContext *aRenderingContext) override; virtual void Reflow(nsPresContext* aCX, ReflowOutput& aDesiredSize, diff --git a/layout/forms/nsMeterFrame.cpp b/layout/forms/nsMeterFrame.cpp index 4683c30b1ff3..d007c016474c 100644 --- a/layout/forms/nsMeterFrame.cpp +++ b/layout/forms/nsMeterFrame.cpp @@ -210,7 +210,7 @@ nsMeterFrame::AttributeChanged(int32_t aNameSpaceID, } LogicalSize -nsMeterFrame::ComputeAutoSize(nsRenderingContext* aRenderingContext, +nsMeterFrame::ComputeAutoSize(gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize, nscoord aAvailableISize, @@ -236,7 +236,7 @@ nsMeterFrame::ComputeAutoSize(nsRenderingContext* aRenderingContext, } nscoord -nsMeterFrame::GetMinISize(nsRenderingContext *aRenderingContext) +nsMeterFrame::GetMinISize(gfxContext *aRenderingContext) { RefPtr fontMet = nsLayoutUtils::GetFontMetricsForFrame(this, 1.0f); @@ -252,7 +252,7 @@ nsMeterFrame::GetMinISize(nsRenderingContext *aRenderingContext) } nscoord -nsMeterFrame::GetPrefISize(nsRenderingContext *aRenderingContext) +nsMeterFrame::GetPrefISize(gfxContext *aRenderingContext) { return GetMinISize(aRenderingContext); } diff --git a/layout/forms/nsMeterFrame.h b/layout/forms/nsMeterFrame.h index f5dde611a865..f09e82f5d400 100644 --- a/layout/forms/nsMeterFrame.h +++ b/layout/forms/nsMeterFrame.h @@ -48,7 +48,7 @@ public: int32_t aModType) override; virtual mozilla::LogicalSize - ComputeAutoSize(nsRenderingContext* aRenderingContext, + ComputeAutoSize(gfxContext* aRenderingContext, mozilla::WritingMode aWM, const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize, @@ -57,8 +57,8 @@ public: const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override; - virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override; - virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override; + virtual nscoord GetMinISize(gfxContext *aRenderingContext) override; + virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override; virtual bool IsFrameOfType(uint32_t aFlags) const override { diff --git a/layout/forms/nsNumberControlFrame.cpp b/layout/forms/nsNumberControlFrame.cpp index 7db5c30190ec..ab7d3d5a193c 100644 --- a/layout/forms/nsNumberControlFrame.cpp +++ b/layout/forms/nsNumberControlFrame.cpp @@ -67,7 +67,7 @@ nsNumberControlFrame::DestroyFrom(nsIFrame* aDestructRoot) } nscoord -nsNumberControlFrame::GetMinISize(nsRenderingContext* aRenderingContext) +nsNumberControlFrame::GetMinISize(gfxContext* aRenderingContext) { nscoord result; DISPLAY_MIN_WIDTH(this, result); @@ -85,7 +85,7 @@ nsNumberControlFrame::GetMinISize(nsRenderingContext* aRenderingContext) } nscoord -nsNumberControlFrame::GetPrefISize(nsRenderingContext* aRenderingContext) +nsNumberControlFrame::GetPrefISize(gfxContext* aRenderingContext) { nscoord result; DISPLAY_PREF_WIDTH(this, result); diff --git a/layout/forms/nsNumberControlFrame.h b/layout/forms/nsNumberControlFrame.h index 5d377a67f712..826a0119f052 100644 --- a/layout/forms/nsNumberControlFrame.h +++ b/layout/forms/nsNumberControlFrame.h @@ -53,9 +53,9 @@ public: virtual mozilla::a11y::AccType AccessibleType() override; #endif - virtual nscoord GetMinISize(nsRenderingContext* aRenderingContext) override; + virtual nscoord GetMinISize(gfxContext* aRenderingContext) override; - virtual nscoord GetPrefISize(nsRenderingContext* aRenderingContext) override; + virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override; virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize, diff --git a/layout/forms/nsProgressFrame.cpp b/layout/forms/nsProgressFrame.cpp index 73e686716ef6..a8cc3ede1168 100644 --- a/layout/forms/nsProgressFrame.cpp +++ b/layout/forms/nsProgressFrame.cpp @@ -224,7 +224,7 @@ nsProgressFrame::AttributeChanged(int32_t aNameSpaceID, } LogicalSize -nsProgressFrame::ComputeAutoSize(nsRenderingContext* aRenderingContext, +nsProgressFrame::ComputeAutoSize(gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize, nscoord aAvailableISize, @@ -249,7 +249,7 @@ nsProgressFrame::ComputeAutoSize(nsRenderingContext* aRenderingContext, } nscoord -nsProgressFrame::GetMinISize(nsRenderingContext *aRenderingContext) +nsProgressFrame::GetMinISize(gfxContext *aRenderingContext) { RefPtr fontMet = nsLayoutUtils::GetFontMetricsForFrame(this, 1.0f); @@ -265,7 +265,7 @@ nsProgressFrame::GetMinISize(nsRenderingContext *aRenderingContext) } nscoord -nsProgressFrame::GetPrefISize(nsRenderingContext *aRenderingContext) +nsProgressFrame::GetPrefISize(gfxContext *aRenderingContext) { return GetMinISize(aRenderingContext); } diff --git a/layout/forms/nsProgressFrame.h b/layout/forms/nsProgressFrame.h index cb4b8c39c71b..56a16ea6a481 100644 --- a/layout/forms/nsProgressFrame.h +++ b/layout/forms/nsProgressFrame.h @@ -56,7 +56,7 @@ public: int32_t aModType) override; virtual mozilla::LogicalSize - ComputeAutoSize(nsRenderingContext* aRenderingContext, + ComputeAutoSize(gfxContext* aRenderingContext, mozilla::WritingMode aWM, const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize, @@ -65,8 +65,8 @@ public: const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override; - virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override; - virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override; + virtual nscoord GetMinISize(gfxContext *aRenderingContext) override; + virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override; virtual bool IsFrameOfType(uint32_t aFlags) const override { diff --git a/layout/forms/nsRangeFrame.cpp b/layout/forms/nsRangeFrame.cpp index 52c7f84cbf86..c5b209bfe36e 100644 --- a/layout/forms/nsRangeFrame.cpp +++ b/layout/forms/nsRangeFrame.cpp @@ -8,6 +8,7 @@ #include "mozilla/EventStates.h" #include "mozilla/TouchEvents.h" +#include "gfxContext.h" #include "nsContentCreatorFunctions.h" #include "nsContentList.h" #include "nsContentUtils.h" @@ -22,7 +23,6 @@ #include "mozilla/dom/HTMLInputElement.h" #include "nsPresContext.h" #include "nsNodeInfoManager.h" -#include "nsRenderingContext.h" #include "mozilla/dom/Element.h" #include "mozilla/StyleSetHandle.h" #include "mozilla/StyleSetHandleInlines.h" @@ -188,7 +188,7 @@ public: const nsDisplayItemGeometry* aGeometry, nsRegion *aInvalidRegion) override; virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) override; - virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) override; + virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override; NS_DISPLAY_DECL_NAME("RangeFocusRing", TYPE_RANGE_FOCUS_RING) }; @@ -234,7 +234,7 @@ nsDisplayRangeFocusRing::GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) void nsDisplayRangeFocusRing::Paint(nsDisplayListBuilder* aBuilder, - nsRenderingContext* aCtx) + gfxContext* aCtx) { bool unused; nsStyleContext* styleContext = @@ -768,7 +768,7 @@ nsRangeFrame::AttributeChanged(int32_t aNameSpaceID, } LogicalSize -nsRangeFrame::ComputeAutoSize(nsRenderingContext* aRenderingContext, +nsRangeFrame::ComputeAutoSize(gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize, nscoord aAvailableISize, @@ -803,7 +803,7 @@ nsRangeFrame::ComputeAutoSize(nsRenderingContext* aRenderingContext, } nscoord -nsRangeFrame::GetMinISize(nsRenderingContext *aRenderingContext) +nsRangeFrame::GetMinISize(gfxContext *aRenderingContext) { // nsFrame::ComputeSize calls GetMinimumWidgetSize to prevent us from being // given too small a size when we're natively themed. If we aren't native @@ -812,7 +812,7 @@ nsRangeFrame::GetMinISize(nsRenderingContext *aRenderingContext) } nscoord -nsRangeFrame::GetPrefISize(nsRenderingContext *aRenderingContext) +nsRangeFrame::GetPrefISize(gfxContext *aRenderingContext) { bool isInline = IsInlineOriented(); diff --git a/layout/forms/nsRangeFrame.h b/layout/forms/nsRangeFrame.h index 7a466994daef..ba8fafcb5901 100644 --- a/layout/forms/nsRangeFrame.h +++ b/layout/forms/nsRangeFrame.h @@ -70,7 +70,7 @@ public: int32_t aModType) override; virtual mozilla::LogicalSize - ComputeAutoSize(nsRenderingContext* aRenderingContext, + ComputeAutoSize(gfxContext* aRenderingContext, mozilla::WritingMode aWM, const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize, @@ -79,8 +79,8 @@ public: const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override; - virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override; - virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override; + virtual nscoord GetMinISize(gfxContext *aRenderingContext) override; + virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override; virtual bool IsFrameOfType(uint32_t aFlags) const override { diff --git a/layout/forms/nsSelectsAreaFrame.cpp b/layout/forms/nsSelectsAreaFrame.cpp index 5d89685b6bd5..2716a70a6f05 100644 --- a/layout/forms/nsSelectsAreaFrame.cpp +++ b/layout/forms/nsSelectsAreaFrame.cpp @@ -115,7 +115,7 @@ public: listFrame->GetOffsetToCrossDoc(ReferenceFrame()); } virtual void Paint(nsDisplayListBuilder* aBuilder, - nsRenderingContext* aCtx) override { + gfxContext* aCtx) override { nsListControlFrame* listFrame = GetEnclosingListFrame(Frame()); // listFrame must be non-null or we wouldn't get called. listFrame->PaintFocus(aCtx->GetDrawTarget(), diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp index d04c4c9ee17d..3b20d9c4d0d1 100644 --- a/layout/forms/nsTextControlFrame.cpp +++ b/layout/forms/nsTextControlFrame.cpp @@ -5,6 +5,7 @@ #include "mozilla/DebugOnly.h" +#include "gfxContext.h" #include "nsCOMPtr.h" #include "nsFontMetrics.h" #include "nsTextControlFrame.h" @@ -20,7 +21,6 @@ #include "nsIContent.h" #include "nsPresContext.h" -#include "nsRenderingContext.h" #include "nsGkAtoms.h" #include "nsLayoutUtils.h" #include "nsIDOMElement.h" @@ -138,7 +138,7 @@ nsTextControlFrame::DestroyFrom(nsIFrame* aDestructRoot) } LogicalSize -nsTextControlFrame::CalcIntrinsicSize(nsRenderingContext* aRenderingContext, +nsTextControlFrame::CalcIntrinsicSize(gfxContext* aRenderingContext, WritingMode aWM, float aFontSizeInflation) const { @@ -431,7 +431,7 @@ nsTextControlFrame::AppendAnonymousContentTo(nsTArray& aElements, } nscoord -nsTextControlFrame::GetPrefISize(nsRenderingContext* aRenderingContext) +nsTextControlFrame::GetPrefISize(gfxContext* aRenderingContext) { nscoord result = 0; DISPLAY_PREF_WIDTH(this, result); @@ -442,7 +442,7 @@ nsTextControlFrame::GetPrefISize(nsRenderingContext* aRenderingContext) } nscoord -nsTextControlFrame::GetMinISize(nsRenderingContext* aRenderingContext) +nsTextControlFrame::GetMinISize(gfxContext* aRenderingContext) { // Our min width is just our preferred width if we have auto width. nscoord result; @@ -452,7 +452,7 @@ nsTextControlFrame::GetMinISize(nsRenderingContext* aRenderingContext) } LogicalSize -nsTextControlFrame::ComputeAutoSize(nsRenderingContext* aRenderingContext, +nsTextControlFrame::ComputeAutoSize(gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize, nscoord aAvailableISize, diff --git a/layout/forms/nsTextControlFrame.h b/layout/forms/nsTextControlFrame.h index c941c11b167c..3b04fdb622d9 100644 --- a/layout/forms/nsTextControlFrame.h +++ b/layout/forms/nsTextControlFrame.h @@ -44,11 +44,11 @@ public: return do_QueryFrame(PrincipalChildList().FirstChild()); } - virtual nscoord GetMinISize(nsRenderingContext* aRenderingContext) override; - virtual nscoord GetPrefISize(nsRenderingContext* aRenderingContext) override; + virtual nscoord GetMinISize(gfxContext* aRenderingContext) override; + virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override; virtual mozilla::LogicalSize - ComputeAutoSize(nsRenderingContext* aRenderingContext, + ComputeAutoSize(gfxContext* aRenderingContext, mozilla::WritingMode aWM, const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize, @@ -300,7 +300,7 @@ protected: // Compute our intrinsic size. This does not include any borders, paddings, // etc. Just the size of our actual area for the text (and the scrollbars, // for