author | Daniel Holbert <dholbert@cs.stanford.edu> |
Tue, 12 May 2015 13:34:25 -0700 | |
changeset 243612 | 4722c39a16f7b293e73166f6a9b92127c38c2f9c |
parent 243611 | 0c1b368f0857a3e484126f192d2c85e73b172d10 |
child 243613 | eb2201af1e2f8061ca67afa296911df08ec55f14 |
push id | 28744 |
push user | kwierso@gmail.com |
push date | Wed, 13 May 2015 18:12:16 +0000 |
treeherder | mozilla-central@324c3423deaf [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mats |
bugs | 1158290 |
milestone | 41.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -146,16 +146,20 @@ PhysicalCoordFromFlexRelativeCoord(nscoo // evaluate), these macros will ensure that only the expression for the correct // axis gets evaluated. #define GET_MAIN_COMPONENT(axisTracker_, width_, height_) \ (axisTracker_).IsMainAxisHorizontal() ? (width_) : (height_) #define GET_CROSS_COMPONENT(axisTracker_, width_, height_) \ (axisTracker_).IsCrossAxisHorizontal() ? (width_) : (height_) +// Logical versions of helper-macros above: +#define GET_MAIN_COMPONENT_LOGICAL(axisTracker_, isize_, bsize_) \ + (axisTracker_).IsRowOriented() ? (isize_) : (bsize_) + // Encapsulates our flex container's main & cross axes. class MOZ_STACK_CLASS nsFlexContainerFrame::FlexboxAxisTracker { public: FlexboxAxisTracker(const nsStylePosition* aStylePosition, const WritingMode& aWM); // Accessors: // XXXdholbert [BEGIN DEPRECATED] @@ -180,16 +184,17 @@ public: } // Returns true if our cross axis is in the reverse direction of our // writing mode's corresponding axis. (From 'flex-wrap: *-reverse') bool IsCrossAxisReversed() const { return mIsCrossAxisReversed; } bool IsRowOriented() const { return mIsRowOriented; } + bool IsColumnOriented() const { return !mIsRowOriented; } nscoord GetMainComponent(const nsSize& aSize) const { return GET_MAIN_COMPONENT(*this, aSize.width, aSize.height); } int32_t GetMainComponent(const LayoutDeviceIntSize& aIntSize) const { return GET_MAIN_COMPONENT(*this, aIntSize.width, aIntSize.height); } @@ -3096,30 +3101,31 @@ nsFlexContainerFrame::GenerateFlexLines( if (isSingleLine) { // Not wrapping. Set threshold to sentinel value that tells us not to wrap. wrapThreshold = NS_UNCONSTRAINEDSIZE; } else { // Wrapping! Set wrap threshold to flex container's content-box main-size. wrapThreshold = aContentBoxMainSize; // If the flex container doesn't have a definite content-box main-size - // (e.g. if we're 'height:auto'), make sure we at least wrap when we hit - // its max main-size. + // (e.g. if main axis is vertical & 'height' is 'auto'), make sure we at + // least wrap when we hit its max main-size. if (wrapThreshold == NS_UNCONSTRAINEDSIZE) { const nscoord flexContainerMaxMainSize = - GET_MAIN_COMPONENT(aAxisTracker, - aReflowState.ComputedMaxWidth(), - aReflowState.ComputedMaxHeight()); + GET_MAIN_COMPONENT_LOGICAL(aAxisTracker, + aReflowState.ComputedMaxISize(), + aReflowState.ComputedMaxBSize()); wrapThreshold = flexContainerMaxMainSize; } - // Also: if we're vertical and paginating, we may need to wrap sooner - // (before we run off the end of the page) - if (!aAxisTracker.IsMainAxisHorizontal() && + // Also: if we're column-oriented and paginating in the block dimension, + // we may need to wrap to a new flex line sooner (before we grow past the + // available BSize, potentially running off the end of the page). + if (aAxisTracker.IsColumnOriented() && aAvailableBSizeForContent != NS_UNCONSTRAINEDSIZE) { wrapThreshold = std::min(wrapThreshold, aAvailableBSizeForContent); } } // Tracks the index of the next strut, in aStruts (and when this hits // aStruts.Length(), that means there are no more struts): uint32_t nextStrutIdx = 0;