зеркало из https://github.com/mozilla/pjs.git
Bug 305032. Fix various situation where focus is confused and commands get disabled/grayed out. r+sr=bryner
This commit is contained in:
Родитель
434c021514
Коммит
b0dd12c84a
|
@ -851,6 +851,13 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
if (focusController) {
|
||||
// Make sure the focus controller is up-to-date, since restoring
|
||||
// focus memory may have caused focus to go elsewhere.
|
||||
|
||||
if (gLastFocusedDocument && gLastFocusedDocument == mDocument) {
|
||||
nsCOMPtr<nsIDOMElement> focusElement = do_QueryInterface(mCurrentFocus);
|
||||
focusController->SetFocusedElement(focusElement);
|
||||
}
|
||||
|
||||
PRBool isSuppressed;
|
||||
focusController->GetSuppressFocus(&isSuppressed);
|
||||
|
@ -862,14 +869,6 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
|||
focusController->GetSuppressFocus(&isSuppressed);
|
||||
}
|
||||
focusController->SetSuppressFocusScroll(PR_FALSE);
|
||||
|
||||
// Make sure the focus controller is up-to-date, since restoring
|
||||
// focus memory may have caused focus to go elsewhere.
|
||||
|
||||
if (gLastFocusedDocument && gLastFocusedDocument == mDocument) {
|
||||
nsCOMPtr<nsIDOMElement> focusElement = do_QueryInterface(mCurrentFocus);
|
||||
focusController->SetFocusedElement(focusElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -360,8 +360,7 @@ nsFocusController::Focus(nsIDOMEvent* aEvent)
|
|||
else
|
||||
mPreviousElement = nsnull;
|
||||
|
||||
if (!mCurrentElement && mCurrentWindow != mPreviousWindow) {
|
||||
mNeedUpdateCommands = PR_TRUE;
|
||||
if (!mCurrentElement) {
|
||||
UpdateCommands();
|
||||
}
|
||||
}
|
||||
|
@ -518,6 +517,8 @@ nsFocusController::SetSuppressFocus(PRBool aSuppressFocus, const char* aReason)
|
|||
// because nsPresShell::UnsuppressPainting may have just now unsuppressed
|
||||
// focus on the currently focused window
|
||||
if (!mSuppressFocus) {
|
||||
// Always update commands if we have a current element
|
||||
mNeedUpdateCommands = mNeedUpdateCommands || mCurrentElement;
|
||||
UpdateCommands();
|
||||
}
|
||||
|
||||
|
|
|
@ -1446,9 +1446,12 @@ var gMsgEditorCreationObserver =
|
|||
editorStyle.addStyleSheet("chrome://messenger/skin/messageQuotes.css");
|
||||
InitEditor();
|
||||
}
|
||||
// Now that we know this document is an editor, ensure
|
||||
// that CommandUpdate_MsgCompose() will update commands
|
||||
// next time the editable document receives focus
|
||||
// Now that we know this document is an editor, update commands now if
|
||||
// the document has focus, or next time it receives focus via
|
||||
// CommandUpdate_MsgCompose()
|
||||
if (gLastWindowToHaveFocus == document.commandDispatcher.focusedWindow)
|
||||
updateComposeItems();
|
||||
else
|
||||
gLastWindowToHaveFocus = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1425,9 +1425,12 @@ var gMsgEditorCreationObserver =
|
|||
var editor = GetCurrentEditor();
|
||||
if (editor && GetCurrentCommandManager() == aSubject)
|
||||
InitEditor(editor);
|
||||
// Now that we know this document is an editor, ensure
|
||||
// that CommandUpdate_MsgCompose() will update commands
|
||||
// next time the editable document receives focus
|
||||
// Now that we know this document is an editor, update commands now if
|
||||
// the document has focus, or next time it receives focus via
|
||||
// CommandUpdate_MsgCompose()
|
||||
if (gLastWindowToHaveFocus == document.commandDispatcher.focusedWindow)
|
||||
updateComposeItems();
|
||||
else
|
||||
gLastWindowToHaveFocus = null;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче