Changed FrameInserted incremental reflow code to insert the new frame

into the child frame list
This commit is contained in:
troy%netscape.com 1998-09-19 04:29:36 +00:00
Родитель 62b1375f69
Коммит f1140763a6
3 изменённых файлов: 54 добавлений и 0 удалений

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

@ -258,6 +258,23 @@ nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout,
return rv;
}
void
nsInlineFrame::InsertNewFrame(nsIFrame* aNewFrame, nsIFrame* aPrevSibling)
{
nsIFrame* nextSibling = nsnull;
if (nsnull == aPrevSibling) {
if (nsnull != mFirstChild) {
mFirstChild->GetNextSibling(nextSibling);
}
mFirstChild = aNewFrame;
} else {
aPrevSibling->GetNextSibling(nextSibling);
aPrevSibling->SetNextSibling(aNewFrame);
}
aNewFrame->SetNextSibling(nextSibling);
}
NS_IMETHODIMP
nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
@ -300,11 +317,20 @@ nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
if (this == target) {
nsIReflowCommand::ReflowType type;
state.reflowCommand->GetType(type);
nsIFrame* newFrame;
nsIFrame* prevSibling;
switch (type) {
case nsIReflowCommand::FrameAppended:
rv = FrameAppendedReflow(state);
break;
case nsIReflowCommand::FrameInserted:
// Link the new frame into the child list
state.reflowCommand->GetChildFrame(newFrame);
state.reflowCommand->GetPrevSiblingFrame(prevSibling);
InsertNewFrame(newFrame, prevSibling);
// fall thru...
default:
// XXX For now map the other incremental operations into full reflows
rv = ResizeReflow(state);

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

@ -122,6 +122,8 @@ protected:
nsresult AppendNewFrames(nsIPresContext* aPresContext, nsIFrame*);
void InsertNewFrame(nsIFrame* aNewFrame, nsIFrame* aPrevSibling);
friend nsresult NS_NewInlineFrame(nsIContent* aContent, nsIFrame* aParentFrame,
nsIFrame*& aNewFrame);
};

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

@ -258,6 +258,23 @@ nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout,
return rv;
}
void
nsInlineFrame::InsertNewFrame(nsIFrame* aNewFrame, nsIFrame* aPrevSibling)
{
nsIFrame* nextSibling = nsnull;
if (nsnull == aPrevSibling) {
if (nsnull != mFirstChild) {
mFirstChild->GetNextSibling(nextSibling);
}
mFirstChild = aNewFrame;
} else {
aPrevSibling->GetNextSibling(nextSibling);
aPrevSibling->SetNextSibling(aNewFrame);
}
aNewFrame->SetNextSibling(nextSibling);
}
NS_IMETHODIMP
nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
@ -300,11 +317,20 @@ nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
if (this == target) {
nsIReflowCommand::ReflowType type;
state.reflowCommand->GetType(type);
nsIFrame* newFrame;
nsIFrame* prevSibling;
switch (type) {
case nsIReflowCommand::FrameAppended:
rv = FrameAppendedReflow(state);
break;
case nsIReflowCommand::FrameInserted:
// Link the new frame into the child list
state.reflowCommand->GetChildFrame(newFrame);
state.reflowCommand->GetPrevSiblingFrame(prevSibling);
InsertNewFrame(newFrame, prevSibling);
// fall thru...
default:
// XXX For now map the other incremental operations into full reflows
rv = ResizeReflow(state);