From 4e6b53ce88e634a8b85ade1c2344f36bec50d7c4 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Tue, 23 Oct 2018 13:08:59 +0000 Subject: [PATCH] Bug 1501145 Part 1 - Assign default values to ReflowConfig fields, and explicitly initialize them in ChooseColumnStrategy. r=mats The original statement is neat, but one cannot easily associates the values computed in ChooseColumnStrategy with the actually field name in ReflowConfig. Remove the aFeasibleBSize and aInfeasibleBSize for ChooseColumnStrategy() because they're not used. Differential Revision: https://phabricator.services.mozilla.com/D9467 --HG-- extra : moz-landing-system : lando --- layout/generic/nsColumnSetFrame.cpp | 21 +++++++++++++-------- layout/generic/nsColumnSetFrame.h | 23 +++++++++++------------ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/layout/generic/nsColumnSetFrame.cpp b/layout/generic/nsColumnSetFrame.cpp index c8ee3893a161..d02df0f6cc9a 100644 --- a/layout/generic/nsColumnSetFrame.cpp +++ b/layout/generic/nsColumnSetFrame.cpp @@ -315,12 +315,8 @@ nsColumnSetFrame::ClampUsedColumnWidth(const nsStyleCoord& aColumnWidth) nsColumnSetFrame::ReflowConfig nsColumnSetFrame::ChooseColumnStrategy(const ReflowInput& aReflowInput, - bool aForceAuto = false, - nscoord aFeasibleBSize = NS_INTRINSICSIZE, - nscoord aInfeasibleBSize = 0) + bool aForceAuto = false) { - nscoord knownFeasibleBSize = aFeasibleBSize; - nscoord knownInfeasibleBSize = aInfeasibleBSize; WritingMode wm = aReflowInput.GetWritingMode(); const nsStyleColumn* colStyle = StyleColumn(); @@ -456,9 +452,18 @@ nsColumnSetFrame::ChooseColumnStrategy(const ReflowInput& aReflowInput, colBSize, colGap); - ReflowConfig config = { numColumns, colISize, expectedISizeLeftOver, colGap, - colBSize, isBalancing, knownFeasibleBSize, - knownInfeasibleBSize, computedBSize, consumedBSize }; + ReflowConfig config; + config.mBalanceColCount = numColumns; + config.mColISize = colISize; + config.mExpectedISizeLeftOver = expectedISizeLeftOver; + config.mColGap = colGap; + config.mColMaxBSize = colBSize; + config.mIsBalancing = isBalancing; + config.mKnownFeasibleBSize = NS_INTRINSICSIZE; + config.mKnownInfeasibleBSize = 0; + config.mComputedBSize = computedBSize; + config.mConsumedBSize = consumedBSize; + return config; } diff --git a/layout/generic/nsColumnSetFrame.h b/layout/generic/nsColumnSetFrame.h index 1c1e8283d134..1213756126aa 100644 --- a/layout/generic/nsColumnSetFrame.h +++ b/layout/generic/nsColumnSetFrame.h @@ -102,42 +102,42 @@ protected: struct ReflowConfig { // The number of columns that we want to balance across. If we're not // balancing, this will be set to INT32_MAX. - int32_t mBalanceColCount; + int32_t mBalanceColCount = INT32_MAX; // The inline-size of each individual column. - nscoord mColISize; + nscoord mColISize = NS_INTRINSICSIZE; // The amount of inline-size that is expected to be left over after all the // columns and column gaps are laid out. - nscoord mExpectedISizeLeftOver; + nscoord mExpectedISizeLeftOver = 0; // The width (inline-size) of each column gap. - nscoord mColGap; + nscoord mColGap = NS_INTRINSICSIZE; // The maximum bSize of any individual column during a reflow iteration. // This parameter is set during each iteration of the binary search for // the best column block-size. - nscoord mColMaxBSize; + nscoord mColMaxBSize = NS_INTRINSICSIZE; // A boolean controlling whether or not we are balancing. This should be // equivalent to mBalanceColCount == INT32_MAX. - bool mIsBalancing; + bool mIsBalancing = false; // The last known column block-size that was 'feasible'. A column bSize is // feasible if all child content fits within the specified bSize. - nscoord mKnownFeasibleBSize; + nscoord mKnownFeasibleBSize = NS_INTRINSICSIZE; // The last known block-size that was 'infeasible'. A column bSize is // infeasible if not all child content fits within the specified bSize. - nscoord mKnownInfeasibleBSize; + nscoord mKnownInfeasibleBSize = 0; // block-size of the column set frame - nscoord mComputedBSize; + nscoord mComputedBSize = NS_INTRINSICSIZE; // The block-size "consumed" by previous-in-flows. // The computed block-size should be equal to the block-size of the element // (i.e. the computed block-size itself) plus the consumed block-size. - nscoord mConsumedBSize; + nscoord mConsumedBSize = 0; }; /** @@ -180,8 +180,7 @@ protected: * the state machine that controls column balancing. */ ReflowConfig ChooseColumnStrategy(const ReflowInput& aReflowInput, - bool aForceAuto, nscoord aFeasibleBSize, - nscoord aInfeasibleBSize); + bool aForceAuto); /** * Perform the binary search for the best balance height for this column set.