Bug 1317588 Part 2 - Remove mozilla::css::Side typedef. draft
authorTing-Yu Lin <tlin@mozilla.com>
Fri, 18 Nov 2016 16:28:38 +0800
changeset 442816 c222e3c07fb705cab9d5723500af0d5dbdc17c8e
parent 442815 949a2e1932f175e6b9064663ba5aaf77bf05bbd7
child 442817 b104c904cbe55402711ca4aba134b5dea818590f
push id36822
push userbmo:tlin@mozilla.com
push dateWed, 23 Nov 2016 08:47:24 +0000
bugs1317588
milestone53.0a1
Bug 1317588 Part 2 - Remove mozilla::css::Side typedef. This patch is written with the help of the following script. function rename() { find .\ -type f\ ! -path "./obj*"\ ! -path "./.git"\ ! -path "./.hg"\ \( -name "*.cpp" -or\ -name "*.h" \)\ -exec sed -i -e "s/$1/$2/g" "{}" \; } rename "css::Side" "Side" MozReview-Commit-ID: DPV6vivpPUp
accessible/base/StyleInfo.cpp
gfx/2d/Types.h
gfx/src/nsRect.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/forms/nsFieldSetFrame.cpp
layout/generic/ReflowInput.cpp
layout/generic/WritingModes.h
layout/generic/nsContainerFrame.cpp
layout/painting/nsCSSRendering.cpp
layout/painting/nsCSSRenderingBorders.cpp
layout/painting/nsCSSRenderingBorders.h
layout/style/StyleAnimationValue.cpp
layout/style/nsCSSDataBlock.cpp
layout/style/nsComputedDOMStyle.cpp
layout/style/nsComputedDOMStyle.h
layout/style/nsStyleCoord.h
layout/style/nsStyleStruct.h
--- a/accessible/base/StyleInfo.cpp
+++ b/accessible/base/StyleInfo.cpp
@@ -76,17 +76,17 @@ StyleInfo::TextIndent(nsAString& aValue)
     case eStyleUnit_Enumerated:
     case eStyleUnit_Calc:
       aValue.AppendLiteral("0px");
       break;
   }
 }
 
 void
-StyleInfo::Margin(css::Side aSide, nsAString& aValue)
+StyleInfo::Margin(Side aSide, nsAString& aValue)
 {
   MOZ_ASSERT(mElement->GetPrimaryFrame(), " mElement->GetPrimaryFrame() needs to be valid pointer");
   aValue.Truncate();
 
   nscoord coordVal = mElement->GetPrimaryFrame()->GetUsedMargin().Side(aSide);
   aValue.AppendFloat(nsPresContext::AppUnitsToFloatCSSPixels(coordVal));
   aValue.AppendLiteral("px");
 }
--- a/gfx/2d/Types.h
+++ b/gfx/2d/Types.h
@@ -399,33 +399,29 @@ enum SideBits {
   eSideBitsAll = eSideBitsTopBottom | eSideBitsLeftRight
 };
 
 #define NS_SIDE_TOP    mozilla::eSideTop
 #define NS_SIDE_RIGHT  mozilla::eSideRight
 #define NS_SIDE_BOTTOM mozilla::eSideBottom
 #define NS_SIDE_LEFT   mozilla::eSideLeft
 
-namespace css {
-typedef mozilla::Side Side;
-} // namespace css
-
-// Creates a for loop that walks over the four mozilla::css::Side values.
+// Creates a for loop that walks over the four mozilla::Side values.
 // We use an int32_t helper variable (instead of a Side) for our loop counter,
 // to avoid triggering undefined behavior just before we exit the loop (at
 // which point the counter is incremented beyond the largest valid Side value).
 #define NS_FOR_CSS_SIDES(var_)                                           \
   int32_t MOZ_CONCAT(var_,__LINE__) = NS_SIDE_TOP;                       \
-  for (mozilla::css::Side var_;                                          \
+  for (mozilla::Side var_;                                               \
        MOZ_CONCAT(var_,__LINE__) <= NS_SIDE_LEFT &&                      \
-         ((var_ = mozilla::css::Side(MOZ_CONCAT(var_,__LINE__))), true); \
+         ((var_ = mozilla::Side(MOZ_CONCAT(var_,__LINE__))), true);      \
        MOZ_CONCAT(var_,__LINE__)++)
 
-static inline css::Side operator++(css::Side& side, int) {
+static inline Side operator++(Side& side, int) {
     NS_PRECONDITION(side >= NS_SIDE_TOP &&
                     side <= NS_SIDE_LEFT, "Out of range side");
-    side = css::Side(side + 1);
+    side = Side(side + 1);
     return side;
 }
 
 } // namespace mozilla
 
 #endif /* MOZILLA_GFX_TYPES_H_ */
--- a/gfx/src/nsRect.cpp
+++ b/gfx/src/nsRect.cpp
@@ -9,17 +9,17 @@
 #include "nsDeviceContext.h"            // for nsDeviceContext
 #include "nsString.h"               // for nsAutoString, etc
 #include "nsMargin.h"                   // for nsMargin
 
 static_assert((int(NS_SIDE_TOP) == 0) &&
               (int(NS_SIDE_RIGHT) == 1) &&
               (int(NS_SIDE_BOTTOM) == 2) &&
               (int(NS_SIDE_LEFT) == 3),
-              "The mozilla::css::Side sequence must match the nsMargin nscoord sequence");
+              "The mozilla::Side sequence must match the nsMargin nscoord sequence");
 
 const mozilla::gfx::IntRect& GetMaxSizedIntRect() {
   static const mozilla::gfx::IntRect r(0, 0, INT32_MAX, INT32_MAX);
   return r;
 }
 
 
 bool nsRect::Overflows() const {
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -6706,33 +6706,33 @@ nsLayoutUtils::HasNonZeroCorner(const ns
   NS_FOR_CSS_HALF_CORNERS(corner) {
     if (NonZeroStyleCoord(aCorners.Get(corner)))
       return true;
   }
   return false;
 }
 
 // aCorner is a "full corner" value, i.e. NS_CORNER_TOP_LEFT etc
-static bool IsCornerAdjacentToSide(uint8_t aCorner, css::Side aSide)
+static bool IsCornerAdjacentToSide(uint8_t aCorner, Side aSide)
 {
   static_assert((int)NS_SIDE_TOP == NS_CORNER_TOP_LEFT, "Check for Full Corner");
   static_assert((int)NS_SIDE_RIGHT == NS_CORNER_TOP_RIGHT, "Check for Full Corner");
   static_assert((int)NS_SIDE_BOTTOM == NS_CORNER_BOTTOM_RIGHT, "Check for Full Corner");
   static_assert((int)NS_SIDE_LEFT == NS_CORNER_BOTTOM_LEFT, "Check for Full Corner");
   static_assert((int)NS_SIDE_TOP == ((NS_CORNER_TOP_RIGHT - 1)&3), "Check for Full Corner");
   static_assert((int)NS_SIDE_RIGHT == ((NS_CORNER_BOTTOM_RIGHT - 1)&3), "Check for Full Corner");
   static_assert((int)NS_SIDE_BOTTOM == ((NS_CORNER_BOTTOM_LEFT - 1)&3), "Check for Full Corner");
   static_assert((int)NS_SIDE_LEFT == ((NS_CORNER_TOP_LEFT - 1)&3), "Check for Full Corner");
 
   return aSide == aCorner || aSide == ((aCorner - 1)&3);
 }
 
 /* static */ bool
 nsLayoutUtils::HasNonZeroCornerOnSide(const nsStyleCorners& aCorners,
-                                      css::Side aSide)
+                                      Side aSide)
 {
   static_assert(NS_CORNER_TOP_LEFT_X/2 == NS_CORNER_TOP_LEFT, "Check for Non Zero on side");
   static_assert(NS_CORNER_TOP_LEFT_Y/2 == NS_CORNER_TOP_LEFT, "Check for Non Zero on side");
   static_assert(NS_CORNER_TOP_RIGHT_X/2 == NS_CORNER_TOP_RIGHT, "Check for Non Zero on side");
   static_assert(NS_CORNER_TOP_RIGHT_Y/2 == NS_CORNER_TOP_RIGHT, "Check for Non Zero on side");
   static_assert(NS_CORNER_BOTTOM_RIGHT_X/2 == NS_CORNER_BOTTOM_RIGHT, "Check for Non Zero on side");
   static_assert(NS_CORNER_BOTTOM_RIGHT_Y/2 == NS_CORNER_BOTTOM_RIGHT, "Check for Non Zero on side");
   static_assert(NS_CORNER_BOTTOM_LEFT_X/2 == NS_CORNER_BOTTOM_LEFT, "Check for Non Zero on side");
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -1933,17 +1933,17 @@ public:
    */
   static bool HasNonZeroCorner(const nsStyleCorners& aCorners);
 
   /**
    * Determine if there is any corner radius on corners adjacent to the
    * given side.
    */
   static bool HasNonZeroCornerOnSide(const nsStyleCorners& aCorners,
-                                       mozilla::css::Side aSide);
+                                       mozilla::Side aSide);
 
   /**
    * Determine if a widget is likely to require transparency or translucency.
    *   @param aBackgroundFrame The frame that the background is set on. For
    *                           <window>s, this will be the canvas frame.
    *   @param aCSSRootFrame    The frame that holds CSS properties affecting
    *                           the widget's transparency. For menupopups,
    *                           aBackgroundFrame and aCSSRootFrame will be the
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -47,17 +47,17 @@ nsFieldSetFrame::GetType() const
 {
   return nsGkAtoms::fieldSetFrame;
 }
 
 nsRect
 nsFieldSetFrame::VisualBorderRectRelativeToSelf() const
 {
   WritingMode wm = GetWritingMode();
-  css::Side legendSide = wm.PhysicalSide(eLogicalSideBStart);
+  Side legendSide = wm.PhysicalSide(eLogicalSideBStart);
   nscoord legendBorder = StyleBorder()->GetComputedBorderWidth(legendSide);
   LogicalRect r(wm, LogicalPoint(wm, 0, 0), GetLogicalSize(wm));
   nsSize containerSize = r.Size(wm).GetPhysicalSize(wm);
   if (legendBorder < mLegendRect.BSize(wm)) {
     nscoord off = (mLegendRect.BSize(wm) - legendBorder) / 2;
     r.BStart(wm) += off;
     r.BSize(wm) -= off;
   }
@@ -232,17 +232,17 @@ nsFieldSetFrame::PaintBorder(
                                : PaintBorderFlags();
 
   DrawResult result = DrawResult::SUCCESS;
 
   nsCSSRendering::PaintBoxShadowInner(presContext, aRenderingContext,
                                       this, rect);
 
   if (nsIFrame* legend = GetLegend()) {
-    css::Side legendSide = wm.PhysicalSide(eLogicalSideBStart);
+    Side legendSide = wm.PhysicalSide(eLogicalSideBStart);
     nscoord legendBorderWidth =
       StyleBorder()->GetComputedBorderWidth(legendSide);
 
     // Use the rect of the legend frame, not mLegendRect, so we draw our
     // border under the legend's inline-start and -end margins.
     LogicalRect legendRect(wm, legend->GetRect() + aPt, rect.Size());
 
     // Compute clipRect using logical coordinates, so that the legend space
--- a/layout/generic/ReflowInput.cpp
+++ b/layout/generic/ReflowInput.cpp
@@ -901,20 +901,20 @@ ReflowInput::InitFrameType(nsIAtom* aFra
 
 /* static */ void
 ReflowInput::ComputeRelativeOffsets(WritingMode aWM,
                                           nsIFrame* aFrame,
                                           const LogicalSize& aCBSize,
                                           nsMargin& aComputedOffsets)
 {
   LogicalMargin offsets(aWM);
-  mozilla::css::Side inlineStart = aWM.PhysicalSide(eLogicalSideIStart);
-  mozilla::css::Side inlineEnd   = aWM.PhysicalSide(eLogicalSideIEnd);
-  mozilla::css::Side blockStart  = aWM.PhysicalSide(eLogicalSideBStart);
-  mozilla::css::Side blockEnd    = aWM.PhysicalSide(eLogicalSideBEnd);
+  mozilla::Side inlineStart = aWM.PhysicalSide(eLogicalSideIStart);
+  mozilla::Side inlineEnd   = aWM.PhysicalSide(eLogicalSideIEnd);
+  mozilla::Side blockStart  = aWM.PhysicalSide(eLogicalSideBStart);
+  mozilla::Side blockEnd    = aWM.PhysicalSide(eLogicalSideBEnd);
 
   const nsStylePosition* position = aFrame->StylePosition();
 
   // Compute the 'inlineStart' and 'inlineEnd' values. 'inlineStart'
   // moves the boxes to the end of the line, and 'inlineEnd' moves the
   // boxes to the start of the line. The computed values are always:
   // inlineStart=-inlineEnd
   bool inlineStartIsAuto =
@@ -1139,19 +1139,19 @@ GetIntrinsicSizeFor(nsIFrame* aFrame, ns
 void
 ReflowInput::CalculateBorderPaddingMargin(
                        LogicalAxis aAxis,
                        nscoord aContainingBlockSize,
                        nscoord* aInsideBoxSizing,
                        nscoord* aOutsideBoxSizing) const
 {
   WritingMode wm = GetWritingMode();
-  mozilla::css::Side startSide =
+  mozilla::Side startSide =
     wm.PhysicalSide(MakeLogicalSide(aAxis, eLogicalEdgeStart));
-  mozilla::css::Side endSide =
+  mozilla::Side endSide =
     wm.PhysicalSide(MakeLogicalSide(aAxis, eLogicalEdgeEnd));
 
   nsMargin styleBorder = mStyleBorder->GetComputedBorder();
   nscoord borderStartEnd =
     styleBorder.Side(startSide) + styleBorder.Side(endSide);
 
   nscoord paddingStartEnd, marginStartEnd;
 
--- a/layout/generic/WritingModes.h
+++ b/layout/generic/WritingModes.h
@@ -319,17 +319,17 @@ public:
 
   static mozilla::Side PhysicalSideForBlockAxis(uint8_t aWritingModeValue,
                                                 LogicalEdge aEdge)
   {
     // indexes are NS_STYLE_WRITING_MODE_* values, which are the same as these
     // two-bit values:
     //   bit 0 = the eOrientationMask value
     //   bit 1 = the eBlockFlowMask value
-    static const mozilla::css::Side kLogicalBlockSides[][2] = {
+    static const mozilla::Side kLogicalBlockSides[][2] = {
       { NS_SIDE_TOP,    NS_SIDE_BOTTOM },  // horizontal-tb
       { NS_SIDE_RIGHT,  NS_SIDE_LEFT   },  // vertical-rl
       { NS_SIDE_BOTTOM, NS_SIDE_TOP    },  // (horizontal-bt)
       { NS_SIDE_LEFT,   NS_SIDE_RIGHT  },  // vertical-lr
     };
 
     // Ignore the SIDEWAYS_MASK bit of the writing-mode value, as this has no
     // effect on the side mappings.
@@ -347,17 +347,17 @@ public:
     //   bit 0 = the eOrientationMask value
     //   bit 1 = the eInlineFlowMask value
     //   bit 2 = the eBlockFlowMask value
     //   bit 3 = the eLineOrientMask value
     // Not all of these combinations can actually be specified via CSS: there
     // is no horizontal-bt writing-mode, and no text-orientation value that
     // produces "inverted" text. (The former 'sideways-left' value, no longer
     // in the spec, would have produced this in vertical-rl mode.)
-    static const mozilla::css::Side kLogicalInlineSides[][2] = {
+    static const mozilla::Side kLogicalInlineSides[][2] = {
       { NS_SIDE_LEFT,   NS_SIDE_RIGHT  },  // horizontal-tb               ltr
       { NS_SIDE_TOP,    NS_SIDE_BOTTOM },  // vertical-rl                 ltr
       { NS_SIDE_RIGHT,  NS_SIDE_LEFT   },  // horizontal-tb               rtl
       { NS_SIDE_BOTTOM, NS_SIDE_TOP    },  // vertical-rl                 rtl
       { NS_SIDE_RIGHT,  NS_SIDE_LEFT   },  // (horizontal-bt)  (inverted) ltr
       { NS_SIDE_TOP,    NS_SIDE_BOTTOM },  // sideways-lr                 rtl
       { NS_SIDE_LEFT,   NS_SIDE_RIGHT  },  // (horizontal-bt)  (inverted) rtl
       { NS_SIDE_BOTTOM, NS_SIDE_TOP    },  // sideways-lr                 ltr
@@ -399,17 +399,17 @@ public:
     return PhysicalSideForInlineAxis(GetEdge(aSide));
   }
 
   /**
    * Returns the logical side corresponding to the specified physical side,
    * given the current writing mode.
    * (This is the inverse of the PhysicalSide() method above.)
    */
-  LogicalSide LogicalSideForPhysicalSide(mozilla::css::Side aSide) const
+  LogicalSide LogicalSideForPhysicalSide(mozilla::Side aSide) const
   {
     // indexes are four-bit values:
     //   bit 0 = the eOrientationMask value
     //   bit 1 = the eInlineFlowMask value
     //   bit 2 = the eBlockFlowMask value
     //   bit 3 = the eLineOrientMask value
     static const LogicalSide kPhysicalToLogicalSides[][4] = {
       // top                right
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -829,19 +829,19 @@ nsContainerFrame::DoInlineIntrinsicISize
 {
   if (GetPrevInFlow())
     return; // Already added.
 
   NS_PRECONDITION(aType == nsLayoutUtils::MIN_ISIZE ||
                   aType == nsLayoutUtils::PREF_ISIZE, "bad type");
 
   WritingMode wm = GetWritingMode();
-  mozilla::css::Side startSide =
+  mozilla::Side startSide =
     wm.PhysicalSideForInlineAxis(eLogicalEdgeStart);
-  mozilla::css::Side endSide =
+  mozilla::Side endSide =
     wm.PhysicalSideForInlineAxis(eLogicalEdgeEnd);
 
   const nsStylePadding *stylePadding = StylePadding();
   const nsStyleBorder *styleBorder = StyleBorder();
   const nsStyleMargin *styleMargin = StyleMargin();
 
   // This goes at the beginning no matter how things are broken and how
   // messy the bidi situations are, since per CSS2.1 section 8.6
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -432,17 +432,17 @@ static DrawResult DrawBorderImage(nsPres
                                   nsRenderingContext& aRenderingContext,
                                   nsIFrame* aForFrame,
                                   const nsRect& aBorderArea,
                                   const nsStyleBorder& aStyleBorder,
                                   const nsRect& aDirtyRect,
                                   Sides aSkipSides,
                                   PaintBorderFlags aFlags);
 
-static nscolor MakeBevelColor(mozilla::css::Side whichSide, uint8_t style,
+static nscolor MakeBevelColor(mozilla::Side whichSide, uint8_t style,
                               nscolor aBackgroundColor,
                               nscolor aBorderColor);
 
 static InlineBackgroundData* gInlineBGData = nullptr;
 
 // Initialize any static variables used by nsCSSRendering.
 void nsCSSRendering::Init()
 {
@@ -456,17 +456,17 @@ void nsCSSRendering::Shutdown()
   delete gInlineBGData;
   gInlineBGData = nullptr;
 }
 
 /**
  * Make a bevel color
  */
 static nscolor
-MakeBevelColor(mozilla::css::Side whichSide, uint8_t style,
+MakeBevelColor(mozilla::Side whichSide, uint8_t style,
                nscolor aBackgroundColor, nscolor aBorderColor)
 {
 
   nscolor colors[2];
   nscolor theColor;
 
   // Given a background color and a border color
   // calculate the color used for the shading
@@ -1734,17 +1734,17 @@ nsCSSRendering::PaintBackground(const Pa
 
     sc = aParams.frame->StyleContext();
   }
 
   return PaintBackgroundWithSC(aParams, sc, *aParams.frame->StyleBorder());
 }
 
 static bool
-IsOpaqueBorderEdge(const nsStyleBorder& aBorder, mozilla::css::Side aSide)
+IsOpaqueBorderEdge(const nsStyleBorder& aBorder, mozilla::Side aSide)
 {
   if (aBorder.GetComputedBorder().Side(aSide) == 0)
     return true;
   switch (aBorder.GetBorderStyle(aSide)) {
   case NS_STYLE_BORDER_STYLE_SOLID:
   case NS_STYLE_BORDER_STYLE_GROOVE:
   case NS_STYLE_BORDER_STYLE_RIDGE:
   case NS_STYLE_BORDER_STYLE_INSET:
@@ -4331,17 +4331,17 @@ nsCSSRendering::DrawTableBorderSegment(D
                              aStartBevelSide, aStartBevelOffset,
                              aEndBevelSide, aEndBevelOffset);
     }
     else {
       nscoord startBevel = (aStartBevelOffset > 0)
                             ? RoundFloatToPixel(0.5f * (float)aStartBevelOffset, twipsPerPixel, true) : 0;
       nscoord endBevel =   (aEndBevelOffset > 0)
                             ? RoundFloatToPixel(0.5f * (float)aEndBevelOffset, twipsPerPixel, true) : 0;
-      mozilla::css::Side ridgeGrooveSide = (horizontal) ? NS_SIDE_TOP : NS_SIDE_LEFT;
+      mozilla::Side ridgeGrooveSide = (horizontal) ? NS_SIDE_TOP : NS_SIDE_LEFT;
       // FIXME: In theory, this should use the visited-dependent
       // background color, but I don't care.
       nscolor bevelColor = MakeBevelColor(ridgeGrooveSide, ridgeGroove,
                                           aBGColor->mBackgroundColor,
                                           aBorderColor);
       nsRect rect(aBorder);
       nscoord half;
       if (horizontal) { // top, bottom
--- a/layout/painting/nsCSSRenderingBorders.cpp
+++ b/layout/painting/nsCSSRenderingBorders.cpp
@@ -59,18 +59,18 @@ using namespace mozilla::gfx;
  *         |- DrawDashedOrDottedSide || DrawBorderSides with one side
  */
 
 static void ComputeBorderCornerDimensions(const Float* aBorderWidths,
                                           const RectCornerRadii& aRadii,
                                           RectCornerRadii *aDimsResult);
 
 // given a side index, get the previous and next side index
-#define NEXT_SIDE(_s) mozilla::css::Side(((_s) + 1) & 3)
-#define PREV_SIDE(_s) mozilla::css::Side(((_s) + 3) & 3)
+#define NEXT_SIDE(_s) mozilla::Side(((_s) + 1) & 3)
+#define PREV_SIDE(_s) mozilla::Side(((_s) + 3) & 3)
 
 // given a corner index, get the previous and next corner index
 #define NEXT_CORNER(_s) mozilla::css::Corner(((_s) + 1) & 3)
 #define PREV_CORNER(_s) mozilla::css::Corner(((_s) + 3) & 3)
 
 // from the given base color and the background color, turn
 // color into a color for the given border pattern style
 static Color MakeBorderColor(nscolor aColor,
@@ -109,49 +109,49 @@ IsZeroSize(const Size& sz) {
 static bool
 AllCornersZeroSize(const RectCornerRadii& corners) {
   return IsZeroSize(corners[NS_CORNER_TOP_LEFT]) &&
     IsZeroSize(corners[NS_CORNER_TOP_RIGHT]) &&
     IsZeroSize(corners[NS_CORNER_BOTTOM_RIGHT]) &&
     IsZeroSize(corners[NS_CORNER_BOTTOM_LEFT]);
 }
 
-static mozilla::css::Side
+static mozilla::Side
 GetHorizontalSide(mozilla::css::Corner aCorner)
 {
   return (aCorner == C_TL || aCorner == C_TR) ? NS_SIDE_TOP : NS_SIDE_BOTTOM;
 }
 
-static mozilla::css::Side
+static mozilla::Side
 GetVerticalSide(mozilla::css::Corner aCorner)
 {
   return (aCorner == C_TL || aCorner == C_BL) ? NS_SIDE_LEFT : NS_SIDE_RIGHT;
 }
 
 static mozilla::css::Corner
-GetCWCorner(mozilla::css::Side aSide)
+GetCWCorner(mozilla::Side aSide)
 {
   return mozilla::css::Corner(NEXT_SIDE(aSide));
 }
 
 static mozilla::css::Corner
-GetCCWCorner(mozilla::css::Side aSide)
+GetCCWCorner(mozilla::Side aSide)
 {
   return mozilla::css::Corner(aSide);
 }
 
 static bool
 IsSingleSide(int aSides)
 {
   return aSides == SIDE_BIT_TOP || aSides == SIDE_BIT_RIGHT ||
          aSides == SIDE_BIT_BOTTOM || aSides == SIDE_BIT_LEFT;
 }
 
 static bool
-IsHorizontalSide(mozilla::css::Side aSide)
+IsHorizontalSide(mozilla::Side aSide)
 {
   return aSide == NS_SIDE_TOP || aSide == NS_SIDE_BOTTOM;
 }
 
 typedef enum {
   // Normal solid square corner.  Will be rectangular, the size of the
   // adjacent sides.  If the corner has a border radius, the corner
   // will always be solid, since we don't do dotted/dashed etc.
@@ -381,18 +381,18 @@ nsCSSBorderRenderer::IsCornerMergeable(m
   // | ####################### |
   // |  #####################  |
   // |   ###################   |
   // |     ###############     |
   // |         #######         |
   // +-------------------------+----
   // |                         |
   // |                         |
-  mozilla::css::Side sideH(GetHorizontalSide(aCorner));
-  mozilla::css::Side sideV(GetVerticalSide(aCorner));
+  mozilla::Side sideH(GetHorizontalSide(aCorner));
+  mozilla::Side sideV(GetVerticalSide(aCorner));
   uint8_t styleH = mBorderStyles[sideH];
   uint8_t styleV = mBorderStyles[sideV];
   if (styleH != styleV || styleH != NS_STYLE_BORDER_STYLE_DOTTED) {
     return false;
   }
 
   Float widthH = mBorderWidths[sideH];
   Float widthV = mBorderWidths[sideV];
@@ -445,17 +445,17 @@ nsCSSBorderRenderer::GetCornerRect(mozil
   if (aCorner == C_BR || aCorner == C_BL)
     offset.y = mOuterRect.Height() - mBorderCornerDimensions[aCorner].height;
 
   return Rect(mOuterRect.TopLeft() + offset,
               mBorderCornerDimensions[aCorner]);
 }
 
 Rect
-nsCSSBorderRenderer::GetSideClipWithoutCornersRect(mozilla::css::Side aSide)
+nsCSSBorderRenderer::GetSideClipWithoutCornersRect(mozilla::Side aSide)
 {
   Point offset(0.f, 0.f);
 
   // The offset from the outside rect to the start of this side's
   // box.  For the top and bottom sides, the height of the box
   // must be the border height; the x start must take into account
   // the corner size (which may be bigger than the right or left
   // side's width).  The same applies to the right and left sides.
@@ -579,17 +579,17 @@ MaybeMoveToMidPoint(Point& aP0, Point& a
       Float k = std::min((aMidPoint.x - aP0.x) / ps.x,
                          (aMidPoint.y - aP0.y) / ps.y);
       aP1 = aP0 + ps * k;
     }
   }
 }
 
 already_AddRefed<Path>
-nsCSSBorderRenderer::GetSideClipSubPath(mozilla::css::Side aSide)
+nsCSSBorderRenderer::GetSideClipSubPath(mozilla::Side aSide)
 {
   // the clip proceeds clockwise from the top left corner;
   // so "start" in each case is the start of the region from that side.
   //
   // the final path will be formed like:
   // s0 ------- e0
   // |         /
   // s1 ----- e1
@@ -669,17 +669,17 @@ nsCSSBorderRenderer::GetSideClipSubPath(
   builder->LineTo(end[0]);
   builder->LineTo(end[1]);
   builder->LineTo(start[1]);
   builder->Close();
   return builder->Finish();
 }
 
 Point
-nsCSSBorderRenderer::GetStraightBorderPoint(mozilla::css::Side aSide,
+nsCSSBorderRenderer::GetStraightBorderPoint(mozilla::Side aSide,
                                             mozilla::css::Corner aCorner,
                                             bool* aIsUnfilled)
 {
   // Calculate the end point of the side for dashed/dotted border, that is also
   // the end point of the corner curve.  The point is specified by aSide and
   // aCorner. (e.g. NS_SIDE_TOP and C_TL means the left end of border-top)
   //
   //
@@ -720,17 +720,17 @@ nsCSSBorderRenderer::GetStraightBorderPo
   //
   //    aCorner      aSide
   //           +--------------
   //           |
   //           |   +----------
   //           |   |
   // otherSide |   |
   //           |   |
-  mozilla::css::Side otherSide = ((uint8_t)aSide == (uint8_t)aCorner)
+  mozilla::Side otherSide = ((uint8_t)aSide == (uint8_t)aCorner)
                                  ? PREV_SIDE(aSide)
                                  : NEXT_SIDE(aSide);
   uint8_t otherStyle = mBorderStyles[otherSide];
   Float otherBorderWidth = mBorderWidths[otherSide];
   Size radius = mBorderRadii[aCorner];
   if (IsZeroSize(radius)) {
     radius.width = 0.0f;
     radius.height = 0.0f;
@@ -1076,18 +1076,18 @@ nsCSSBorderRenderer::GetOuterAndInnerBez
   // |           /
   // |          |
   // |          |
   // |         |
   // |         |
   // |         |
   // +---------+
 
-  mozilla::css::Side sideH(GetHorizontalSide(aCorner));
-  mozilla::css::Side sideV(GetVerticalSide(aCorner));
+  mozilla::Side sideH(GetHorizontalSide(aCorner));
+  mozilla::Side sideV(GetVerticalSide(aCorner));
 
   Size outerCornerSize(ceil(mBorderRadii[aCorner].width),
                        ceil(mBorderRadii[aCorner].height));
   Size innerCornerSize(ceil(std::max(0.0f, mBorderRadii[aCorner].width -
                                      mBorderWidths[sideV])),
                        ceil(std::max(0.0f, mBorderRadii[aCorner].height -
                                      mBorderWidths[sideH])));
 
@@ -1612,17 +1612,17 @@ nsCSSBorderRenderer::DrawBorderSides(int
     // And now soRect is the same as siRect, for the next line in.
     soRect = siRect;
   }
 }
 
 void
 nsCSSBorderRenderer::SetupDashedOptions(StrokeOptions* aStrokeOptions,
                                         Float aDash[2],
-                                        mozilla::css::Side aSide,
+                                        mozilla::Side aSide,
                                         Float aBorderLength, bool isCorner)
 {
   uint8_t style = mBorderStyles[aSide];
   Float borderWidth = mBorderWidths[aSide];
 
   // Dashed line starts and ends with half segment in most case.
   //
   // __--+---+---+---+---+---+---+---+---+--__
@@ -1787,33 +1787,33 @@ nsCSSBorderRenderer::SetupDashedOptions(
 
   aStrokeOptions->mDashPattern = aDash;
   aStrokeOptions->mDashLength = 2;
 
   PrintAsFormatString("dash: %f %f\n", aDash[0], aDash[1]);
 }
 
 static Float
-GetBorderLength(mozilla::css::Side aSide,
+GetBorderLength(mozilla::Side aSide,
                 const Point& aStart, const Point& aEnd)
 {
   if (aSide == NS_SIDE_TOP) {
     return aEnd.x - aStart.x;
   }
   if (aSide == NS_SIDE_RIGHT) {
     return aEnd.y - aStart.y;
   }
   if (aSide == NS_SIDE_BOTTOM) {
     return aStart.x - aEnd.x;
   }
   return aStart.y - aEnd.y;
 }
 
 void
-nsCSSBorderRenderer::DrawDashedOrDottedSide(mozilla::css::Side aSide)
+nsCSSBorderRenderer::DrawDashedOrDottedSide(mozilla::Side aSide)
 {
   // Draw dashed/dotted side with following approach.
   //
   // dashed side
   //   Draw dashed line along the side, with appropriate dash length and gap
   //   to make the side symmetric as far as possible.  Dash length equals to
   //   the gap, and the ratio of the dash length to border-width is the maximum
   //   value in in [1, 3] range.
@@ -1873,17 +1873,17 @@ nsCSSBorderRenderer::DrawDashedOrDottedS
   SetupDashedOptions(&strokeOptions, dash, aSide, borderLength, false);
 
   mDrawTarget->StrokeLine(start, end,
                           ColorPattern(ToDeviceColor(borderColor)),
                           strokeOptions);
 }
 
 void
-nsCSSBorderRenderer::DrawDottedSideSlow(mozilla::css::Side aSide)
+nsCSSBorderRenderer::DrawDottedSideSlow(mozilla::Side aSide)
 {
   // Draw each circles separately for dotted with borderWidth > 2.0.
   // Dashed line with CapStyle::ROUND doesn't render perfect circles.
 
   NS_ASSERTION(mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DOTTED,
                "Style should be dotted.");
 
   Float borderWidth = mBorderWidths[aSide];
@@ -2253,17 +2253,17 @@ nsCSSBorderRenderer::DrawDottedSideSlow(
   mDrawTarget->Fill(path, ColorPattern(ToDeviceColor(borderColor)));
 
   if (mergeStart == MERGE_HALF || mergeEnd == MERGE_HALF) {
     mDrawTarget->PopClip();
   }
 }
 
 void
-nsCSSBorderRenderer::DrawDashedOrDottedCorner(mozilla::css::Side aSide,
+nsCSSBorderRenderer::DrawDashedOrDottedCorner(mozilla::Side aSide,
                                               mozilla::css::Corner aCorner)
 {
   // Draw dashed/dotted corner with following approach.
   //
   // dashed corner
   //   If both side has same border-width and border-width <= 2.0, draw dashed
   //   line along the corner, with appropriate dash length and gap to make the
   //   corner symmetric as far as possible.  Dash length equals to the gap, and
@@ -2291,18 +2291,18 @@ nsCSSBorderRenderer::DrawDashedOrDottedC
                mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DOTTED,
                "Style should be dashed or dotted.");
 
   if (IsCornerMergeable(aCorner)) {
     // DrawDashedOrDottedSide will draw corner.
      return;
    }
 
-  mozilla::css::Side sideH(GetHorizontalSide(aCorner));
-  mozilla::css::Side sideV(GetVerticalSide(aCorner));
+  mozilla::Side sideH(GetHorizontalSide(aCorner));
+  mozilla::Side sideV(GetVerticalSide(aCorner));
   Float borderWidthH = mBorderWidths[sideH];
   Float borderWidthV = mBorderWidths[sideV];
   if (borderWidthH == 0.0f && borderWidthV == 0.0f) {
     return;
   }
 
   Float styleH = mBorderStyles[sideH];
   Float styleV = mBorderStyles[sideV];
@@ -2359,24 +2359,24 @@ nsCSSBorderRenderer::DrawDashedOrDottedC
   builder->MoveTo(points[0]);
   builder->BezierTo(points[1], points[2], points[3]);
   RefPtr<Path> path = builder->Finish();
   mDrawTarget->Stroke(path, ColorPattern(ToDeviceColor(borderColor)),
                       strokeOptions);
 }
 
 void
-nsCSSBorderRenderer::DrawDottedCornerSlow(mozilla::css::Side aSide,
+nsCSSBorderRenderer::DrawDottedCornerSlow(mozilla::Side aSide,
                                           mozilla::css::Corner aCorner)
 {
   NS_ASSERTION(mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DOTTED,
                "Style should be dotted.");
 
-  mozilla::css::Side sideH(GetHorizontalSide(aCorner));
-  mozilla::css::Side sideV(GetVerticalSide(aCorner));
+  mozilla::Side sideH(GetHorizontalSide(aCorner));
+  mozilla::Side sideV(GetVerticalSide(aCorner));
   Float R0 = mBorderWidths[sideH] / 2.0f;
   Float Rn = mBorderWidths[sideV] / 2.0f;
   if (R0 == 0.0f && Rn == 0.0f) {
     return;
   }
 
   nscolor borderColor = mBorderColors[aSide];
   Bezier outerBezier;
@@ -2436,24 +2436,24 @@ DashedPathOverlapsRect(Rect& pathRect,
   pathRect.ExpandToEnclose(result.innerSectionBezier.mPoints[1]);
   pathRect.ExpandToEnclose(result.innerSectionBezier.mPoints[2]);
   pathRect.ExpandToEnclose(result.innerSectionBezier.mPoints[3]);
 
   return pathRect.Intersects(marginedDirtyRect);
 }
 
 void
-nsCSSBorderRenderer::DrawDashedCornerSlow(mozilla::css::Side aSide,
+nsCSSBorderRenderer::DrawDashedCornerSlow(mozilla::Side aSide,
                                           mozilla::css::Corner aCorner)
 {
   NS_ASSERTION(mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DASHED,
                "Style should be dashed.");
 
-  mozilla::css::Side sideH(GetHorizontalSide(aCorner));
-  mozilla::css::Side sideV(GetVerticalSide(aCorner));
+  mozilla::Side sideH(GetHorizontalSide(aCorner));
+  mozilla::Side sideV(GetVerticalSide(aCorner));
   Float borderWidthH = mBorderWidths[sideH];
   Float borderWidthV = mBorderWidths[sideV];
   if (borderWidthH == 0.0f && borderWidthV == 0.0f) {
     return;
   }
 
   nscolor borderColor = mBorderColors[aSide];
   Bezier outerBezier;
@@ -2552,17 +2552,17 @@ nsCSSBorderRenderer::DrawDashedCornerSlo
     builder->LineTo(outerBezier.mPoints[3]);
   }
 
   RefPtr<Path> path = builder->Finish();
   mDrawTarget->Fill(path, ColorPattern(ToDeviceColor(borderColor)));
 }
 
 void
-nsCSSBorderRenderer::DrawFallbackSolidCorner(mozilla::css::Side aSide,
+nsCSSBorderRenderer::DrawFallbackSolidCorner(mozilla::Side aSide,
                                              mozilla::css::Corner aCorner)
 {
   // Render too large dashed or dotted corner with solid style, to avoid hangup
   // inside DashedCornerFinder and DottedCornerFinder.
 
   NS_ASSERTION(mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DASHED ||
                mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DOTTED,
                "Style should be dashed or dotted.");
@@ -3352,17 +3352,17 @@ nsCSSBorderRenderer::DrawBorders()
      * negligible, so don't bother doing anything fancy.  Just extend
      * the top and bottom borders to the right 1px and the left border
      * to the bottom 1px.  We do this by twiddling the corner dimensions,
      * which causes the right to happen later on.  Only do this if we have
      * a 1.0 unit border all around and no border radius.
      */
 
     NS_FOR_CSS_CORNERS(corner) {
-      const mozilla::css::Side sides[2] = { mozilla::css::Side(corner), PREV_SIDE(corner) };
+      const mozilla::Side sides[2] = { mozilla::Side(corner), PREV_SIDE(corner) };
 
       if (!IsZeroSize(mBorderRadii[corner]))
         continue;
 
       if (mBorderWidths[sides[0]] == 1.0 && mBorderWidths[sides[1]] == 1.0) {
         if (corner == NS_CORNER_TOP_LEFT || corner == NS_CORNER_TOP_RIGHT)
           mBorderCornerDimensions[corner].width = 0.0;
         else
@@ -3413,17 +3413,17 @@ nsCSSBorderRenderer::DrawBorders()
         // don't have transparency and the current destination surface
         // has an alpha channel, we could just clear the region and
         // avoid the temporary, but that situation doesn't happen all
         // that often in practice (we double buffer to no-alpha
         // surfaces). We choose just to seam though, as the performance
         // advantages outway the modest easthetic improvement.
 
         for (int cornerSide = 0; cornerSide < 2; cornerSide++) {
-          mozilla::css::Side side = mozilla::css::Side(sides[cornerSide]);
+          mozilla::Side side = mozilla::Side(sides[cornerSide]);
           uint8_t style = mBorderStyles[side];
 
           PrintAsFormatString("corner: %d cornerSide: %d side: %d style: %d\n", corner, cornerSide, side, style);
 
           RefPtr<Path> path = GetSideClipSubPath(side);
           mDrawTarget->PushClip(path);
 
           DrawBorderSides(1 << side);
--- a/layout/painting/nsCSSRenderingBorders.h
+++ b/layout/painting/nsCSSRenderingBorders.h
@@ -153,30 +153,30 @@ private:
 
   //
   // Path generation functions
   //
 
   // Get the Rect for drawing the given corner
   Rect GetCornerRect(mozilla::css::Corner aCorner);
   // add the path for drawing the given side without any adjacent corners to the context
-  Rect GetSideClipWithoutCornersRect(mozilla::css::Side aSide);
+  Rect GetSideClipWithoutCornersRect(mozilla::Side aSide);
 
   // Create a clip path for the wedge that this side of
   // the border should take up.  This is only called
   // when we're drawing separate border sides, so we know
   // that ADD compositing is taking place.
   //
   // This code needs to make sure that the individual pieces
   // don't ever (mathematically) overlap; the pixel overlap
   // is taken care of by the ADD compositing.
-  already_AddRefed<Path> GetSideClipSubPath(mozilla::css::Side aSide);
+  already_AddRefed<Path> GetSideClipSubPath(mozilla::Side aSide);
 
   // Return start or end point for dashed/dotted side
-  Point GetStraightBorderPoint(mozilla::css::Side aSide,
+  Point GetStraightBorderPoint(mozilla::Side aSide,
                                mozilla::css::Corner aCorner,
                                bool* aIsUnfilled);
 
   // Return bezier control points for the outer and the inner curve for given
   // corner
   void GetOuterAndInnerBezier(Bezier* aOuterBezier,
                               Bezier* aInnerBezier,
                               mozilla::css::Corner aCorner);
@@ -208,39 +208,39 @@ private:
   // present in the bitmask
   void DrawBorderSides (int aSides);
 
   // function used by the above to handle -moz-border-colors
   void DrawBorderSidesCompositeColors(int aSides, const nsBorderColors *compositeColors);
 
   // Setup the stroke options for the given dashed/dotted side
   void SetupDashedOptions(StrokeOptions* aStrokeOptions,
-                          Float aDash[2], mozilla::css::Side aSide,
+                          Float aDash[2], mozilla::Side aSide,
                           Float aBorderLength, bool isCorner);
 
   // Draw the given dashed/dotte side
-  void DrawDashedOrDottedSide(mozilla::css::Side aSide);
+  void DrawDashedOrDottedSide(mozilla::Side aSide);
 
   // Draw the given dotted side, each dot separately
-  void DrawDottedSideSlow(mozilla::css::Side aSide);
+  void DrawDottedSideSlow(mozilla::Side aSide);
 
   // Draw the given dashed/dotted corner
-  void DrawDashedOrDottedCorner(mozilla::css::Side aSide,
+  void DrawDashedOrDottedCorner(mozilla::Side aSide,
                                 mozilla::css::Corner aCorner);
 
   // Draw the given dotted corner, each segment separately
-  void DrawDottedCornerSlow(mozilla::css::Side aSide,
+  void DrawDottedCornerSlow(mozilla::Side aSide,
                             mozilla::css::Corner aCorner);
 
   // Draw the given dashed corner, each dot separately
-  void DrawDashedCornerSlow(mozilla::css::Side aSide,
+  void DrawDashedCornerSlow(mozilla::Side aSide,
                             mozilla::css::Corner aCorner);
 
   // Draw the given dashed/dotted corner with solid style
-  void DrawFallbackSolidCorner(mozilla::css::Side aSide,
+  void DrawFallbackSolidCorner(mozilla::Side aSide,
                                mozilla::css::Corner aCorner);
 
   // Analyze if all border sides have the same width.
   bool AllBordersSameWidth();
 
   // Analyze if all borders are 'solid' this also considers hidden or 'none'
   // borders because they can be considered 'solid' borders of 0 width and
   // with no color effect.
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -4526,17 +4526,17 @@ StyleAnimationValue::ExtractComputedValu
        NS_SIDE_TOP    == eStyleAnimType_Sides_Top   -eStyleAnimType_Sides_Top &&
        NS_SIDE_RIGHT  == eStyleAnimType_Sides_Right -eStyleAnimType_Sides_Top &&
        NS_SIDE_BOTTOM == eStyleAnimType_Sides_Bottom-eStyleAnimType_Sides_Top &&
        NS_SIDE_LEFT   == eStyleAnimType_Sides_Left  -eStyleAnimType_Sides_Top,
        "box side constants out of sync with animation side constants");
 
       const nsStyleCoord &coord =
         StyleDataAtOffset<nsStyleSides>(styleStruct, ssOffset).
-          Get(mozilla::css::Side(animType - eStyleAnimType_Sides_Top));
+          Get(mozilla::Side(animType - eStyleAnimType_Sides_Top));
       return StyleCoordToValue(coord, aComputedValue);
     }
     case eStyleAnimType_Corner_TopLeft:
     case eStyleAnimType_Corner_TopRight:
     case eStyleAnimType_Corner_BottomRight:
     case eStyleAnimType_Corner_BottomLeft: {
       static_assert(
        NS_CORNER_TOP_LEFT     == eStyleAnimType_Corner_TopLeft -
--- a/layout/style/nsCSSDataBlock.cpp
+++ b/layout/style/nsCSSDataBlock.cpp
@@ -236,17 +236,17 @@ EnsurePhysicalProperty(nsCSSPropertyID& 
     bool isEnd =
       nsCSSProps::PropHasFlags(aProperty, CSS_PROPERTY_LOGICAL_END_EDGE);
 
     LogicalEdge edge = isEnd ? eLogicalEdgeEnd : eLogicalEdgeStart;
 
     // We handle block axis logical properties separately to save a bit of
     // work that the WritingMode constructor does that is unnecessary
     // unless we have an inline axis property.
-    mozilla::css::Side side;
+    mozilla::Side side;
     if (isBlock) {
       uint8_t wm = aRuleData->mStyleContext->StyleVisibility()->mWritingMode;
       side = WritingMode::PhysicalSideForBlockAxis(wm, edge);
     } else {
       WritingMode wm(aRuleData->mStyleContext);
       side = wm.PhysicalSideForInlineAxis(edge);
     }
 
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -5005,17 +5005,17 @@ nsComputedDOMStyle::DoGetTop()
 
 nsDOMCSSValueList*
 nsComputedDOMStyle::GetROCSSValueList(bool aCommaDelimited)
 {
   return new nsDOMCSSValueList(aCommaDelimited, true);
 }
 
 already_AddRefed<CSSValue>
-nsComputedDOMStyle::GetOffsetWidthFor(mozilla::css::Side aSide)
+nsComputedDOMStyle::GetOffsetWidthFor(mozilla::Side aSide)
 {
   const nsStyleDisplay* display = StyleDisplay();
 
   AssertFlushedPendingReflows();
 
   uint8_t position = display->mPosition;
   if (!mOuterFrame) {
     // GetRelativeOffset and GetAbsoluteOffset don't handle elements
@@ -5036,17 +5036,17 @@ nsComputedDOMStyle::GetOffsetWidthFor(mo
       return GetAbsoluteOffset(aSide);
     default:
       NS_ERROR("Invalid position");
       return nullptr;
   }
 }
 
 already_AddRefed<CSSValue>
-nsComputedDOMStyle::GetAbsoluteOffset(mozilla::css::Side aSide)
+nsComputedDOMStyle::GetAbsoluteOffset(mozilla::Side aSide)
 {
   MOZ_ASSERT(mOuterFrame, "need a frame, so we can call GetContainingBlock()");
 
   nsIFrame* container = mOuterFrame->GetContainingBlock();
   nsMargin margin = mOuterFrame->GetUsedMargin();
   nsMargin border = container->GetUsedBorder();
   nsMargin scrollbarSizes(0, 0, 0, 0);
   nsRect rect = mOuterFrame->GetRect();
@@ -5094,20 +5094,20 @@ nsComputedDOMStyle::GetAbsoluteOffset(mo
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   val->SetAppUnits(offset);
   return val.forget();
 }
 
 static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
               NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
               "box side constants not as expected for NS_OPPOSITE_SIDE");
-#define NS_OPPOSITE_SIDE(s_) mozilla::css::Side(((s_) + 2) & 3)
-
-already_AddRefed<CSSValue>
-nsComputedDOMStyle::GetRelativeOffset(mozilla::css::Side aSide)
+#define NS_OPPOSITE_SIDE(s_) mozilla::Side(((s_) + 2) & 3)
+
+already_AddRefed<CSSValue>
+nsComputedDOMStyle::GetRelativeOffset(mozilla::Side aSide)
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
 
   const nsStylePosition* positionData = StylePosition();
   int32_t sign = 1;
   nsStyleCoord coord = positionData->mOffset.Get(aSide);
 
   NS_ASSERTION(coord.GetUnit() == eStyleUnit_Coord ||
@@ -5127,17 +5127,17 @@ nsComputedDOMStyle::GetRelativeOffset(mo
     baseGetter = &nsComputedDOMStyle::GetCBContentHeight;
   }
 
   val->SetAppUnits(sign * StyleCoordToNSCoord(coord, baseGetter, 0, false));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
-nsComputedDOMStyle::GetStickyOffset(mozilla::css::Side aSide)
+nsComputedDOMStyle::GetStickyOffset(mozilla::Side aSide)
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
 
   const nsStylePosition* positionData = StylePosition();
   nsStyleCoord coord = positionData->mOffset.Get(aSide);
 
   NS_ASSERTION(coord.GetUnit() == eStyleUnit_Coord ||
                coord.GetUnit() == eStyleUnit_Percent ||
@@ -5157,26 +5157,26 @@ nsComputedDOMStyle::GetStickyOffset(mozi
   }
 
   val->SetAppUnits(StyleCoordToNSCoord(coord, baseGetter, 0, false));
   return val.forget();
 }
 
 
 already_AddRefed<CSSValue>
-nsComputedDOMStyle::GetStaticOffset(mozilla::css::Side aSide)
+nsComputedDOMStyle::GetStaticOffset(mozilla::Side aSide)
 
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   SetValueToCoord(val, StylePosition()->mOffset.Get(aSide), false);
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
-nsComputedDOMStyle::GetPaddingWidthFor(mozilla::css::Side aSide)
+nsComputedDOMStyle::GetPaddingWidthFor(mozilla::Side aSide)
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
 
   if (!mInnerFrame) {
     SetValueToCoord(val, StylePadding()->mPadding.Get(aSide), true);
   } else {
     AssertFlushedPendingReflows();
 
@@ -5220,17 +5220,17 @@ nsComputedDOMStyle::GetLineHeightCoord(n
     fCoord = fCoord * (float(font->mSize) / float(font->mFont.size));
   }
   aCoord = NSToCoordRound(fCoord);
 
   return true;
 }
 
 already_AddRefed<CSSValue>
-nsComputedDOMStyle::GetBorderColorsFor(mozilla::css::Side aSide)
+nsComputedDOMStyle::GetBorderColorsFor(mozilla::Side aSide)
 {
   const nsStyleBorder *border = StyleBorder();
 
   if (border->mBorderColors) {
     nsBorderColors* borderColors = border->mBorderColors[aSide];
     if (borderColors) {
       RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(false);
 
@@ -5248,42 +5248,42 @@ nsComputedDOMStyle::GetBorderColorsFor(m
   }
 
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   val->SetIdent(eCSSKeyword_none);
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
-nsComputedDOMStyle::GetBorderWidthFor(mozilla::css::Side aSide)
+nsComputedDOMStyle::GetBorderWidthFor(mozilla::Side aSide)
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
 
   nscoord width;
   if (mInnerFrame) {
     AssertFlushedPendingReflows();
     width = mInnerFrame->GetUsedBorder().Side(aSide);
   } else {
     width = StyleBorder()->GetComputedBorderWidth(aSide);
   }
   val->SetAppUnits(width);
 
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
-nsComputedDOMStyle::GetBorderColorFor(mozilla::css::Side aSide)
+nsComputedDOMStyle::GetBorderColorFor(mozilla::Side aSide)
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   SetValueFromComplexColor(val, StyleBorder()->mBorderColor[aSide]);
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
-nsComputedDOMStyle::GetMarginWidthFor(mozilla::css::Side aSide)
+nsComputedDOMStyle::GetMarginWidthFor(mozilla::Side aSide)
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
 
   if (!mInnerFrame) {
     SetValueToCoord(val, StyleMargin()->mMargin.Get(aSide), false);
   } else {
     AssertFlushedPendingReflows();
 
@@ -5294,17 +5294,17 @@ nsComputedDOMStyle::GetMarginWidthFor(mo
                  mInnerFrame->GetUsedMargin() == nsMargin(0, 0, 0, 0),
                  "Inner tables must have zero margins");
   }
 
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
-nsComputedDOMStyle::GetBorderStyleFor(mozilla::css::Side aSide)
+nsComputedDOMStyle::GetBorderStyleFor(mozilla::Side aSide)
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   val->SetIdent(
     nsCSSProps::ValueToKeywordEnum(StyleBorder()->GetBorderStyle(aSide),
                                    nsCSSProps::kBorderStyleKTable));
   return val.forget();
 }
 
--- a/layout/style/nsComputedDOMStyle.h
+++ b/layout/style/nsComputedDOMStyle.h
@@ -148,37 +148,37 @@ private:
     return mStyleContext->Style##name_();                               \
   }
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
 
   already_AddRefed<CSSValue> GetEllipseRadii(const nsStyleCorners& aRadius,
                                              uint8_t aFullCorner);
 
-  already_AddRefed<CSSValue> GetOffsetWidthFor(mozilla::css::Side aSide);
+  already_AddRefed<CSSValue> GetOffsetWidthFor(mozilla::Side aSide);
 
-  already_AddRefed<CSSValue> GetAbsoluteOffset(mozilla::css::Side aSide);
+  already_AddRefed<CSSValue> GetAbsoluteOffset(mozilla::Side aSide);
 
-  already_AddRefed<CSSValue> GetRelativeOffset(mozilla::css::Side aSide);
+  already_AddRefed<CSSValue> GetRelativeOffset(mozilla::Side aSide);
 
-  already_AddRefed<CSSValue> GetStickyOffset(mozilla::css::Side aSide);
+  already_AddRefed<CSSValue> GetStickyOffset(mozilla::Side aSide);
 
-  already_AddRefed<CSSValue> GetStaticOffset(mozilla::css::Side aSide);
+  already_AddRefed<CSSValue> GetStaticOffset(mozilla::Side aSide);
 
-  already_AddRefed<CSSValue> GetPaddingWidthFor(mozilla::css::Side aSide);
+  already_AddRefed<CSSValue> GetPaddingWidthFor(mozilla::Side aSide);
 
-  already_AddRefed<CSSValue> GetBorderColorsFor(mozilla::css::Side aSide);
+  already_AddRefed<CSSValue> GetBorderColorsFor(mozilla::Side aSide);
 
-  already_AddRefed<CSSValue> GetBorderStyleFor(mozilla::css::Side aSide);
+  already_AddRefed<CSSValue> GetBorderStyleFor(mozilla::Side aSide);
 
-  already_AddRefed<CSSValue> GetBorderWidthFor(mozilla::css::Side aSide);
+  already_AddRefed<CSSValue> GetBorderWidthFor(mozilla::Side aSide);
 
-  already_AddRefed<CSSValue> GetBorderColorFor(mozilla::css::Side aSide);
+  already_AddRefed<CSSValue> GetBorderColorFor(mozilla::Side aSide);
 
-  already_AddRefed<CSSValue> GetMarginWidthFor(mozilla::css::Side aSide);
+  already_AddRefed<CSSValue> GetMarginWidthFor(mozilla::Side aSide);
 
   already_AddRefed<CSSValue> GetSVGPaintFor(bool aFill);
 
   // Appends all aLineNames (may be empty) space-separated to aResult.
   void AppendGridLineNames(nsString& aResult,
                            const nsTArray<nsString>& aLineNames);
   // Appends aLineNames as a CSSValue* to aValueList.  If aLineNames is empty
   // a value ("[]") is only appended if aSuppressEmptyList is false.
--- a/layout/style/nsStyleCoord.h
+++ b/layout/style/nsStyleCoord.h
@@ -269,23 +269,23 @@ public:
   nsStyleSides();
   nsStyleSides(const nsStyleSides&);
   ~nsStyleSides();
 
   nsStyleSides&  operator=(const nsStyleSides& aCopy);
   bool           operator==(const nsStyleSides& aOther) const;
   bool           operator!=(const nsStyleSides& aOther) const;
 
-  inline nsStyleUnit GetUnit(mozilla::css::Side aSide) const;
+  inline nsStyleUnit GetUnit(mozilla::Side aSide) const;
   inline nsStyleUnit GetLeftUnit() const;
   inline nsStyleUnit GetTopUnit() const;
   inline nsStyleUnit GetRightUnit() const;
   inline nsStyleUnit GetBottomUnit() const;
 
-  inline nsStyleCoord Get(mozilla::css::Side aSide) const;
+  inline nsStyleCoord Get(mozilla::Side aSide) const;
   inline nsStyleCoord GetLeft() const;
   inline nsStyleCoord GetTop() const;
   inline nsStyleCoord GetRight() const;
   inline nsStyleCoord GetBottom() const;
 
   // Methods to access the units and values in terms of logical sides
   // for a given writing mode.
   // NOTE: The definitions are in WritingModes.h (after we have the full
@@ -308,23 +308,23 @@ public:
   inline nsStyleCoord GetIEnd(mozilla::WritingMode aWritingMode) const;
   inline nsStyleCoord GetBEnd(mozilla::WritingMode aWritingMode) const;
 
   // Sets each side to null and releases any refcounted objects.  Only use this
   // if the object is initialized (i.e. don't use it in nsStyleSides
   // constructors).
   void Reset();
 
-  inline void Set(mozilla::css::Side aSide, const nsStyleCoord& aCoord);
+  inline void Set(mozilla::Side aSide, const nsStyleCoord& aCoord);
   inline void SetLeft(const nsStyleCoord& aCoord);
   inline void SetTop(const nsStyleCoord& aCoord);
   inline void SetRight(const nsStyleCoord& aCoord);
   inline void SetBottom(const nsStyleCoord& aCoord);
 
-  nscoord ToLength(mozilla::css::Side aSide) const {
+  nscoord ToLength(mozilla::Side aSide) const {
     return nsStyleCoord::ToLength(mUnits[aSide], mValues[aSide]);
   }
 
   bool ConvertsToLength() const {
     NS_FOR_CSS_SIDES(side) {
       if (!nsStyleCoord::ConvertsToLength(mUnits[side], mValues[side])) {
         return false;
       }
@@ -543,17 +543,17 @@ nsStyleCoord::InitWithValue(nsStyleUnit&
 // -------------------------
 // nsStyleSides inlines
 //
 inline bool nsStyleSides::operator!=(const nsStyleSides& aOther) const
 {
   return !((*this) == aOther);
 }
 
-inline nsStyleUnit nsStyleSides::GetUnit(mozilla::css::Side aSide) const
+inline nsStyleUnit nsStyleSides::GetUnit(mozilla::Side aSide) const
 {
   return (nsStyleUnit)mUnits[aSide];
 }
 
 inline nsStyleUnit nsStyleSides::GetLeftUnit() const
 {
   return GetUnit(NS_SIDE_LEFT);
 }
@@ -568,17 +568,17 @@ inline nsStyleUnit nsStyleSides::GetRigh
   return GetUnit(NS_SIDE_RIGHT);
 }
 
 inline nsStyleUnit nsStyleSides::GetBottomUnit() const
 {
   return GetUnit(NS_SIDE_BOTTOM);
 }
 
-inline nsStyleCoord nsStyleSides::Get(mozilla::css::Side aSide) const
+inline nsStyleCoord nsStyleSides::Get(mozilla::Side aSide) const
 {
   return nsStyleCoord(mValues[aSide], nsStyleUnit(mUnits[aSide]));
 }
 
 inline nsStyleCoord nsStyleSides::GetLeft() const
 {
   return Get(NS_SIDE_LEFT);
 }
@@ -593,17 +593,17 @@ inline nsStyleCoord nsStyleSides::GetRig
   return Get(NS_SIDE_RIGHT);
 }
 
 inline nsStyleCoord nsStyleSides::GetBottom() const
 {
   return Get(NS_SIDE_BOTTOM);
 }
 
-inline void nsStyleSides::Set(mozilla::css::Side aSide, const nsStyleCoord& aCoord)
+inline void nsStyleSides::Set(mozilla::Side aSide, const nsStyleCoord& aCoord)
 {
   nsStyleCoord::SetValue(mUnits[aSide], mValues[aSide], aCoord);
 }
 
 inline void nsStyleSides::SetLeft(const nsStyleCoord& aCoord)
 {
   Set(NS_SIDE_LEFT, aCoord);
 }
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -1258,35 +1258,35 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
       if (mBorderColors) {
         for (int32_t i = 0; i < 4; i++) {
           mBorderColors[i] = nullptr;
         }
       }
     }
   }
 
-  void ClearBorderColors(mozilla::css::Side aSide) {
+  void ClearBorderColors(mozilla::Side aSide) {
     if (mBorderColors && mBorderColors[aSide]) {
       delete mBorderColors[aSide];
       mBorderColors[aSide] = nullptr;
     }
   }
 
   // Return whether aStyle is a visible style.  Invisible styles cause
   // the relevant computed border width to be 0.
   // Note that this does *not* consider the effects of 'border-image':
   // if border-style is none, but there is a loaded border image,
   // HasVisibleStyle will be false even though there *is* a border.
-  bool HasVisibleStyle(mozilla::css::Side aSide) const
+  bool HasVisibleStyle(mozilla::Side aSide) const
   {
     return IsVisibleBorderStyle(mBorderStyle[aSide]);
   }
 
   // aBorderWidth is in twips
-  void SetBorderWidth(mozilla::css::Side aSide, nscoord aBorderWidth)
+  void SetBorderWidth(mozilla::Side aSide, nscoord aBorderWidth)
   {
     nscoord roundedWidth =
       NS_ROUND_BORDER_TO_PIXELS(aBorderWidth, mTwipsPerPixel);
     mBorder.Side(aSide) = roundedWidth;
     if (HasVisibleStyle(aSide)) {
       mComputedBorder.Side(aSide) = roundedWidth;
     }
   }
@@ -1303,28 +1303,28 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   {
     return mComputedBorder != nsMargin(0,0,0,0) || !mBorderImageSource.IsEmpty();
   }
 
   // Get the actual border width for a particular side, in appunits.  Note that
   // this is zero if and only if there is no border to be painted for this
   // side.  That is, this value takes into account the border style and the
   // value is rounded to the nearest device pixel by NS_ROUND_BORDER_TO_PIXELS.
-  nscoord GetComputedBorderWidth(mozilla::css::Side aSide) const
+  nscoord GetComputedBorderWidth(mozilla::Side aSide) const
   {
     return GetComputedBorder().Side(aSide);
   }
 
-  uint8_t GetBorderStyle(mozilla::css::Side aSide) const
+  uint8_t GetBorderStyle(mozilla::Side aSide) const
   {
     NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
     return mBorderStyle[aSide];
   }
 
-  void SetBorderStyle(mozilla::css::Side aSide, uint8_t aStyle)
+  void SetBorderStyle(mozilla::Side aSide, uint8_t aStyle)
   {
     NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
     mBorderStyle[aSide] = aStyle;
     mComputedBorder.Side(aSide) =
       (HasVisibleStyle(aSide) ? mBorder.Side(aSide) : 0);
   }
 
   inline bool IsBorderImageLoaded() const
@@ -1887,17 +1887,17 @@ public:
 
   // NOTE: The comment above MinWidthDependsOnContainer about flex items
   // applies here, too.
   bool MinHeightDependsOnContainer() const
     { return HeightCoordDependsOnContainer(mMinHeight); }
   bool MaxHeightDependsOnContainer() const
     { return HeightCoordDependsOnContainer(mMaxHeight); }
 
-  bool OffsetHasPercent(mozilla::css::Side aSide) const
+  bool OffsetHasPercent(mozilla::Side aSide) const
   {
     return mOffset.Get(aSide).HasPercent();
   }
 
   // Logical-coordinate accessors for width and height properties,
   // given a WritingMode value. The definitions of these methods are
   // found in WritingModes.h (after the WritingMode class is fully
   // declared).