From 950248eff1858b23b32c77ed8d949f62e32d1db6 Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Tue, 1 Jul 2014 17:58:14 +0000 Subject: [PATCH] Bug 1031701 - Remove FlexContainerFrame::MarginComponentForSide(), use nsMargin::Side() instead. r=dholbert --- layout/generic/nsFlexContainerFrame.cpp | 48 +++---------------------- 1 file changed, 5 insertions(+), 43 deletions(-) diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp index 8b512872cbc..650e92588b2 100644 --- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -153,44 +153,6 @@ PhysicalPosFromLogicalPos(nscoord aLogicalPosn, return aLogicalContainerSize - aLogicalPosn; } -static nscoord -MarginComponentForSide(const nsMargin& aMargin, mozilla::Side aSide) -{ - switch (aSide) { - case eSideLeft: - return aMargin.left; - case eSideRight: - return aMargin.right; - case eSideTop: - return aMargin.top; - case eSideBottom: - return aMargin.bottom; - } - - NS_NOTREACHED("unexpected Side enum"); - return aMargin.left; // have to return something - // (but something's busted if we got here) -} - -static nscoord& -MarginComponentForSide(nsMargin& aMargin, mozilla::Side aSide) -{ - switch (aSide) { - case eSideLeft: - return aMargin.left; - case eSideRight: - return aMargin.right; - case eSideTop: - return aMargin.top; - case eSideBottom: - return aMargin.bottom; - } - - NS_NOTREACHED("unexpected Side enum"); - return aMargin.left; // have to return something - // (but something's busted if we got here) -} - // Helper-macro to let us pick one of two expressions to evaluate // (a width expression vs. a height expression), to get a main-axis or // cross-axis component. @@ -416,7 +378,7 @@ public: // Returns the margin component for a given mozilla::Side nscoord GetMarginComponentForSide(mozilla::Side aSide) const - { return MarginComponentForSide(mMargin, aSide); } + { return mMargin.Side(aSide); } // Returns the total space occupied by this item's margins in the given axis nscoord GetMarginSizeInAxis(AxisOrientationType aAxis) const @@ -433,7 +395,7 @@ public: // Returns the border+padding component for a given mozilla::Side nscoord GetBorderPaddingComponentForSide(mozilla::Side aSide) const - { return MarginComponentForSide(mBorderPadding, aSide); } + { return mBorderPadding.Side(aSide); } // Returns the total space occupied by this item's borders and padding in // the given axis @@ -553,7 +515,7 @@ public: void SetMarginComponentForSide(mozilla::Side aSide, nscoord aLength) { MOZ_ASSERT(mIsFrozen, "main size should be resolved before this"); - MarginComponentForSide(mMargin, aSide) = aLength; + mMargin.Side(aSide) = aLength; } void ResolveStretchedCrossSize(nscoord aLineCrossSize, @@ -1327,7 +1289,7 @@ public: void EnterMargin(const nsMargin& aMargin) { mozilla::Side side = kAxisOrientationToSidesMap[mAxis][eAxisEdge_Start]; - mPosition += MarginComponentForSide(aMargin, side); + mPosition += aMargin.Side(side); } // Advances our position across the end edge of the given margin, in the axis @@ -1335,7 +1297,7 @@ public: void ExitMargin(const nsMargin& aMargin) { mozilla::Side side = kAxisOrientationToSidesMap[mAxis][eAxisEdge_End]; - mPosition += MarginComponentForSide(aMargin, side); + mPosition += aMargin.Side(side); } // Advances our current position from the start side of a child frame's