From de4be1cb932c89fd71a5e9fb5188dbcf0a005170 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Tue, 12 Aug 2008 21:32:10 +1200 Subject: [PATCH] Bug 413048. Disable float breaking in columns. r+sr=dbaron --- layout/generic/crashtests/413048-1.html | 9 +++++++++ layout/generic/crashtests/crashtests.list | 1 + layout/generic/nsBlockFrame.cpp | 15 ++++++++++++++- layout/generic/nsBlockReflowState.cpp | 5 ++--- layout/reftests/bugs/reftest.list | 2 +- 5 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 layout/generic/crashtests/413048-1.html diff --git a/layout/generic/crashtests/413048-1.html b/layout/generic/crashtests/413048-1.html new file mode 100644 index 000000000000..958c93023a5b --- /dev/null +++ b/layout/generic/crashtests/413048-1.html @@ -0,0 +1,9 @@ + + + + +
a
+
+ + + diff --git a/layout/generic/crashtests/crashtests.list b/layout/generic/crashtests/crashtests.list index 7b367dd448d4..e0e757e3d7ae 100644 --- a/layout/generic/crashtests/crashtests.list +++ b/layout/generic/crashtests/crashtests.list @@ -129,6 +129,7 @@ load 408883-1.html load 410228-1.html load 411851-1.html load 412201-1.xhtml +load 413048-1.html load 414061-1.html load 414719-1.html load 415685-1.html diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index dea8f57d4420..1a2fa2287e0c 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -98,6 +98,8 @@ static const int MIN_LINES_NEEDING_CURSOR = 20; +#define DISABLE_FLOAT_BREAKING_IN_COLUMNS + #ifdef DEBUG #include "nsPrintfCString.h" #include "nsBlockDebugFlags.h" @@ -5649,9 +5651,20 @@ nsBlockFrame::ComputeFloatAvailableSpace(nsBlockReflowState& aState, // aState.mY is relative to the border-top, make it relative to the content-top nscoord contentYOffset = aState.mY - aState.BorderPadding().top; nscoord availHeight = NS_UNCONSTRAINEDSIZE == aState.mContentArea.height - ? NS_UNCONSTRAINEDSIZE + ? NS_UNCONSTRAINEDSIZE : PR_MAX(0, aState.mContentArea.height - contentYOffset); +#ifdef DISABLE_FLOAT_BREAKING_IN_COLUMNS + if (availHeight != NS_UNCONSTRAINEDSIZE && + nsLayoutUtils::GetClosestFrameOfType(this, nsGkAtoms::columnSetFrame)) { + // Tell the float it has unrestricted height, so it won't break. + // If the float doesn't actually fit in the column it will fail to be + // placed, and either move to the top of the next column or just + // overflow. + availHeight = NS_UNCONSTRAINEDSIZE; + } +#endif + return nsRect(aState.BorderPadding().left, aState.BorderPadding().top, availWidth, availHeight); diff --git a/layout/generic/nsBlockReflowState.cpp b/layout/generic/nsBlockReflowState.cpp index d4e06d83f030..13bd3202226e 100644 --- a/layout/generic/nsBlockReflowState.cpp +++ b/layout/generic/nsBlockReflowState.cpp @@ -636,10 +636,9 @@ nsBlockReflowState::AddFloat(nsLineLayout& aLineLayout, // This float will be placed after the line is done (it is a // below-current-line float). mBelowCurrentLineFloats.Append(fc); - if (mReflowState.availableHeight != NS_UNCONSTRAINEDSIZE || - aPlaceholder->GetNextInFlow()) { + if (aPlaceholder->GetNextInFlow()) { // If the float might not be complete, mark it incomplete now to - // prevent the placeholders being torn down. We will destroy any + // prevent its next-in-flow placeholders being torn down. We will destroy any // placeholders later if PlaceBelowCurrentLineFloats finds the // float is complete. // Note that we could have unconstrained height and yet have diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 6ed83e0cafbe..f918140fbc98 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -571,7 +571,7 @@ fails == 385823-2b.html 385823-2-ref.html == 386014-1c.html 386014-1-ref.html == 386065-1.html 386065-1-ref.html == 386065-2.html about:blank -== 386147-1.html 386147-1-ref.html +fails == 386147-1.html 386147-1-ref.html # bug 447460 == 386310-1a.html 386310-1-ref.html fails == 386310-1b.html 386310-1-ref.html == 386310-1c.html 386310-1-ref.html