per-window browse with caret: allow the caret to be moved with arrow keys on any window (e.g., viewsource) for which the caret is enabled, b=254078, r+sr=bzbarsky

This commit is contained in:
rbs%maths.uq.edu.au 2004-08-04 23:31:38 +00:00
parent 6310329ee0
commit 0d6c204cda

View File

@ -256,15 +256,17 @@ nsSelectMoveScrollCommand::DoSelectCommand(const char *aCommandName, nsIDOMWindo
GetSelectionControllerFromWindow(aWindow, getter_AddRefs(selCont));
NS_ENSURE_TRUE(selCont, NS_ERROR_NOT_INITIALIZED);
PRBool doBrowseWithCaret = PR_FALSE;
PRBool caretOn = PR_FALSE;
selCont->GetCaretEnabled(&caretOn);
nsCOMPtr<nsIEventStateManager> esm;
GetEventStateManagerForWindow(aWindow, getter_AddRefs(esm));
if (esm)
doBrowseWithCaret = esm->GetBrowseWithCaret();
nsresult rv;
if (doBrowseWithCaret)
// We allow the caret to be moved with arrow keys on any window for which
// the caret is enabled. In particular, this includes caret-browsing mode,
// but we refer to this mode again in the test condition for readability.
if (caretOn || (esm && esm->GetBrowseWithCaret()))
rv = DoCommandBrowseWithCaretOn(aCommandName, selCont, esm);
else
rv = DoCommandBrowseWithCaretOff(aCommandName, selCont);