Bug 1157569 part 7 - Rename methods and fields in nsTableColFrame from physicals to logicals. r=roc
authorXidorn Quan <quanxunzhen@gmail.com>
Mon, 04 May 2015 19:09:25 +1200
changeset 242168 372ec739411b87e2d4bef6725c8b7e1236f29895
parent 242167 7738943aa2ed789c986bf49b903065ea465fa1c6
child 242169 d87457c5be3003a7ef52bf0f14bcd593ccf38979
push id59328
push userxquan@mozilla.com
push dateMon, 04 May 2015 07:10:49 +0000
treeherdermozilla-inbound@8e1f05ac1281 [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 7 - Rename methods and fields in nsTableColFrame from physicals to logicals. r=roc
layout/tables/nsTableColFrame.cpp
layout/tables/nsTableColFrame.h
layout/tables/nsTableFrame.cpp
--- a/layout/tables/nsTableColFrame.cpp
+++ b/layout/tables/nsTableColFrame.cpp
@@ -8,16 +8,18 @@
 #include "nsContainerFrame.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsGkAtoms.h"
 #include "nsCSSRendering.h"
 #include "nsIContent.h"
 
+using namespace mozilla;
+
 #define COL_TYPE_BITS                 (NS_FRAME_STATE_BIT(28) | \
                                        NS_FRAME_STATE_BIT(29) | \
                                        NS_FRAME_STATE_BIT(30) | \
                                        NS_FRAME_STATE_BIT(31))
 #define COL_TYPE_OFFSET               28
 
 using namespace mozilla;
 
@@ -64,28 +66,28 @@ nsTableColFrame::DidSetStyleContext(nsSt
   nsTableFrame* tableFrame = GetTableFrame();
   if (tableFrame->IsBorderCollapse() &&
       tableFrame->BCRecalcNeeded(aOldStyleContext, StyleContext())) {
     TableArea damageArea(GetColIndex(), 0, 1, tableFrame->GetRowCount());
     tableFrame->AddBCDamageArea(damageArea);
   }
 }
 
-void nsTableColFrame::SetContinuousBCBorderWidth(uint8_t     aForSide,
+void nsTableColFrame::SetContinuousBCBorderWidth(LogicalSide aForSide,
                                                  BCPixelSize aPixelValue)
 {
   switch (aForSide) {
-    case NS_SIDE_TOP:
-      mTopContBorderWidth = aPixelValue;
+    case eLogicalSideBStart:
+      mBStartContBorderWidth = aPixelValue;
       return;
-    case NS_SIDE_RIGHT:
-      mRightContBorderWidth = aPixelValue;
+    case eLogicalSideIEnd:
+      mIEndContBorderWidth = aPixelValue;
       return;
-    case NS_SIDE_BOTTOM:
-      mBottomContBorderWidth = aPixelValue;
+    case eLogicalSideBEnd:
+      mBEndContBorderWidth = aPixelValue;
       return;
     default:
       NS_ERROR("invalid side arg");
   }
 }
 
 void
 nsTableColFrame::Reflow(nsPresContext*          aPresContext,
--- a/layout/tables/nsTableColFrame.h
+++ b/layout/tables/nsTableColFrame.h
@@ -83,35 +83,35 @@ public:
     { return GetTableFrame()->GetWritingMode(); }
 
   /** return the number of the columns the col represents.  always >= 1 */
   int32_t GetSpan();
 
   /** convenience method, calls into cellmap */
   int32_t Count() const;
 
-  nscoord GetLeftBorderWidth();
-  void    SetLeftBorderWidth(BCPixelSize aWidth);
-  nscoord GetRightBorderWidth();
-  void    SetRightBorderWidth(BCPixelSize aWidth);
+  nscoord GetIStartBorderWidth() const { return mIStartBorderWidth; }
+  nscoord GetIEndBorderWidth() const { return mIEndBorderWidth; }
+  void SetIStartBorderWidth(BCPixelSize aWidth) { mIStartBorderWidth = aWidth; }
+  void SetIEndBorderWidth(BCPixelSize aWidth) { mIEndBorderWidth = aWidth; }
 
   /**
    * Gets inner border widths before collapsing with cell borders
    * Caller must get left border from previous column or from table
    * GetContinuousBCBorderWidth will not overwrite aBorder.left
    * see nsTablePainter about continuous borders
    *
    * @return outer right border width (left inner for next column)
    */
   nscoord GetContinuousBCBorderWidth(nsMargin& aBorder);
   /**
    * Set full border widths before collapsing with cell borders
-   * @param aForSide - side to set; only valid for top, right, and bottom
+   * @param aForSide - side to set; only valid for bstart, iend, and bend
    */
-  void SetContinuousBCBorderWidth(uint8_t     aForSide,
+  void SetContinuousBCBorderWidth(mozilla::LogicalSide aForSide,
                                   BCPixelSize aPixelValue);
 #ifdef DEBUG
   void Dump(int32_t aIndent);
 #endif
 
   /**
    * Restore the default values of the intrinsic widths, so that we can
    * re-accumulate intrinsic widths from the cells in the column.
@@ -300,61 +300,45 @@ protected:
   nscoord mFinalISize;
 
   // the index of the column with respect to the whole table (starting at 0)
   // it should never be smaller then the start column index of the parent
   // colgroup
   uint32_t mColIndex;
 
   // border width in pixels of the inner half of the border only
-  BCPixelSize mLeftBorderWidth;
-  BCPixelSize mRightBorderWidth;
-  BCPixelSize mTopContBorderWidth;
-  BCPixelSize mRightContBorderWidth;
-  BCPixelSize mBottomContBorderWidth;
+  BCPixelSize mIStartBorderWidth;
+  BCPixelSize mIEndBorderWidth;
+  BCPixelSize mBStartContBorderWidth;
+  BCPixelSize mIEndContBorderWidth;
+  BCPixelSize mBEndContBorderWidth;
 
   bool mHasSpecifiedCoord;
 };
 
 inline int32_t nsTableColFrame::GetColIndex() const
 {
   return mColIndex;
 }
 
 inline void nsTableColFrame::SetColIndex (int32_t aColIndex)
 {
   mColIndex = aColIndex;
 }
 
-inline nscoord nsTableColFrame::GetLeftBorderWidth()
-{
-  return mLeftBorderWidth;
-}
-
-inline void nsTableColFrame::SetLeftBorderWidth(BCPixelSize aWidth)
-{
-  mLeftBorderWidth = aWidth;
-}
-
-inline nscoord nsTableColFrame::GetRightBorderWidth()
-{
-  return mRightBorderWidth;
-}
-
-inline void nsTableColFrame::SetRightBorderWidth(BCPixelSize aWidth)
-{
-  mRightBorderWidth = aWidth;
-}
-
 inline nscoord
 nsTableColFrame::GetContinuousBCBorderWidth(nsMargin& aBorder)
 {
   int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
-  aBorder.top = BC_BORDER_END_HALF_COORD(aPixelsToTwips, mTopContBorderWidth);
-  aBorder.right = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
-                                             mRightContBorderWidth);
-  aBorder.bottom = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
-                                              mBottomContBorderWidth);
-  return BC_BORDER_END_HALF_COORD(aPixelsToTwips, mRightContBorderWidth);
+  mozilla::WritingMode wm = GetWritingMode();
+  mozilla::LogicalMargin border(wm, aBorder);
+  border.BStart(wm) = BC_BORDER_END_HALF_COORD(aPixelsToTwips,
+                                               mBStartContBorderWidth);
+  border.IEnd(wm) = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
+                                               mIEndContBorderWidth);
+  border.BEnd(wm) = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
+                                               mBEndContBorderWidth);
+  aBorder = border.GetPhysicalMargin(wm);
+  return BC_BORDER_END_HALF_COORD(aPixelsToTwips, mIEndContBorderWidth);
 }
 
 #endif
 
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -5337,41 +5337,41 @@ BCMapCellInfo::SetColumnBStartIEndContBC
 {
   BCCellBorder currentBorder;
   //calculate column continuous borders
   //we only need to do this once, so we'll do it only on the first row
   currentBorder = CompareBorders(mTableFrame, mCurrentColGroupFrame,
                                  mCurrentColFrame, mRowGroup, mStartRow,
                                  nullptr, mTableWM, eLogicalSideBStart,
                                  !ADJACENT);
-  ((nsTableColFrame*) mCurrentColFrame)->SetContinuousBCBorderWidth(NS_SIDE_TOP,
-                                                           currentBorder.width);
+  ((nsTableColFrame*) mCurrentColFrame)->
+    SetContinuousBCBorderWidth(eLogicalSideBStart, currentBorder.width);
   if (mNumTableCols == GetCellEndColIndex() + 1) {
     currentBorder = CompareBorders(mTableFrame, mCurrentColGroupFrame,
                                    mCurrentColFrame, nullptr, nullptr, nullptr,
                                    mTableWM, eLogicalSideIEnd, !ADJACENT);
   }
   else {
     currentBorder = CompareBorders(nullptr, mCurrentColGroupFrame,
                                    mCurrentColFrame, nullptr,nullptr, nullptr,
                                    mTableWM, eLogicalSideIEnd, !ADJACENT);
   }
-  mCurrentColFrame->SetContinuousBCBorderWidth(NS_SIDE_RIGHT,
+  mCurrentColFrame->SetContinuousBCBorderWidth(eLogicalSideIEnd,
                                                currentBorder.width);
 }
 
 void
 BCMapCellInfo::SetColumnBEndContBCBorder()
 {
   BCCellBorder currentBorder;
   //get col continuous border
   currentBorder = CompareBorders(mTableFrame, mCurrentColGroupFrame,
                                  mCurrentColFrame, mRowGroup, mEndRow,
                                  nullptr, mTableWM, eLogicalSideBEnd, ADJACENT);
-  mCurrentColFrame->SetContinuousBCBorderWidth(NS_SIDE_BOTTOM,
+  mCurrentColFrame->SetContinuousBCBorderWidth(eLogicalSideBEnd,
                                                currentBorder.width);
 }
 
 void
 BCMapCellInfo::SetColGroupBEndContBCBorder()
 {
   BCCellBorder currentBorder;
   if (mColGroup) {
@@ -5486,18 +5486,18 @@ BCMapCellInfo::SetIEndBorderWidths(BCPix
 {
    // update the borders of the cells and cols affected
   if (mCell) {
     mCell->SetBorderWidth(mEndSide, std::max(aWidth,
                           mCell->GetBorderWidth(mEndSide)));
   }
   if (mEndCol) {
     BCPixelSize half = BC_BORDER_START_HALF(aWidth);
-    mEndCol->SetRightBorderWidth(std::max(nscoord(half),
-                                           mEndCol->GetRightBorderWidth()));
+    mEndCol->SetIEndBorderWidth(
+      std::max(nscoord(half), mEndCol->GetIEndBorderWidth()));
   }
 }
 
 void
 BCMapCellInfo::SetBEndBorderWidths(BCPixelSize aWidth)
 {
   // update the borders of the affected cells and rows
   if (mCell) {
@@ -5527,18 +5527,18 @@ void
 BCMapCellInfo::SetIStartBorderWidths(BCPixelSize aWidth)
 {
   if (mCell) {
     mCell->SetBorderWidth(mStartSide, std::max(aWidth,
                           mCell->GetBorderWidth(mStartSide)));
   }
   if (mStartCol) {
     BCPixelSize half = BC_BORDER_END_HALF(aWidth);
-    mStartCol->SetLeftBorderWidth(std::max(nscoord(half),
-                                           mStartCol->GetLeftBorderWidth()));
+    mStartCol->SetIStartBorderWidth(
+      std::max(nscoord(half), mStartCol->GetIStartBorderWidth()));
   }
 }
 
 void
 BCMapCellInfo::SetTableBEndBorderWidth(BCPixelSize aWidth)
 {
   mTableBCData->mBottomBorderWidth = std::max(mTableBCData->mBottomBorderWidth,
                                             aWidth);
@@ -6469,28 +6469,28 @@ BCPaintBorderIterator::SetDamageArea(con
   int32_t colX;
   for (colX = leftCol; colX != rightCol; colX += mColInc) {
     nsTableColFrame* colFrame = mTableFirstInFlow->GetColFrame(colX);
     if (!colFrame) ABORT1(false);
     // get the col rect relative to the table rather than the col group
     nsSize size = colFrame->GetSize();
     if (haveIntersect) {
       // conservatively estimate the left half border width outside the col
-      nscoord leftBorderHalf =
-        nsPresContext::CSSPixelsToAppUnits(colFrame->GetLeftBorderWidth() + 1);
-      if (aDirtyRect.XMost() >= (x - leftBorderHalf)) {
+      nscoord istartBorderHalf = nsPresContext::
+        CSSPixelsToAppUnits(colFrame->GetIStartBorderWidth() + 1);
+      if (aDirtyRect.XMost() >= x - istartBorderHalf) {
         endColIndex = colX;
       }
       else break;
     }
     else {
       // conservatively estimate the right half border width outside the col
-      nscoord rightBorderHalf =
-        nsPresContext::CSSPixelsToAppUnits(colFrame->GetRightBorderWidth() + 1);
-      if ((x + size.width + rightBorderHalf) >= aDirtyRect.x) {
+      nscoord iendBorderHalf = nsPresContext::
+        CSSPixelsToAppUnits(colFrame->GetIEndBorderWidth() + 1);
+      if (x + size.width + iendBorderHalf >= aDirtyRect.x) {
         startColIndex = endColIndex = colX;
         haveIntersect = true;
       }
       else {
         mInitialOffsetX += mColInc * size.width;
       }
     }
     x += size.width;