Bug 1152913 part 2: Convert flexbox 'IsAxisHorizontal' checks to use new logical-axis member data. r=mats

This commit is contained in:
Daniel Holbert 2015-04-10 13:35:42 -07:00
parent e67945f2b0
commit e18372102c

View File

@ -164,8 +164,15 @@ public:
AxisOrientationType GetMainAxis() const { return mMainAxis; }
AxisOrientationType GetCrossAxis() const { return mCrossAxis; }
bool IsMainAxisHorizontal() const { return IsAxisHorizontal(mMainAxis); }
bool IsCrossAxisHorizontal() const { return IsAxisHorizontal(mCrossAxis); }
bool IsMainAxisHorizontal() const {
// If we're row-oriented, and our writing mode is NOT vertical,
// or we're column-oriented and our writing mode IS vertical,
// then our main axis is horizontal. This handles all cases:
return mIsRowOriented != mWM.IsVertical();
}
bool IsCrossAxisHorizontal() const {
return !IsMainAxisHorizontal();
}
// XXXdholbert [END DEPRECATED]
// Returns true if our main axis is in the reverse direction of our
@ -270,14 +277,7 @@ private:
FlexboxAxisTracker(const FlexboxAxisTracker&) = delete;
FlexboxAxisTracker& operator=(const FlexboxAxisTracker&) = delete;
// Indicates whether the given AxisOrientationType is horizontal.
// XXXdholbert This is private so that callers outside of FlexboxAxisTracker
// don't depend on it. This lets us move away from AxisOrientationType to a
// logical-axis-relative representation more seamlessly.
// XXXdholbert [BEGIN DEPRECATED]
static inline bool IsAxisHorizontal(AxisOrientationType aAxis) {
return eAxis_LR == aAxis || eAxis_RL == aAxis;
}
AxisOrientationType mMainAxis;
AxisOrientationType mCrossAxis;
// XXXdholbert [END DEPRECATED]
@ -3032,9 +3032,6 @@ FlexboxAxisTracker::FlexboxAxisTracker(const nsStylePosition* aStylePosition,
mIsCrossAxisReversed = !mIsCrossAxisReversed;
}
}
MOZ_ASSERT(IsMainAxisHorizontal() != IsCrossAxisHorizontal(),
"main & cross axes should be in different dimensions");
}
// Allocates a new FlexLine, adds it to the given LinkedList (at the front or