Backed out changeset 9b31d6fb1fcb (bug 1251995)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 07 Mar 2016 12:18:16 +0100
changeset 310859 96ae983fac674e836f2d74958eee59082d23f60d
parent 310858 6eb75d38d55e0aab08573ca2943c976d30e73193
child 310860 345a475be5f1ad5a076879c853b3ca32eb2b6650
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1251995
milestone47.0a1
backs out9b31d6fb1fcbda3393045ad53f80b7bf52b8207b
Backed out changeset 9b31d6fb1fcb (bug 1251995)
layout/generic/nsTextFrame.cpp
layout/generic/nsTextFrame.h
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -5910,29 +5910,24 @@ nsTextFrame::PaintOneShadow(Range aRange
   aCtx->Save();
   aCtx->NewPath();
   aCtx->SetColor(Color::FromABGR(shadowColor));
 
   // Draw the text onto our alpha-only surface to capture the alpha values.
   // Remember that the box blur context has a device offset on it, so we don't need to
   // translate any coordinates to fit on the surface.
   gfxFloat advanceWidth;
-  nsTextPaintStyle textPaintStyle(this);
-  DrawTextParams params(shadowContext);
-  params.advanceWidth = &advanceWidth;
-  params.dirtyRect = gfxRect(aDirtyRect.x, aDirtyRect.y,
-                             aDirtyRect.width, aDirtyRect.height);
-  params.framePt = aFramePt + shadowOffset;
-  params.provider = aProvider;
-  params.textStyle = &textPaintStyle;
-  params.textColor = aCtx == shadowContext ? shadowColor : NS_RGB(0, 0, 0);
-  params.clipEdges = &aClipEdges;
-  params.drawSoftHyphen = (GetStateBits() & TEXT_HYPHEN_BREAK) != 0;
-  params.decorationOverrideColor = decorationOverrideColor;
-  DrawText(aRange, aTextBaselinePt + shadowOffset, params);
+  gfxRect dirtyRect(aDirtyRect.x, aDirtyRect.y,
+                    aDirtyRect.width, aDirtyRect.height);
+  DrawText(shadowContext, dirtyRect, aFramePt + shadowOffset,
+           aTextBaselinePt + shadowOffset, aRange, *aProvider,
+           nsTextPaintStyle(this),
+           aCtx == shadowContext ? shadowColor : NS_RGB(0, 0, 0), aClipEdges,
+           advanceWidth, (GetStateBits() & TEXT_HYPHEN_BREAK) != 0,
+           decorationOverrideColor);
 
   contextBoxBlur.DoPaint();
   aCtx->Restore();
 }
 
 // Paints selection backgrounds and text in the correct colors. Also computes
 // aAllTypes, the union of all selection types that are applying to this text.
 bool
@@ -6026,26 +6021,16 @@ nsTextFrame::PaintTextWithSelectionColor
         }
         PaintSelectionBackground(*aCtx->GetDrawTarget(), background, dirtyRect,
                                  AppUnitGfxRectToDevRect(bgRect, appUnitsPerDevPixel),
                                  aCallbacks);
       }
       iterator.UpdateWithAdvance(advance);
     }
   }
-
-  gfxFloat advance;
-  DrawTextParams params(aCtx);
-  params.dirtyRect = aDirtyRect;
-  params.framePt = aFramePt;
-  params.provider = &aProvider;
-  params.textStyle = &aTextPaintStyle;
-  params.clipEdges = &aClipEdges;
-  params.advanceWidth = &advance;
-  params.callbacks = aCallbacks;
   
   // Draw text
   const nsStyleText* textStyle = StyleText();
   nsRect dirtyRect(aDirtyRect.x, aDirtyRect.y,
                    aDirtyRect.width, aDirtyRect.height);
   SelectionIterator iterator(prevailingSelections, aContentRange,
                              aProvider, mTextRun, startIOffset);
   while (iterator.GetNextSegment(&iOffset, &range, &hyphenWidth,
@@ -6067,19 +6052,20 @@ nsTextFrame::PaintTextWithSelectionColor
         startEdge -= hyphenWidth +
           mTextRun->GetAdvanceWidth(range, &aProvider);
       }
       PaintShadows(shadow, range, dirtyRect, aFramePt, textBaselinePt,
           startEdge, aProvider, foreground, aClipEdges, aCtx);
     }
 
     // Draw text segment
-    params.textColor = foreground;
-    params.drawSoftHyphen = hyphenWidth > 0;
-    DrawText(range, textBaselinePt, params);
+    gfxFloat advance;
+    DrawText(aCtx, aDirtyRect, aFramePt, textBaselinePt,
+             range, aProvider, aTextPaintStyle, foreground, aClipEdges,
+             advance, hyphenWidth > 0, nullptr, nullptr, aCallbacks);
     advance += hyphenWidth;
     iterator.UpdateWithAdvance(advance);
   }
   return true;
 }
 
 void
 nsTextFrame::PaintTextSelectionDecorations(gfxContext* aCtx,
@@ -6226,17 +6212,17 @@ nsTextFrame::PaintTextWithSelection(gfxC
   return true;
 }
 
 void
 nsTextFrame::DrawEmphasisMarks(gfxContext* aContext, WritingMode aWM,
                                const gfxPoint& aTextBaselinePt,
                                Range aRange,
                                const nscolor* aDecorationOverrideColor,
-                               PropertyProvider* aProvider)
+                               PropertyProvider& aProvider)
 {
   const auto info = Properties().Get(EmphasisMarkProperty());
   if (!info) {
     return;
   }
 
   nscolor color = aDecorationOverrideColor ? *aDecorationOverrideColor :
     nsLayoutUtils::GetColor(this, eCSSProperty_text_emphasis_color);
@@ -6247,17 +6233,17 @@ nsTextFrame::DrawEmphasisMarks(gfxContex
   } else {
     if (aWM.IsVerticalRL()) {
       pt.x -= info->baselineOffset;
     } else {
       pt.x += info->baselineOffset;
     }
   }
   mTextRun->DrawEmphasisMarks(aContext, info->textRun, info->advance,
-                              pt, aRange, aProvider);
+                              pt, aRange, &aProvider);
 }
 
 nscolor
 nsTextFrame::GetCaretColorAt(int32_t aOffset)
 {
   NS_PRECONDITION(aOffset >= 0, "aOffset must be positive");
 
   nscolor result = nsFrame::GetCaretColorAt(aOffset);
@@ -6578,130 +6564,139 @@ nsTextFrame::PaintText(nsRenderingContex
   if (!aCallbacks) {
     const nsStyleText* textStyle = StyleText();
     PaintShadows(
         textStyle->mTextShadow, range, aDirtyRect, framePt, textBaselinePt,
         snappedStartEdge, provider, foregroundColor, clipEdges, ctx);
   }
 
   gfxFloat advanceWidth;
-  DrawTextParams params(ctx);
-  params.dirtyRect = dirtyRect;
-  params.framePt = framePt;
-  params.provider = &provider;
-  params.advanceWidth = &advanceWidth;
-  params.textStyle = &textPaintStyle;
-  params.textColor = foregroundColor;
-  params.clipEdges = &clipEdges;
-  params.drawSoftHyphen = (GetStateBits() & TEXT_HYPHEN_BREAK) != 0;
-  params.contextPaint = aContextPaint;
-  params.callbacks = aCallbacks;
-  DrawText(range, textBaselinePt, params);
+  DrawText(ctx, dirtyRect, framePt, textBaselinePt, range, provider,
+           textPaintStyle, foregroundColor, clipEdges, advanceWidth,
+           (GetStateBits() & TEXT_HYPHEN_BREAK) != 0,
+           nullptr, aContextPaint, aCallbacks);
 }
 
 static void
 DrawTextRun(gfxTextRun* aTextRun,
+            gfxContext* const aCtx,
             const gfxPoint& aTextBaselinePt,
             gfxTextRun::Range aRange,
-            const nsTextFrame::DrawTextRunParams& aParams)
-{
-  gfxTextRun::DrawParams params(aParams.context);
-  params.drawMode = aParams.callbacks ? DrawMode::GLYPH_PATH
-                                      : DrawMode::GLYPH_FILL;
-  params.provider = aParams.provider;
-  params.advanceWidth = aParams.advanceWidth;
-  params.contextPaint = aParams.contextPaint;
-  params.callbacks = aParams.callbacks;
-  if (aParams.callbacks) {
-    aParams.callbacks->NotifyBeforeText(aParams.textColor);
+            PropertyProvider* aProvider,
+            nscolor aTextColor,
+            gfxFloat* aAdvanceWidth,
+            gfxTextContextPaint* aContextPaint,
+            nsTextFrame::DrawPathCallbacks* aCallbacks)
+{
+  gfxTextRun::DrawParams params(aCtx);
+  params.drawMode = aCallbacks ? DrawMode::GLYPH_PATH
+                               : DrawMode::GLYPH_FILL;
+  params.provider = aProvider;
+  params.advanceWidth = aAdvanceWidth;
+  params.contextPaint = aContextPaint;
+  params.callbacks = aCallbacks;
+  if (aCallbacks) {
+    aCallbacks->NotifyBeforeText(aTextColor);
     aTextRun->Draw(aRange, aTextBaselinePt, params);
-    aParams.callbacks->NotifyAfterText();
+    aCallbacks->NotifyAfterText();
   } else {
-    aParams.context->SetColor(Color::FromABGR(aParams.textColor));
+    aCtx->SetColor(Color::FromABGR(aTextColor));
     aTextRun->Draw(aRange, aTextBaselinePt, params);
   }
 }
 
 void
-nsTextFrame::DrawTextRun(Range aRange, const gfxPoint& aTextBaselinePt,
-                         const DrawTextRunParams& aParams)
-{
-  MOZ_ASSERT(aParams.advanceWidth, "Must provide advanceWidth");
-  ::DrawTextRun(mTextRun, aTextBaselinePt, aRange, aParams);
-
-  if (aParams.drawSoftHyphen) {
+nsTextFrame::DrawTextRun(gfxContext* const aCtx,
+                         const gfxPoint& aTextBaselinePt,
+                         Range aRange,
+                         PropertyProvider& aProvider,
+                         nscolor aTextColor,
+                         gfxFloat& aAdvanceWidth,
+                         bool aDrawSoftHyphen,
+                         gfxTextContextPaint* aContextPaint,
+                         nsTextFrame::DrawPathCallbacks* aCallbacks)
+{
+  ::DrawTextRun(mTextRun, aCtx, aTextBaselinePt, aRange, &aProvider,
+                aTextColor, &aAdvanceWidth, aContextPaint, aCallbacks);
+
+  if (aDrawSoftHyphen) {
     // Don't use ctx as the context, because we need a reference context here,
     // ctx may be transformed.
     nsAutoPtr<gfxTextRun> hyphenTextRun(GetHyphenTextRun(mTextRun, nullptr, this));
     if (hyphenTextRun.get()) {
       // For right-to-left text runs, the soft-hyphen is positioned at the left
       // of the text, minus its own width
       gfxFloat hyphenBaselineX =
         (mTextRun->IsRightToLeft() ? hyphenTextRun->GetAdvanceWidth() : 0);
-      DrawTextRunParams params = aParams;
-      params.provider = nullptr;
-      params.advanceWidth = nullptr;
-      ::DrawTextRun(hyphenTextRun.get(),
+      ::DrawTextRun(hyphenTextRun.get(), aCtx,
                     gfxPoint(hyphenBaselineX, aTextBaselinePt.y),
-                    Range(hyphenTextRun.get()), params);
+                    Range(hyphenTextRun.get()),
+                    nullptr, aTextColor, nullptr, aContextPaint, aCallbacks);
     }
   }
 }
 
 void
-nsTextFrame::DrawTextRunAndDecorations(Range aRange,
-                                       const gfxPoint& aTextBaselinePt,
-                                       const DrawTextParams& aParams,
-                                       const TextDecorations& aDecorations)
-{
-    const gfxFloat app =
-      aParams.textStyle->PresContext()->AppUnitsPerDevPixel();
+nsTextFrame::DrawTextRunAndDecorations(
+    gfxContext* const aCtx, const gfxRect& aDirtyRect,
+    const gfxPoint& aFramePt, const gfxPoint& aTextBaselinePt,
+    Range aRange,
+    PropertyProvider& aProvider,
+    const nsTextPaintStyle& aTextStyle,
+    nscolor aTextColor,
+    const nsCharClipDisplayItem::ClipEdges& aClipEdges,
+    gfxFloat& aAdvanceWidth,
+    bool aDrawSoftHyphen,
+    const TextDecorations& aDecorations,
+    const nscolor* const aDecorationOverrideColor,
+    gfxTextContextPaint* aContextPaint,
+    nsTextFrame::DrawPathCallbacks* aCallbacks)
+{
+    const gfxFloat app = aTextStyle.PresContext()->AppUnitsPerDevPixel();
     bool verticalRun = mTextRun->IsVertical();
     bool useVerticalMetrics = verticalRun && mTextRun->UseCenterBaseline();
 
     // XXX aFramePt is in AppUnits, shouldn't it be nsFloatPoint?
-    nscoord x = NSToCoordRound(aParams.framePt.x);
-    nscoord y = NSToCoordRound(aParams.framePt.y);
+    nscoord x = NSToCoordRound(aFramePt.x);
+    nscoord y = NSToCoordRound(aFramePt.y);
 
     // 'measure' here is textrun-relative, so for a horizontal run it's the
     // width, while for a vertical run it's the height of the decoration
     const nsSize frameSize = GetSize();
     nscoord measure = verticalRun ? frameSize.height : frameSize.width;
 
     if (verticalRun) {
-      aParams.clipEdges->Intersect(&y, &measure);
+      aClipEdges.Intersect(&y, &measure);
     } else {
-      aParams.clipEdges->Intersect(&x, &measure);
+      aClipEdges.Intersect(&x, &measure);
     }
 
     // decPt is the physical point where the decoration is to be drawn,
     // relative to the frame; one of its coordinates will be updated below.
     Point decPt(x / app, y / app);
     Float& bCoord = verticalRun ? decPt.x : decPt.y;
 
     // decSize is a textrun-relative size, so its 'width' field is actually
     // the run-relative measure, and 'height' will be the line thickness
     Size decSize(measure / app, 0);
     gfxFloat ascent = gfxFloat(mAscent) / app;
 
     // The starting edge of the frame in block direction
-    gfxFloat frameBStart = verticalRun ? aParams.framePt.x : aParams.framePt.y;
+    gfxFloat frameBStart = verticalRun ? aFramePt.x : aFramePt.y;
 
     // In vertical-rl mode, block coordinates are measured from the right,
     // so we need to adjust here.
     const WritingMode wm = GetWritingMode();
     if (wm.IsVerticalRL()) {
       frameBStart += frameSize.width;
       ascent = -ascent;
     }
 
-    gfxRect dirtyRect(aParams.dirtyRect.x / app,
-                      aParams.dirtyRect.y / app,
-                      aParams.dirtyRect.Width() / app,
-                      aParams.dirtyRect.Height() / app);
+    gfxRect dirtyRect(aDirtyRect.x / app, aDirtyRect.y / app,
+                      aDirtyRect.Width() / app, aDirtyRect.Height() / app);
 
     nscoord inflationMinFontSize =
       nsLayoutUtils::InflationMinFontSizeFor(this);
 
     // The decoration-line offsets need to be reversed for sideways-lr mode,
     // so we will multiply the values from metrics by this factor.
     gfxFloat decorationOffsetDir = mTextRun->IsSidewaysLeft() ? -1.0 : 1.0;
 
@@ -6716,21 +6711,21 @@ nsTextFrame::DrawTextRunAndDecorations(R
         GetInflationForTextDecorations(dec.mFrame, inflationMinFontSize);
       const gfxFont::Metrics metrics =
         GetFirstFontMetrics(GetFontGroupForFrame(dec.mFrame, inflation),
                             useVerticalMetrics);
 
       decSize.height = metrics.underlineSize;
       bCoord = (frameBStart - dec.mBaselineOffset) / app;
 
-      PaintDecorationLine(aParams.context, dirtyRect, dec.mColor,
-        aParams.decorationOverrideColor, decPt, 0.0, decSize, ascent,
+      PaintDecorationLine(aCtx, dirtyRect, dec.mColor,
+        aDecorationOverrideColor, decPt, 0.0, decSize, ascent,
         decorationOffsetDir * metrics.underlineOffset,
         NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE,
-        dec.mStyle, eNormalDecoration, aParams.callbacks, verticalRun);
+        dec.mStyle, eNormalDecoration, aCallbacks, verticalRun);
     }
     // Overlines
     for (uint32_t i = aDecorations.mOverlines.Length(); i-- > 0; ) {
       const LineDecoration& dec = aDecorations.mOverlines[i];
       if (dec.mStyle == NS_STYLE_TEXT_DECORATION_STYLE_NONE) {
         continue;
       }
 
@@ -6738,30 +6733,31 @@ nsTextFrame::DrawTextRunAndDecorations(R
         GetInflationForTextDecorations(dec.mFrame, inflationMinFontSize);
       const gfxFont::Metrics metrics =
         GetFirstFontMetrics(GetFontGroupForFrame(dec.mFrame, inflation),
                             useVerticalMetrics);
 
       decSize.height = metrics.underlineSize;
       bCoord = (frameBStart - dec.mBaselineOffset) / app;
 
-      PaintDecorationLine(aParams.context, dirtyRect, dec.mColor,
-        aParams.decorationOverrideColor, decPt, 0.0, decSize, ascent,
+      PaintDecorationLine(aCtx, dirtyRect, dec.mColor,
+        aDecorationOverrideColor, decPt, 0.0, decSize, ascent,
         decorationOffsetDir * metrics.maxAscent,
         NS_STYLE_TEXT_DECORATION_LINE_OVERLINE, dec.mStyle,
-        eNormalDecoration, aParams.callbacks, verticalRun);
+        eNormalDecoration, aCallbacks, verticalRun);
     }
 
     // CSS 2.1 mandates that text be painted after over/underlines, and *then*
     // line-throughs
-    DrawTextRun(aRange, aTextBaselinePt, aParams);
+    DrawTextRun(aCtx, aTextBaselinePt, aRange, aProvider, aTextColor,
+                aAdvanceWidth, aDrawSoftHyphen, aContextPaint, aCallbacks);
 
     // Emphasis marks
-    DrawEmphasisMarks(aParams.context, wm, aTextBaselinePt, aRange,
-                      aParams.decorationOverrideColor, aParams.provider);
+    DrawEmphasisMarks(aCtx, wm, aTextBaselinePt, aRange,
+                      aDecorationOverrideColor, aProvider);
 
     // Line-throughs
     for (uint32_t i = aDecorations.mStrikes.Length(); i-- > 0; ) {
       const LineDecoration& dec = aDecorations.mStrikes[i];
       if (dec.mStyle == NS_STYLE_TEXT_DECORATION_STYLE_NONE) {
         continue;
       }
 
@@ -6769,41 +6765,56 @@ nsTextFrame::DrawTextRunAndDecorations(R
         GetInflationForTextDecorations(dec.mFrame, inflationMinFontSize);
       const gfxFont::Metrics metrics =
         GetFirstFontMetrics(GetFontGroupForFrame(dec.mFrame, inflation),
                             useVerticalMetrics);
 
       decSize.height = metrics.strikeoutSize;
       bCoord = (frameBStart - dec.mBaselineOffset) / app;
 
-      PaintDecorationLine(aParams.context, dirtyRect, dec.mColor,
-        aParams.decorationOverrideColor, decPt, 0.0, decSize, ascent,
+      PaintDecorationLine(aCtx, dirtyRect, dec.mColor,
+        aDecorationOverrideColor, decPt, 0.0, decSize, ascent,
         decorationOffsetDir * metrics.strikeoutOffset,
         NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH,
-        dec.mStyle, eNormalDecoration, aParams.callbacks, verticalRun);
+        dec.mStyle, eNormalDecoration, aCallbacks, verticalRun);
     }
 }
 
 void
-nsTextFrame::DrawText(Range aRange, const gfxPoint& aTextBaselinePt,
-                      const DrawTextParams& aParams)
+nsTextFrame::DrawText(
+    gfxContext* const aCtx, const gfxRect& aDirtyRect,
+    const gfxPoint& aFramePt, const gfxPoint& aTextBaselinePt,
+    Range aRange,
+    PropertyProvider& aProvider,
+    const nsTextPaintStyle& aTextStyle,
+    nscolor aTextColor,
+    const nsCharClipDisplayItem::ClipEdges& aClipEdges,
+    gfxFloat& aAdvanceWidth,
+    bool aDrawSoftHyphen,
+    const nscolor* const aDecorationOverrideColor,
+    gfxTextContextPaint* aContextPaint,
+    nsTextFrame::DrawPathCallbacks* aCallbacks)
 {
   TextDecorations decorations;
-  GetTextDecorations(aParams.textStyle->PresContext(),
-                     aParams.callbacks ? eUnresolvedColors : eResolvedColors,
+  GetTextDecorations(aTextStyle.PresContext(),
+                     aCallbacks ? eUnresolvedColors : eResolvedColors,
                      decorations);
 
   // Hide text decorations if we're currently hiding @font-face fallback text
-  const bool drawDecorations =
-    !aParams.provider->GetFontGroup()->ShouldSkipDrawing() &&
-    (decorations.HasDecorationLines() || StyleText()->HasTextEmphasis());
+  const bool drawDecorations = !aProvider.GetFontGroup()->ShouldSkipDrawing() &&
+                               (decorations.HasDecorationLines() ||
+                                StyleText()->HasTextEmphasis());
   if (drawDecorations) {
-    DrawTextRunAndDecorations(aRange, aTextBaselinePt, aParams, decorations);
+    DrawTextRunAndDecorations(aCtx, aDirtyRect, aFramePt, aTextBaselinePt, aRange,
+                              aProvider, aTextStyle, aTextColor, aClipEdges, aAdvanceWidth,
+                              aDrawSoftHyphen, decorations,
+                              aDecorationOverrideColor, aContextPaint, aCallbacks);
   } else {
-    DrawTextRun(aRange, aTextBaselinePt, aParams);
+    DrawTextRun(aCtx, aTextBaselinePt, aRange, aProvider,
+                aTextColor, aAdvanceWidth, aDrawSoftHyphen, aContextPaint, aCallbacks);
   }
 }
 
 int16_t
 nsTextFrame::GetSelectionStatus(int16_t* aSelectionFlags)
 {
   // get the selection controller
   nsCOMPtr<nsISelectionController> selectionController;
--- a/layout/generic/nsTextFrame.h
+++ b/layout/generic/nsTextFrame.h
@@ -385,40 +385,16 @@ public:
 
     /**
      * Called just after a path corresponding to a selection decoration line
      * has been emitted to the gfxContext.
      */
     virtual void NotifySelectionDecorationLinePathEmitted() { }
   };
 
-  struct DrawTextRunParams
-  {
-    gfxContext* context;
-    PropertyProvider* provider = nullptr;
-    gfxFloat* advanceWidth = nullptr;
-    gfxTextContextPaint* contextPaint = nullptr;
-    DrawPathCallbacks* callbacks = nullptr;
-    nscolor textColor = NS_RGBA(0, 0, 0, 0);
-    bool drawSoftHyphen = false;
-    explicit DrawTextRunParams(gfxContext* aContext)
-      : context(aContext) {}
-  };
-
-  struct DrawTextParams : DrawTextRunParams
-  {
-    gfxPoint framePt;
-    gfxRect dirtyRect;
-    const nsTextPaintStyle* textStyle = nullptr;
-    const nsCharClipDisplayItem::ClipEdges* clipEdges = nullptr;
-    const nscolor* decorationOverrideColor = nullptr;
-    explicit DrawTextParams(gfxContext* aContext)
-      : DrawTextRunParams(aContext) {}
-  };
-
   // Primary frame paint method called from nsDisplayText.  Can also be used
   // to generate paths rather than paint the frame's text by passing a callback
   // object.  The private DrawText() is what applies the text to a graphics
   // context.
   void PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt,
                  const nsRect& aDirtyRect, const nsCharClipDisplayItem& aItem,
                  gfxTextContextPaint* aContextPaint = nullptr,
                  DrawPathCallbacks* aCallbacks = nullptr,
@@ -464,17 +440,17 @@ public:
                                      SelectionType aSelectionType,
                                      DrawPathCallbacks* aCallbacks);
 
   void DrawEmphasisMarks(gfxContext* aContext,
                          mozilla::WritingMode aWM,
                          const gfxPoint& aTextBaselinePt,
                          Range aRange,
                          const nscolor* aDecorationOverrideColor,
-                         PropertyProvider* aProvider);
+                         PropertyProvider& aProvider);
 
   virtual nscolor GetCaretColorAt(int32_t aOffset) override;
 
   int16_t GetSelectionStatus(int16_t* aSelectionFlags);
 
   int32_t GetContentOffset() const { return mContentOffset; }
   int32_t GetContentLength() const
   {
@@ -713,25 +689,56 @@ protected:
   enum TextDecorationColorResolution {
     eResolvedColors,
     eUnresolvedColors
   };
   void GetTextDecorations(nsPresContext* aPresContext,
                           TextDecorationColorResolution aColorResolution,
                           TextDecorations& aDecorations);
 
-  void DrawTextRun(Range aRange, const gfxPoint& aTextBaselinePt,
-                   const DrawTextRunParams& aParams);
+  void DrawTextRun(gfxContext* const aCtx,
+                   const gfxPoint& aTextBaselinePt,
+                   Range aRange,
+                   PropertyProvider& aProvider,
+                   nscolor aTextColor,
+                   gfxFloat& aAdvanceWidth,
+                   bool aDrawSoftHyphen,
+                   gfxTextContextPaint* aContextPaint,
+                   DrawPathCallbacks* aCallbacks);
 
-  void DrawTextRunAndDecorations(Range aRange, const gfxPoint& aTextBaselinePt,
-                                 const DrawTextParams& aParams,
-                                 const TextDecorations& aDecorations);
+  void DrawTextRunAndDecorations(gfxContext* const aCtx,
+                                 const gfxRect& aDirtyRect,
+                                 const gfxPoint& aFramePt,
+                                 const gfxPoint& aTextBaselinePt,
+                                 Range aRange,
+                                 PropertyProvider& aProvider,
+                                 const nsTextPaintStyle& aTextStyle,
+                                 nscolor aTextColor,
+                             const nsCharClipDisplayItem::ClipEdges& aClipEdges,
+                                 gfxFloat& aAdvanceWidth,
+                                 bool aDrawSoftHyphen,
+                                 const TextDecorations& aDecorations,
+                                 const nscolor* const aDecorationOverrideColor,
+                                 gfxTextContextPaint* aContextPaint,
+                                 DrawPathCallbacks* aCallbacks);
 
-  void DrawText(Range aRange, const gfxPoint& aTextBaselinePt,
-                const DrawTextParams& aParams);
+  void DrawText(gfxContext* const aCtx,
+                const gfxRect& aDirtyRect,
+                const gfxPoint& aFramePt,
+                const gfxPoint& aTextBaselinePt,
+                Range aRange,
+                PropertyProvider& aProvider,
+                const nsTextPaintStyle& aTextStyle,
+                nscolor aTextColor,
+                const nsCharClipDisplayItem::ClipEdges& aClipEdges,
+                gfxFloat& aAdvanceWidth,
+                bool aDrawSoftHyphen,
+                const nscolor* const aDecorationOverrideColor = nullptr,
+                gfxTextContextPaint* aContextPaint = nullptr,
+                DrawPathCallbacks* aCallbacks = nullptr);
 
   // Set non empty rect to aRect, it should be overflow rect or frame rect.
   // If the result rect is larger than the given rect, this returns true.
   bool CombineSelectionUnderlineRect(nsPresContext* aPresContext,
                                        nsRect& aRect);
 
   /**
    * Utility methods to paint selection.