Bug 1237902 (part 2) - Pass a DrawTarget to DrawTableBorderSegment(). r=roc.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 07 Jan 2016 20:20:06 -0800
changeset 279320 4538baf122990a4d8efd2e98b22a0c9929cdcf90
parent 279319 957569c6b178028826c1dc13d11895152d020287
child 279321 6c88738fdc4d8bea3f88969e89b0c04b2603b9e5
push id29879
push usercbook@mozilla.com
push dateMon, 11 Jan 2016 11:13:58 +0000
treeherdermozilla-central@5acc2a44834c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1237902
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1237902 (part 2) - Pass a DrawTarget to DrawTableBorderSegment(). r=roc. And to several functions above it in the callgraph, ones that no longer need an nsRenderingContext.
layout/base/nsCSSRendering.cpp
layout/base/nsCSSRendering.h
layout/tables/nsTableFrame.cpp
layout/tables/nsTableFrame.h
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -3863,17 +3863,17 @@ GetDashInfo(nscoord  aBorderLength,
       nscoord half = RoundIntToPixel(extra / 2, aTwipsPerPixel);
       aStartDashLength += half;
       aEndDashLength += (extra - half);
     }
   }
 }
 
 void
-nsCSSRendering::DrawTableBorderSegment(nsRenderingContext&     aContext,
+nsCSSRendering::DrawTableBorderSegment(DrawTarget&              aDrawTarget,
                                        uint8_t                  aBorderStyle,
                                        nscolor                  aBorderColor,
                                        const nsStyleBackground* aBGColor,
                                        const nsRect&            aBorder,
                                        int32_t                  aAppUnitsPerDevPixel,
                                        int32_t                  aAppUnitsPerCSSPixel,
                                        uint8_t                  aStartBevelSide,
                                        nscoord                  aStartBevelOffset,
@@ -3886,18 +3886,16 @@ nsCSSRendering::DrawTableBorderSegment(n
 
   if ((twipsPerPixel >= aBorder.width) || (twipsPerPixel >= aBorder.height) ||
       (NS_STYLE_BORDER_STYLE_DASHED == aBorderStyle) || (NS_STYLE_BORDER_STYLE_DOTTED == aBorderStyle)) {
     // no beveling for 1 pixel border, dash or dot
     aStartBevelOffset = 0;
     aEndBevelOffset = 0;
   }
 
-  DrawTarget& drawTarget = *aContext.GetDrawTarget();
-
   switch (aBorderStyle) {
   case NS_STYLE_BORDER_STYLE_NONE:
   case NS_STYLE_BORDER_STYLE_HIDDEN:
     //NS_ASSERTION(false, "style of none or hidden");
     break;
   case NS_STYLE_BORDER_STYLE_DOTTED:
   case NS_STYLE_BORDER_STYLE_DASHED:
     {
@@ -3910,58 +3908,58 @@ nsCSSRendering::DrawTableBorderSegment(n
       minDashLength = std::max(minDashLength, twipsPerPixel);
       nscoord numDashSpaces = 0;
       nscoord startDashLength = minDashLength;
       nscoord endDashLength   = minDashLength;
       if (horizontal) {
         GetDashInfo(aBorder.width, dashLength, twipsPerPixel, numDashSpaces,
                     startDashLength, endDashLength);
         nsRect rect(aBorder.x, aBorder.y, startDashLength, aBorder.height);
-        DrawSolidBorderSegment(drawTarget, rect, aBorderColor,
+        DrawSolidBorderSegment(aDrawTarget, rect, aBorderColor,
                                aAppUnitsPerDevPixel, twipsPerPixel);
 
         rect.x += startDashLength + dashLength;
         rect.width = aBorder.width
                      - (startDashLength + endDashLength + dashLength);
-        DrawDashedSegment(drawTarget, rect, dashLength, aBorderColor,
+        DrawDashedSegment(aDrawTarget, rect, dashLength, aBorderColor,
                           aAppUnitsPerDevPixel, twipsPerPixel, horizontal);
 
         rect.x += rect.width;
         rect.width = endDashLength;
-        DrawSolidBorderSegment(drawTarget, rect, aBorderColor,
+        DrawSolidBorderSegment(aDrawTarget, rect, aBorderColor,
                                aAppUnitsPerDevPixel, twipsPerPixel);
       }
       else {
         GetDashInfo(aBorder.height, dashLength, twipsPerPixel, numDashSpaces,
                     startDashLength, endDashLength);
         nsRect rect(aBorder.x, aBorder.y, aBorder.width, startDashLength);
-        DrawSolidBorderSegment(drawTarget, rect, aBorderColor,
+        DrawSolidBorderSegment(aDrawTarget, rect, aBorderColor,
                                aAppUnitsPerDevPixel, twipsPerPixel);
 
         rect.y += rect.height + dashLength;
         rect.height = aBorder.height
                       - (startDashLength + endDashLength + dashLength);
-        DrawDashedSegment(drawTarget, rect, dashLength, aBorderColor,
+        DrawDashedSegment(aDrawTarget, rect, dashLength, aBorderColor,
                           aAppUnitsPerDevPixel, twipsPerPixel, horizontal);
 
         rect.y += rect.height;
         rect.height = endDashLength;
-        DrawSolidBorderSegment(drawTarget, rect, aBorderColor,
+        DrawSolidBorderSegment(aDrawTarget, rect, aBorderColor,
                                aAppUnitsPerDevPixel, twipsPerPixel);
       }
     }
     break;
   case NS_STYLE_BORDER_STYLE_GROOVE:
     ridgeGroove = NS_STYLE_BORDER_STYLE_GROOVE; // and fall through to ridge
     MOZ_FALLTHROUGH;
   case NS_STYLE_BORDER_STYLE_RIDGE:
     if ((horizontal && (twipsPerPixel >= aBorder.height)) ||
         (!horizontal && (twipsPerPixel >= aBorder.width))) {
       // a one pixel border
-      DrawSolidBorderSegment(drawTarget, aBorder, aBorderColor,
+      DrawSolidBorderSegment(aDrawTarget, aBorder, aBorderColor,
                              aAppUnitsPerDevPixel, twipsPerPixel,
                              aStartBevelSide, aStartBevelOffset,
                              aEndBevelSide, aEndBevelOffset);
     }
     else {
       nscoord startBevel = (aStartBevelOffset > 0)
                             ? RoundFloatToPixel(0.5f * (float)aStartBevelOffset, twipsPerPixel, true) : 0;
       nscoord endBevel =   (aEndBevelOffset > 0)
@@ -3979,32 +3977,32 @@ nsCSSRendering::DrawTableBorderSegment(n
         rect.height = half;
         if (NS_SIDE_TOP == aStartBevelSide) {
           rect.x += startBevel;
           rect.width -= startBevel;
         }
         if (NS_SIDE_TOP == aEndBevelSide) {
           rect.width -= endBevel;
         }
-        DrawSolidBorderSegment(drawTarget, rect, bevelColor,
+        DrawSolidBorderSegment(aDrawTarget, rect, bevelColor,
                                aAppUnitsPerDevPixel, twipsPerPixel,
                                aStartBevelSide, startBevel, aEndBevelSide,
                                endBevel);
       }
       else { // left, right
         half = RoundFloatToPixel(0.5f * (float)aBorder.width, twipsPerPixel);
         rect.width = half;
         if (NS_SIDE_LEFT == aStartBevelSide) {
           rect.y += startBevel;
           rect.height -= startBevel;
         }
         if (NS_SIDE_LEFT == aEndBevelSide) {
           rect.height -= endBevel;
         }
-        DrawSolidBorderSegment(drawTarget, rect, bevelColor,
+        DrawSolidBorderSegment(aDrawTarget, rect, bevelColor,
                                aAppUnitsPerDevPixel, twipsPerPixel,
                                aStartBevelSide, startBevel, aEndBevelSide,
                                endBevel);
       }
 
       rect = aBorder;
       ridgeGrooveSide = (NS_SIDE_TOP == ridgeGrooveSide) ? NS_SIDE_BOTTOM : NS_SIDE_RIGHT;
       // FIXME: In theory, this should use the visited-dependent
@@ -4016,32 +4014,32 @@ nsCSSRendering::DrawTableBorderSegment(n
         rect.height = aBorder.height - half;
         if (NS_SIDE_BOTTOM == aStartBevelSide) {
           rect.x += startBevel;
           rect.width -= startBevel;
         }
         if (NS_SIDE_BOTTOM == aEndBevelSide) {
           rect.width -= endBevel;
         }
-        DrawSolidBorderSegment(drawTarget, rect, bevelColor,
+        DrawSolidBorderSegment(aDrawTarget, rect, bevelColor,
                                aAppUnitsPerDevPixel, twipsPerPixel,
                                aStartBevelSide, startBevel, aEndBevelSide,
                                endBevel);
       }
       else {
         rect.x = rect.x + half;
         rect.width = aBorder.width - half;
         if (NS_SIDE_RIGHT == aStartBevelSide) {
           rect.y += aStartBevelOffset - startBevel;
           rect.height -= startBevel;
         }
         if (NS_SIDE_RIGHT == aEndBevelSide) {
           rect.height -= endBevel;
         }
-        DrawSolidBorderSegment(drawTarget, rect, bevelColor,
+        DrawSolidBorderSegment(aDrawTarget, rect, bevelColor,
                                aAppUnitsPerDevPixel, twipsPerPixel,
                                aStartBevelSide, startBevel, aEndBevelSide,
                                endBevel);
       }
     }
     break;
   case NS_STYLE_BORDER_STYLE_DOUBLE:
     // We can only do "double" borders if the thickness of the border
@@ -4060,72 +4058,72 @@ nsCSSRendering::DrawTableBorderSegment(n
         nsRect topRect(aBorder.x, aBorder.y, aBorder.width, thirdHeight);
         if (NS_SIDE_TOP == aStartBevelSide) {
           topRect.x += aStartBevelOffset - startBevel;
           topRect.width -= aStartBevelOffset - startBevel;
         }
         if (NS_SIDE_TOP == aEndBevelSide) {
           topRect.width -= aEndBevelOffset - endBevel;
         }
-        DrawSolidBorderSegment(drawTarget, topRect, aBorderColor,
+        DrawSolidBorderSegment(aDrawTarget, topRect, aBorderColor,
                                aAppUnitsPerDevPixel, twipsPerPixel,
                                aStartBevelSide, startBevel, aEndBevelSide,
                                endBevel);
 
         // draw the botom line or rect
         nscoord heightOffset = aBorder.height - thirdHeight;
         nsRect bottomRect(aBorder.x, aBorder.y + heightOffset, aBorder.width, aBorder.height - heightOffset);
         if (NS_SIDE_BOTTOM == aStartBevelSide) {
           bottomRect.x += aStartBevelOffset - startBevel;
           bottomRect.width -= aStartBevelOffset - startBevel;
         }
         if (NS_SIDE_BOTTOM == aEndBevelSide) {
           bottomRect.width -= aEndBevelOffset - endBevel;
         }
-        DrawSolidBorderSegment(drawTarget, bottomRect, aBorderColor,
+        DrawSolidBorderSegment(aDrawTarget, bottomRect, aBorderColor,
                                aAppUnitsPerDevPixel, twipsPerPixel,
                                aStartBevelSide, startBevel, aEndBevelSide,
                                endBevel);
       }
       else { // left, right
         nscoord thirdWidth = RoundFloatToPixel(0.333333f * (float)aBorder.width, twipsPerPixel);
 
         nsRect leftRect(aBorder.x, aBorder.y, thirdWidth, aBorder.height);
         if (NS_SIDE_LEFT == aStartBevelSide) {
           leftRect.y += aStartBevelOffset - startBevel;
           leftRect.height -= aStartBevelOffset - startBevel;
         }
         if (NS_SIDE_LEFT == aEndBevelSide) {
           leftRect.height -= aEndBevelOffset - endBevel;
         }
-        DrawSolidBorderSegment(drawTarget, leftRect, aBorderColor,
+        DrawSolidBorderSegment(aDrawTarget, leftRect, aBorderColor,
                                aAppUnitsPerDevPixel, twipsPerPixel,
                                aStartBevelSide, startBevel, aEndBevelSide,
                                endBevel);
 
         nscoord widthOffset = aBorder.width - thirdWidth;
         nsRect rightRect(aBorder.x + widthOffset, aBorder.y, aBorder.width - widthOffset, aBorder.height);
         if (NS_SIDE_RIGHT == aStartBevelSide) {
           rightRect.y += aStartBevelOffset - startBevel;
           rightRect.height -= aStartBevelOffset - startBevel;
         }
         if (NS_SIDE_RIGHT == aEndBevelSide) {
           rightRect.height -= aEndBevelOffset - endBevel;
         }
-        DrawSolidBorderSegment(drawTarget, rightRect, aBorderColor,
+        DrawSolidBorderSegment(aDrawTarget, rightRect, aBorderColor,
                                aAppUnitsPerDevPixel, twipsPerPixel,
                                aStartBevelSide, startBevel, aEndBevelSide,
                                endBevel);
       }
       break;
     }
     // else fall through to solid
     MOZ_FALLTHROUGH;
   case NS_STYLE_BORDER_STYLE_SOLID:
-    DrawSolidBorderSegment(drawTarget, aBorder, aBorderColor,
+    DrawSolidBorderSegment(aDrawTarget, aBorder, aBorderColor,
                            aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide,
                            aStartBevelOffset, aEndBevelSide, aEndBevelOffset);
     break;
   case NS_STYLE_BORDER_STYLE_OUTSET:
   case NS_STYLE_BORDER_STYLE_INSET:
     NS_ASSERTION(false, "inset, outset should have been converted to groove, ridge");
     break;
   case NS_STYLE_BORDER_STYLE_AUTO:
--- a/layout/base/nsCSSRendering.h
+++ b/layout/base/nsCSSRendering.h
@@ -639,18 +639,18 @@ struct nsCSSRendering {
    * Called when we've finished using a display list. When all
    * BeginFrameTreeLocked calls have been balanced by an EndFrameTreeLocked,
    * the frame tree may start changing again.
    */
   static void EndFrameTreesLocked();
 
   // Draw a border segment in the table collapsing border model without
   // beveling corners
-  static void DrawTableBorderSegment(nsRenderingContext& aContext,
-                                     uint8_t              aBorderStyle,  
+  static void DrawTableBorderSegment(DrawTarget&          aDrawTarget,
+                                     uint8_t              aBorderStyle,
                                      nscolor              aBorderColor,
                                      const nsStyleBackground* aBGColor,
                                      const nsRect&        aBorderRect,
                                      int32_t              aAppUnitsPerDevPixel,
                                      int32_t              aAppUnitsPerCSSPixel,
                                      uint8_t              aStartBevelSide = 0,
                                      nscoord              aStartBevelOffset = 0,
                                      uint8_t              aEndBevelSide = 0,
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -1412,17 +1412,17 @@ nsTableFrame::PaintTableBorderBackground
         nsLayoutUtils::PointToGfxPoint(aPt,
                                        PresContext()->AppUnitsPerDevPixel());
 
       // XXX we should probably get rid of this translation at some stage
       // But that would mean modifying PaintBCBorders, ugh
       gfxContextMatrixAutoSaveRestore autoSR(ctx);
       ctx->SetMatrix(ctx->CurrentMatrix().Translate(devPixelOffset));
 
-      PaintBCBorders(aRenderingContext, aDirtyRect - aPt);
+      PaintBCBorders(*aRenderingContext.GetDrawTarget(), aDirtyRect - aPt);
     }
   }
 
   return result;
 }
 
 nsIFrame::LogicalSides
 nsTableFrame::GetLogicalSkipSides(const nsHTMLReflowState* aReflowState) const
@@ -6225,17 +6225,17 @@ struct BCBlockDirSeg
              BCPixelSize            aInlineSegBSize);
 
   void Initialize(BCPaintBorderIterator& aIter);
   void GetBEndCorner(BCPaintBorderIterator& aIter,
                      BCPixelSize            aInlineSegBSize);
 
 
   void Paint(BCPaintBorderIterator& aIter,
-             nsRenderingContext&    aRenderingContext,
+             DrawTarget&            aDrawTarget,
              BCPixelSize            aInlineSegBSize);
   void AdvanceOffsetB();
   void IncludeCurrentBorder(BCPaintBorderIterator& aIter);
 
 
   union {
     nsTableColFrame*  mCol;
     int32_t           mColWidth;
@@ -6275,18 +6275,17 @@ struct BCInlineDirSeg
   void Start(BCPaintBorderIterator& aIter,
              BCBorderOwner          aBorderOwner,
              BCPixelSize            aBEndBlockSegISize,
              BCPixelSize            aInlineSegBSize);
   void GetIEndCorner(BCPaintBorderIterator& aIter,
                      BCPixelSize            aIStartSegISize);
   void AdvanceOffsetI();
   void IncludeCurrentBorder(BCPaintBorderIterator& aIter);
-  void Paint(BCPaintBorderIterator& aIter,
-             nsRenderingContext&    aRenderingContext);
+  void Paint(BCPaintBorderIterator& aIter, DrawTarget& aDrawTarget);
 
   nscoord            mOffsetI;       // i-offset with respect to the table edge
   nscoord            mOffsetB;       // b-offset with respect to the table edge
   nscoord            mLength;        // inline-dir length including corners
   BCPixelSize        mWidth;         // border thickness in pixels
   nscoord            mIStartBevelOffset; // how much to bevel at the iStart
   LogicalSide        mIStartBevelSide;   // direction to bevel at the iStart
   bool               mIsIEndBevel;       // should we bevel at the iEnd end
@@ -6320,18 +6319,18 @@ public:
    * Determine the damage area in terms of rows and columns and finalize
    * mInitialOffsetI and mInitialOffsetB.
    * @param aDirtyRect - dirty rect in table coordinates
    * @return - true if we need to paint something given dirty rect
    */
   bool SetDamageArea(const nsRect& aDamageRect);
   void First();
   void Next();
-  void AccumulateOrPaintInlineDirSegment(nsRenderingContext& aRenderingContext);
-  void AccumulateOrPaintBlockDirSegment(nsRenderingContext& aRenderingContext);
+  void AccumulateOrPaintInlineDirSegment(DrawTarget& aDrawTarget);
+  void AccumulateOrPaintBlockDirSegment(DrawTarget& aDrawTarget);
   void ResetVerInfo();
   void StoreColumnWidth(int32_t aIndex);
   bool BlockDirSegmentOwnsCorner();
 
   nsTableFrame*         mTable;
   nsTableFrame*         mTableFirstInFlow;
   nsTableCellMap*       mTableCellMap;
   nsCellMap*            mCellMap;
@@ -6947,24 +6946,24 @@ BCBlockDirSeg::GetBEndCorner(BCPaintBord
    mBEndOffset = CalcVerCornerOffset(ownerSide, cornerSubWidth,
                                     mBEndInlineSegBSize,
                                     false, mIsBEndBevel);
    mLength += mBEndOffset;
 }
 
 /**
  * Paint the block-dir segment
- * @param aIter             - iterator containing the structural information
- * @param aRenderingContext - the rendering context
- * @param aInlineSegBSize   - the width of the inline-dir segment joining the corner
- *                            at the start
+ * @param aIter           - iterator containing the structural information
+ * @param aDrawTarget     - the draw target
+ * @param aInlineSegBSize - the width of the inline-dir segment joining the
+ *                          corner at the start
  */
 void
 BCBlockDirSeg::Paint(BCPaintBorderIterator& aIter,
-                     nsRenderingContext&    aRenderingContext,
+                     DrawTarget&            aDrawTarget,
                      BCPixelSize            aInlineSegBSize)
 {
   // get the border style, color and paint the segment
   LogicalSide side =
     aIter.IsDamageAreaIEndMost() ? eLogicalSideIEnd : eLogicalSideIStart;
   int32_t relColIndex = aIter.GetRelativeColIndex();
   nsTableColFrame* col           = mCol; if (!col) ABORT0();
   nsTableCellFrame* cell         = mFirstCell; // ???
@@ -7060,17 +7059,17 @@ BCBlockDirSeg::Paint(BCPaintBorderIterat
   // the-left for the "start" (left) end of the border-segment, and
   // endBevelOffset is the indentation-from-the-right for the "end" (right)
   // end of the border-segment. We've got them reversed, since our block dir
   // is RTL, so we have to swap them here.)
   if (aIter.mTableWM.IsVerticalRL()) {
     Swap(startBevelSide, endBevelSide);
     Swap(startBevelOffset, endBevelOffset);
   }
-  nsCSSRendering::DrawTableBorderSegment(aRenderingContext, style, color,
+  nsCSSRendering::DrawTableBorderSegment(aDrawTarget, style, color,
                                          aIter.mTableBgColor, physicalRect,
                                          appUnitsPerDevPixel,
                                          nsPresContext::AppUnitsPerCSSPixel(),
                                          startBevelSide, startBevelOffset,
                                          endBevelSide, endBevelOffset);
 }
 
 /**
@@ -7162,22 +7161,21 @@ BCInlineDirSeg::GetIEndCorner(BCPaintBor
   mLength += mEndOffset;
   mIEndBevelOffset = (mIsIEndBevel) ?
                        nsPresContext::CSSPixelsToAppUnits(verWidth) : 0;
   mIEndBevelSide = (aIStartSegISize > 0) ? eLogicalSideBEnd : eLogicalSideBStart;
 }
 
 /**
  * Paint the inline-dir segment
- * @param aIter             - iterator containing the structural information
- * @param aRenderingContext - the rendering context
+ * @param aIter       - iterator containing the structural information
+ * @param aDrawTarget - the draw target
  */
 void
-BCInlineDirSeg::Paint(BCPaintBorderIterator& aIter,
-                      nsRenderingContext&    aRenderingContext)
+BCInlineDirSeg::Paint(BCPaintBorderIterator& aIter, DrawTarget& aDrawTarget)
 {
   // get the border style, color and paint the segment
   LogicalSide side =
     aIter.IsDamageAreaBEndMost() ? eLogicalSideBEnd : eLogicalSideBStart;
   nsIFrame* rg   = aIter.mRg;  if (!rg) ABORT0();
   nsIFrame* row  = aIter.mRow; if (!row) ABORT0();
   nsIFrame* cell = mFirstCell;
   nsIFrame* col;
@@ -7265,17 +7263,17 @@ BCInlineDirSeg::Paint(BCPaintBorderItera
   // of the border-segment, and endBevelOffset is the indentation-from-the-
   // right or bottom end. If the writing mode is inline-RTL, our "start" and
   // "end" will be reversed from this physical-coord view, so we have to swap
   // them here.
   if (!aIter.mTableWM.IsBidiLTR()) {
     Swap(startBevelSide, endBevelSide);
     Swap(startBevelOffset, endBevelOffset);
   }
-  nsCSSRendering::DrawTableBorderSegment(aRenderingContext, style, color,
+  nsCSSRendering::DrawTableBorderSegment(aDrawTarget, style, color,
                                          aIter.mTableBgColor, physicalRect,
                                          appUnitsPerDevPixel,
                                          nsPresContext::AppUnitsPerCSSPixel(),
                                          startBevelSide, startBevelOffset,
                                          endBevelSide, endBevelOffset);
 }
 
 /**
@@ -7324,20 +7322,20 @@ BCPaintBorderIterator::BlockDirSegmentOw
   }
   // unitialized ownerside, bevel
   return  (eLogicalSideBStart == cornerOwnerSide) ||
           (eLogicalSideBEnd == cornerOwnerSide);
 }
 
 /**
  * Paint if necessary an inline-dir segment, otherwise accumulate it
- * @param aRenderingContext - the rendering context
+ * @param aDrawTarget - the draw target
  */
 void
-BCPaintBorderIterator::AccumulateOrPaintInlineDirSegment(nsRenderingContext& aRenderingContext)
+BCPaintBorderIterator::AccumulateOrPaintInlineDirSegment(DrawTarget& aDrawTarget)
 {
 
   int32_t relColIndex = GetRelativeColIndex();
   // store the current col width if it hasn't been already
   if (mBlockDirInfo[relColIndex].mColWidth < 0) {
     StoreColumnWidth(relColIndex);
   }
 
@@ -7360,32 +7358,32 @@ BCPaintBorderIterator::AccumulateOrPaint
   }
 
   if (!IsDamageAreaIStartMost() && (isSegStart || IsDamageAreaIEndMost() ||
                                     BlockDirSegmentOwnsCorner())) {
     // paint the previous seg or the current one if IsDamageAreaIEndMost()
     if (mInlineSeg.mLength > 0) {
       mInlineSeg.GetIEndCorner(*this, iStartSegISize);
       if (mInlineSeg.mWidth > 0) {
-        mInlineSeg.Paint(*this, aRenderingContext);
+        mInlineSeg.Paint(*this, aDrawTarget);
       }
       mInlineSeg.AdvanceOffsetI();
     }
     mInlineSeg.Start(*this, borderOwner, iStartSegISize, bStartSegBSize);
   }
   mInlineSeg.IncludeCurrentBorder(*this);
   mBlockDirInfo[relColIndex].mWidth = iStartSegISize;
   mBlockDirInfo[relColIndex].mLastCell = mCell;
 }
 /**
  * Paint if necessary a block-dir segment, otherwise accumulate it
- * @param aRenderingContext - the rendering context
+ * @param aDrawTarget - the draw target
  */
 void
-BCPaintBorderIterator::AccumulateOrPaintBlockDirSegment(nsRenderingContext& aRenderingContext)
+BCPaintBorderIterator::AccumulateOrPaintBlockDirSegment(DrawTarget& aDrawTarget)
 {
   BCBorderOwner borderOwner = eCellOwner;
   BCBorderOwner ignoreBorderOwner;
   bool isSegStart = true;
   bool ignoreSegStart;
 
   nscoord blockSegISize  =
     mBCData ? mBCData->GetIStartEdge(borderOwner, isSegStart) : 0;
@@ -7402,17 +7400,17 @@ BCPaintBorderIterator::AccumulateOrPaint
 
   if (!IsDamageAreaBStartMost() && (isSegStart || IsDamageAreaBEndMost() ||
                                     IsAfterRepeatedHeader() ||
                                     StartRepeatedFooter())) {
     // paint the previous seg or the current one if IsDamageAreaBEndMost()
     if (blockDirSeg.mLength > 0) {
       blockDirSeg.GetBEndCorner(*this, inlineSegBSize);
       if (blockDirSeg.mWidth > 0) {
-        blockDirSeg.Paint(*this, aRenderingContext, inlineSegBSize);
+        blockDirSeg.Paint(*this, aDrawTarget, inlineSegBSize);
       }
       blockDirSeg.AdvanceOffsetB();
     }
     blockDirSeg.Start(*this, borderOwner, blockSegISize, inlineSegBSize);
   }
   blockDirSeg.IncludeCurrentBorder(*this);
   mPrevInlineSegBSize = inlineSegBSize;
 }
@@ -7430,22 +7428,21 @@ BCPaintBorderIterator::ResetVerInfo()
       mBlockDirInfo[xIndex].mColWidth = -1;
     }
   }
 }
 
 /**
  * Method to paint BCBorders, this does not use currently display lists although
  * it will do this in future
- * @param aRenderingContext - the rendering context
- * @param aDirtyRect        - inside this rectangle the BC Borders will redrawn
+ * @param aDrawTarget - the rendering context
+ * @param aDirtyRect  - inside this rectangle the BC Borders will redrawn
  */
 void
-nsTableFrame::PaintBCBorders(nsRenderingContext& aRenderingContext,
-                             const nsRect&       aDirtyRect)
+nsTableFrame::PaintBCBorders(DrawTarget& aDrawTarget, const nsRect& aDirtyRect)
 {
   // We first transfer the aDirtyRect into cellmap coordinates to compute which
   // cell borders need to be painted
   BCPaintBorderIterator iter(this);
   if (!iter.SetDamageArea(aDirtyRect))
     return;
 
   // XXX comment still has physical terminology
@@ -7454,25 +7451,25 @@ nsTableFrame::PaintBCBorders(nsRendering
   // efficient to paint than horizontal segments. They were stored with as few
   // segments as possible (since horizontal borders are painted last and
   // possibly over them). For every cell in a row that fails in the damage are
   // we look up if the current border would start a new segment, if so we paint
   // the previously stored vertical segment and start a new segment. After
   // this we  the now active segment with the current border. These
   // segments are stored in mBlockDirInfo to be used on the next row
   for (iter.First(); !iter.mAtEnd; iter.Next()) {
-    iter.AccumulateOrPaintBlockDirSegment(aRenderingContext);
+    iter.AccumulateOrPaintBlockDirSegment(aDrawTarget);
   }
 
   // Next, paint all of the inline-dir border segments from bStart to bEnd reuse
   // the mBlockDirInfo array to keep track of col widths and block-dir segments for
   // corner calculations
   iter.Reset();
   for (iter.First(); !iter.mAtEnd; iter.Next()) {
-    iter.AccumulateOrPaintInlineDirSegment(aRenderingContext);
+    iter.AccumulateOrPaintInlineDirSegment(aDrawTarget);
   }
 }
 
 bool
 nsTableFrame::RowHasSpanningCells(int32_t aRowIndex, int32_t aNumEffCols)
 {
   bool result = false;
   nsTableCellMap* cellMap = GetCellMap();
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -307,18 +307,17 @@ public:
   nscoord GetContinuousIStartBCBorderWidth() const;
   void SetContinuousIStartBCBorderWidth(nscoord aValue);
 
   friend class nsDelayedCalcBCBorders;
 
   void AddBCDamageArea(const mozilla::TableArea& aValue);
   bool BCRecalcNeeded(nsStyleContext* aOldStyleContext,
                         nsStyleContext* aNewStyleContext);
-  void PaintBCBorders(nsRenderingContext& aRenderingContext,
-                      const nsRect&        aDirtyRect);
+  void PaintBCBorders(DrawTarget& aDrawTarget, const nsRect& aDirtyRect);
 
   virtual void MarkIntrinsicISizesDirty() override;
   // For border-collapse tables, the caller must not add padding and
   // border to the results of these functions.
   virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
   virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
   virtual IntrinsicISizeOffsetData IntrinsicISizeOffsets() override;