From af1ea33dd6ce743a714af0ab2855faa0a9b86479 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Thu, 19 May 2005 16:18:32 +0000 Subject: [PATCH] Update focus and hover state correctly when an _ancestor_ of the current focus or hover content is removed from the DOM. Bug 293914, r+sr=roc, a=asa --- content/events/src/nsEventStateManager.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index e7f7bff27e9d..a0b93328e6e2 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -4216,7 +4216,8 @@ nsEventStateManager::GetFocusedFrame(nsIFrame** aFrame) NS_IMETHODIMP nsEventStateManager::ContentRemoved(nsIContent* aContent) { - if (aContent == mCurrentFocus) { + if (mCurrentFocus && + nsContentUtils::ContentIsDescendantOf(mCurrentFocus, aContent)) { // Note that we don't use SetContentState() here because // we don't want to fire a blur. Blurs should only be fired // in response to clicks or tabbing. @@ -4224,7 +4225,8 @@ nsEventStateManager::ContentRemoved(nsIContent* aContent) SetFocusedContent(nsnull); } - if (aContent == mHoverContent) { + if (mHoverContent && + nsContentUtils::ContentIsDescendantOf(mHoverContent, aContent)) { // Since hover is hierarchical, set the current hover to the // content's parent node. mHoverContent = aContent->GetParent();