From 367e34d52e690c91948f219761e258920e6b80c6 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 5 Aug 2010 21:59:18 -0700 Subject: [PATCH] Fix assertion about float manager state by restoring old float manager state when we place a float and then cancel that placement. (Bug 563584, patch 1) r=roc --- layout/generic/nsBlockReflowState.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/layout/generic/nsBlockReflowState.cpp b/layout/generic/nsBlockReflowState.cpp index b70439ab59c8..a5c4ecd8cf54 100644 --- a/layout/generic/nsBlockReflowState.cpp +++ b/layout/generic/nsBlockReflowState.cpp @@ -574,6 +574,9 @@ nsBlockReflowState::AddFloat(nsLineLayout* aLineLayout, (aLineLayout->LineIsEmpty() || mBlock->ComputeFloatWidth(*this, floatAvailableSpace, aFloat) <= aAvailableWidth))) { + nsFloatManager::SavedState floatManagerState; + mFloatManager->PushState(&floatManagerState); + // And then place it // force it to fit if we're at the top of the block and we can't // break before this @@ -599,6 +602,11 @@ nsBlockReflowState::AddFloat(nsLineLayout* aLineLayout, aReflowStatus &= ~NS_FRAME_TRUNCATED; } else { + if (placed) { + mFloatManager->PopState(&floatManagerState); + } else { + mFloatManager->AssertStateMatches(&floatManagerState); + } if (IsAdjacentWithTop()) { // Pushing the line to the next page won't give us any more space; // therefore, we break.