Bug 307242 - "ASSERTION: bad argument: '(aRight > mLeft) && (aRight < mRight)', @ nsSpaceManager::BandRect::SplitHorizontally" [p=elif (sharparrow1) r+sr+a1.9=roc]
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1339,20 +1339,18 @@ nsBlockFrame::ComputeFinalSize(const nsH
// Truncate bottom margin if it doesn't fit to our available height.
autoHeight = PR_MIN(autoHeight + aState.mPrevBottomMargin.get(), aState.mReflowState.availableHeight);
}
}
if (aState.GetFlag(BRS_SPACE_MGR)) {
// Include the space manager's state to properly account for the
// bottom margin of any floated elements; e.g., inside a table cell.
- nscoord ymost;
- if (aReflowState.mSpaceManager->YMost(ymost) &&
- autoHeight < ymost)
- autoHeight = ymost;
+ nscoord floatHeight = aReflowState.mSpaceManager->ClearFloats(nscoord_MIN, NS_STYLE_CLEAR_LEFT_AND_RIGHT);
+ autoHeight = PR_MAX(autoHeight, floatHeight);
}
// Apply min/max values
autoHeight -= borderPadding.top;
nscoord oldAutoHeight = autoHeight;
aReflowState.ApplyMinMaxConstraints(nsnull, &autoHeight);
if (autoHeight != oldAutoHeight) {
// Our min-height or max-height made our height change. Don't carry out
--- a/layout/generic/nsSpaceManager.cpp
+++ b/layout/generic/nsSpaceManager.cpp
@@ -843,37 +843,31 @@ nsSpaceManager::InsertBandRect(BandRect*
}
}
}
nsresult
nsSpaceManager::AddRectRegion(nsIFrame* aFrame, const nsRect& aUnavailableSpace)
{
NS_PRECONDITION(nsnull != aFrame, "null frame");
-
-#ifdef DEBUG
- // See if there is already a region associated with aFrame
- NS_ASSERTION(!GetFrameInfoFor(aFrame),
- "aFrame is already associated with a region");
-#endif
// Convert the frame to world coordinates
nsRect rect(aUnavailableSpace.x + mX, aUnavailableSpace.y + mY,
aUnavailableSpace.width, aUnavailableSpace.height);
if (rect.y > mLowestTop)
mLowestTop = rect.y;
// Create a frame info structure
FrameInfo* frameInfo = CreateFrameInfo(aFrame, rect);
if (nsnull == frameInfo) {
return NS_ERROR_OUT_OF_MEMORY;
}
- if (aUnavailableSpace.height <= 0)
+ if (aUnavailableSpace.IsEmpty())
return NS_OK;
// Allocate a band rect
BandRect* bandRect = new BandRect(rect.x, rect.y, rect.XMost(), rect.YMost(), aFrame);
if (nsnull == bandRect) {
return NS_ERROR_OUT_OF_MEMORY;
}
@@ -914,17 +908,17 @@ nsSpaceManager::RemoveRegion(nsIFrame* a
// Get the frame info associated with aFrame
FrameInfo* frameInfo = GetFrameInfoFor(aFrame);
if (nsnull == frameInfo) {
NS_WARNING("no region associated with aFrame");
return NS_ERROR_INVALID_ARG;
}
- if (frameInfo->mRect.height > 0) {
+ if (!frameInfo->mRect.IsEmpty()) {
NS_ASSERTION(!mBandList.IsEmpty(), "no bands");
BandRect* band = mBandList.Head();
BandRect* prevBand = nsnull;
PRBool prevFoundMatchingRect = PR_FALSE;
// Iterate each band looking for rects tagged with aFrame
while (nsnull != band) {
BandRect* rect = band;