diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index a13ceb37cad..967d0fd21d7 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -6562,17 +6562,18 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsFrameConstructorState& aSta } // See if it's relatively positioned else if ((NS_STYLE_POSITION_RELATIVE == aDisplay->mPosition) && - ((NS_STYLE_DISPLAY_BLOCK == aDisplay->mDisplay) || - (NS_STYLE_DISPLAY_INLINE == aDisplay->mDisplay) || - (NS_STYLE_DISPLAY_LIST_ITEM == aDisplay->mDisplay))) { + (aDisplay->IsBlockInside() || + (NS_STYLE_DISPLAY_INLINE == aDisplay->mDisplay))) { if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) { ProcessPseudoFrames(aState, aFrameItems); } // Is it block-level or inline-level? - if ((NS_STYLE_DISPLAY_BLOCK == aDisplay->mDisplay) || - (NS_STYLE_DISPLAY_LIST_ITEM == aDisplay->mDisplay)) { - // Create a wrapper frame. No space manager, though - newFrame = NS_NewRelativeItemWrapperFrame(mPresShell, aStyleContext); + if (aDisplay->IsBlockInside()) { + // Create a wrapper frame. Only need space manager if it's inline-block + PRUint32 flags = (aDisplay->mDisplay == NS_STYLE_DISPLAY_INLINE_BLOCK ? + NS_BLOCK_SPACE_MGR | NS_BLOCK_MARGIN_ROOT : 0); + newFrame = NS_NewRelativeItemWrapperFrame(mPresShell, aStyleContext, + flags); // XXXbz should we be passing in a non-null aContentParentFrame? ConstructBlock(aState, aDisplay, aContent, aParentFrame, nsnull, aStyleContext, &newFrame, @@ -12634,7 +12635,7 @@ nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState, blockSC = mPresShell->StyleSet()-> ResolvePseudoStyleFor(aContent, blockStyle, aStyleContext); - blockFrame = NS_NewRelativeItemWrapperFrame(mPresShell, blockSC); + blockFrame = NS_NewRelativeItemWrapperFrame(mPresShell, blockSC, 0); } else { blockStyle = nsCSSAnonBoxes::mozAnonymousBlock; diff --git a/mozilla/layout/generic/nsHTMLParts.h b/mozilla/layout/generic/nsHTMLParts.h index c2334962eaf..8660f113a49 100644 --- a/mozilla/layout/generic/nsHTMLParts.h +++ b/mozilla/layout/generic/nsHTMLParts.h @@ -125,8 +125,8 @@ NS_NewFloatingItemWrapperFrame(nsIPresShell* aPresShell, nsStyleContext* aContex // This type of AreaFrame doesn't use its own space manager and // doesn't shrink wrap. inline nsIFrame* -NS_NewRelativeItemWrapperFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) { - return NS_NewAreaFrame(aPresShell, aContext, 0); +NS_NewRelativeItemWrapperFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags) { + return NS_NewAreaFrame(aPresShell, aContext, aFlags); } nsIFrame* diff --git a/mozilla/layout/reftests/bugs/398797-1-ref.html b/mozilla/layout/reftests/bugs/398797-1-ref.html new file mode 100644 index 00000000000..cf32e846bc2 --- /dev/null +++ b/mozilla/layout/reftests/bugs/398797-1-ref.html @@ -0,0 +1,11 @@ + +
+ + + +