bug 1157569 part 1 - Rename BC_BORDER_{TOP,RIGHT,BOTTOM,LEFT}_HALF* to BC_BORDER_{START,END}_HALF*. r=roc
authorXidorn Quan <quanxunzhen@gmail.com>
Mon, 04 May 2015 19:09:25 +1200
changeset 273595 446a65d17e3387f5cfeb1eab97c62809d1931da2
parent 273594 f20483b68bda5a002dbc6cfdad752083408ed116
child 273596 2e5ad5a98101453c1ce9d43685e37b13e54153c3
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [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 1 - Rename BC_BORDER_{TOP,RIGHT,BOTTOM,LEFT}_HALF* to BC_BORDER_{START,END}_HALF*. r=roc
layout/tables/celldata.h
layout/tables/nsTableCellFrame.cpp
layout/tables/nsTableColFrame.h
layout/tables/nsTableColGroupFrame.cpp
layout/tables/nsTableFrame.cpp
layout/tables/nsTableFrame.h
layout/tables/nsTableRowFrame.h
layout/tables/nsTableRowGroupFrame.h
--- a/layout/tables/celldata.h
+++ b/layout/tables/celldata.h
@@ -160,29 +160,29 @@ enum BCBorderOwner
 };
 
 typedef uint16_t BCPixelSize;
 
 // These are the max sizes that are stored. If they are exceeded, then the max is stored and
 // the actual value is computed when needed.
 #define MAX_BORDER_WIDTH nscoord((1u << (sizeof(BCPixelSize) * 8)) - 1)
 
-static inline nscoord
-BC_BORDER_TOP_HALF_COORD(int32_t p2t, uint16_t px)    { return (px - px / 2) * p2t; }
-static inline nscoord
-BC_BORDER_RIGHT_HALF_COORD(int32_t p2t, uint16_t px)  { return (     px / 2) * p2t; }
-static inline nscoord
-BC_BORDER_BOTTOM_HALF_COORD(int32_t p2t, uint16_t px) { return (     px / 2) * p2t; }
+// The half of border on inline/block-axis start side
+static inline BCPixelSize
+BC_BORDER_START_HALF(BCPixelSize px) { return px - px / 2; }
+// The half of border on inline/block-axis end side
+static inline BCPixelSize
+BC_BORDER_END_HALF(BCPixelSize px) { return px / 2; }
+
 static inline nscoord
-BC_BORDER_LEFT_HALF_COORD(int32_t p2t, uint16_t px)   { return (px - px / 2) * p2t; }
-
-#define BC_BORDER_TOP_HALF(px)    ((px) - (px) / 2)
-#define BC_BORDER_RIGHT_HALF(px)  ((px) / 2)
-#define BC_BORDER_BOTTOM_HALF(px) ((px) / 2)
-#define BC_BORDER_LEFT_HALF(px)   ((px) - (px) / 2)
+BC_BORDER_START_HALF_COORD(int32_t p2t, BCPixelSize px)
+  { return BC_BORDER_START_HALF(px) * p2t; }
+static inline nscoord
+BC_BORDER_END_HALF_COORD(int32_t p2t, BCPixelSize px)
+  { return BC_BORDER_END_HALF(px) * p2t; }
 
 // BCData stores the top and left border info and the corner connecting the two.
 class BCData
 {
 public:
   BCData();
 
   ~BCData();
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -1147,35 +1147,35 @@ nsBCTableCellFrame::GetFrameName(nsAStri
   return MakeFrameName(NS_LITERAL_STRING("BCTableCell"), aResult);
 }
 #endif
 
 nsMargin*
 nsBCTableCellFrame::GetBorderWidth(nsMargin&  aBorder) const
 {
   int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
-  aBorder.top    = BC_BORDER_BOTTOM_HALF_COORD(aPixelsToTwips, mTopBorder);
-  aBorder.right  = BC_BORDER_LEFT_HALF_COORD(aPixelsToTwips, mRightBorder);
-  aBorder.bottom = BC_BORDER_TOP_HALF_COORD(aPixelsToTwips, mBottomBorder);
-  aBorder.left   = BC_BORDER_RIGHT_HALF_COORD(aPixelsToTwips, mLeftBorder);
+  aBorder.top = BC_BORDER_END_HALF_COORD(aPixelsToTwips, mTopBorder);
+  aBorder.right = BC_BORDER_START_HALF_COORD(aPixelsToTwips, mRightBorder);
+  aBorder.bottom = BC_BORDER_START_HALF_COORD(aPixelsToTwips, mBottomBorder);
+  aBorder.left = BC_BORDER_END_HALF_COORD(aPixelsToTwips, mLeftBorder);
   return &aBorder;
 }
 
 BCPixelSize
 nsBCTableCellFrame::GetBorderWidth(mozilla::css::Side aSide) const
 {
   switch(aSide) {
   case NS_SIDE_TOP:
-    return BC_BORDER_BOTTOM_HALF(mTopBorder);
+    return BC_BORDER_END_HALF(mTopBorder);
   case NS_SIDE_RIGHT:
-    return BC_BORDER_LEFT_HALF(mRightBorder);
+    return BC_BORDER_START_HALF(mRightBorder);
   case NS_SIDE_BOTTOM:
-    return BC_BORDER_TOP_HALF(mBottomBorder);
+    return BC_BORDER_START_HALF(mBottomBorder);
   default:
-    return BC_BORDER_RIGHT_HALF(mLeftBorder);
+    return BC_BORDER_END_HALF(mLeftBorder);
   }
 }
 
 void
 nsBCTableCellFrame::SetBorderWidth(mozilla::css::Side aSide,
                                    BCPixelSize aValue)
 {
   switch(aSide) {
@@ -1193,20 +1193,20 @@ nsBCTableCellFrame::SetBorderWidth(mozil
   }
 }
 
 /* virtual */ nsMargin
 nsBCTableCellFrame::GetBorderOverflow()
 {
   nsMargin halfBorder;
   int32_t p2t = nsPresContext::AppUnitsPerCSSPixel();
-  halfBorder.top = BC_BORDER_TOP_HALF_COORD(p2t, mTopBorder);
-  halfBorder.right = BC_BORDER_RIGHT_HALF_COORD(p2t, mRightBorder);
-  halfBorder.bottom = BC_BORDER_BOTTOM_HALF_COORD(p2t, mBottomBorder);
-  halfBorder.left = BC_BORDER_LEFT_HALF_COORD(p2t, mLeftBorder);
+  halfBorder.top = BC_BORDER_START_HALF_COORD(p2t, mTopBorder);
+  halfBorder.right = BC_BORDER_END_HALF_COORD(p2t, mRightBorder);
+  halfBorder.bottom = BC_BORDER_END_HALF_COORD(p2t, mBottomBorder);
+  halfBorder.left = BC_BORDER_START_HALF_COORD(p2t, mLeftBorder);
   return halfBorder;
 }
 
 
 DrawResult
 nsBCTableCellFrame::PaintBackground(nsRenderingContext& aRenderingContext,
                                     const nsRect&        aDirtyRect,
                                     nsPoint              aPt,
--- a/layout/tables/nsTableColFrame.h
+++ b/layout/tables/nsTableColFrame.h
@@ -343,19 +343,18 @@ inline void nsTableColFrame::SetRightBor
 {
   mRightBorderWidth = aWidth;
 }
 
 inline nscoord
 nsTableColFrame::GetContinuousBCBorderWidth(nsMargin& aBorder)
 {
   int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
-  aBorder.top = BC_BORDER_BOTTOM_HALF_COORD(aPixelsToTwips,
-                                            mTopContBorderWidth);
-  aBorder.right = BC_BORDER_LEFT_HALF_COORD(aPixelsToTwips,
-                                            mRightContBorderWidth);
-  aBorder.bottom = BC_BORDER_TOP_HALF_COORD(aPixelsToTwips,
-                                            mBottomContBorderWidth);
-  return BC_BORDER_RIGHT_HALF_COORD(aPixelsToTwips, mRightContBorderWidth);
+  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);
 }
 
 #endif
 
--- a/layout/tables/nsTableColGroupFrame.cpp
+++ b/layout/tables/nsTableColGroupFrame.cpp
@@ -432,20 +432,20 @@ void nsTableColGroupFrame::SetContinuous
 }
 
 void nsTableColGroupFrame::GetContinuousBCBorderWidth(nsMargin& aBorder)
 {
   int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
   nsTableColFrame* col = GetTableFrame()->
     GetColFrame(mStartColIndex + mColCount - 1);
   col->GetContinuousBCBorderWidth(aBorder);
-  aBorder.top = BC_BORDER_BOTTOM_HALF_COORD(aPixelsToTwips,
-                                            mTopContBorderWidth);
-  aBorder.bottom = BC_BORDER_TOP_HALF_COORD(aPixelsToTwips,
-                                            mBottomContBorderWidth);
+  aBorder.top = BC_BORDER_END_HALF_COORD(aPixelsToTwips,
+                                         mTopContBorderWidth);
+  aBorder.bottom = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
+                                              mBottomContBorderWidth);
 }
 
 /* ----- global methods ----- */
 
 nsTableColGroupFrame*
 NS_NewTableColGroupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
   return new (aPresShell) nsTableColGroupFrame(aContext);
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -2596,38 +2596,38 @@ nsTableFrame::GetOuterBCBorder() const
 {
   if (NeedToCalcBCBorders())
     const_cast<nsTableFrame*>(this)->CalcBCBorders();
 
   nsMargin border(0, 0, 0, 0);
   int32_t p2t = nsPresContext::AppUnitsPerCSSPixel();
   BCPropertyData* propData = GetBCProperty();
   if (propData) {
-    border.top    = BC_BORDER_TOP_HALF_COORD(p2t, propData->mTopBorderWidth);
-    border.right  = BC_BORDER_RIGHT_HALF_COORD(p2t, propData->mRightBorderWidth);
-    border.bottom = BC_BORDER_BOTTOM_HALF_COORD(p2t, propData->mBottomBorderWidth);
-    border.left   = BC_BORDER_LEFT_HALF_COORD(p2t, propData->mLeftBorderWidth);
+    border.top = BC_BORDER_START_HALF_COORD(p2t, propData->mTopBorderWidth);
+    border.right = BC_BORDER_END_HALF_COORD(p2t, propData->mRightBorderWidth);
+    border.bottom = BC_BORDER_END_HALF_COORD(p2t, propData->mBottomBorderWidth);
+    border.left = BC_BORDER_START_HALF_COORD(p2t, propData->mLeftBorderWidth);
   }
   return border;
 }
 
 nsMargin
 nsTableFrame::GetIncludedOuterBCBorder() const
 {
   if (NeedToCalcBCBorders())
     const_cast<nsTableFrame*>(this)->CalcBCBorders();
 
   nsMargin border(0, 0, 0, 0);
   int32_t p2t = nsPresContext::AppUnitsPerCSSPixel();
   BCPropertyData* propData = GetBCProperty();
   if (propData) {
-    border.top += BC_BORDER_TOP_HALF_COORD(p2t, propData->mTopBorderWidth);
-    border.right += BC_BORDER_RIGHT_HALF_COORD(p2t, propData->mRightCellBorderWidth);
-    border.bottom += BC_BORDER_BOTTOM_HALF_COORD(p2t, propData->mBottomBorderWidth);
-    border.left += BC_BORDER_LEFT_HALF_COORD(p2t, propData->mLeftCellBorderWidth);
+    border.top += BC_BORDER_START_HALF_COORD(p2t, propData->mTopBorderWidth);
+    border.right += BC_BORDER_END_HALF_COORD(p2t, propData->mRightCellBorderWidth);
+    border.bottom += BC_BORDER_END_HALF_COORD(p2t, propData->mBottomBorderWidth);
+    border.left += BC_BORDER_START_HALF_COORD(p2t, propData->mLeftCellBorderWidth);
   }
   return border;
 }
 
 nsMargin
 nsTableFrame::GetExcludedOuterBCBorder() const
 {
   return GetOuterBCBorder() - GetIncludedOuterBCBorder();
@@ -5512,58 +5512,58 @@ void
 BCMapCellInfo::SetRightBorderWidths(BCPixelSize aWidth)
 {
    // update the borders of the cells and cols affected
   if (mCell) {
     mCell->SetBorderWidth(mEndSide, std::max(aWidth,
                           mCell->GetBorderWidth(mEndSide)));
   }
   if (mRightCol) {
-    BCPixelSize half = BC_BORDER_LEFT_HALF(aWidth);
+    BCPixelSize half = BC_BORDER_START_HALF(aWidth);
     mRightCol->SetRightBorderWidth(std::max(nscoord(half),
                                    mRightCol->GetRightBorderWidth()));
   }
 }
 
 void
 BCMapCellInfo::SetBottomBorderWidths(BCPixelSize aWidth)
 {
   // 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 (mBottomRow) {
-    BCPixelSize half = BC_BORDER_TOP_HALF(aWidth);
+    BCPixelSize half = BC_BORDER_START_HALF(aWidth);
     mBottomRow->SetBottomBCBorderWidth(std::max(nscoord(half),
                                        mBottomRow->GetBottomBCBorderWidth()));
   }
 }
 void
 BCMapCellInfo::SetTopBorderWidths(BCPixelSize aWidth)
 {
  if (mCell) {
      mCell->SetBorderWidth(NS_SIDE_TOP, std::max(aWidth,
                            mCell->GetBorderWidth(NS_SIDE_TOP)));
   }
   if (mTopRow) {
-    BCPixelSize half = BC_BORDER_BOTTOM_HALF(aWidth);
+    BCPixelSize half = BC_BORDER_END_HALF(aWidth);
     mTopRow->SetTopBCBorderWidth(std::max(nscoord(half),
                                         mTopRow->GetTopBCBorderWidth()));
   }
 }
 void
 BCMapCellInfo::SetLeftBorderWidths(BCPixelSize aWidth)
 {
   if (mCell) {
     mCell->SetBorderWidth(mStartSide, std::max(aWidth,
                           mCell->GetBorderWidth(mStartSide)));
   }
   if (mLeftCol) {
-    BCPixelSize half = BC_BORDER_RIGHT_HALF(aWidth);
+    BCPixelSize half = BC_BORDER_END_HALF(aWidth);
     mLeftCol->SetLeftBorderWidth(std::max(nscoord(half),
                                         mLeftCol->GetLeftBorderWidth()));
   }
 }
 
 void
 BCMapCellInfo::SetTableBottomBorderWidth(BCPixelSize aWidth)
 {
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -981,17 +981,17 @@ inline void nsTableFrame::SetNeedToCalcB
 {
   mBits.mNeedToCalcBCBorders = (unsigned)aValue;
 }
 
 inline nscoord
 nsTableFrame::GetContinuousLeftBCBorderWidth() const
 {
   int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
-  return BC_BORDER_RIGHT_HALF_COORD(aPixelsToTwips, mBits.mLeftContBCBorder);
+  return BC_BORDER_END_HALF_COORD(aPixelsToTwips, mBits.mLeftContBCBorder);
 }
 
 inline void nsTableFrame::SetContinuousLeftBCBorderWidth(nscoord aValue)
 {
   mBits.mLeftContBCBorder = (unsigned) aValue;
 }
 
 class nsTableIterator
--- a/layout/tables/nsTableRowFrame.h
+++ b/layout/tables/nsTableRowFrame.h
@@ -430,23 +430,23 @@ inline nsMargin* nsTableRowFrame::GetBCB
 
   return &aBorder;
 }
 
 inline void
 nsTableRowFrame::GetContinuousBCBorderWidth(nsMargin& aBorder)
 {
   int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
-  aBorder.right = BC_BORDER_LEFT_HALF_COORD(aPixelsToTwips,
-                                            mLeftContBorderWidth);
-  aBorder.top = BC_BORDER_BOTTOM_HALF_COORD(aPixelsToTwips,
-                                            mTopContBorderWidth);
-  aBorder.left = BC_BORDER_RIGHT_HALF_COORD(aPixelsToTwips,
-                                            mRightContBorderWidth);
+  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);
 }
 
 inline nscoord nsTableRowFrame::GetOuterTopContBCBorderWidth()
 {
   int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
-  return BC_BORDER_TOP_HALF_COORD(aPixelsToTwips, mTopContBorderWidth);
+  return BC_BORDER_START_HALF_COORD(aPixelsToTwips, mTopContBorderWidth);
 }
 
 #endif
--- a/layout/tables/nsTableRowGroupFrame.h
+++ b/layout/tables/nsTableRowGroupFrame.h
@@ -445,17 +445,17 @@ inline void nsTableRowGroupFrame::SetHas
     mState &= ~NS_ROWGROUP_HAS_STYLE_HEIGHT;
   }
 }
 
 inline void
 nsTableRowGroupFrame::GetContinuousBCBorderWidth(nsMargin& aBorder)
 {
   int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
-  aBorder.right = BC_BORDER_LEFT_HALF_COORD(aPixelsToTwips,
-                                            mRightContBorderWidth);
-  aBorder.bottom = BC_BORDER_TOP_HALF_COORD(aPixelsToTwips,
-                                            mBottomContBorderWidth);
-  aBorder.left = BC_BORDER_RIGHT_HALF_COORD(aPixelsToTwips,
-                                            mLeftContBorderWidth);
+  aBorder.right = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
+                                             mRightContBorderWidth);
+  aBorder.bottom = BC_BORDER_START_HALF_COORD(aPixelsToTwips,
+                                              mBottomContBorderWidth);
+  aBorder.left = BC_BORDER_END_HALF_COORD(aPixelsToTwips,
+                                          mLeftContBorderWidth);
   return;
 }
 #endif