diff --git a/dom/canvas/DocumentRendererChild.cpp b/dom/canvas/DocumentRendererChild.cpp index edfc4746a72c..1d39fa6abbd4 100644 --- a/dom/canvas/DocumentRendererChild.cpp +++ b/dom/canvas/DocumentRendererChild.cpp @@ -7,7 +7,6 @@ #include "base/basictypes.h" #include "gfx2DGlue.h" -#include "gfxContext.h" #include "gfxPattern.h" #include "mozilla/gfx/2D.h" #include "mozilla/RefPtr.h" @@ -20,6 +19,7 @@ #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 80fe0ddf64bc..463ba27076a0 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 7cfe5322795f..f1922825dc0d 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 c5d33dc2da48..0d35fcf333f0 100644 --- a/dom/plugins/ipc/PluginInstanceParent.cpp +++ b/dom/plugins/ipc/PluginInstanceParent.cpp @@ -31,6 +31,7 @@ #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 8c7497b0c0c7..e2d897188b8e 100644 --- a/gfx/layers/basic/BasicDisplayItemLayer.cpp +++ b/gfx/layers/basic/BasicDisplayItemLayer.cpp @@ -60,7 +60,8 @@ public: RefPtr context = gfxContext::CreateOrNull(aDT, aDeviceOffset); context->SetMatrix(ThebesMatrix(transform)); - mItem->Paint(mBuilder, context); + nsRenderingContext ctx(context); + mItem->Paint(mBuilder, &ctx); } protected: diff --git a/gfx/layers/wr/WebRenderDisplayItemLayer.cpp b/gfx/layers/wr/WebRenderDisplayItemLayer.cpp index bf37fce9e09c..030a37874256 100644 --- a/gfx/layers/wr/WebRenderDisplayItemLayer.cpp +++ b/gfx/layers/wr/WebRenderDisplayItemLayer.cpp @@ -161,7 +161,8 @@ WebRenderDisplayItemLayer::PushItemAsBlobImage(wr::DisplayListBuilder& aBuilder, RefPtr context = gfxContext::CreateOrNull(dt, offset.ToUnknownPoint()); MOZ_ASSERT(context); - mItem->Paint(mBuilder, context); + nsRenderingContext ctx(context); + mItem->Paint(mBuilder, &ctx); } wr::ByteBuffer bytes; diff --git a/gfx/src/moz.build b/gfx/src/moz.build index dbfb4049dbb1..3678eee7abbd 100644 --- a/gfx/src/moz.build +++ b/gfx/src/moz.build @@ -33,6 +33,7 @@ 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 d0deef87959a..d3da66ccae03 100644 --- a/gfx/src/nsFontMetrics.cpp +++ b/gfx/src/nsFontMetrics.cpp @@ -6,7 +6,6 @@ #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 @@ -17,6 +16,7 @@ #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, - gfxContext *aContext) + nsRenderingContext *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); + gfxTextRun::DrawParams params(aContext->ThebesContext()); 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, - gfxContext *aContext, + nsRenderingContext *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); + gfxTextRun::DrawParams params(aContext->ThebesContext()); params.provider = &provider; textRun->Draw(range, pt, params); } diff --git a/gfx/src/nsFontMetrics.h b/gfx/src/nsFontMetrics.h index e1c80f6561c4..49fc2c486e4d 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, - gfxContext *aContext); + nsRenderingContext *aContext); void DrawString(const char16_t* aString, uint32_t aLength, nscoord aX, nscoord aY, - gfxContext *aContext, + nsRenderingContext *aContext, DrawTarget* aTextRunConstructionDrawTarget); nsBoundingMetrics GetBoundingMetrics(const char16_t *aString, diff --git a/gfx/src/nsITheme.h b/gfx/src/nsITheme.h index ae072c9eeb14..64352802c4d6 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(gfxContext* aContext, + NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext, nsIFrame* aFrame, uint8_t aWidgetType, const nsRect& aRect, diff --git a/gfx/src/nsRenderingContext.h b/gfx/src/nsRenderingContext.h new file mode 100644 index 000000000000..02bb397d655c --- /dev/null +++ b/gfx/src/nsRenderingContext.h @@ -0,0 +1,41 @@ +/* -*- 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 97dea208cabd..a189462551d5 100644 --- a/layout/base/GeckoRestyleManager.cpp +++ b/layout/base/GeckoRestyleManager.cpp @@ -11,7 +11,6 @@ #include "mozilla/GeckoRestyleManager.h" #include // For std::max -#include "gfxContext.h" #include "mozilla/EffectSet.h" #include "mozilla/EventStates.h" #include "mozilla/ViewportFrame.h" @@ -32,6 +31,7 @@ #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 d9bcb9ae2061..268140f655fa 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -45,7 +45,6 @@ #include "winuser.h" #endif -#include "gfxContext.h" #include "gfxPrefs.h" #include "gfxUserFontSet.h" #include "nsPresContext.h" @@ -103,6 +102,7 @@ #include "prenv.h" #include "nsDisplayList.h" #include "nsRegion.h" +#include "nsRenderingContext.h" #include "nsAutoLayoutPhase.h" #ifdef MOZ_REFLOW_PERF #include "nsFontMetrics.h" @@ -118,6 +118,7 @@ #include "nsNetUtil.h" #include "nsThreadUtils.h" #include "nsStyleSheetService.h" +#include "gfxContext.h" #include "gfxUtils.h" #include "nsSMILAnimationController.h" #include "SVGContentUtils.h" @@ -380,7 +381,7 @@ public: void Add(const char * aName, nsIFrame * aFrame); ReflowCounter * LookUp(const char * aName); - void PaintCount(const char *aName, gfxContext* aRenderingContext, + void PaintCount(const char *aName, nsRenderingContext* aRenderingContext, nsPresContext *aPresContext, nsIFrame *aFrame, const nsPoint &aOffset, uint32_t aColor); @@ -4684,6 +4685,8 @@ 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()) { @@ -4732,7 +4735,7 @@ PresShell::RenderDocument(const nsRect& aRect, uint32_t aFlags, flags &= ~PaintFrameFlags::PAINT_WIDGET_LAYERS; } - nsLayoutUtils::PaintFrame(aThebesContext, rootFrame, nsRegion(aRect), + nsLayoutUtils::PaintFrame(&rc, rootFrame, nsRegion(aRect), aBackgroundColor, nsDisplayListBuilderMode::PAINTING, flags); @@ -5072,6 +5075,8 @@ PresShell::PaintRangePaintInfo(const nsTArray>& aItems ctx->Clip(path); } + nsRenderingContext rc(ctx); + gfxMatrix initialTM = ctx->CurrentMatrix(); if (resize) @@ -5106,7 +5111,7 @@ PresShell::PaintRangePaintInfo(const nsTArray>& aItems aArea.MoveBy(-rangeInfo->mRootOffset.x, -rangeInfo->mRootOffset.y); nsRegion visible(aArea); RefPtr layerManager = - rangeInfo->mList.PaintRoot(&rangeInfo->mBuilder, ctx, + rangeInfo->mList.PaintRoot(&rangeInfo->mBuilder, &rc, nsDisplayList::PAINT_DEFAULT); aArea.MoveBy(rangeInfo->mRootOffset.x, rangeInfo->mRootOffset.y); } @@ -9238,7 +9243,7 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible) nsIFrame* rootFrame = mFrameConstructor->GetRootFrame(); // CreateReferenceRenderingContext can return nullptr - RefPtr rcx(CreateReferenceRenderingContext()); + nsRenderingContext rcx(CreateReferenceRenderingContext()); #ifdef DEBUG mCurrentReflowRoot = target; @@ -9261,7 +9266,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); @@ -9342,7 +9347,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); @@ -10260,7 +10265,7 @@ PresShell::CountReflows(const char * aName, nsIFrame * aFrame) //------------------------------------------------------------- void PresShell::PaintCount(const char * aName, - gfxContext* aRenderingContext, + nsRenderingContext* aRenderingContext, nsPresContext* aPresContext, nsIFrame * aFrame, const nsPoint& aOffset, @@ -10453,7 +10458,7 @@ void ReflowCountMgr::Add(const char * aName, nsIFrame * aFrame) //------------------------------------------------------------------ void ReflowCountMgr::PaintCount(const char* aName, - gfxContext* aRenderingContext, + nsRenderingContext* aRenderingContext, nsPresContext* aPresContext, nsIFrame* aFrame, const nsPoint& aOffset, @@ -10470,11 +10475,11 @@ void ReflowCountMgr::PaintCount(const char* aName, DrawTarget* drawTarget = aRenderingContext->GetDrawTarget(); int32_t appUnitsPerDevPixel = aPresContext->AppUnitsPerDevPixel(); - aRenderingContext->Save(); + aRenderingContext->ThebesContext()->Save(); gfxPoint devPixelOffset = nsLayoutUtils::PointToGfxPoint(aOffset, appUnitsPerDevPixel); - aRenderingContext->SetMatrix( - aRenderingContext->CurrentMatrix().Translate(devPixelOffset)); + aRenderingContext->ThebesContext()->SetMatrix( + aRenderingContext->ThebesContext()->CurrentMatrix().Translate(devPixelOffset)); // We don't care about the document language or user fonts here; // just get a default Latin font. @@ -10517,12 +10522,12 @@ void ReflowCountMgr::PaintCount(const char* aName, ColorPattern black(ToDeviceColor(Color(0.f, 0.f, 0.f, 1.f))); drawTarget->FillRect(devPxRect, black); - aRenderingContext->SetColor(color2); + aRenderingContext->ThebesContext()->SetColor(color2); fm->DrawString(buf, len, x+15, y+15, aRenderingContext); - aRenderingContext->SetColor(color); + aRenderingContext->ThebesContext()->SetColor(color); fm->DrawString(buf, len, x, y, aRenderingContext); - aRenderingContext->Restore(); + aRenderingContext->ThebesContext()->Restore(); } } } @@ -11187,8 +11192,8 @@ nsIPresShell::SyncWindowProperties(nsView* aView) nsIFrame* frame = aView->GetFrame(); if (frame && mPresContext) { // CreateReferenceRenderingContext can return nullptr - RefPtr rcx(CreateReferenceRenderingContext()); - nsContainerFrame::SyncWindowProperties(mPresContext, frame, aView, rcx, 0); + nsRenderingContext rcx(CreateReferenceRenderingContext()); + nsContainerFrame::SyncWindowProperties(mPresContext, frame, aView, &rcx, 0); } } diff --git a/layout/base/PresShell.h b/layout/base/PresShell.h index 96a0114b750e..8cc607a2ab62 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, - gfxContext* aRenderingContext, + nsRenderingContext* aRenderingContext, nsPresContext* aPresContext, nsIFrame * aFrame, const nsPoint& aOffset, diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index f1b40d80f425..f38c6905a67a 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. - RefPtr rc = - aFrame->PresContext()->PresShell()->CreateReferenceRenderingContext(); + nsRenderingContext 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 0b896d15f2b5..53f4022485ed 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(gfxContext* aCtx, + nsIRenderingContextBidiProcessor(nsRenderingContext* aCtx, DrawTarget* aTextRunConstructionDrawTarget, nsFontMetrics* aFontMetrics, const nsPoint& aPt) @@ -2344,7 +2344,7 @@ public: } private: - gfxContext* mCtx; + nsRenderingContext* 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, - gfxContext& aRenderingContext, + nsRenderingContext& aRenderingContext, DrawTarget* aTextRunConstructionDrawTarget, nsFontMetrics& aFontMetrics, Mode aMode, diff --git a/layout/base/nsBidiPresUtils.h b/layout/base/nsBidiPresUtils.h index d0b30e8cc7be..05435a3d6e72 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, - gfxContext& aRenderingContext, + nsRenderingContext& aRenderingContext, DrawTarget* aTextRunConstructionDrawTarget, nsFontMetrics& aFontMetrics, nscoord aX, @@ -231,7 +231,7 @@ public: int32_t aLength, nsBidiLevel aBaseLevel, nsPresContext* aPresContext, - gfxContext& aRenderingContext, + nsRenderingContext& aRenderingContext, nsFontMetrics& aFontMetrics) { nscoord length; @@ -379,7 +379,7 @@ private: int32_t aLength, nsBidiLevel aBaseLevel, nsPresContext* aPresContext, - gfxContext& aRenderingContext, + nsRenderingContext& aRenderingContext, DrawTarget* aTextRunConstructionDrawTarget, nsFontMetrics& aFontMetrics, Mode aMode, diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 4455de03c9c7..d11b1971aabb 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -6,7 +6,6 @@ /* container for a document and its presentation */ -#include "gfxContext.h" #include "mozilla/ServoRestyleManager.h" #include "mozilla/ServoStyleSet.h" #include "nsAutoPtr.h" @@ -83,6 +82,7 @@ #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; { - RefPtr rcx(presShell->CreateReferenceRenderingContext()); - prefWidth = root->GetPrefISize(rcx); + nsRenderingContext 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 e8ecafcd67ea..7337b37434f8 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,6 +77,7 @@ template class nsCOMArray; class AutoWeakFrame; class WeakFrame; class nsIScrollableFrame; +class gfxContext; class nsIDOMEvent; class nsDisplayList; class nsDisplayListBuilder; @@ -1020,7 +1021,7 @@ public: virtual void DumpReflows() = 0; virtual void CountReflows(const char * aName, nsIFrame * aFrame) = 0; virtual void PaintCount(const char * aName, - gfxContext* aRenderingContext, + nsRenderingContext* aRenderingContext, nsPresContext * aPresContext, nsIFrame * aFrame, const nsPoint& aOffset, diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index a7535a7e7c3a..e46ed972732f 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 "gfxContext.h" +#include "nsRenderingContext.h" #include "nsIInterfaceRequestorUtils.h" #include "nsCSSRendering.h" #include "nsTextFragment.h" @@ -3420,7 +3420,7 @@ nsLayoutUtils::ExpireDisplayPortOnAsyncScrollableAncestor(nsIFrame* aFrame) } nsresult -nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame, +nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFrame, const nsRegion& aDirtyRegion, nscolor aBackstop, nsDisplayListBuilderMode aBuilderMode, PaintFrameFlags aFlags) @@ -3518,8 +3518,8 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame, gfxPoint devPixelOffset = nsLayoutUtils::PointToGfxPoint(pos, presContext->AppUnitsPerDevPixel()); - aRenderingContext->SetMatrix( - aRenderingContext->CurrentMatrix().Translate(devPixelOffset)); + aRenderingContext->ThebesContext()->SetMatrix( + aRenderingContext->ThebesContext()->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, - gfxContext* aRenderingContext, + nsRenderingContext* aRenderingContext, nsIFrame* aFrame, eWidthProperty aProperty, nscoord& aResult) @@ -4965,7 +4965,7 @@ FormControlShrinksForPercentISize(nsIFrame* aFrame) * @param aContainerWM the container's WM */ static nscoord -AddIntrinsicSizeOffset(gfxContext* aRenderingContext, +AddIntrinsicSizeOffset(nsRenderingContext* 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, - gfxContext* aRenderingContext, + nsRenderingContext* aRenderingContext, nsIFrame* aFrame, IntrinsicISizeType aType, const Maybe& aPercentageBasis, @@ -5364,7 +5364,7 @@ nsLayoutUtils::IntrinsicForAxis(PhysicalAxis aAxis, } /* static */ nscoord -nsLayoutUtils::IntrinsicForContainer(gfxContext* aRenderingContext, +nsLayoutUtils::IntrinsicForContainer(nsRenderingContext* aRenderingContext, nsIFrame* aFrame, IntrinsicISizeType aType, uint32_t aFlags) @@ -5378,7 +5378,7 @@ nsLayoutUtils::IntrinsicForContainer(gfxContext* aRenderingContext, /* static */ nscoord nsLayoutUtils::MinSizeContributionForAxis(PhysicalAxis aAxis, - gfxContext* aRC, + nsRenderingContext* aRC, nsIFrame* aFrame, IntrinsicISizeType aType, uint32_t aFlags) @@ -5674,7 +5674,7 @@ nsLayoutUtils::ComputeAutoSizeWithIntrinsicDimensions(nscoord minWidth, nscoord /* static */ nscoord nsLayoutUtils::MinISizeFromInline(nsIFrame* aFrame, - gfxContext* aRenderingContext) + nsRenderingContext* 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, - gfxContext* aRenderingContext) + nsRenderingContext* 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, - gfxContext& aContext) + nsRenderingContext& 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, - gfxContext* aContext, + nsRenderingContext* 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, - gfxContext& aContext) + nsRenderingContext& 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, - gfxContext* aContext, + nsRenderingContext* 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; + gfxContext* aDestCtx = aContext->ThebesContext(); for (uint32_t i = textStyle->mTextShadow->Length(); i > 0; --i) { nsCSSShadowItem* shadowDetails = textStyle->mTextShadow->ShadowAt(i - 1); nsPoint shadowOffset(shadowDetails->mXOffset, @@ -6009,12 +6009,16 @@ 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(shadowContext, shadowOffset, shadowColor, aCallbackData); + aCallback(&renderingContext, shadowOffset, shadowColor, aCallbackData); contextBoxBlur.DoPaint(); aDestCtx->Restore(); diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index b4aa9ad350b3..71eb0bb6dc22 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -35,7 +35,6 @@ #include #include -class gfxContext; class nsPresContext; class nsIContent; class nsIAtom; @@ -55,6 +54,7 @@ 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(gfxContext* aRenderingContext, nsIFrame* aFrame, + static nsresult PaintFrame(nsRenderingContext* 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, - gfxContext* aRenderingContext, + nsRenderingContext* 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(gfxContext* aRenderingContext, + static nscoord IntrinsicForContainer(nsRenderingContext* 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, - gfxContext* aRC, + nsRenderingContext* 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, - gfxContext* aRenderingContext); + nsRenderingContext* aRenderingContext); // Implement nsIFrame::GetMinISize in terms of nsIFrame::AddInlineMinISize static nscoord MinISizeFromInline(nsIFrame* aFrame, - gfxContext* aRenderingContext); + nsRenderingContext* 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, - gfxContext& aContext) { + nsRenderingContext& aContext) { return nsLayoutUtils::AppUnitWidthOfStringBidi(aString.get(), aString.Length(), aFrame, aFontMetrics, aContext); @@ -1593,7 +1593,7 @@ public: uint32_t aLength, const nsIFrame* aFrame, nsFontMetrics& aFontMetrics, - gfxContext& aContext); + nsRenderingContext& aContext); static bool StringWidthIsGreaterThan(const nsString& aString, nsFontMetrics& aFontMetrics, @@ -1607,7 +1607,7 @@ public: static void DrawString(const nsIFrame* aFrame, nsFontMetrics& aFontMetrics, - gfxContext* aContext, + nsRenderingContext* aContext, const char16_t* aString, int32_t aLength, nsPoint aPoint, @@ -1625,19 +1625,19 @@ public: uint32_t aLength, nsPoint aPoint, nsFontMetrics& aFontMetrics, - gfxContext& aContext); + nsRenderingContext& 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)(gfxContext* aCtx, + typedef void (* TextShadowCallback)(nsRenderingContext* aCtx, nsPoint aShadowOffset, const nscolor& aShadowColor, void* aData); static void PaintTextShadow(const nsIFrame* aFrame, - gfxContext* aContext, + nsRenderingContext* aContext, const nsRect& aTextRect, const nsRect& aDirtyRect, const nscolor& aForegroundColor, diff --git a/layout/forms/nsButtonFrameRenderer.cpp b/layout/forms/nsButtonFrameRenderer.cpp index 594f889a5921..e2214c494061 100644 --- a/layout/forms/nsButtonFrameRenderer.cpp +++ b/layout/forms/nsButtonFrameRenderer.cpp @@ -88,7 +88,7 @@ public: #endif virtual void Paint(nsDisplayListBuilder* aBuilder, - gfxContext* aCtx) override; + nsRenderingContext* 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, - gfxContext* aCtx) { + nsRenderingContext* 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, - gfxContext* aCtx) override; + nsRenderingContext* 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, - gfxContext* aCtx) + nsRenderingContext* 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, - gfxContext* aCtx) override; + nsRenderingContext* aCtx) override; virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aParameters) override; @@ -323,7 +323,7 @@ nsDisplayButtonForeground::ComputeInvalidationRegion( } void nsDisplayButtonForeground::Paint(nsDisplayListBuilder* aBuilder, - gfxContext* aCtx) + nsRenderingContext* aCtx) { nsPresContext *presContext = mFrame->PresContext(); const nsStyleDisplay *disp = mFrame->StyleDisplay(); @@ -427,7 +427,7 @@ DrawResult nsButtonFrameRenderer::PaintInnerFocusBorder( nsDisplayListBuilder* aBuilder, nsPresContext* aPresContext, - gfxContext& aRenderingContext, + nsRenderingContext& aRenderingContext, const nsRect& aDirtyRect, const nsRect& aRect) { @@ -457,7 +457,7 @@ Maybe nsButtonFrameRenderer::CreateInnerFocusBorderRenderer( nsDisplayListBuilder* aBuilder, nsPresContext* aPresContext, - gfxContext* aRenderingContext, + nsRenderingContext* aRenderingContext, const nsRect& aDirtyRect, const nsRect& aRect) { @@ -481,7 +481,7 @@ DrawResult nsButtonFrameRenderer::PaintBorder( nsDisplayListBuilder* aBuilder, nsPresContext* aPresContext, - gfxContext& aRenderingContext, + nsRenderingContext& aRenderingContext, const nsRect& aDirtyRect, const nsRect& aRect) { diff --git a/layout/forms/nsButtonFrameRenderer.h b/layout/forms/nsButtonFrameRenderer.h index 90b74a6e6abc..81b6693a9e4a 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, - gfxContext& aRenderingContext, + nsRenderingContext& aRenderingContext, const nsRect& aDirtyRect, const nsRect& aRect); mozilla::Maybe CreateInnerFocusBorderRenderer(nsDisplayListBuilder* aBuilder, nsPresContext* aPresContext, - gfxContext* aRenderingContext, + nsRenderingContext* aRenderingContext, const nsRect& aDirtyRect, const nsRect& aRect); DrawResult PaintBorder(nsDisplayListBuilder* aBuilder, nsPresContext* aPresContext, - gfxContext& aRenderingContext, + nsRenderingContext& aRenderingContext, const nsRect& aDirtyRect, const nsRect& aRect); diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index 1f458ca29029..08be1b238237 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -5,7 +5,6 @@ #include "nsComboboxControlFrame.h" -#include "gfxContext.h" #include "gfxUtils.h" #include "mozilla/gfx/2D.h" #include "mozilla/gfx/PathHelpers.h" @@ -39,6 +38,7 @@ #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(gfxContext* aRenderingContext, +nsComboboxControlFrame::GetIntrinsicISize(nsRenderingContext* aRenderingContext, nsLayoutUtils::IntrinsicISizeType aType) { // get the scrollbar width, we'll use this later @@ -791,7 +791,7 @@ nsComboboxControlFrame::GetIntrinsicISize(gfxContext* aRenderingContext, } nscoord -nsComboboxControlFrame::GetMinISize(gfxContext *aRenderingContext) +nsComboboxControlFrame::GetMinISize(nsRenderingContext *aRenderingContext) { nscoord minISize; DISPLAY_MIN_WIDTH(this, minISize); @@ -800,7 +800,7 @@ nsComboboxControlFrame::GetMinISize(gfxContext *aRenderingContext) } nscoord -nsComboboxControlFrame::GetPrefISize(gfxContext *aRenderingContext) +nsComboboxControlFrame::GetPrefISize(nsRenderingContext *aRenderingContext) { nscoord prefISize; DISPLAY_PREF_WIDTH(this, prefISize); @@ -1539,12 +1539,12 @@ public: #endif virtual void Paint(nsDisplayListBuilder* aBuilder, - gfxContext* aCtx) override; + nsRenderingContext* aCtx) override; NS_DISPLAY_DECL_NAME("ComboboxFocus", TYPE_COMBOBOX_FOCUS) }; void nsDisplayComboboxFocus::Paint(nsDisplayListBuilder* aBuilder, - gfxContext* aCtx) + nsRenderingContext* aCtx) { static_cast(mFrame) ->PaintFocus(*aCtx->GetDrawTarget(), ToReferenceFrame()); diff --git a/layout/forms/nsComboboxControlFrame.h b/layout/forms/nsComboboxControlFrame.h index c9250f160275..aa04d6ee015e 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(gfxContext *aRenderingContext) override; + virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override; - virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override; + virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override; virtual void Reflow(nsPresContext* aCX, ReflowOutput& aDesiredSize, @@ -249,7 +249,7 @@ protected: DropDownPositionState AbsolutelyPositionDropDown(); // Helper for GetMinISize/GetPrefISize - nscoord GetIntrinsicISize(gfxContext* aRenderingContext, + nscoord GetIntrinsicISize(nsRenderingContext* aRenderingContext, nsLayoutUtils::IntrinsicISizeType aType); class RedisplayTextEvent : public mozilla::Runnable { diff --git a/layout/forms/nsDateTimeControlFrame.cpp b/layout/forms/nsDateTimeControlFrame.cpp index fdfb15182d9a..51c5c37f9f96 100644 --- a/layout/forms/nsDateTimeControlFrame.cpp +++ b/layout/forms/nsDateTimeControlFrame.cpp @@ -126,7 +126,7 @@ nsDateTimeControlFrame::HandleBlurEvent() } nscoord -nsDateTimeControlFrame::GetMinISize(gfxContext* aRenderingContext) +nsDateTimeControlFrame::GetMinISize(nsRenderingContext* aRenderingContext) { nscoord result; DISPLAY_MIN_WIDTH(this, result); @@ -144,7 +144,7 @@ nsDateTimeControlFrame::GetMinISize(gfxContext* aRenderingContext) } nscoord -nsDateTimeControlFrame::GetPrefISize(gfxContext* aRenderingContext) +nsDateTimeControlFrame::GetPrefISize(nsRenderingContext* aRenderingContext) { nscoord result; DISPLAY_PREF_WIDTH(this, result); diff --git a/layout/forms/nsDateTimeControlFrame.h b/layout/forms/nsDateTimeControlFrame.h index 7958d373393e..e8ab5297455d 100644 --- a/layout/forms/nsDateTimeControlFrame.h +++ b/layout/forms/nsDateTimeControlFrame.h @@ -56,9 +56,9 @@ public: } // Reflow - nscoord GetMinISize(gfxContext* aRenderingContext) override; + nscoord GetMinISize(nsRenderingContext* aRenderingContext) override; - nscoord GetPrefISize(gfxContext* aRenderingContext) override; + nscoord GetPrefISize(nsRenderingContext* aRenderingContext) override; void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize, diff --git a/layout/forms/nsFieldSetFrame.cpp b/layout/forms/nsFieldSetFrame.cpp index 817f6ebc2615..83ba3d49724c 100644 --- a/layout/forms/nsFieldSetFrame.cpp +++ b/layout/forms/nsFieldSetFrame.cpp @@ -6,7 +6,6 @@ #include "nsFieldSetFrame.h" #include -#include "gfxContext.h" #include "mozilla/gfx/2D.h" #include "mozilla/Likely.h" #include "mozilla/Maybe.h" @@ -17,6 +16,7 @@ #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, - gfxContext* aCtx) override; + nsRenderingContext* 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, - gfxContext* aCtx) + nsRenderingContext* 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, - gfxContext& aRenderingContext, + nsRenderingContext& aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect) { @@ -255,12 +255,14 @@ nsFieldSetFrame::PaintBorder( false); RefPtr clipPath = pathBuilder->Finish(); - aRenderingContext.Save(); - aRenderingContext.Clip(clipPath); + gfxContext* gfx = aRenderingContext.ThebesContext(); + + gfx->Save(); + gfx->Clip(clipPath); result &= nsCSSRendering::PaintBorder(presContext, aRenderingContext, this, aDirtyRect, rect, mStyleContext, borderFlags); - aRenderingContext.Restore(); + gfx->Restore(); } else { result &= nsCSSRendering::PaintBorder(presContext, aRenderingContext, this, @@ -272,7 +274,7 @@ nsFieldSetFrame::PaintBorder( } nscoord -nsFieldSetFrame::GetIntrinsicISize(gfxContext* aRenderingContext, +nsFieldSetFrame::GetIntrinsicISize(nsRenderingContext* aRenderingContext, nsLayoutUtils::IntrinsicISizeType aType) { nscoord legendWidth = 0; @@ -296,7 +298,7 @@ nsFieldSetFrame::GetIntrinsicISize(gfxContext* aRenderingContext, nscoord -nsFieldSetFrame::GetMinISize(gfxContext* aRenderingContext) +nsFieldSetFrame::GetMinISize(nsRenderingContext* aRenderingContext) { nscoord result = 0; DISPLAY_MIN_WIDTH(this, result); @@ -306,7 +308,7 @@ nsFieldSetFrame::GetMinISize(gfxContext* aRenderingContext) } nscoord -nsFieldSetFrame::GetPrefISize(gfxContext* aRenderingContext) +nsFieldSetFrame::GetPrefISize(nsRenderingContext* aRenderingContext) { nscoord result = 0; DISPLAY_PREF_WIDTH(this, result); diff --git a/layout/forms/nsFieldSetFrame.h b/layout/forms/nsFieldSetFrame.h index c13f1ff51285..e4c85932c799 100644 --- a/layout/forms/nsFieldSetFrame.h +++ b/layout/forms/nsFieldSetFrame.h @@ -20,10 +20,10 @@ public: explicit nsFieldSetFrame(nsStyleContext* aContext); nscoord - GetIntrinsicISize(gfxContext* aRenderingContext, + GetIntrinsicISize(nsRenderingContext* aRenderingContext, nsLayoutUtils::IntrinsicISizeType); - virtual nscoord GetMinISize(gfxContext* aRenderingContext) override; - virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override; + virtual nscoord GetMinISize(nsRenderingContext* aRenderingContext) override; + virtual nscoord GetPrefISize(nsRenderingContext* 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, - gfxContext& aRenderingContext, + nsRenderingContext& aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect); #ifdef DEBUG diff --git a/layout/forms/nsFileControlFrame.cpp b/layout/forms/nsFileControlFrame.cpp index 52f66a62b3e3..a654b438e154 100644 --- a/layout/forms/nsFileControlFrame.cpp +++ b/layout/forms/nsFileControlFrame.cpp @@ -422,7 +422,7 @@ nsFileControlFrame::DnDListener::CanDropTheseFiles(nsIDOMDataTransfer* aDOMDataT } nscoord -nsFileControlFrame::GetMinISize(gfxContext *aRenderingContext) +nsFileControlFrame::GetMinISize(nsRenderingContext *aRenderingContext) { nscoord result; DISPLAY_MIN_WIDTH(this, result); diff --git a/layout/forms/nsFileControlFrame.h b/layout/forms/nsFileControlFrame.h index 57f96ac0f447..8c4e76d060b6 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(gfxContext *aRenderingContext) override; + virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override; virtual void DestroyFrom(nsIFrame* aDestructRoot) override; diff --git a/layout/forms/nsFormControlFrame.cpp b/layout/forms/nsFormControlFrame.cpp index e87691b46974..a5d0180413d0 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(gfxContext *aRenderingContext) +nsFormControlFrame::GetMinISize(nsRenderingContext *aRenderingContext) { nscoord result; DISPLAY_MIN_WIDTH(this, result); @@ -53,7 +53,7 @@ nsFormControlFrame::GetMinISize(gfxContext *aRenderingContext) } /* virtual */ nscoord -nsFormControlFrame::GetPrefISize(gfxContext *aRenderingContext) +nsFormControlFrame::GetPrefISize(nsRenderingContext *aRenderingContext) { nscoord result; DISPLAY_PREF_WIDTH(this, result); @@ -67,7 +67,7 @@ nsFormControlFrame::GetPrefISize(gfxContext *aRenderingContext) /* virtual */ LogicalSize -nsFormControlFrame::ComputeAutoSize(gfxContext* aRC, +nsFormControlFrame::ComputeAutoSize(nsRenderingContext* aRC, WritingMode aWM, const LogicalSize& aCBSize, nscoord aAvailableISize, diff --git a/layout/forms/nsFormControlFrame.h b/layout/forms/nsFormControlFrame.h index f7e8de260493..ecfdaa4f3683 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(gfxContext *aRenderingContext) override; - virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override; + virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override; + virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override; /** * Our auto size is just intrinsic width and intrinsic height. */ virtual mozilla::LogicalSize - ComputeAutoSize(gfxContext* aRenderingContext, + ComputeAutoSize(nsRenderingContext* aRenderingContext, mozilla::WritingMode aWM, const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize, diff --git a/layout/forms/nsGfxCheckboxControlFrame.cpp b/layout/forms/nsGfxCheckboxControlFrame.cpp index 02a758dd5061..101e3a4adf30 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 da14f1a47581..a01bf492ab8a 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 4606b46a9d6f..2d04562eef09 100644 --- a/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/layout/forms/nsHTMLButtonControlFrame.cpp @@ -142,7 +142,7 @@ nsHTMLButtonControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, } nscoord -nsHTMLButtonControlFrame::GetMinISize(gfxContext* aRenderingContext) +nsHTMLButtonControlFrame::GetMinISize(nsRenderingContext* aRenderingContext) { nscoord result; DISPLAY_MIN_WIDTH(this, result); @@ -156,7 +156,7 @@ nsHTMLButtonControlFrame::GetMinISize(gfxContext* aRenderingContext) } nscoord -nsHTMLButtonControlFrame::GetPrefISize(gfxContext* aRenderingContext) +nsHTMLButtonControlFrame::GetPrefISize(nsRenderingContext* aRenderingContext) { nscoord result; DISPLAY_PREF_WIDTH(this, result); diff --git a/layout/forms/nsHTMLButtonControlFrame.h b/layout/forms/nsHTMLButtonControlFrame.h index 05b1f4f5cccf..6736b5596efc 100644 --- a/layout/forms/nsHTMLButtonControlFrame.h +++ b/layout/forms/nsHTMLButtonControlFrame.h @@ -11,7 +11,7 @@ #include "nsIFormControlFrame.h" #include "nsButtonFrameRenderer.h" -class gfxContext; +class nsRenderingContext; class nsPresContext; class nsHTMLButtonControlFrame : public nsContainerFrame, @@ -33,9 +33,9 @@ public: const nsRect& aDirtyRect, const nsDisplayListSet& aLists) override; - virtual nscoord GetMinISize(gfxContext *aRenderingContext) override; + virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override; - virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override; + virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override; virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize, diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index dec2e65630a9..9f77627a1cd4 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -323,7 +323,7 @@ nsListControlFrame::CalcBSizeOfARow() } nscoord -nsListControlFrame::GetPrefISize(gfxContext *aRenderingContext) +nsListControlFrame::GetPrefISize(nsRenderingContext *aRenderingContext) { nscoord result; DISPLAY_PREF_WIDTH(this, result); @@ -341,7 +341,7 @@ nsListControlFrame::GetPrefISize(gfxContext *aRenderingContext) } nscoord -nsListControlFrame::GetMinISize(gfxContext *aRenderingContext) +nsListControlFrame::GetMinISize(nsRenderingContext *aRenderingContext) { nscoord result; DISPLAY_MIN_WIDTH(this, result); diff --git a/layout/forms/nsListControlFrame.h b/layout/forms/nsListControlFrame.h index eab82ecd5105..5e4893f87035 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(gfxContext *aRenderingContext) override; - virtual nscoord GetMinISize(gfxContext *aRenderingContext) override; + virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override; + virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override; virtual void Reflow(nsPresContext* aCX, ReflowOutput& aDesiredSize, diff --git a/layout/forms/nsMeterFrame.cpp b/layout/forms/nsMeterFrame.cpp index d007c016474c..4683c30b1ff3 100644 --- a/layout/forms/nsMeterFrame.cpp +++ b/layout/forms/nsMeterFrame.cpp @@ -210,7 +210,7 @@ nsMeterFrame::AttributeChanged(int32_t aNameSpaceID, } LogicalSize -nsMeterFrame::ComputeAutoSize(gfxContext* aRenderingContext, +nsMeterFrame::ComputeAutoSize(nsRenderingContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize, nscoord aAvailableISize, @@ -236,7 +236,7 @@ nsMeterFrame::ComputeAutoSize(gfxContext* aRenderingContext, } nscoord -nsMeterFrame::GetMinISize(gfxContext *aRenderingContext) +nsMeterFrame::GetMinISize(nsRenderingContext *aRenderingContext) { RefPtr fontMet = nsLayoutUtils::GetFontMetricsForFrame(this, 1.0f); @@ -252,7 +252,7 @@ nsMeterFrame::GetMinISize(gfxContext *aRenderingContext) } nscoord -nsMeterFrame::GetPrefISize(gfxContext *aRenderingContext) +nsMeterFrame::GetPrefISize(nsRenderingContext *aRenderingContext) { return GetMinISize(aRenderingContext); } diff --git a/layout/forms/nsMeterFrame.h b/layout/forms/nsMeterFrame.h index f09e82f5d400..f5dde611a865 100644 --- a/layout/forms/nsMeterFrame.h +++ b/layout/forms/nsMeterFrame.h @@ -48,7 +48,7 @@ public: int32_t aModType) override; virtual mozilla::LogicalSize - ComputeAutoSize(gfxContext* aRenderingContext, + ComputeAutoSize(nsRenderingContext* 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(gfxContext *aRenderingContext) override; - virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override; + virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override; + virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override; virtual bool IsFrameOfType(uint32_t aFlags) const override { diff --git a/layout/forms/nsNumberControlFrame.cpp b/layout/forms/nsNumberControlFrame.cpp index ab7d3d5a193c..7db5c30190ec 100644 --- a/layout/forms/nsNumberControlFrame.cpp +++ b/layout/forms/nsNumberControlFrame.cpp @@ -67,7 +67,7 @@ nsNumberControlFrame::DestroyFrom(nsIFrame* aDestructRoot) } nscoord -nsNumberControlFrame::GetMinISize(gfxContext* aRenderingContext) +nsNumberControlFrame::GetMinISize(nsRenderingContext* aRenderingContext) { nscoord result; DISPLAY_MIN_WIDTH(this, result); @@ -85,7 +85,7 @@ nsNumberControlFrame::GetMinISize(gfxContext* aRenderingContext) } nscoord -nsNumberControlFrame::GetPrefISize(gfxContext* aRenderingContext) +nsNumberControlFrame::GetPrefISize(nsRenderingContext* aRenderingContext) { nscoord result; DISPLAY_PREF_WIDTH(this, result); diff --git a/layout/forms/nsNumberControlFrame.h b/layout/forms/nsNumberControlFrame.h index 826a0119f052..5d377a67f712 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(gfxContext* aRenderingContext) override; + virtual nscoord GetMinISize(nsRenderingContext* aRenderingContext) override; - virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override; + virtual nscoord GetPrefISize(nsRenderingContext* aRenderingContext) override; virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize, diff --git a/layout/forms/nsProgressFrame.cpp b/layout/forms/nsProgressFrame.cpp index a8cc3ede1168..73e686716ef6 100644 --- a/layout/forms/nsProgressFrame.cpp +++ b/layout/forms/nsProgressFrame.cpp @@ -224,7 +224,7 @@ nsProgressFrame::AttributeChanged(int32_t aNameSpaceID, } LogicalSize -nsProgressFrame::ComputeAutoSize(gfxContext* aRenderingContext, +nsProgressFrame::ComputeAutoSize(nsRenderingContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize, nscoord aAvailableISize, @@ -249,7 +249,7 @@ nsProgressFrame::ComputeAutoSize(gfxContext* aRenderingContext, } nscoord -nsProgressFrame::GetMinISize(gfxContext *aRenderingContext) +nsProgressFrame::GetMinISize(nsRenderingContext *aRenderingContext) { RefPtr fontMet = nsLayoutUtils::GetFontMetricsForFrame(this, 1.0f); @@ -265,7 +265,7 @@ nsProgressFrame::GetMinISize(gfxContext *aRenderingContext) } nscoord -nsProgressFrame::GetPrefISize(gfxContext *aRenderingContext) +nsProgressFrame::GetPrefISize(nsRenderingContext *aRenderingContext) { return GetMinISize(aRenderingContext); } diff --git a/layout/forms/nsProgressFrame.h b/layout/forms/nsProgressFrame.h index 56a16ea6a481..cb4b8c39c71b 100644 --- a/layout/forms/nsProgressFrame.h +++ b/layout/forms/nsProgressFrame.h @@ -56,7 +56,7 @@ public: int32_t aModType) override; virtual mozilla::LogicalSize - ComputeAutoSize(gfxContext* aRenderingContext, + ComputeAutoSize(nsRenderingContext* 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(gfxContext *aRenderingContext) override; - virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override; + virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override; + virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override; virtual bool IsFrameOfType(uint32_t aFlags) const override { diff --git a/layout/forms/nsRangeFrame.cpp b/layout/forms/nsRangeFrame.cpp index c5b209bfe36e..52c7f84cbf86 100644 --- a/layout/forms/nsRangeFrame.cpp +++ b/layout/forms/nsRangeFrame.cpp @@ -8,7 +8,6 @@ #include "mozilla/EventStates.h" #include "mozilla/TouchEvents.h" -#include "gfxContext.h" #include "nsContentCreatorFunctions.h" #include "nsContentList.h" #include "nsContentUtils.h" @@ -23,6 +22,7 @@ #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, gfxContext* aCtx) override; + virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* 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, - gfxContext* aCtx) + nsRenderingContext* aCtx) { bool unused; nsStyleContext* styleContext = @@ -768,7 +768,7 @@ nsRangeFrame::AttributeChanged(int32_t aNameSpaceID, } LogicalSize -nsRangeFrame::ComputeAutoSize(gfxContext* aRenderingContext, +nsRangeFrame::ComputeAutoSize(nsRenderingContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize, nscoord aAvailableISize, @@ -803,7 +803,7 @@ nsRangeFrame::ComputeAutoSize(gfxContext* aRenderingContext, } nscoord -nsRangeFrame::GetMinISize(gfxContext *aRenderingContext) +nsRangeFrame::GetMinISize(nsRenderingContext *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(gfxContext *aRenderingContext) } nscoord -nsRangeFrame::GetPrefISize(gfxContext *aRenderingContext) +nsRangeFrame::GetPrefISize(nsRenderingContext *aRenderingContext) { bool isInline = IsInlineOriented(); diff --git a/layout/forms/nsRangeFrame.h b/layout/forms/nsRangeFrame.h index ba8fafcb5901..7a466994daef 100644 --- a/layout/forms/nsRangeFrame.h +++ b/layout/forms/nsRangeFrame.h @@ -70,7 +70,7 @@ public: int32_t aModType) override; virtual mozilla::LogicalSize - ComputeAutoSize(gfxContext* aRenderingContext, + ComputeAutoSize(nsRenderingContext* 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(gfxContext *aRenderingContext) override; - virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override; + virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override; + virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override; virtual bool IsFrameOfType(uint32_t aFlags) const override { diff --git a/layout/forms/nsSelectsAreaFrame.cpp b/layout/forms/nsSelectsAreaFrame.cpp index 2716a70a6f05..5d89685b6bd5 100644 --- a/layout/forms/nsSelectsAreaFrame.cpp +++ b/layout/forms/nsSelectsAreaFrame.cpp @@ -115,7 +115,7 @@ public: listFrame->GetOffsetToCrossDoc(ReferenceFrame()); } virtual void Paint(nsDisplayListBuilder* aBuilder, - gfxContext* aCtx) override { + nsRenderingContext* 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 3b20d9c4d0d1..d04c4c9ee17d 100644 --- a/layout/forms/nsTextControlFrame.cpp +++ b/layout/forms/nsTextControlFrame.cpp @@ -5,7 +5,6 @@ #include "mozilla/DebugOnly.h" -#include "gfxContext.h" #include "nsCOMPtr.h" #include "nsFontMetrics.h" #include "nsTextControlFrame.h" @@ -21,6 +20,7 @@ #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(gfxContext* aRenderingContext, +nsTextControlFrame::CalcIntrinsicSize(nsRenderingContext* aRenderingContext, WritingMode aWM, float aFontSizeInflation) const { @@ -431,7 +431,7 @@ nsTextControlFrame::AppendAnonymousContentTo(nsTArray& aElements, } nscoord -nsTextControlFrame::GetPrefISize(gfxContext* aRenderingContext) +nsTextControlFrame::GetPrefISize(nsRenderingContext* aRenderingContext) { nscoord result = 0; DISPLAY_PREF_WIDTH(this, result); @@ -442,7 +442,7 @@ nsTextControlFrame::GetPrefISize(gfxContext* aRenderingContext) } nscoord -nsTextControlFrame::GetMinISize(gfxContext* aRenderingContext) +nsTextControlFrame::GetMinISize(nsRenderingContext* aRenderingContext) { // Our min width is just our preferred width if we have auto width. nscoord result; @@ -452,7 +452,7 @@ nsTextControlFrame::GetMinISize(gfxContext* aRenderingContext) } LogicalSize -nsTextControlFrame::ComputeAutoSize(gfxContext* aRenderingContext, +nsTextControlFrame::ComputeAutoSize(nsRenderingContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize, nscoord aAvailableISize, diff --git a/layout/forms/nsTextControlFrame.h b/layout/forms/nsTextControlFrame.h index 3b04fdb622d9..c941c11b167c 100644 --- a/layout/forms/nsTextControlFrame.h +++ b/layout/forms/nsTextControlFrame.h @@ -44,11 +44,11 @@ public: return do_QueryFrame(PrincipalChildList().FirstChild()); } - virtual nscoord GetMinISize(gfxContext* aRenderingContext) override; - virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override; + virtual nscoord GetMinISize(nsRenderingContext* aRenderingContext) override; + virtual nscoord GetPrefISize(nsRenderingContext* aRenderingContext) override; virtual mozilla::LogicalSize - ComputeAutoSize(gfxContext* aRenderingContext, + ComputeAutoSize(nsRenderingContext* 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