diff --git a/layout/base/TouchCaret.cpp b/layout/base/TouchCaret.cpp index f7c007de9521..88dd285b7863 100644 --- a/layout/base/TouchCaret.cpp +++ b/layout/base/TouchCaret.cpp @@ -18,7 +18,6 @@ #include "nsIContent.h" #include "nsIPresShell.h" #include "nsCanvasFrame.h" -#include "nsRenderingContext.h" #include "nsPresContext.h" #include "nsBlockFrame.h" #include "nsISelectionController.h" diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp index e7d95f7f2ad8..1b386ba04ab8 100644 --- a/layout/base/nsCaret.cpp +++ b/layout/base/nsCaret.cpp @@ -24,7 +24,6 @@ #include "nsIContent.h" #include "nsIPresShell.h" #include "nsLayoutUtils.h" -#include "nsRenderingContext.h" #include "nsPresContext.h" #include "nsBlockFrame.h" #include "nsISelectionController.h" @@ -513,7 +512,7 @@ nsCaret::GetPaintGeometry(nsRect* aRect) } void nsCaret::PaintCaret(nsDisplayListBuilder *aBuilder, - nsRenderingContext *aCtx, + DrawTarget& aDrawTarget, nsIFrame* aForFrame, const nsPoint &aOffset) { @@ -525,7 +524,6 @@ void nsCaret::PaintCaret(nsDisplayListBuilder *aBuilder, } NS_ASSERTION(frame == aForFrame, "We're referring different frame"); - DrawTarget* drawTarget = aCtx->GetDrawTarget(); int32_t appUnitsPerDevPixel = frame->PresContext()->AppUnitsPerDevPixel(); nsRect caretRect; @@ -533,14 +531,14 @@ void nsCaret::PaintCaret(nsDisplayListBuilder *aBuilder, ComputeCaretRects(frame, contentOffset, &caretRect, &hookRect); Rect devPxCaretRect = - NSRectToSnappedRect(caretRect + aOffset, appUnitsPerDevPixel, *drawTarget); + NSRectToSnappedRect(caretRect + aOffset, appUnitsPerDevPixel, aDrawTarget); Rect devPxHookRect = - NSRectToSnappedRect(hookRect + aOffset, appUnitsPerDevPixel, *drawTarget); + NSRectToSnappedRect(hookRect + aOffset, appUnitsPerDevPixel, aDrawTarget); ColorPattern color(ToDeviceColor(frame->GetCaretColorAt(contentOffset))); - drawTarget->FillRect(devPxCaretRect, color); + aDrawTarget.FillRect(devPxCaretRect, color); if (!hookRect.IsEmpty()) { - drawTarget->FillRect(devPxHookRect, color); + aDrawTarget.FillRect(devPxHookRect, color); } } diff --git a/layout/base/nsCaret.h b/layout/base/nsCaret.h index a4eb6fab31db..e71ce4e51a93 100644 --- a/layout/base/nsCaret.h +++ b/layout/base/nsCaret.h @@ -25,17 +25,21 @@ class nsIFrame; class nsINode; class nsIPresShell; class nsITimer; -class nsRenderingContext; namespace mozilla { namespace dom { class Selection; } +namespace gfx { +class DrawTarget; +} } //----------------------------------------------------------------------------- class nsCaret MOZ_FINAL : public nsISelectionListener { + typedef mozilla::gfx::DrawTarget DrawTarget; + public: nsCaret(); @@ -119,7 +123,7 @@ class nsCaret MOZ_FINAL : public nsISelectionListener * Actually paint the caret onto the given rendering context. */ void PaintCaret(nsDisplayListBuilder *aBuilder, - nsRenderingContext *aCtx, + DrawTarget& aDrawTarget, nsIFrame *aForFrame, const nsPoint &aOffset); diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 53adf841ac38..1626581074ca 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -2900,7 +2900,7 @@ nsDisplayCaret::Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) { // Note: Because we exist, we know that the caret is visible, so we don't // need to check for the caret's visibility. - mCaret->PaintCaret(aBuilder, aCtx, mFrame, ToReferenceFrame()); + mCaret->PaintCaret(aBuilder, *aCtx->GetDrawTarget(), mFrame, ToReferenceFrame()); } bool diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp index 27ee6348df73..820ad8e30756 100644 --- a/layout/svg/SVGTextFrame.cpp +++ b/layout/svg/SVGTextFrame.cpp @@ -3724,7 +3724,7 @@ SVGTextFrame::PaintSVG(nsRenderingContext* aContext, if (frame == caretFrame && ShouldPaintCaret(run, caret)) { // XXX Should we be looking at the fill/stroke colours to paint the // caret with, rather than using the color property? - caret->PaintCaret(nullptr, aContext, frame, nsPoint()); + caret->PaintCaret(nullptr, *aContext->GetDrawTarget(), frame, nsPoint()); gfx->NewPath(); }