mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 725376 - Don't do column balancing deeper than 5 nested levels to avoid hang. r=roc
This commit is contained in:
parent
d28a42b8c2
commit
2fd1364623
@ -364,6 +364,22 @@ nsColumnSetFrame::ChooseColumnStrategy(const nsHTMLReflowState& aReflowState)
|
||||
nscoord colGap = GetColumnGap(this, colStyle);
|
||||
PRInt32 numColumns = colStyle->mColumnCount;
|
||||
|
||||
bool isBalancing = colStyle->mColumnFill == NS_STYLE_COLUMN_FILL_BALANCE;
|
||||
if (isBalancing) {
|
||||
const PRUint32 MAX_NESTED_COLUMN_BALANCING = 5;
|
||||
PRUint32 cnt = 1;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
nscoord colWidth;
|
||||
if (colStyle->mColumnWidth.GetUnit() == eStyleUnit_Coord) {
|
||||
colWidth = colStyle->mColumnWidth.GetCoordValue();
|
||||
@ -417,7 +433,7 @@ nsColumnSetFrame::ChooseColumnStrategy(const nsHTMLReflowState& aReflowState)
|
||||
}
|
||||
|
||||
// If column-fill is set to 'balance', then we want to balance the columns.
|
||||
if (colStyle->mColumnFill == NS_STYLE_COLUMN_FILL_BALANCE) {
|
||||
if (isBalancing) {
|
||||
// Balancing!
|
||||
|
||||
if (numColumns <= 0) {
|
||||
@ -657,6 +673,7 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
|
||||
aReflowState.ComputedHeight());
|
||||
kidReflowState.mFlags.mIsTopOfPage = true;
|
||||
kidReflowState.mFlags.mTableIsSplittable = false;
|
||||
kidReflowState.mFlags.mIsColumnBalancing = aConfig.mBalanceColCount < PR_INT32_MAX;
|
||||
|
||||
#ifdef DEBUG_roc
|
||||
printf("*** Reflowing child #%d %p: availHeight=%d\n",
|
||||
|
@ -367,7 +367,7 @@ public:
|
||||
// and never insider a column frame
|
||||
PRUint16 mHeightDependsOnAncestorCell:1; // Does frame height depend on
|
||||
// an ancestor table-cell?
|
||||
|
||||
PRUint16 mIsColumnBalancing:1; // nsColumnSetFrame is balancing columns
|
||||
} mFlags;
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user