Bug 71594. Reparent views from 'trailing' frame, but only make trailing frame if it'd have children. r=karnaze, sr=attinasi

This commit is contained in:
waterson%netscape.com 2001-03-19 22:16:47 +00:00
parent 96eeb7b828
commit ab1db03317
3 changed files with 55 additions and 38 deletions

View File

@ -12544,36 +12544,44 @@ nsCSSFrameConstructor::ConstructInline(nsIPresShell* aPresShell,
// list3's frames belong to another inline frame
nsIFrame* inlineFrame = nsnull;
if (aIsPositioned) {
NS_NewPositionedInlineFrame(aPresShell, &inlineFrame);
}
else {
NS_NewInlineFrame(aPresShell, &inlineFrame);
}
InitAndRestoreFrame(aPresContext, aState, aContent,
aParentFrame, aStyleContext, nsnull, inlineFrame);
if (aIsPositioned) {
// Relatively positioned frames need a view
nsHTMLContainerFrame::CreateViewForFrame(aPresContext, inlineFrame,
aStyleContext, nsnull, PR_FALSE);
}
if (list3) {
if (aIsPositioned) {
NS_NewPositionedInlineFrame(aPresShell, &inlineFrame);
}
else {
NS_NewInlineFrame(aPresShell, &inlineFrame);
}
InitAndRestoreFrame(aPresContext, aState, aContent,
aParentFrame, aStyleContext, nsnull, inlineFrame);
if (aIsPositioned) {
// Relatively positioned frames need a view
nsHTMLContainerFrame::CreateViewForFrame(aPresContext, inlineFrame,
aStyleContext, nsnull, PR_FALSE);
// Move list3's frames into the new view
nsIFrame* oldParent;
list3->GetParent(&oldParent);
nsHTMLContainerFrame::ReparentFrameViewList(aPresContext, list3, oldParent, inlineFrame);
}
// Reparent (cheaply) the frames in list3 - we don't have to futz
// with their style context because they already have the right one.
nsFrameList list;
list.AppendFrames(inlineFrame, list3);
inlineFrame->SetInitialChildList(aPresContext, nsnull, list3);
}
inlineFrame->SetInitialChildList(aPresContext, nsnull, list3);
// Mark the 3 frames as special. That way if any of the
// append/insert/remove methods try to fiddle with the children, the
// containing block will be reframed instead.
SetFrameIsSpecial(aState.mFrameManager, aNewFrame, blockFrame);
SetFrameIsSpecial(aState.mFrameManager, blockFrame, inlineFrame);
SetFrameIsSpecial(aState.mFrameManager, inlineFrame, nsnull);
if (inlineFrame)
SetFrameIsSpecial(aState.mFrameManager, inlineFrame, nsnull);
#ifdef DEBUG
if (gNoisyInlineConstruction) {
@ -12588,7 +12596,7 @@ nsCSSFrameConstructor::ConstructInline(nsIPresShell* aPresShell,
printf(" ==> block frame:\n");
frameDebug->List(aPresContext, stdout, 2);
}
if (NS_SUCCEEDED(inlineFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) {
if (inlineFrame && NS_SUCCEEDED(inlineFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) {
printf(" ==> trailing inline frame:\n");
frameDebug->List(aPresContext, stdout, 2);
}

View File

@ -12544,36 +12544,44 @@ nsCSSFrameConstructor::ConstructInline(nsIPresShell* aPresShell,
// list3's frames belong to another inline frame
nsIFrame* inlineFrame = nsnull;
if (aIsPositioned) {
NS_NewPositionedInlineFrame(aPresShell, &inlineFrame);
}
else {
NS_NewInlineFrame(aPresShell, &inlineFrame);
}
InitAndRestoreFrame(aPresContext, aState, aContent,
aParentFrame, aStyleContext, nsnull, inlineFrame);
if (aIsPositioned) {
// Relatively positioned frames need a view
nsHTMLContainerFrame::CreateViewForFrame(aPresContext, inlineFrame,
aStyleContext, nsnull, PR_FALSE);
}
if (list3) {
if (aIsPositioned) {
NS_NewPositionedInlineFrame(aPresShell, &inlineFrame);
}
else {
NS_NewInlineFrame(aPresShell, &inlineFrame);
}
InitAndRestoreFrame(aPresContext, aState, aContent,
aParentFrame, aStyleContext, nsnull, inlineFrame);
if (aIsPositioned) {
// Relatively positioned frames need a view
nsHTMLContainerFrame::CreateViewForFrame(aPresContext, inlineFrame,
aStyleContext, nsnull, PR_FALSE);
// Move list3's frames into the new view
nsIFrame* oldParent;
list3->GetParent(&oldParent);
nsHTMLContainerFrame::ReparentFrameViewList(aPresContext, list3, oldParent, inlineFrame);
}
// Reparent (cheaply) the frames in list3 - we don't have to futz
// with their style context because they already have the right one.
nsFrameList list;
list.AppendFrames(inlineFrame, list3);
inlineFrame->SetInitialChildList(aPresContext, nsnull, list3);
}
inlineFrame->SetInitialChildList(aPresContext, nsnull, list3);
// Mark the 3 frames as special. That way if any of the
// append/insert/remove methods try to fiddle with the children, the
// containing block will be reframed instead.
SetFrameIsSpecial(aState.mFrameManager, aNewFrame, blockFrame);
SetFrameIsSpecial(aState.mFrameManager, blockFrame, inlineFrame);
SetFrameIsSpecial(aState.mFrameManager, inlineFrame, nsnull);
if (inlineFrame)
SetFrameIsSpecial(aState.mFrameManager, inlineFrame, nsnull);
#ifdef DEBUG
if (gNoisyInlineConstruction) {
@ -12588,7 +12596,7 @@ nsCSSFrameConstructor::ConstructInline(nsIPresShell* aPresShell,
printf(" ==> block frame:\n");
frameDebug->List(aPresContext, stdout, 2);
}
if (NS_SUCCEEDED(inlineFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) {
if (inlineFrame && NS_SUCCEEDED(inlineFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) {
printf(" ==> trailing inline frame:\n");
frameDebug->List(aPresContext, stdout, 2);
}

View File

@ -0,0 +1 @@
<!doctype html public "-//w3c//dtd html 4.0 Transitional//en" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><body><span style="position:relative;left:20px;top:30px;"><hr /><span style="position:relative;left:70px;top:25px;">test</span></span></body></html>