diff --git a/layout/forms/nsHTMLButtonControlFrame.cpp b/layout/forms/nsHTMLButtonControlFrame.cpp
index 4c5f646939a9..1747141d369c 100644
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -387,7 +387,10 @@ nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext& aPresContext,
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) styleDisplay);
mInline = (NS_STYLE_DISPLAY_BLOCK != styleDisplay->mDisplay);
- PRUint8 flags = (mInline) ? NS_BLOCK_SHRINK_WRAP : 0;
+ PRUint32 flags = NS_BLOCK_SPACE_MGR;
+ if (mInline) {
+ flags |= NS_BLOCK_SHRINK_WRAP;
+ }
nsIFrame* areaFrame;
NS_NewAreaFrame(&areaFrame, flags);
mFrames.SetFrames(areaFrame);
diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp
index d88f916abd4a..32bf803e5edb 100644
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1393,6 +1393,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Should we create a space manager?
nsCOMPtr spaceManager;
+ nsISpaceManager* oldSpaceManager = aReflowState.mSpaceManager;
if (NS_BLOCK_SPACE_MGR & mState) {
nsSpaceManager* rawPtr = new nsSpaceManager(this);
if (!rawPtr) {
@@ -1529,6 +1530,13 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
}
}
+ // If we set the space manager, then restore the old space manager now that we're
+ // going out of scope
+ if (NS_BLOCK_SPACE_MGR & mState) {
+ nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
+ reflowState.mSpaceManager = oldSpaceManager;
+ }
+
#if 0
#ifdef NOISY_SPACEMANAGER
if (eReflowReason_Incremental == aReflowState.reason) {
diff --git a/layout/generic/nsBlockReflowState.cpp b/layout/generic/nsBlockReflowState.cpp
index d88f916abd4a..32bf803e5edb 100644
--- a/layout/generic/nsBlockReflowState.cpp
+++ b/layout/generic/nsBlockReflowState.cpp
@@ -1393,6 +1393,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Should we create a space manager?
nsCOMPtr spaceManager;
+ nsISpaceManager* oldSpaceManager = aReflowState.mSpaceManager;
if (NS_BLOCK_SPACE_MGR & mState) {
nsSpaceManager* rawPtr = new nsSpaceManager(this);
if (!rawPtr) {
@@ -1529,6 +1530,13 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
}
}
+ // If we set the space manager, then restore the old space manager now that we're
+ // going out of scope
+ if (NS_BLOCK_SPACE_MGR & mState) {
+ nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
+ reflowState.mSpaceManager = oldSpaceManager;
+ }
+
#if 0
#ifdef NOISY_SPACEMANAGER
if (eReflowReason_Incremental == aReflowState.reason) {
diff --git a/layout/generic/nsBlockReflowState.h b/layout/generic/nsBlockReflowState.h
index d88f916abd4a..32bf803e5edb 100644
--- a/layout/generic/nsBlockReflowState.h
+++ b/layout/generic/nsBlockReflowState.h
@@ -1393,6 +1393,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Should we create a space manager?
nsCOMPtr spaceManager;
+ nsISpaceManager* oldSpaceManager = aReflowState.mSpaceManager;
if (NS_BLOCK_SPACE_MGR & mState) {
nsSpaceManager* rawPtr = new nsSpaceManager(this);
if (!rawPtr) {
@@ -1529,6 +1530,13 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
}
}
+ // If we set the space manager, then restore the old space manager now that we're
+ // going out of scope
+ if (NS_BLOCK_SPACE_MGR & mState) {
+ nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
+ reflowState.mSpaceManager = oldSpaceManager;
+ }
+
#if 0
#ifdef NOISY_SPACEMANAGER
if (eReflowReason_Incremental == aReflowState.reason) {
diff --git a/layout/html/base/src/nsBlockFrame.cpp b/layout/html/base/src/nsBlockFrame.cpp
index d88f916abd4a..32bf803e5edb 100644
--- a/layout/html/base/src/nsBlockFrame.cpp
+++ b/layout/html/base/src/nsBlockFrame.cpp
@@ -1393,6 +1393,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Should we create a space manager?
nsCOMPtr spaceManager;
+ nsISpaceManager* oldSpaceManager = aReflowState.mSpaceManager;
if (NS_BLOCK_SPACE_MGR & mState) {
nsSpaceManager* rawPtr = new nsSpaceManager(this);
if (!rawPtr) {
@@ -1529,6 +1530,13 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
}
}
+ // If we set the space manager, then restore the old space manager now that we're
+ // going out of scope
+ if (NS_BLOCK_SPACE_MGR & mState) {
+ nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
+ reflowState.mSpaceManager = oldSpaceManager;
+ }
+
#if 0
#ifdef NOISY_SPACEMANAGER
if (eReflowReason_Incremental == aReflowState.reason) {
diff --git a/layout/html/base/src/nsBlockReflowState.cpp b/layout/html/base/src/nsBlockReflowState.cpp
index d88f916abd4a..32bf803e5edb 100644
--- a/layout/html/base/src/nsBlockReflowState.cpp
+++ b/layout/html/base/src/nsBlockReflowState.cpp
@@ -1393,6 +1393,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Should we create a space manager?
nsCOMPtr spaceManager;
+ nsISpaceManager* oldSpaceManager = aReflowState.mSpaceManager;
if (NS_BLOCK_SPACE_MGR & mState) {
nsSpaceManager* rawPtr = new nsSpaceManager(this);
if (!rawPtr) {
@@ -1529,6 +1530,13 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
}
}
+ // If we set the space manager, then restore the old space manager now that we're
+ // going out of scope
+ if (NS_BLOCK_SPACE_MGR & mState) {
+ nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
+ reflowState.mSpaceManager = oldSpaceManager;
+ }
+
#if 0
#ifdef NOISY_SPACEMANAGER
if (eReflowReason_Incremental == aReflowState.reason) {
diff --git a/layout/html/base/src/nsBlockReflowState.h b/layout/html/base/src/nsBlockReflowState.h
index d88f916abd4a..32bf803e5edb 100644
--- a/layout/html/base/src/nsBlockReflowState.h
+++ b/layout/html/base/src/nsBlockReflowState.h
@@ -1393,6 +1393,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Should we create a space manager?
nsCOMPtr spaceManager;
+ nsISpaceManager* oldSpaceManager = aReflowState.mSpaceManager;
if (NS_BLOCK_SPACE_MGR & mState) {
nsSpaceManager* rawPtr = new nsSpaceManager(this);
if (!rawPtr) {
@@ -1529,6 +1530,13 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
}
}
+ // If we set the space manager, then restore the old space manager now that we're
+ // going out of scope
+ if (NS_BLOCK_SPACE_MGR & mState) {
+ nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
+ reflowState.mSpaceManager = oldSpaceManager;
+ }
+
#if 0
#ifdef NOISY_SPACEMANAGER
if (eReflowReason_Incremental == aReflowState.reason) {
diff --git a/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/layout/html/forms/src/nsHTMLButtonControlFrame.cpp
index 4c5f646939a9..1747141d369c 100644
--- a/layout/html/forms/src/nsHTMLButtonControlFrame.cpp
+++ b/layout/html/forms/src/nsHTMLButtonControlFrame.cpp
@@ -387,7 +387,10 @@ nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext& aPresContext,
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) styleDisplay);
mInline = (NS_STYLE_DISPLAY_BLOCK != styleDisplay->mDisplay);
- PRUint8 flags = (mInline) ? NS_BLOCK_SHRINK_WRAP : 0;
+ PRUint32 flags = NS_BLOCK_SPACE_MGR;
+ if (mInline) {
+ flags |= NS_BLOCK_SHRINK_WRAP;
+ }
nsIFrame* areaFrame;
NS_NewAreaFrame(&areaFrame, flags);
mFrames.SetFrames(areaFrame);