Bug 846575: Clean up nsColumnSetFrame by adding an isBalancing convenience member to ReflowConfig. [r=fantasai]

This commit is contained in:
Scott Johnson
2013-03-08 09:43:46 -06:00
parent 5216e7ff08
commit 79fe21d68d

View File

@@ -99,6 +99,7 @@ protected:
nscoord mExpectedWidthLeftOver; nscoord mExpectedWidthLeftOver;
nscoord mColGap; nscoord mColGap;
nscoord mColMaxHeight; nscoord mColMaxHeight;
bool mIsBalancing;
}; };
/** /**
@@ -433,7 +434,8 @@ nsColumnSetFrame::ChooseColumnStrategy(const nsHTMLReflowState& aReflowState,
printf("*** nsColumnSetFrame::ChooseColumnStrategy: numColumns=%d, colWidth=%d, expectedWidthLeftOver=%d, colHeight=%d, colGap=%d\n", printf("*** nsColumnSetFrame::ChooseColumnStrategy: numColumns=%d, colWidth=%d, expectedWidthLeftOver=%d, colHeight=%d, colGap=%d\n",
numColumns, colWidth, expectedWidthLeftOver, colHeight, colGap); numColumns, colWidth, expectedWidthLeftOver, colHeight, colGap);
#endif #endif
ReflowConfig config = { numColumns, colWidth, expectedWidthLeftOver, colGap, colHeight }; ReflowConfig config = { numColumns, colWidth, expectedWidthLeftOver, colGap,
colHeight, isBalancing };
return config; return config;
} }
@@ -912,7 +914,6 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
//------------ Handle Incremental Reflow ----------------- //------------ Handle Incremental Reflow -----------------
ReflowConfig config = ChooseColumnStrategy(aReflowState); ReflowConfig config = ChooseColumnStrategy(aReflowState);
bool isBalancing = config.mBalanceColCount < INT32_MAX;
// If balancing, then we allow the last column to grow to unbounded // If balancing, then we allow the last column to grow to unbounded
// height during the first reflow. This gives us a way to estimate // height during the first reflow. This gives us a way to estimate
@@ -921,7 +922,7 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
// if we have a next in flow because we don't want to suck all its // if we have a next in flow because we don't want to suck all its
// content back here and then have to push it out again! // content back here and then have to push it out again!
nsIFrame* nextInFlow = GetNextInFlow(); nsIFrame* nextInFlow = GetNextInFlow();
bool unboundedLastColumn = isBalancing && !nextInFlow; bool unboundedLastColumn = config.mIsBalancing && !nextInFlow;
nsCollapsingMargin carriedOutBottomMargin; nsCollapsingMargin carriedOutBottomMargin;
ColumnBalanceData colData; ColumnBalanceData colData;
colData.mShouldRevertToAuto = false; colData.mShouldRevertToAuto = false;
@@ -935,13 +936,13 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
do { do {
if (colData.mShouldRevertToAuto) { if (colData.mShouldRevertToAuto) {
config = ChooseColumnStrategy(aReflowState, true); config = ChooseColumnStrategy(aReflowState, true);
isBalancing = false; config.mIsBalancing = false;
} }
bool feasible = ReflowChildren(aDesiredSize, aReflowState, bool feasible = ReflowChildren(aDesiredSize, aReflowState,
aStatus, config, unboundedLastColumn, &carriedOutBottomMargin, colData); aStatus, config, unboundedLastColumn, &carriedOutBottomMargin, colData);
if (isBalancing && !aPresContext->HasPendingInterrupt()) { if (config.mIsBalancing && !aPresContext->HasPendingInterrupt()) {
nscoord availableContentHeight = GetAvailableContentHeight(aReflowState); nscoord availableContentHeight = GetAvailableContentHeight(aReflowState);
// Termination of the algorithm below is guaranteed because // Termination of the algorithm below is guaranteed because