Ensure that the event state manager doesn't send content state changed notifications for content that's been removed from the document. b=157322 r=bryner sr=kin

git-svn-id: svn://10.0.0.236/trunk@127627 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dbaron%fas.harvard.edu 2002-08-19 18:31:59 +00:00
parent 8ec55d91d3
commit 12c9b29b2b
3 changed files with 29 additions and 2 deletions

View File

@ -4099,6 +4099,21 @@ nsEventStateManager::ContentRemoved(nsIContent* aContent)
NS_RELEASE(mCurrentFocus);
}
if (aContent == mHoverContent) {
// Since hover is hierarchical, set the current hover to the
// content's parent node.
NS_RELEASE(mHoverContent);
aContent->GetParent(mHoverContent);
}
if (aContent == mActiveContent) {
NS_RELEASE(mActiveContent);
}
if (aContent == mDragOverContent) {
NS_RELEASE(mDragOverContent);
}
return NS_OK;
}

View File

@ -5264,6 +5264,13 @@ PresShell::ContentReplaced(nsIDocument* aDocument,
nsIContent* aNewChild,
PRInt32 aIndexInContainer)
{
// Notify the ESM that the content has been removed, so that
// it can clean up any state related to the content.
nsCOMPtr<nsIEventStateManager> esm;
mPresContext->GetEventStateManager(getter_AddRefs(esm));
if (esm)
esm->ContentRemoved(aOldChild);
WillCauseReflow();
nsresult rv = mStyleSet->ContentReplaced(mPresContext, aContainer, aOldChild,
aNewChild, aIndexInContainer);
@ -5280,7 +5287,6 @@ PresShell::ContentRemoved(nsIDocument *aDocument,
{
// Notify the ESM that the content has been removed, so that
// it can clean up any state related to the content.
nsCOMPtr<nsIEventStateManager> esm;
mPresContext->GetEventStateManager(getter_AddRefs(esm));
if (esm)

View File

@ -5264,6 +5264,13 @@ PresShell::ContentReplaced(nsIDocument* aDocument,
nsIContent* aNewChild,
PRInt32 aIndexInContainer)
{
// Notify the ESM that the content has been removed, so that
// it can clean up any state related to the content.
nsCOMPtr<nsIEventStateManager> esm;
mPresContext->GetEventStateManager(getter_AddRefs(esm));
if (esm)
esm->ContentRemoved(aOldChild);
WillCauseReflow();
nsresult rv = mStyleSet->ContentReplaced(mPresContext, aContainer, aOldChild,
aNewChild, aIndexInContainer);
@ -5280,7 +5287,6 @@ PresShell::ContentRemoved(nsIDocument *aDocument,
{
// Notify the ESM that the content has been removed, so that
// it can clean up any state related to the content.
nsCOMPtr<nsIEventStateManager> esm;
mPresContext->GetEventStateManager(getter_AddRefs(esm));
if (esm)