Bug 1174003 part 11: [css-flexbox] Remove IsCrossAxisHorizontal(), and make IsMainAxisHorizontal() a private implementation detail. r?mats
At this point in the series:
- AxisOrientationTracker::IsCrossAxisHorizontal() has zero callers, so it can
be deleted.
- AxisOrientationTracker::IsMainAxisHorizontal() only has two callers, and
both are inside its own class. So it's effectively become an implementation
detail of its class, and it can be made private. (I'm not entirely removing
it, because it does make its two callers more readable. The callers are
working with a physical-axis-dependent type, 'LayoutDeviceIntSize', which
comes from an API that isn't logical-axis-friendly, "GetMinimumWidgetSize",
so they're not easily logicalized. So: it's nice to keep
IsMainAxisHorizontal() around as an internal convenience method to tell us
whether to extract the width or height inside of these two specific
methods. But we don't want to introduce more callers, so let's leave it
around & make it private.)
MozReview-Commit-ID: 1iz1e52NmxV
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -289,26 +289,16 @@ public:
FlexboxAxisTracker(const nsFlexContainerFrame* aFlexContainer,
const WritingMode& aWM,
AxisTrackerFlags aFlags = eNoFlags);
// Accessors:
// XXXdholbert [BEGIN DEPRECATED]
AxisOrientationType GetMainAxis() const { return mMainAxis; }
AxisOrientationType GetCrossAxis() const { return 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 the flex container's writing mode.
WritingMode GetWritingMode() const { return mWM; }
// Returns true if our main axis is in the reverse direction of our
// writing mode's corresponding axis. (From 'flex-direction: *-reverse')
bool IsMainAxisReversed() const {
@@ -407,16 +397,25 @@ public:
}
private:
// Delete copy-constructor & reassignment operator, to prevent accidental
// (unnecessary) copying.
FlexboxAxisTracker(const FlexboxAxisTracker&) = delete;
FlexboxAxisTracker& operator=(const FlexboxAxisTracker&) = delete;
+ // Private because callers shouldn't need to care about physical axes
+ // (but we do internally, to provide one API).
+ 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();
+ }
+
// Helpers for constructor which determine the orientation of our axes, based
// on legacy box properties (-webkit-box-orient, -webkit-box-direction) or
// modern flexbox properties (flex-direction, flex-wrap) depending on whether
// the flex container is a "legacy box" (as determined by IsLegacyBox).
void InitAxesFromLegacyProps(const nsFlexContainerFrame* aFlexContainer);
void InitAxesFromModernProps(const nsFlexContainerFrame* aFlexContainer);
// XXXdholbert [BEGIN DEPRECATED]