Bug 1157569 part 9 - Rename methods and fields in nsTableRowFrame from physicals to logicals. r=roc
authorXidorn Quan <quanxunzhen@gmail.com>
Mon, 04 May 2015 19:09:25 +1200
changeset 242238 78893c39c41135f4d5e1b5a8a4bf0f5816d40109
parent 242237 d87457c5be3003a7ef52bf0f14bcd593ccf38979
child 242239 aba4c5eb06de498f63d20d7399b2742891d0aa50
push id28686
push userryanvm@gmail.com
push dateMon, 04 May 2015 20:06:04 +0000
treeherdermozilla-central@102d0e9aa9e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1157569
milestone40.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 1157569 part 9 - Rename methods and fields in nsTableRowFrame from physicals to logicals. r=roc
layout/tables/nsTableFrame.cpp
layout/tables/nsTablePainter.cpp
layout/tables/nsTableRowFrame.cpp
layout/tables/nsTableRowFrame.h
layout/tables/nsTableRowGroupFrame.cpp
layout/tables/nsTableRowGroupFrame.h
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -2667,17 +2667,20 @@ nsTableFrame::InitChildReflowState(nsHTM
 {
   nsMargin collapseBorder;
   nsMargin padding(0,0,0,0);
   nsMargin* pCollapseBorder = nullptr;
   nsPresContext* presContext = PresContext();
   if (IsBorderCollapse()) {
     nsTableRowGroupFrame* rgFrame =
        static_cast<nsTableRowGroupFrame*>(aReflowState.frame);
-    pCollapseBorder = rgFrame->GetBCBorderWidth(collapseBorder);
+    WritingMode wm = GetWritingMode();
+    LogicalMargin border = rgFrame->GetBCBorderWidth(wm);
+    collapseBorder = border.GetPhysicalMargin(wm);
+    pCollapseBorder = &collapseBorder;
   }
   aReflowState.Init(presContext, -1, -1, pCollapseBorder, &padding);
 
   NS_ASSERTION(!mBits.mResizedColumns ||
                !aReflowState.parentReflowState->mFlags.mSpecialHeightReflow,
                "should not resize columns on special height reflow");
   if (mBits.mResizedColumns) {
     aReflowState.SetHResize(true);
@@ -5284,24 +5287,26 @@ BCMapCellInfo::SetTableBStartIStartContB
 {
   BCCellBorder currentBorder;
   //calculate continuous top first row & rowgroup border: special case
   //because it must include the table in the collapse
   if (mStartRow) {
     currentBorder = CompareBorders(mTableFrame, nullptr, nullptr, mRowGroup,
                                    mStartRow, nullptr, mTableWM,
                                    eLogicalSideBStart, !ADJACENT);
-    mStartRow->SetContinuousBCBorderWidth(NS_SIDE_TOP, currentBorder.width);
+    mStartRow->SetContinuousBCBorderWidth(eLogicalSideBStart,
+                                          currentBorder.width);
   }
   if (mCgAtEnd && mColGroup) {
     //calculate continuous top colgroup border once per colgroup
     currentBorder = CompareBorders(mTableFrame, mColGroup, nullptr, mRowGroup,
                                    mStartRow, nullptr, mTableWM,
                                    eLogicalSideBStart, !ADJACENT);
-    mColGroup->SetContinuousBCBorderWidth(NS_SIDE_TOP, currentBorder.width);
+    mColGroup->SetContinuousBCBorderWidth(eLogicalSideBStart,
+                                          currentBorder.width);
   }
   if (0 == mColIndex) {
     currentBorder = CompareBorders(mTableFrame, mColGroup, mStartCol, nullptr,
                                    nullptr, nullptr, mTableWM,
                                    eLogicalSideIStart, !ADJACENT);
     mTableFrame->SetContinuousLeftBCBorderWidth(currentBorder.width);
   }
 }
@@ -5310,30 +5315,32 @@ void
 BCMapCellInfo::SetRowGroupIStartContBCBorder()
 {
   BCCellBorder currentBorder;
   //get row group continuous borders
   if (mRgAtEnd && mRowGroup) { //once per row group, so check for bottom
      currentBorder = CompareBorders(mTableFrame, mColGroup, mStartCol,
                                     mRowGroup, nullptr, nullptr, mTableWM,
                                     eLogicalSideIStart, !ADJACENT);
-     mRowGroup->SetContinuousBCBorderWidth(mStartSide, currentBorder.width);
+     mRowGroup->SetContinuousBCBorderWidth(eLogicalSideIStart,
+                                           currentBorder.width);
   }
 }
 
 void
 BCMapCellInfo::SetRowGroupIEndContBCBorder()
 {
   BCCellBorder currentBorder;
   //get row group continuous borders
   if (mRgAtEnd && mRowGroup) { //once per mRowGroup, so check for bottom
     currentBorder = CompareBorders(mTableFrame, mColGroup, mEndCol, mRowGroup,
                                    nullptr, nullptr, mTableWM, eLogicalSideIEnd,
                                    ADJACENT);
-    mRowGroup->SetContinuousBCBorderWidth(mEndSide, currentBorder.width);
+    mRowGroup->SetContinuousBCBorderWidth(eLogicalSideIEnd,
+                                          currentBorder.width);
   }
 }
 
 void
 BCMapCellInfo::SetColumnBStartIEndContBCBorder()
 {
   BCCellBorder currentBorder;
   //calculate column continuous borders
@@ -5405,46 +5412,47 @@ BCMapCellInfo::SetInnerRowGroupBEndContB
                                  nullptr, mTableWM, eLogicalSideBEnd, ADJACENT);
 
   adjacentBorder = CompareBorders(nullptr, nullptr, nullptr, aNextRowGroup,
                                   aNextRow, nullptr, mTableWM, eLogicalSideBStart,
                                   !ADJACENT);
   currentBorder = CompareBorders(false, currentBorder, adjacentBorder,
                                  HORIZONTAL);
   if (aNextRow) {
-    aNextRow->SetContinuousBCBorderWidth(NS_SIDE_TOP, currentBorder.width);
+    aNextRow->SetContinuousBCBorderWidth(eLogicalSideBStart,
+                                         currentBorder.width);
   }
   if (mRgAtEnd && mRowGroup) {
     mRowGroup->SetContinuousBCBorderWidth(NS_SIDE_BOTTOM, currentBorder.width);
   }
 }
 
 void
 BCMapCellInfo::SetRowIStartContBCBorder()
 {
   //get row continuous borders
   if (mCurrentRowFrame) {
     BCCellBorder currentBorder;
     currentBorder = CompareBorders(mTableFrame, mColGroup, mStartCol,
                                    mRowGroup, mCurrentRowFrame, nullptr,
                                    mTableWM, eLogicalSideIStart, !ADJACENT);
-    mCurrentRowFrame->SetContinuousBCBorderWidth(mStartSide,
+    mCurrentRowFrame->SetContinuousBCBorderWidth(eLogicalSideIStart,
                                                  currentBorder.width);
   }
 }
 
 void
 BCMapCellInfo::SetRowIEndContBCBorder()
 {
   if (mCurrentRowFrame) {
     BCCellBorder currentBorder;
     currentBorder = CompareBorders(mTableFrame, mColGroup, mEndCol, mRowGroup,
                                    mCurrentRowFrame, nullptr, mTableWM,
                                    eLogicalSideIEnd, ADJACENT);
-    mCurrentRowFrame->SetContinuousBCBorderWidth(mEndSide,
+    mCurrentRowFrame->SetContinuousBCBorderWidth(eLogicalSideIEnd,
                                                  currentBorder.width);
   }
 }
 void
 BCMapCellInfo::SetTableBStartBorderWidth(BCPixelSize aWidth)
 {
   mTableBCData->mTopBorderWidth = std::max(mTableBCData->mTopBorderWidth, aWidth);
 }
@@ -5501,31 +5509,31 @@ BCMapCellInfo::SetBEndBorderWidths(BCPix
 {
   // update the borders of the affected cells and rows
   if (mCell) {
     mCell->SetBorderWidth(NS_SIDE_BOTTOM, std::max(aWidth,
                           mCell->GetBorderWidth(NS_SIDE_BOTTOM)));
   }
   if (mEndRow) {
     BCPixelSize half = BC_BORDER_START_HALF(aWidth);
-    mEndRow->SetBottomBCBorderWidth(
-      std::max(nscoord(half), mEndRow->GetBottomBCBorderWidth()));
+    mEndRow->SetBEndBCBorderWidth(
+      std::max(nscoord(half), mEndRow->GetBEndBCBorderWidth()));
   }
 }
 void
 BCMapCellInfo::SetBStartBorderWidths(BCPixelSize aWidth)
 {
  if (mCell) {
      mCell->SetBorderWidth(NS_SIDE_TOP, std::max(aWidth,
                            mCell->GetBorderWidth(NS_SIDE_TOP)));
   }
   if (mStartRow) {
     BCPixelSize half = BC_BORDER_END_HALF(aWidth);
-    mStartRow->SetTopBCBorderWidth(
-      std::max(nscoord(half), mStartRow->GetTopBCBorderWidth()));
+    mStartRow->SetBStartBCBorderWidth(
+      std::max(nscoord(half), mStartRow->GetBStartBCBorderWidth()));
   }
 }
 void
 BCMapCellInfo::SetIStartBorderWidths(BCPixelSize aWidth)
 {
   if (mCell) {
     mCell->SetBorderWidth(mStartSide, std::max(aWidth,
                           mCell->GetBorderWidth(mStartSide)));
@@ -6407,28 +6415,28 @@ BCPaintBorderIterator::SetDamageArea(con
     nsTableRowGroupFrame* rgFrame = mRowGroups[rgX];
     for (nsTableRowFrame* rowFrame = rgFrame->GetFirstRow(); rowFrame;
          rowFrame = rowFrame->GetNextRow()) {
       // get the row rect relative to the table rather than the row group
       nsSize rowSize = rowFrame->GetSize();
       if (haveIntersect) {
         // conservatively estimate the half border widths outside the row
         nscoord borderHalf = mTable->GetPrevInFlow() ? 0 : nsPresContext::
-          CSSPixelsToAppUnits(rowFrame->GetTopBCBorderWidth() + 1);
+          CSSPixelsToAppUnits(rowFrame->GetBStartBCBorderWidth() + 1);
         if (aDirtyRect.YMost() >= rowY - borderHalf) {
           nsTableRowFrame* fifRow =
             static_cast<nsTableRowFrame*>(rowFrame->FirstInFlow());
           endRowIndex = fifRow->GetRowIndex();
         }
         else done = true;
       }
       else {
         // conservatively estimate the half border widths outside the row
         nscoord borderHalf = mTable->GetNextInFlow() ? 0 : nsPresContext::
-          CSSPixelsToAppUnits(rowFrame->GetBottomBCBorderWidth() + 1);
+          CSSPixelsToAppUnits(rowFrame->GetBEndBCBorderWidth() + 1);
         if (rowY + rowSize.height + borderHalf >= aDirtyRect.y) {
           mStartRg  = rgFrame;
           mStartRow = rowFrame;
           nsTableRowFrame* fifRow =
             static_cast<nsTableRowFrame*>(rowFrame->FirstInFlow());
           startRowIndex = endRowIndex = fifRow->GetRowIndex();
           haveIntersect = true;
         }
--- a/layout/tables/nsTablePainter.cpp
+++ b/layout/tables/nsTablePainter.cpp
@@ -7,16 +7,17 @@
 #include "nsTableRowGroupFrame.h"
 #include "nsTableRowFrame.h"
 #include "nsTableColGroupFrame.h"
 #include "nsTableColFrame.h"
 #include "nsTableCellFrame.h"
 #include "nsTablePainter.h"
 #include "nsCSSRendering.h"
 #include "nsDisplayList.h"
+#include "mozilla/WritingModes.h"
 
 /* ~*~ Table Background Painting ~*~
 
    Mozilla's Table Background painting follows CSS2.1:17.5.1
    That section does not, however, describe the effect of
    borders on background image positioning. What we do is:
 
      - in separate borders, the borders are passed in so that
@@ -90,16 +91,17 @@
    Elements with stacking contexts set up their own painter to finish the
    painting process, since they were skipped. They call the appropriate
    sub-part of the loop (e.g. PaintRow) which will paint the frame and
    descendants.
 
    XXX views are going
  */
 
+using namespace mozilla;
 using namespace mozilla::image;
 
 TableBackgroundPainter::TableBackgroundData::TableBackgroundData()
   : mFrame(nullptr)
   , mVisible(false)
   , mUsesSynthBorder(false)
 {
 }
@@ -484,17 +486,19 @@ TableBackgroundPainter::PaintRow(nsTable
   /* Load row data */
   if (aPassThrough) {
     aRowBGData.MakeInvisible();
   } else {
     if (mIsBorderCollapse && aRowBGData.ShouldSetBCBorder()) {
       nsMargin border;
       nsTableRowFrame* nextRow = aFrame->GetNextRow();
       if (nextRow) { //outer top below us is inner bottom for us
-        border.bottom = nextRow->GetOuterTopContBCBorderWidth();
+        WritingMode wm = nextRow->GetWritingMode();
+        border.Side(wm.PhysicalSide(eLogicalSideBEnd)) =
+          nextRow->GetOuterBStartContBCBorderWidth();
       }
       else { //acquire rg's bottom border
         nsTableRowGroupFrame* rowGroup = static_cast<nsTableRowGroupFrame*>(aFrame->GetParent());
         rowGroup->GetContinuousBCBorderWidth(border);
       }
       //get the rest of the borders; will overwrite all but bottom
       aFrame->GetContinuousBCBorderWidth(border);
 
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -1368,28 +1368,28 @@ nsTableRowFrame::SetUnpaginatedHeight(ns
 
 nscoord
 nsTableRowFrame::GetUnpaginatedHeight(nsPresContext* aPresContext)
 {
   FrameProperties props = FirstInFlow()->Properties();
   return NS_PTR_TO_INT32(props.Get(RowUnpaginatedHeightProperty()));
 }
 
-void nsTableRowFrame::SetContinuousBCBorderWidth(uint8_t     aForSide,
+void nsTableRowFrame::SetContinuousBCBorderWidth(LogicalSide aForSide,
                                                  BCPixelSize aPixelValue)
 {
   switch (aForSide) {
-    case NS_SIDE_RIGHT:
-      mRightContBorderWidth = aPixelValue;
+    case eLogicalSideIEnd:
+      mIEndContBorderWidth = aPixelValue;
       return;
-    case NS_SIDE_TOP:
-      mTopContBorderWidth = aPixelValue;
+    case eLogicalSideBStart:
+      mBStartContBorderWidth = aPixelValue;
       return;
-    case NS_SIDE_LEFT:
-      mLeftContBorderWidth = aPixelValue;
+    case eLogicalSideIStart:
+      mIStartContBorderWidth = aPixelValue;
       return;
     default:
       NS_ERROR("invalid NS_SIDE arg");
   }
 }
 #ifdef ACCESSIBILITY
 a11y::AccType
 nsTableRowFrame::AccessibleType()
--- a/layout/tables/nsTableRowFrame.h
+++ b/layout/tables/nsTableRowFrame.h
@@ -206,38 +206,38 @@ public:
 
   nsTableRowFrame* GetNextRow() const;
 
   bool    HasUnpaginatedHeight();
   void    SetHasUnpaginatedHeight(bool aValue);
   nscoord GetUnpaginatedHeight(nsPresContext* aPresContext);
   void    SetUnpaginatedHeight(nsPresContext* aPresContext, nscoord aValue);
 
-  nscoord GetTopBCBorderWidth();
-  void    SetTopBCBorderWidth(BCPixelSize aWidth);
-  nscoord GetBottomBCBorderWidth();
-  void    SetBottomBCBorderWidth(BCPixelSize aWidth);
-  nsMargin* GetBCBorderWidth(nsMargin& aBorder);
+  nscoord GetBStartBCBorderWidth() const { return mBStartBorderWidth; }
+  nscoord GetBEndBCBorderWidth() const { return mBEndBorderWidth; }
+  void SetBStartBCBorderWidth(BCPixelSize aWidth) { mBStartBorderWidth = aWidth; }
+  void SetBEndBCBorderWidth(BCPixelSize aWidth) { mBEndBorderWidth = aWidth; }
+  mozilla::LogicalMargin GetBCBorderWidth(mozilla::WritingMode aWM);
                              
   /**
    * Gets inner border widths before collapsing with cell borders
-   * Caller must get bottom border from next row or from table
-   * GetContinuousBCBorderWidth will not overwrite aBorder.bottom
+   * Caller must get block-end border from next row or from table
+   * GetContinuousBCBorderWidth will not overwrite that border
    * see nsTablePainter about continuous borders
    */
   void GetContinuousBCBorderWidth(nsMargin& aBorder);
   /**
-   * @returns outer top bc border == prev row's bottom inner
+   * @returns outer block-start bc border == prev row's block-end inner
    */
-  nscoord GetOuterTopContBCBorderWidth();
+  nscoord GetOuterBStartContBCBorderWidth();
   /**
    * Sets full border widths before collapsing with cell borders
-   * @param aForSide - side to set; only accepts right, left, and top
+   * @param aForSide - side to set; only accepts iend, istart, and bstart
    */
-  void SetContinuousBCBorderWidth(uint8_t     aForSide,
+  void SetContinuousBCBorderWidth(mozilla::LogicalSide aForSide,
                                   BCPixelSize aPixelValue);
 
   virtual bool IsFrameOfType(uint32_t aFlags) const override
   {
     return nsContainerFrame::IsFrameOfType(aFlags & ~(nsIFrame::eTablePart));
   }
 
   virtual void InvalidateFrame(uint32_t aDisplayItemKey = 0) override;
@@ -295,21 +295,21 @@ private:
   nscoord mStyleFixedHeight;
 
   // max-ascent and max-descent amongst all cells that have 'vertical-align: baseline'
   nscoord mMaxCellAscent;  // does include cells with rowspan > 1
   nscoord mMaxCellDescent; // does *not* include cells with rowspan > 1
 
   // border widths in pixels in the collapsing border model of the *inner*
   // half of the border only
-  BCPixelSize mTopBorderWidth;
-  BCPixelSize mBottomBorderWidth;
-  BCPixelSize mRightContBorderWidth;
-  BCPixelSize mTopContBorderWidth;
-  BCPixelSize mLeftContBorderWidth;
+  BCPixelSize mBStartBorderWidth;
+  BCPixelSize mBEndBorderWidth;
+  BCPixelSize mIEndContBorderWidth;
+  BCPixelSize mBStartContBorderWidth;
+  BCPixelSize mIStartContBorderWidth;
 
   /**
    * Sets the NS_ROW_HAS_CELL_WITH_STYLE_HEIGHT bit to indicate whether
    * this row has any cells that have non-auto-height.  (Row-spanning
    * cells are ignored.)
    */
   void InitHasCellWithStyleHeight(nsTableFrame* aTableFrame);
 
@@ -396,57 +396,38 @@ inline void nsTableRowFrame::SetHasUnpag
 {
   if (aValue) {
     mState |= NS_TABLE_ROW_HAS_UNPAGINATED_HEIGHT;
   } else {
     mState &= ~NS_TABLE_ROW_HAS_UNPAGINATED_HEIGHT;
   }
 }
 
-inline nscoord nsTableRowFrame::GetTopBCBorderWidth()
-{
-  return mTopBorderWidth;
-}
-
-inline void nsTableRowFrame::SetTopBCBorderWidth(BCPixelSize aWidth)
-{
-  mTopBorderWidth = aWidth;
-}
-
-inline nscoord nsTableRowFrame::GetBottomBCBorderWidth()
+inline mozilla::LogicalMargin
+nsTableRowFrame::GetBCBorderWidth(mozilla::WritingMode aWM)
 {
-  return mBottomBorderWidth;
-}
-
-inline void nsTableRowFrame::SetBottomBCBorderWidth(BCPixelSize aWidth)
-{
-  mBottomBorderWidth = aWidth;
-}
-
-inline nsMargin* nsTableRowFrame::GetBCBorderWidth(nsMargin& aBorder)
-{
-  aBorder.left = aBorder.right = 0;
-
-  aBorder.top    = nsPresContext::CSSPixelsToAppUnits(mTopBorderWidth);
-  aBorder.bottom = nsPresContext::CSSPixelsToAppUnits(mBottomBorderWidth);
-
-  return &aBorder;
+  return mozilla::LogicalMargin(
+    aWM, nsPresContext::CSSPixelsToAppUnits(mBStartBorderWidth), 0,
+    nsPresContext::CSSPixelsToAppUnits(mBEndBorderWidth), 0);
 }
 
 inline void
 nsTableRowFrame::GetContinuousBCBorderWidth(nsMargin& aBorder)
 {
   int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
-  aBorder.right = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
-                                             mLeftContBorderWidth);
-  aBorder.top = BC_BORDER_END_HALF_COORD(aPixelsToTwips,
-                                         mTopContBorderWidth);
-  aBorder.left = BC_BORDER_END_HALF_COORD(aPixelsToTwips,
-                                          mRightContBorderWidth);
+  mozilla::WritingMode wm = GetWritingMode();
+  mozilla::LogicalMargin border(wm, aBorder);
+  border.IEnd(wm) = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
+                                               mIStartContBorderWidth);
+  border.BStart(wm) = BC_BORDER_END_HALF_COORD(aPixelsToTwips,
+                                               mBStartContBorderWidth);
+  border.IStart(wm) = BC_BORDER_END_HALF_COORD(aPixelsToTwips,
+                                               mIEndContBorderWidth);
+  aBorder = border.GetPhysicalMargin(wm);
 }
 
-inline nscoord nsTableRowFrame::GetOuterTopContBCBorderWidth()
+inline nscoord nsTableRowFrame::GetOuterBStartContBCBorderWidth()
 {
   int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
-  return BC_BORDER_START_HALF_COORD(aPixelsToTwips, mTopContBorderWidth);
+  return BC_BORDER_START_HALF_COORD(aPixelsToTwips, mBStartContBorderWidth);
 }
 
 #endif
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -291,17 +291,20 @@ nsTableRowGroupFrame::InitChildReflowSta
                                            nsHTMLReflowState& aReflowState)
 {
   nsMargin collapseBorder;
   nsMargin padding(0,0,0,0);
   nsMargin* pCollapseBorder = nullptr;
   if (aBorderCollapse) {
     nsTableRowFrame *rowFrame = do_QueryFrame(aReflowState.frame);
     if (rowFrame) {
-      pCollapseBorder = rowFrame->GetBCBorderWidth(collapseBorder);
+      WritingMode wm = GetWritingMode();
+      LogicalMargin border = rowFrame->GetBCBorderWidth(wm);
+      collapseBorder = border.GetPhysicalMargin(wm);
+      pCollapseBorder = &collapseBorder;
     }
   }
   aReflowState.Init(&aPresContext, -1, -1, pCollapseBorder, &padding);
 }
 
 static void
 CacheRowHeightsForPrinting(nsPresContext*   aPresContext,
                            nsTableRowFrame* aFirstRow)
@@ -1595,35 +1598,35 @@ NS_IMPL_FRAMEARENA_HELPERS(nsTableRowGro
 #ifdef DEBUG_FRAME_DUMP
 nsresult
 nsTableRowGroupFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("TableRowGroup"), aResult);
 }
 #endif
 
-nsMargin*
-nsTableRowGroupFrame::GetBCBorderWidth(nsMargin& aBorder)
+LogicalMargin
+nsTableRowGroupFrame::GetBCBorderWidth(WritingMode aWM)
 {
-  aBorder.left = aBorder.right = aBorder.top = aBorder.bottom = 0;
-
+  LogicalMargin border(aWM);
   nsTableRowFrame* firstRowFrame = nullptr;
   nsTableRowFrame* lastRowFrame = nullptr;
   for (nsTableRowFrame* rowFrame = GetFirstRow(); rowFrame; rowFrame = rowFrame->GetNextRow()) {
     if (!firstRowFrame) {
       firstRowFrame = rowFrame;
     }
     lastRowFrame = rowFrame;
   }
   if (firstRowFrame) {
-    aBorder.top    = nsPresContext::CSSPixelsToAppUnits(firstRowFrame->GetTopBCBorderWidth());
-    aBorder.bottom = nsPresContext::CSSPixelsToAppUnits(lastRowFrame->GetBottomBCBorderWidth());
+    border.BStart(aWM) = nsPresContext::
+      CSSPixelsToAppUnits(firstRowFrame->GetBStartBCBorderWidth());
+    border.BEnd(aWM) = nsPresContext::
+      CSSPixelsToAppUnits(lastRowFrame->GetBEndBCBorderWidth());
   }
-
-  return &aBorder;
+  return border;
 }
 
 void nsTableRowGroupFrame::SetContinuousBCBorderWidth(uint8_t     aForSide,
                                                       BCPixelSize aPixelValue)
 {
   switch (aForSide) {
     case NS_SIDE_RIGHT:
       mRightContBorderWidth = aPixelValue;
--- a/layout/tables/nsTableRowGroupFrame.h
+++ b/layout/tables/nsTableRowGroupFrame.h
@@ -8,16 +8,17 @@
 #include "mozilla/Attributes.h"
 #include "nscore.h"
 #include "nsContainerFrame.h"
 #include "nsIAtom.h"
 #include "nsILineIterator.h"
 #include "nsTablePainter.h"
 #include "nsTArray.h"
 #include "nsTableFrame.h"
+#include "mozilla/WritingModes.h"
 
 class nsTableRowFrame;
 
 struct nsRowGroupReflowState {
   const nsHTMLReflowState& reflowState;  // Our reflow state
 
   nsTableFrame* tableFrame;
 
@@ -156,17 +157,17 @@ public:
                               nsTableRowGroupFrame* aHeaderFooterFrame);
 
 
   /**
    * Get the total height of all the row rects
    */
   nscoord GetHeightBasis(const nsHTMLReflowState& aReflowState);
 
-  nsMargin* GetBCBorderWidth(nsMargin& aBorder);
+  mozilla::LogicalMargin GetBCBorderWidth(mozilla::WritingMode aWM);
 
   /**
    * Gets inner border widths before collapsing with cell borders
    * Caller must get top border from previous row group or from table
    * GetContinuousBCBorderWidth will not overwrite aBorder.top
    * see nsTablePainter about continuous borders
    */
   void GetContinuousBCBorderWidth(nsMargin& aBorder);