Bug 822053 - Nested balancing column sets restriction shouldn't affect non-balancing column sets. r=roc

This commit is contained in:
Mats Palmgren
2012-12-27 22:24:08 +01:00
parent 531b49fed0
commit f065c7762f
7 changed files with 258 additions and 16 deletions

View File

@@ -326,16 +326,20 @@ nsColumnSetFrame::ChooseColumnStrategy(const nsHTMLReflowState& aReflowState)
nscoord colGap = GetColumnGap(this, colStyle);
int32_t numColumns = colStyle->mColumnCount;
const uint32_t MAX_NESTED_COLUMN_BALANCING = 2;
uint32_t cnt = 1;
for (const nsHTMLReflowState* rs = aReflowState.parentReflowState; rs && cnt
< MAX_NESTED_COLUMN_BALANCING; rs = rs->parentReflowState) {
if (rs->mFlags.mIsColumnBalancing) {
++cnt;
// If column-fill is set to 'balance', then we want to balance the columns.
const bool isBalancing = colStyle->mColumnFill == NS_STYLE_COLUMN_FILL_BALANCE;
if (isBalancing) {
const uint32_t MAX_NESTED_COLUMN_BALANCING = 2;
uint32_t cnt = 0;
for (const nsHTMLReflowState* rs = aReflowState.parentReflowState;
rs && cnt < MAX_NESTED_COLUMN_BALANCING; rs = rs->parentReflowState) {
if (rs->mFlags.mIsColumnBalancing) {
++cnt;
}
}
if (cnt == MAX_NESTED_COLUMN_BALANCING) {
numColumns = 1;
}
}
if (cnt == MAX_NESTED_COLUMN_BALANCING) {
numColumns = 1;
}
nscoord colWidth;
@@ -390,17 +394,13 @@ nsColumnSetFrame::ChooseColumnStrategy(const nsHTMLReflowState& aReflowState)
expectedWidthLeftOver = extraSpace - (extraToColumns*numColumns);
}
// If column-fill is set to 'balance', then we want to balance the columns.
if (colStyle->mColumnFill == NS_STYLE_COLUMN_FILL_BALANCE) {
// Balancing!
if (isBalancing) {
if (numColumns <= 0) {
// Hmm, auto column count, column width or available width is unknown,
// and balancing is required. Let's just use one column then.
numColumns = 1;
}
colHeight = NS_MIN(mLastBalanceHeight,
colHeight);
colHeight = NS_MIN(mLastBalanceHeight, colHeight);
} else {
// This is the case when the column-fill property is set to 'auto'.
// No balancing, so don't limit the column count