From f34440c5b90889c6ef7c1bc799f23ec888cf22b3 Mon Sep 17 00:00:00 2001 From: "ere%atp.fi" Date: Tue, 29 Apr 2003 18:24:28 +0000 Subject: [PATCH] Bug 201242: When minimize and then restore, two carets appear in a mail compose window Patch by bryner and me r=bryner sr=jst a=sspitzer --- dom/src/base/nsFocusController.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dom/src/base/nsFocusController.cpp b/dom/src/base/nsFocusController.cpp index 723a4deeac4..95cba0ab506 100644 --- a/dom/src/base/nsFocusController.cpp +++ b/dom/src/base/nsFocusController.cpp @@ -105,7 +105,11 @@ nsFocusController::GetFocusedWindow(nsIDOMWindowInternal** aWindow) NS_IMETHODIMP nsFocusController::SetFocusedElement(nsIDOMElement* aElement) { - mPreviousElement = mCurrentElement; + if (mCurrentElement) + mPreviousElement = mCurrentElement; + else if (aElement) + mPreviousElement = aElement; + mCurrentElement = aElement; if (!mSuppressFocus) { @@ -309,8 +313,10 @@ nsFocusController::Focus(nsIDOMEvent* aEvent) nsCOMPtr windowDoc; mCurrentWindow->GetDocument(getter_AddRefs(windowDoc)); if (ownerDoc != windowDoc) - mCurrentElement = nsnull; + mCurrentElement = mPreviousElement = nsnull; } + else + mPreviousElement = nsnull; if (!mCurrentElement) UpdateCommands(NS_LITERAL_STRING("focus"));