r=saari 42074 pd+dogfood ect. i think we finally nailed this one. focused objects now being passed focus events even when previous document couldnt take focus and is simply returning it. aka hitting return in url bar trying to focus document that will be destroyed to fetch new page.

This commit is contained in:
mjudge%netscape.com 2000-06-29 05:27:05 +00:00
Родитель f7409a961f
Коммит fa0242f3f6
2 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -346,6 +346,7 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext,
if (!mCurrentFocus && gLastFocusedContent)// must send it to the element that is loosing focus. since SendFocusBlur wont be called
gLastFocusedContent->HandleDOMEvent(gLastFocusedPresContext, &blurevent, nsnull, NS_EVENT_FLAG_INIT, &blurstatus);
if (commandDispatcher) {
commandDispatcher->SetSuppressFocus(PR_FALSE);
}
@ -358,11 +359,17 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext,
if (globalObject) {
nsIContent* currentFocus = mCurrentFocus;
mCurrentFocus = nsnull;
if(gLastFocusedDocument != mDocument)
if(gLastFocusedDocument != mDocument) {
mDocument->HandleDOMEvent(aPresContext, &focusevent, nsnull, NS_EVENT_FLAG_INIT, &status);
if (currentFocus && currentFocus != gLastFocusedContent)
currentFocus->HandleDOMEvent(aPresContext, &focusevent, nsnull, NS_EVENT_FLAG_INIT, &status);
}
globalObject->HandleDOMEvent(aPresContext, &focusevent, nsnull, NS_EVENT_FLAG_INIT, &status);
mCurrentFocus = currentFocus;
NS_IF_RELEASE(gLastFocusedContent);
gLastFocusedContent = mCurrentFocus;
NS_IF_ADDREF(gLastFocusedContent);
}

Просмотреть файл

@ -346,6 +346,7 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext,
if (!mCurrentFocus && gLastFocusedContent)// must send it to the element that is loosing focus. since SendFocusBlur wont be called
gLastFocusedContent->HandleDOMEvent(gLastFocusedPresContext, &blurevent, nsnull, NS_EVENT_FLAG_INIT, &blurstatus);
if (commandDispatcher) {
commandDispatcher->SetSuppressFocus(PR_FALSE);
}
@ -358,11 +359,17 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext,
if (globalObject) {
nsIContent* currentFocus = mCurrentFocus;
mCurrentFocus = nsnull;
if(gLastFocusedDocument != mDocument)
if(gLastFocusedDocument != mDocument) {
mDocument->HandleDOMEvent(aPresContext, &focusevent, nsnull, NS_EVENT_FLAG_INIT, &status);
if (currentFocus && currentFocus != gLastFocusedContent)
currentFocus->HandleDOMEvent(aPresContext, &focusevent, nsnull, NS_EVENT_FLAG_INIT, &status);
}
globalObject->HandleDOMEvent(aPresContext, &focusevent, nsnull, NS_EVENT_FLAG_INIT, &status);
mCurrentFocus = currentFocus;
NS_IF_RELEASE(gLastFocusedContent);
gLastFocusedContent = mCurrentFocus;
NS_IF_ADDREF(gLastFocusedContent);
}