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 mColGap;
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",
numColumns, colWidth, expectedWidthLeftOver, colHeight, colGap);
#endif
ReflowConfig config = { numColumns, colWidth, expectedWidthLeftOver, colGap, colHeight };
ReflowConfig config = { numColumns, colWidth, expectedWidthLeftOver, colGap,
colHeight, isBalancing };
return config;
}
@@ -912,7 +914,6 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
//------------ Handle Incremental Reflow -----------------
ReflowConfig config = ChooseColumnStrategy(aReflowState);
bool isBalancing = config.mBalanceColCount < INT32_MAX;
// If balancing, then we allow the last column to grow to unbounded
// 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
// content back here and then have to push it out again!
nsIFrame* nextInFlow = GetNextInFlow();
bool unboundedLastColumn = isBalancing && !nextInFlow;
bool unboundedLastColumn = config.mIsBalancing && !nextInFlow;
nsCollapsingMargin carriedOutBottomMargin;
ColumnBalanceData colData;
colData.mShouldRevertToAuto = false;
@@ -935,13 +936,13 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
do {
if (colData.mShouldRevertToAuto) {
config = ChooseColumnStrategy(aReflowState, true);
isBalancing = false;
config.mIsBalancing = false;
}
bool feasible = ReflowChildren(aDesiredSize, aReflowState,
aStatus, config, unboundedLastColumn, &carriedOutBottomMargin, colData);
if (isBalancing && !aPresContext->HasPendingInterrupt()) {
if (config.mIsBalancing && !aPresContext->HasPendingInterrupt()) {
nscoord availableContentHeight = GetAvailableContentHeight(aReflowState);
// Termination of the algorithm below is guaranteed because