Changed to handle FrameRemoved reflow command for an absolutely positioned

child frame
This commit is contained in:
troy%netscape.com 1999-01-07 05:46:26 +00:00
Родитель d3df2a0245
Коммит fd0d24ebb6
2 изменённых файлов: 144 добавлений и 20 удалений

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

@ -262,24 +262,86 @@ nsAreaFrame::Reflow(nsIPresContext& aPresContext,
aReflowState.reflowCommand->GetTarget(targetFrame); aReflowState.reflowCommand->GetTarget(targetFrame);
if (this == targetFrame) { if (this == targetFrame) {
nsIAtom* listName; nsIAtom* listName;
PRBool isAbsoluteChild;
// See if it's for an absolutely positioned child frame
aReflowState.reflowCommand->GetChildListName(listName); aReflowState.reflowCommand->GetChildListName(listName);
if (nsLayoutAtoms::absoluteList == listName) { isAbsoluteChild = nsLayoutAtoms::absoluteList == listName;
NS_IF_RELEASE(listName);
if (isAbsoluteChild) {
nsIReflowCommand::ReflowType type; nsIReflowCommand::ReflowType type;
aReflowState.reflowCommand->GetType(type); aReflowState.reflowCommand->GetType(type);
NS_ASSERTION(nsIReflowCommand::FrameAppended == type, "unexpected reflow type");
// Add the frames to our list of absolutely position frames // Handle each specific type
nsIFrame* childFrames; if (nsIReflowCommand::FrameAppended == type) {
aReflowState.reflowCommand->GetChildFrame(childFrames); // Add the frames to our list of absolutely position frames
NS_ASSERTION(nsnull != childFrames, "null child list"); nsIFrame* childFrames;
AddAbsoluteFrame(childFrames); aReflowState.reflowCommand->GetChildFrame(childFrames);
NS_ASSERTION(nsnull != childFrames, "null child list");
AddAbsoluteFrame(childFrames);
// Indicate we handled the reflow command // Indicate we handled the reflow command
wasHandled = PR_TRUE; wasHandled = PR_TRUE;
} else if (nsIReflowCommand::FrameRemoved == type) {
// Get the new frame
nsIFrame* childFrame;
aReflowState.reflowCommand->GetChildFrame(childFrame);
// Find the frame in our list of absolutely positioned children
// and remove it
if (mAbsoluteFrames == childFrame) {
childFrame->GetNextSibling(mAbsoluteFrames);
} else {
nsIFrame* prevSibling = nsnull;
for (nsIFrame* f = mAbsoluteFrames; nsnull != f; f->GetNextSibling(f)) {
if (f == childFrame) {
break;
}
prevSibling = f;
}
NS_ASSERTION(nsnull != prevSibling, "didn't find frame");
nsIFrame* nextSibling;
childFrame->GetNextSibling(nextSibling);
prevSibling->SetNextSibling(nextSibling);
}
// Now go ahead and delete the child frame
childFrame->DeleteFrame(aPresContext);
// XXX We don't need to reflow all the absolutely positioned
// frames. Compute the desired size and exit...
wasHandled = PR_TRUE;
} else if (nsIReflowCommand::FrameInserted == type) {
// Get the new frame
nsIFrame* childFrame;
aReflowState.reflowCommand->GetChildFrame(childFrame);
// Get the previous sibling
nsIFrame* prevSibling;
aReflowState.reflowCommand->GetPrevSiblingFrame(prevSibling);
// Insert the frame
if (nsnull == prevSibling) {
mAbsoluteFrames = childFrame;
} else {
nsIFrame* nextSibling;
prevSibling->GetNextSibling(nextSibling);
prevSibling->SetNextSibling(childFrame);
childFrame->SetNextSibling(nextSibling);
}
wasHandled = PR_TRUE;
} else {
NS_ASSERTION(PR_FALSE, "unexpected reflow type");
}
} }
NS_IF_RELEASE(listName);
} }
} }

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

@ -262,24 +262,86 @@ nsAreaFrame::Reflow(nsIPresContext& aPresContext,
aReflowState.reflowCommand->GetTarget(targetFrame); aReflowState.reflowCommand->GetTarget(targetFrame);
if (this == targetFrame) { if (this == targetFrame) {
nsIAtom* listName; nsIAtom* listName;
PRBool isAbsoluteChild;
// See if it's for an absolutely positioned child frame
aReflowState.reflowCommand->GetChildListName(listName); aReflowState.reflowCommand->GetChildListName(listName);
if (nsLayoutAtoms::absoluteList == listName) { isAbsoluteChild = nsLayoutAtoms::absoluteList == listName;
NS_IF_RELEASE(listName);
if (isAbsoluteChild) {
nsIReflowCommand::ReflowType type; nsIReflowCommand::ReflowType type;
aReflowState.reflowCommand->GetType(type); aReflowState.reflowCommand->GetType(type);
NS_ASSERTION(nsIReflowCommand::FrameAppended == type, "unexpected reflow type");
// Add the frames to our list of absolutely position frames // Handle each specific type
nsIFrame* childFrames; if (nsIReflowCommand::FrameAppended == type) {
aReflowState.reflowCommand->GetChildFrame(childFrames); // Add the frames to our list of absolutely position frames
NS_ASSERTION(nsnull != childFrames, "null child list"); nsIFrame* childFrames;
AddAbsoluteFrame(childFrames); aReflowState.reflowCommand->GetChildFrame(childFrames);
NS_ASSERTION(nsnull != childFrames, "null child list");
AddAbsoluteFrame(childFrames);
// Indicate we handled the reflow command // Indicate we handled the reflow command
wasHandled = PR_TRUE; wasHandled = PR_TRUE;
} else if (nsIReflowCommand::FrameRemoved == type) {
// Get the new frame
nsIFrame* childFrame;
aReflowState.reflowCommand->GetChildFrame(childFrame);
// Find the frame in our list of absolutely positioned children
// and remove it
if (mAbsoluteFrames == childFrame) {
childFrame->GetNextSibling(mAbsoluteFrames);
} else {
nsIFrame* prevSibling = nsnull;
for (nsIFrame* f = mAbsoluteFrames; nsnull != f; f->GetNextSibling(f)) {
if (f == childFrame) {
break;
}
prevSibling = f;
}
NS_ASSERTION(nsnull != prevSibling, "didn't find frame");
nsIFrame* nextSibling;
childFrame->GetNextSibling(nextSibling);
prevSibling->SetNextSibling(nextSibling);
}
// Now go ahead and delete the child frame
childFrame->DeleteFrame(aPresContext);
// XXX We don't need to reflow all the absolutely positioned
// frames. Compute the desired size and exit...
wasHandled = PR_TRUE;
} else if (nsIReflowCommand::FrameInserted == type) {
// Get the new frame
nsIFrame* childFrame;
aReflowState.reflowCommand->GetChildFrame(childFrame);
// Get the previous sibling
nsIFrame* prevSibling;
aReflowState.reflowCommand->GetPrevSiblingFrame(prevSibling);
// Insert the frame
if (nsnull == prevSibling) {
mAbsoluteFrames = childFrame;
} else {
nsIFrame* nextSibling;
prevSibling->GetNextSibling(nextSibling);
prevSibling->SetNextSibling(childFrame);
childFrame->SetNextSibling(nextSibling);
}
wasHandled = PR_TRUE;
} else {
NS_ASSERTION(PR_FALSE, "unexpected reflow type");
}
} }
NS_IF_RELEASE(listName);
} }
} }