зеркало из https://github.com/mozilla/pjs.git
Bug 286933 - Enter that selects autocomplete entry should be hidden from page scripts. r=mconnor.
This commit is contained in:
Родитель
4683d0889d
Коммит
fad8ff6b69
|
@ -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();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче