Fix for bug 89236: printing is producing crash

Modified nsBlockFrame::DrainOverflowLines() so
that it reparents any floater out-of-flow frames
and their views.

r=dbaron@fas.harvard.edu  sr=waterson@netscape.com  a=pdt
This commit is contained in:
kin%netscape.com 2001-09-28 13:59:23 +00:00
Родитель 862ea625c9
Коммит e3bd36cd90
2 изменённых файлов: 46 добавлений и 0 удалений

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

@ -4196,6 +4196,29 @@ nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext)
// views need to be reparented
nsHTMLContainerFrame::ReparentFrameView(aPresContext, frame, prevBlock, this);
// If the frame we are looking at is a placeholder for a floater, we
// need to reparent both it's out-of-flow frame and any views it has.
//
// Note: A floating table (example: style="position: relative; float: right")
// is an example of an out-of-flow frame with a view
nsCOMPtr<nsIAtom> frameType;
frame->GetFrameType(getter_AddRefs(frameType));
if (nsLayoutAtoms::placeholderFrame == frameType.get()) {
nsIFrame *outOfFlowFrame = NS_STATIC_CAST(nsPlaceholderFrame*, frame)->GetOutOfFlowFrame();
if (outOfFlowFrame) {
const nsStyleDisplay* display = nsnull;
outOfFlowFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
if (display && !display->IsAbsolutelyPositioned()) {
// It's not an absolute or fixed positioned frame, so it
// must be a floater!
outOfFlowFrame->SetParent(this);
nsHTMLContainerFrame::ReparentFrameView(aPresContext, outOfFlowFrame, prevBlock, this);
}
}
}
// Get the next frame
lastFrame = frame;
frame->GetNextSibling(&frame);

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

@ -4196,6 +4196,29 @@ nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext)
// views need to be reparented
nsHTMLContainerFrame::ReparentFrameView(aPresContext, frame, prevBlock, this);
// If the frame we are looking at is a placeholder for a floater, we
// need to reparent both it's out-of-flow frame and any views it has.
//
// Note: A floating table (example: style="position: relative; float: right")
// is an example of an out-of-flow frame with a view
nsCOMPtr<nsIAtom> frameType;
frame->GetFrameType(getter_AddRefs(frameType));
if (nsLayoutAtoms::placeholderFrame == frameType.get()) {
nsIFrame *outOfFlowFrame = NS_STATIC_CAST(nsPlaceholderFrame*, frame)->GetOutOfFlowFrame();
if (outOfFlowFrame) {
const nsStyleDisplay* display = nsnull;
outOfFlowFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
if (display && !display->IsAbsolutelyPositioned()) {
// It's not an absolute or fixed positioned frame, so it
// must be a floater!
outOfFlowFrame->SetParent(this);
nsHTMLContainerFrame::ReparentFrameView(aPresContext, outOfFlowFrame, prevBlock, this);
}
}
}
// Get the next frame
lastFrame = frame;
frame->GetNextSibling(&frame);