зеркало из 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) {
|
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;
|
PRBool isSuppressed;
|
||||||
focusController->GetSuppressFocus(&isSuppressed);
|
focusController->GetSuppressFocus(&isSuppressed);
|
||||||
|
@ -862,14 +869,6 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||||
focusController->GetSuppressFocus(&isSuppressed);
|
focusController->GetSuppressFocus(&isSuppressed);
|
||||||
}
|
}
|
||||||
focusController->SetSuppressFocusScroll(PR_FALSE);
|
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;
|
break;
|
||||||
|
|
|
@ -360,8 +360,7 @@ nsFocusController::Focus(nsIDOMEvent* aEvent)
|
||||||
else
|
else
|
||||||
mPreviousElement = nsnull;
|
mPreviousElement = nsnull;
|
||||||
|
|
||||||
if (!mCurrentElement && mCurrentWindow != mPreviousWindow) {
|
if (!mCurrentElement) {
|
||||||
mNeedUpdateCommands = PR_TRUE;
|
|
||||||
UpdateCommands();
|
UpdateCommands();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -518,6 +517,8 @@ nsFocusController::SetSuppressFocus(PRBool aSuppressFocus, const char* aReason)
|
||||||
// because nsPresShell::UnsuppressPainting may have just now unsuppressed
|
// because nsPresShell::UnsuppressPainting may have just now unsuppressed
|
||||||
// focus on the currently focused window
|
// focus on the currently focused window
|
||||||
if (!mSuppressFocus) {
|
if (!mSuppressFocus) {
|
||||||
|
// Always update commands if we have a current element
|
||||||
|
mNeedUpdateCommands = mNeedUpdateCommands || mCurrentElement;
|
||||||
UpdateCommands();
|
UpdateCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1446,10 +1446,13 @@ var gMsgEditorCreationObserver =
|
||||||
editorStyle.addStyleSheet("chrome://messenger/skin/messageQuotes.css");
|
editorStyle.addStyleSheet("chrome://messenger/skin/messageQuotes.css");
|
||||||
InitEditor();
|
InitEditor();
|
||||||
}
|
}
|
||||||
// Now that we know this document is an editor, ensure
|
// Now that we know this document is an editor, update commands now if
|
||||||
// that CommandUpdate_MsgCompose() will update commands
|
// the document has focus, or next time it receives focus via
|
||||||
// next time the editable document receives focus
|
// CommandUpdate_MsgCompose()
|
||||||
gLastWindowToHaveFocus = null;
|
if (gLastWindowToHaveFocus == document.commandDispatcher.focusedWindow)
|
||||||
|
updateComposeItems();
|
||||||
|
else
|
||||||
|
gLastWindowToHaveFocus = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1425,10 +1425,13 @@ var gMsgEditorCreationObserver =
|
||||||
var editor = GetCurrentEditor();
|
var editor = GetCurrentEditor();
|
||||||
if (editor && GetCurrentCommandManager() == aSubject)
|
if (editor && GetCurrentCommandManager() == aSubject)
|
||||||
InitEditor(editor);
|
InitEditor(editor);
|
||||||
// Now that we know this document is an editor, ensure
|
// Now that we know this document is an editor, update commands now if
|
||||||
// that CommandUpdate_MsgCompose() will update commands
|
// the document has focus, or next time it receives focus via
|
||||||
// next time the editable document receives focus
|
// CommandUpdate_MsgCompose()
|
||||||
gLastWindowToHaveFocus = null;
|
if (gLastWindowToHaveFocus == document.commandDispatcher.focusedWindow)
|
||||||
|
updateComposeItems();
|
||||||
|
else
|
||||||
|
gLastWindowToHaveFocus = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче