Bug 398797: let rel.-positioned inline-blocks be containing blocks for abs. content. r+sr=bz, a=blocking1.9+

This commit is contained in:
dholbert@cs.stanford.edu 2007-11-07 12:00:51 -08:00
parent a0238499f9
commit 9f681499ba
9 changed files with 83 additions and 10 deletions

View File

@ -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;

View File

@ -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*

View File

@ -0,0 +1,11 @@
<html>
<head>
<link rel="stylesheet" href="398797-style.css"/>
</head>
<body>
<div class="green">foo</div>
<div class="blue">
<span class="yellow">bar</span>
</div>
</body>
</html>

View File

@ -0,0 +1,11 @@
<html>
<head>
<link rel="stylesheet" href="398797-style.css"/>
</head>
<body>
<div class="green">foo</div>
<div class="blue rel in">
<span class="yellow abs pos">bar</span>
</div>
</body>
</html>

View File

@ -0,0 +1,11 @@
<html>
<head>
<link rel="stylesheet" href="398797-style.css"/>
</head>
<body>
<div class="green">foo</div>
<div class="blue rel">
<span class="yellow abs pos">bar</span>
</div>
</body>
</html>

View File

@ -0,0 +1,11 @@
<html>
<head>
<link rel="stylesheet" href="398797-style.css"/>
</head>
<body>
<div class="green">foo</div>
<div class="blue abs in">
<span class="yellow abs pos">bar</span>
</div>
</body>
</html>

View File

@ -0,0 +1,11 @@
<html>
<head>
<link rel="stylesheet" href="398797-style.css"/>
</head>
<body>
<div class="green">foo</div>
<div class="blue abs">
<span class="yellow abs pos">bar</span>
</div>
</body>
</html>

View File

@ -0,0 +1,13 @@
/* Size the divs */
div { width: 50px; height: 50px; }
/* Colors */
div.green { background: lightgreen; }
div.blue { background: lightblue; }
span.yellow { background: yellow; }
/* Positioning */
.abs { position: absolute; }
.rel { position: relative; }
.in { display: inline-block; }
.pos { top: 0px; left: 0px; }

View File

@ -423,6 +423,10 @@ fails == 393655-2.html 393655-2-ref.html # Remove 'fails' when 393655 lands
== 395331-1.xml 395331-1-ref.xml
== 396286-1.html about:blank # crash test
== 398289-1.html 398289-1-ref.html
== 398797-1a.html 398797-1-ref.html
== 398797-1b.html 398797-1-ref.html
== 398797-1c.html 398797-1-ref.html
== 398797-1d.html 398797-1-ref.html
== 399384-1.html 399384-1-ref.html
fails == 400171-1a.html 400171-1-ref.html # Remove 'fails' when 400171 lands
== 400171-1b.html 400171-1-ref.html