Bug 462307 - 'Speed up columns case hit by HTML5 spec'. r+sr=dbaron

This commit is contained in:
Robert O'Callahan 2008-11-04 14:01:27 -08:00
Родитель bdeeace995
Коммит 83a3ac2d87
1 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -129,11 +129,17 @@ protected:
* Some data that is better calculated during reflow * Some data that is better calculated during reflow
*/ */
struct ColumnBalanceData { struct ColumnBalanceData {
// The maximum "content height" of any column
nscoord mMaxHeight; nscoord mMaxHeight;
// The sum of the "content heights" for all columns
nscoord mSumHeight; nscoord mSumHeight;
// The "content height" of the last column
nscoord mLastHeight; nscoord mLastHeight;
// The maximum "content height" of all columns that overflowed
// their available height
nscoord mMaxOverflowingHeight;
void Reset() { void Reset() {
mMaxHeight = mSumHeight = mLastHeight = 0; mMaxHeight = mSumHeight = mLastHeight = mMaxOverflowingHeight = 0;
} }
}; };
@ -669,6 +675,10 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
if (childContentBottom > aConfig.mColMaxHeight) { if (childContentBottom > aConfig.mColMaxHeight) {
allFit = PR_FALSE; allFit = PR_FALSE;
} }
if (childContentBottom > availSize.height) {
aColData.mMaxOverflowingHeight = PR_MAX(childContentBottom,
aColData.mMaxOverflowingHeight);
}
} }
contentRect.UnionRect(contentRect, child->GetRect()); contentRect.UnionRect(contentRect, child->GetRect());
@ -908,6 +918,11 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
} }
} else { } else {
knownInfeasibleHeight = PR_MAX(knownInfeasibleHeight, mLastBalanceHeight); knownInfeasibleHeight = PR_MAX(knownInfeasibleHeight, mLastBalanceHeight);
// If a column didn't fit in its available height, then its current
// height must be the minimum height for unbreakable content in
// the column, and therefore no smaller height can be feasible.
knownInfeasibleHeight = PR_MAX(knownInfeasibleHeight,
colData.mMaxOverflowingHeight - 1);
if (unboundedLastColumn) { if (unboundedLastColumn) {
// The last column is unbounded, so all content got reflowed, so the // The last column is unbounded, so all content got reflowed, so the