fixing regression caused by 93521 fix, and another, more friendly fix for the bug. r=bryner, sr=hyatt

This commit is contained in:
saari%netscape.com 2001-08-14 00:44:13 +00:00
parent 576ec53cbc
commit e75294835e

View File

@ -1507,8 +1507,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
if (newFocus && currFrame)
ChangeFocus(newFocus, currFrame, PR_TRUE);
else if (!suppressBlur) {
if(gLastFocusedDocument != mDocument)
SetContentState(nsnull, NS_EVENT_STATE_FOCUS);
SetContentState(nsnull, NS_EVENT_STATE_FOCUS);
}
// The rest is left button-specific.
@ -3727,8 +3726,20 @@ nsEventStateManager::SendFocusBlur(nsIPresContext* aPresContext, nsIContent *aCo
if (clearFirstFocusEvent) {
NS_RELEASE(mFirstFocusEvent);
}
} else if (!aContent) {
//fire focus on document even if the content isn't focusable (ie. text)
//see bugzilla bug 93521
nsEventStatus status = nsEventStatus_eIgnore;
nsEvent event;
event.eventStructType = NS_EVENT;
event.message = NS_FOCUS_CONTENT;
if (nsnull != mPresContext && mDocument) {
mDocument->HandleDOMEvent(mPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
}
}
nsIFrame * currentFocusFrame = nsnull;
if (mCurrentFocus)
presShell->GetPrimaryFrameFor(mCurrentFocus, &currentFocusFrame);