Bug 286933 - Enter that selects autocomplete entry should be hidden from page scripts. r=mconnor.
git-svn-id: svn://10.0.0.236/trunk@211995 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
21a65357f0
commit
21c41e082a
@ -961,6 +961,10 @@ nsFormFillController::AddWindowListeners(nsIDOMWindow *aWindow)
|
||||
target->AddEventListener(NS_LITERAL_STRING("contextmenu"),
|
||||
NS_STATIC_CAST(nsIDOMContextMenuListener *, this),
|
||||
PR_TRUE);
|
||||
|
||||
target->AddEventListener(NS_LITERAL_STRING("keypress"),
|
||||
NS_STATIC_CAST(nsIDOMKeyListener *, this),
|
||||
PR_TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1016,32 +1020,10 @@ nsFormFillController::RemoveWindowListeners(nsIDOMWindow *aWindow)
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("contextmenu"),
|
||||
NS_STATIC_CAST(nsIDOMContextMenuListener *, this),
|
||||
PR_TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
nsFormFillController::AddKeyListener(nsIDOMHTMLInputElement *aInput)
|
||||
{
|
||||
if (!aInput)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(aInput);
|
||||
|
||||
target->AddEventListener(NS_LITERAL_STRING("keypress"),
|
||||
NS_STATIC_CAST(nsIDOMKeyListener *, this),
|
||||
PR_TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
nsFormFillController::RemoveKeyListener()
|
||||
{
|
||||
if (!mFocusedInput)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mFocusedInput);
|
||||
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("keypress"),
|
||||
NS_STATIC_CAST(nsIDOMKeyListener *, this),
|
||||
PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("keypress"),
|
||||
NS_STATIC_CAST(nsIDOMKeyListener *, this),
|
||||
PR_TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1059,7 +1041,6 @@ nsFormFillController::StartControllingInput(nsIDOMHTMLInputElement *aInput)
|
||||
// Cache the popup for the focused docShell
|
||||
mPopups->GetElementAt(index, getter_AddRefs(mFocusedPopup));
|
||||
|
||||
AddKeyListener(aInput);
|
||||
mFocusedInput = aInput;
|
||||
|
||||
// Now we are the autocomplete controller's bitch
|
||||
@ -1069,8 +1050,6 @@ nsFormFillController::StartControllingInput(nsIDOMHTMLInputElement *aInput)
|
||||
void
|
||||
nsFormFillController::StopControllingInput()
|
||||
{
|
||||
RemoveKeyListener();
|
||||
|
||||
// Reset the controller's input, but not if it has been switched
|
||||
// to another input already, which might happen if the user switches
|
||||
// focus by clicking another autocomplete textbox
|
||||
|
||||
@ -126,9 +126,6 @@ protected:
|
||||
void AddWindowListeners(nsIDOMWindow *aWindow);
|
||||
void RemoveWindowListeners(nsIDOMWindow *aWindow);
|
||||
|
||||
void AddKeyListener(nsIDOMHTMLInputElement *aInput);
|
||||
void RemoveKeyListener();
|
||||
|
||||
void StartControllingInput(nsIDOMHTMLInputElement *aInput);
|
||||
void StopControllingInput();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user