Don't use enum bit-fields. r=timeless b=334571
authorMats Palmgren <matspal@gmail.com>
Tue, 27 Apr 2010 18:15:02 +0200
changeset 41421 22c58d0e27eee38c23daa33c4981a69b153103b0
parent 41420 d83245839ca627ebfc9480562a072a2b1f6b3686
child 41422 24b8e061eff00d62dffd9af10290cd08cd420a55
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstimeless
bugs334571
milestone1.9.3a5pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
Don't use enum bit-fields. r=timeless b=334571
layout/tables/celldata.h
layout/tables/nsTableFrame.cpp
--- a/layout/tables/celldata.h
+++ b/layout/tables/celldata.h
@@ -251,17 +251,17 @@ protected:
                               //   dominant plane (for example, if corner is
                               //   owned by the segment to its top or bottom,
                               //   then the size is the max of the border
                               //   sizes of the segments to its left or right.
   unsigned mLeftOwner:     4; // owner of left border
   unsigned mTopOwner:      4; // owner of top border
   unsigned mLeftStart:     1; // set if this is the start of a vertical border segment
   unsigned mTopStart:      1; // set if this is the start of a horizontal border segment
-  mozilla::css::Side mCornerSide: 2; // side of the owner of the upper left corner relative to the corner
+  unsigned mCornerSide:    2; // mozilla::css::Side of the owner of the upper left corner relative to the corner
   unsigned mCornerBevel:   1; // is the corner beveled (only two segments, perpendicular, not dashed or dotted).
 };
 
 // BCCellData entries replace CellData entries in the cell map if the border collapsing model is in
 // effect. BCData for a row and col entry contains the left and top borders of cell at that row and
 // col and the corner connecting the two. The right borders of the cells in the last col and the bottom
 // borders of the last row are stored in separate BCData entries in the cell map.
 class BCCellData : public CellData
@@ -457,20 +457,20 @@ inline void BCData::SetTopEdge(BCBorderO
                                nscoord        aSize,
                                PRBool         aStart)
 {
   mTopOwner = aOwner;
   mTopSize  = (aSize > MAX_BORDER_WIDTH) ? MAX_BORDER_WIDTH : aSize;
   mTopStart = aStart;
 }
 
-inline BCPixelSize BCData::GetCorner(mozilla::css::Side&       aOwnerSide,
-                                     PRPackedBool&  aBevel) const
+inline BCPixelSize BCData::GetCorner(mozilla::css::Side& aOwnerSide,
+                                     PRPackedBool&       aBevel) const
 {
-  aOwnerSide = mCornerSide;
+  aOwnerSide = mozilla::css::Side(mCornerSide);
   aBevel     = (PRBool)mCornerBevel;
   return mCornerSubSize;
 }
 
 inline void BCData::SetCorner(BCPixelSize aSubSize,
                               mozilla::css::Side aOwnerSide,
                               PRBool  aBevel)
 {
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -4697,18 +4697,18 @@ struct BCCornerInfo
 
   void Update(mozilla::css::Side aSide,
               BCCellBorder  border);
 
   nscolor   ownerColor;     // color of borderOwner
   PRUint16  ownerWidth;     // pixel width of borderOwner
   PRUint16  subWidth;       // pixel width of the largest border intersecting the border perpendicular
                             // to ownerSide
-  mozilla::css::Side ownerSide:2; // side (e.g NS_SIDE_TOP, NS_SIDE_RIGHT, etc) of the border owning
-                            // the corner relative to the corner
+  PRUint32  ownerSide:2;    // mozilla::css::Side (e.g NS_SIDE_TOP, NS_SIDE_RIGHT, etc) of the border
+                            // owning the corner relative to the corner
   PRUint32  ownerElem:3;    // elem type (e.g. eTable, eGroup, etc) owning the corner
   PRUint32  ownerStyle:8;   // border style of ownerElem
   PRUint32  subSide:2;      // side of border with subWidth relative to the corner
   PRUint32  subElem:3;      // elem type (e.g. eTable, eGroup, etc) of sub owner
   PRUint32  subStyle:8;     // border style of subElem
   PRUint32  hasDashDot:1;   // does a dashed, dotted segment enter the corner, they cannot be beveled
   PRUint32  numSegs:3;      // number of segments entering corner
   PRUint32  bevel:1;        // is the corner beveled (uses the above two fields together with subWidth)
@@ -4750,26 +4750,26 @@ BCCornerInfo::Update(mozilla::css::Side 
   else {
     PRBool horizontal = (NS_SIDE_LEFT == aSide) || (NS_SIDE_RIGHT == aSide); // relative to the corner
     BCCellBorder oldBorder, tempBorder;
     oldBorder.owner  = (BCBorderOwner) ownerElem;
     oldBorder.style =  ownerStyle;
     oldBorder.width =  ownerWidth;
     oldBorder.color =  ownerColor;
 
-    mozilla::css::Side oldSide  = ownerSide;
+    mozilla::css::Side oldSide  = mozilla::css::Side(ownerSide);
 
     tempBorder = CompareBorders(CELL_CORNER, oldBorder, aBorder, horizontal, &existingWins);
 
     ownerElem  = tempBorder.owner;
     ownerStyle = tempBorder.style;
     ownerWidth = tempBorder.width;
     ownerColor = tempBorder.color;
     if (existingWins) { // existing corner is dominant
-      if (::Perpendicular(ownerSide, aSide)) {
+      if (::Perpendicular(mozilla::css::Side(ownerSide), aSide)) {
         // see if the new sub info replaces the old
         BCCellBorder subBorder;
         subBorder.owner = (BCBorderOwner) subElem;
         subBorder.style =  subStyle;
         subBorder.width =  subWidth;
         subBorder.color = 0; // we are not interested in subBorder color
         PRBool firstWins;
 
@@ -4780,17 +4780,17 @@ BCCornerInfo::Update(mozilla::css::Side 
         subWidth = tempBorder.width;
         if (!firstWins) {
           subSide = aSide;
         }
       }
     }
     else { // input args are dominant
       ownerSide = aSide;
-      if (::Perpendicular(oldSide, ownerSide)) {
+      if (::Perpendicular(oldSide, mozilla::css::Side(ownerSide))) {
         subElem  = oldBorder.owner;
         subStyle = oldBorder.style;
         subWidth = oldBorder.width;
         subSide  = oldSide;
       }
     }
     if (aBorder.width > 0) {
       numSegs++;
@@ -5501,17 +5501,18 @@ nsTableFrame::CalcBCBorders()
         BCCornerInfo& tlCorner = topCorners[colX]; // top left
         if (0 == colX) {
           // we are on right hand side of the corner
           tlCorner.Set(NS_SIDE_RIGHT, currentBorder);
         }
         else {
           tlCorner.Update(NS_SIDE_RIGHT, currentBorder);
           tableCellMap->SetBCBorderCorner(eTopLeft, *iter.mCellMap, 0, 0, colX,
-                                          tlCorner.ownerSide, tlCorner.subWidth,
+                                          mozilla::css::Side(tlCorner.ownerSide),
+                                          tlCorner.subWidth,
                                           tlCorner.bevel);
         }
         topCorners[colX + 1].Set(NS_SIDE_LEFT, currentBorder); // top right
         // update lastTopBorder and see if a new segment starts
         startSeg = SetHorBorder(currentBorder, tlCorner, lastTopBorder);
         // store the border segment in the cell map
         tableCellMap->SetBCBorderEdge(NS_SIDE_TOP, *iter.mCellMap, 0, 0, colX,
                                       1, currentBorder.owner,
@@ -5551,17 +5552,18 @@ nsTableFrame::CalcBCBorders()
       for (PRInt32 rowY = info.mRowIndex; rowY <= info.GetCellEndRowIndex();
            rowY++) {
         info.IncrementRow(rowY == info.mRowIndex);
         currentBorder = info.GetLeftEdgeBorder();
         BCCornerInfo& tlCorner = (0 == rowY) ? topCorners[0] : bottomCorners[0];
         tlCorner.Update(NS_SIDE_BOTTOM, currentBorder);
         tableCellMap->SetBCBorderCorner(eTopLeft, *iter.mCellMap,
                                         iter.mRowGroupStart, rowY, 0,
-                                        tlCorner.ownerSide, tlCorner.subWidth,
+                                        mozilla::css::Side(tlCorner.ownerSide),
+                                        tlCorner.subWidth,
                                         tlCorner.bevel);
         bottomCorners[0].Set(NS_SIDE_TOP, currentBorder); // bottom left
 
         // update lastVerBordersBorder and see if a new segment starts
         startSeg = SetBorder(currentBorder, lastVerBorders[0]);
         // store the border segment in the cell map
         tableCellMap->SetBCBorderEdge(NS_SIDE_LEFT, *iter.mCellMap,
                                       iter.mRowGroupStart, rowY, info.mColIndex,
@@ -5590,24 +5592,26 @@ nsTableFrame::CalcBCBorders()
         // update/store the top right & bottom right corners
         BCCornerInfo& trCorner = (0 == rowY) ?
                                  topCorners[info.GetCellEndColIndex() + 1] :
                                  bottomCorners[info.GetCellEndColIndex() + 1];
         trCorner.Update(NS_SIDE_BOTTOM, currentBorder);   // top right
         tableCellMap->SetBCBorderCorner(eTopRight, *iter.mCellMap,
                                         iter.mRowGroupStart, rowY,
                                         info.GetCellEndColIndex(),
-                                        trCorner.ownerSide, trCorner.subWidth,
+                                        mozilla::css::Side(trCorner.ownerSide),
+                                        trCorner.subWidth,
                                         trCorner.bevel);
         BCCornerInfo& brCorner = bottomCorners[info.GetCellEndColIndex() + 1];
         brCorner.Set(NS_SIDE_TOP, currentBorder); // bottom right
         tableCellMap->SetBCBorderCorner(eBottomRight, *iter.mCellMap,
                                         iter.mRowGroupStart, rowY,
                                         info.GetCellEndColIndex(),
-                                        brCorner.ownerSide, brCorner.subWidth,
+                                        mozilla::css::Side(brCorner.ownerSide),
+                                        brCorner.subWidth,
                                         brCorner.bevel);
         // update lastVerBorders and see if a new segment starts
         startSeg = SetBorder(currentBorder,
                              lastVerBorders[info.GetCellEndColIndex() + 1]);
         // store the border segment in the cell map and update cellBorders
         tableCellMap->SetBCBorderEdge(NS_SIDE_RIGHT, *iter.mCellMap,
                                       iter.mRowGroupStart, rowY,
                                       info.GetCellEndColIndex(), 1,
@@ -5665,26 +5669,26 @@ nsTableFrame::CalcBCBorders()
         }
         // store the top right corner in the cell map
         if (info.GetCellEndColIndex() < damageArea.XMost() &&
             rowY >= damageArea.y) {
           if (0 != rowY) {
             tableCellMap->SetBCBorderCorner(eTopRight, *iter.mCellMap,
                                             iter.mRowGroupStart, rowY,
                                             info.GetCellEndColIndex(),
-                                            trCorner->ownerSide,
+                                            mozilla::css::Side(trCorner->ownerSide),
                                             trCorner->subWidth,
                                             trCorner->bevel);
           }
           // store any corners this cell spans together with the aja cell
           for (PRInt32 rX = rowY + 1; rX < rowY + segLength; rX++) {
             tableCellMap->SetBCBorderCorner(eBottomRight, *iter.mCellMap,
                                             iter.mRowGroupStart, rX,
                                             info.GetCellEndColIndex(),
-                                            trCorner->ownerSide,
+                                            mozilla::css::Side(trCorner->ownerSide),
                                             trCorner->subWidth, PR_FALSE);
           }
         }
         // update bottom right corner, topCorners, bottomCorners
         hitsSpanOnRight = (rowY + segLength <
                            ajaInfo.mRowIndex + ajaInfo.mRowSpan);
         BCCornerInfo& brCorner = (hitsSpanOnRight) ?
                                  topCorners[info.GetCellEndColIndex() + 1] :
@@ -5711,25 +5715,27 @@ nsTableFrame::CalcBCBorders()
         info.SetColumn(colX);
         currentBorder = info.GetBottomEdgeBorder();
         // update/store the bottom left & bottom right corners
         BCCornerInfo& blCorner = bottomCorners[colX]; // bottom left
         blCorner.Update(NS_SIDE_RIGHT, currentBorder);
         tableCellMap->SetBCBorderCorner(eBottomLeft, *iter.mCellMap,
                                         iter.mRowGroupStart,
                                         info.GetCellEndRowIndex(),
-                                        colX, blCorner.ownerSide,
+                                        colX,
+                                        mozilla::css::Side(blCorner.ownerSide),
                                         blCorner.subWidth, blCorner.bevel);
         BCCornerInfo& brCorner = bottomCorners[colX + 1]; // bottom right
         brCorner.Update(NS_SIDE_LEFT, currentBorder);
         if (info.mNumTableCols == colX + 1) { // lower right corner of the table
           tableCellMap->SetBCBorderCorner(eBottomRight, *iter.mCellMap,
                                           iter.mRowGroupStart,
                                           info.GetCellEndRowIndex(),colX,
-                                          brCorner.ownerSide, brCorner.subWidth,
+                                          mozilla::css::Side(brCorner.ownerSide),
+                                          brCorner.subWidth,
                                           brCorner.bevel, PR_TRUE);
         }
         // update lastBottomBorder and see if a new segment starts
         startSeg = SetHorBorder(currentBorder, blCorner, lastBottomBorder);
         if (!startSeg) {
            // make sure that we did not compare apples to oranges i.e. the
            // current border should be a continuation of the lastBottomBorder,
            // as it is a bottom border
@@ -5790,27 +5796,28 @@ nsTableFrame::CalcBCBorders()
           blCorner.Update(NS_SIDE_RIGHT, currentBorder);
         }
         if (info.GetCellEndRowIndex() < damageArea.YMost() &&
             (colX >= damageArea.x)) {
           if (hitsSpanBelow) {
             tableCellMap->SetBCBorderCorner(eBottomLeft, *iter.mCellMap,
                                             iter.mRowGroupStart,
                                             info.GetCellEndRowIndex(), colX,
-                                            blCorner.ownerSide,
+                                            mozilla::css::Side(blCorner.ownerSide),
                                             blCorner.subWidth, blCorner.bevel);
           }
           // store any corners this cell spans together with the aja cell
           for (PRInt32 cX = colX + 1; cX < colX + segLength; cX++) {
             BCCornerInfo& corner = bottomCorners[cX];
             corner.Set(NS_SIDE_RIGHT, currentBorder);
             tableCellMap->SetBCBorderCorner(eBottomLeft, *iter.mCellMap,
                                             iter.mRowGroupStart,
                                             info.GetCellEndRowIndex(), cX,
-                                            corner.ownerSide, corner.subWidth,
+                                            mozilla::css::Side(corner.ownerSide),
+                                            corner.subWidth,
                                             PR_FALSE);
           }
         }
         // update lastBottomBorders and see if a new segment starts
         startSeg = SetHorBorder(currentBorder, blCorner, lastBottomBorder);
         if (!startSeg) {
            // make sure that we did not compare apples to oranges i.e. the
            // current border should be a continuation of the lastBottomBorder,