Use an AutoRestore to restore mY in nsBlockReflowState::FlowAndPlaceFloat. (Bug 563584, patch 7) r=roc

This commit is contained in:
L. David Baron 2010-08-05 21:59:19 -07:00
Родитель b505799e67
Коммит 2a10a8b16f
1 изменённых файлов: 6 добавлений и 6 удалений

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

@ -50,6 +50,7 @@
#include "nsGkAtoms.h"
#include "nsIFrame.h"
#include "nsFrameManager.h"
#include "mozilla/AutoRestore.h"
#include "nsINameSpaceManager.h"
@ -58,6 +59,8 @@
#include "nsBlockDebugFlags.h"
#endif
using namespace mozilla;
nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,
nsPresContext* aPresContext,
nsBlockFrame* aFrame,
@ -670,7 +673,9 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat,
// necessary because any adjustments to mY during the float
// placement are for the float only, not for any non-floating
// content.
nscoord saveY = mY;
AutoRestore<nscoord> restoreY(mY);
// FIXME: Should give AutoRestore a getter for the value to avoid this.
const nscoord saveY = mY;
// Grab the float's display information
const nsStyleDisplay* floatDisplay = aFloat->GetStyleDisplay();
@ -717,7 +722,6 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat,
for (;;) {
if (floatAvailableSpace.mRect.height <= 0) {
// No space, nowhere to put anything.
mY = saveY;
return PR_FALSE;
}
@ -839,7 +843,6 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat,
pushedDown) &&
aFloat->GetSize().height + floatMargin.TopBottom() >
mContentArea.height - floatY) {
mY = saveY;
return PR_FALSE;
}
@ -904,9 +907,6 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat,
region.x, region.y, region.width, region.height);
#endif
// Now restore mY
mY = saveY;
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow) {
nsRect r = aFloat->GetRect();