Moved ContentDeleted() document notification code to the style system which

generates the reflow command
This commit is contained in:
troy@netscape.com
1998-09-25 05:13:06 +00:00
parent a6caa3c0e7
commit e78f443a85
32 changed files with 836 additions and 1399 deletions

View File

@@ -252,6 +252,12 @@ public:
nsIContent* aChild,
PRInt32 aIndexInContainer);
NS_IMETHOD ContentRemoved(nsIPresContext* aPresContext,
nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer);
// XXX style rule enumerations
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
@@ -1565,6 +1571,42 @@ HTMLStyleSheetImpl::ContentInserted(nsIPresContext* aPresContext,
return rv;
}
NS_IMETHODIMP
HTMLStyleSheetImpl::ContentRemoved(nsIPresContext* aPresContext,
nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer)
{
nsIPresShell* shell = aPresContext->GetShell();
nsresult rv = NS_OK;
// Find the child frame
nsIFrame* childFrame = shell->FindFrameWithContent(aChild);
if (nsnull != childFrame) {
// Get the parent frame.
// Note that we use the content parent, and not the geometric parent,
// in case the frame has been moved out of the flow...
nsIFrame* parentFrame;
childFrame->GetContentParent(parentFrame);
NS_ASSERTION(nsnull != parentFrame, "null content parent frame");
// Notify the parent frame with a reflow command.
nsIReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, parentFrame,
nsIReflowCommand::FrameDeleted, childFrame);
if (NS_SUCCEEDED(rv)) {
shell->AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}
NS_RELEASE(shell);
return rv;
}
void HTMLStyleSheetImpl::List(FILE* out, PRInt32 aIndent) const
{
nsAutoString buffer;