Bug 1374893 - Don't handle the input event for inputs that aren't text controls; r=MattN
This commit is contained in:
@@ -916,6 +916,12 @@ nsFormFillController::HandleEvent(nsIDOMEvent* aEvent)
|
||||
return KeyPress(aEvent);
|
||||
case eEditorInput:
|
||||
{
|
||||
nsCOMPtr<nsINode> input = do_QueryInterface(
|
||||
aEvent->InternalDOMEvent()->GetTarget());
|
||||
if (!IsTextControl(input)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool unused = false;
|
||||
return (!mSuppressOnInput && mController && mFocusedInput) ?
|
||||
mController->HandleText(&unused) : NS_OK;
|
||||
@@ -996,6 +1002,14 @@ nsFormFillController::RemoveForDocument(nsIDocument* aDoc)
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
nsFormFillController::IsTextControl(nsINode* aNode)
|
||||
{
|
||||
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(aNode);
|
||||
return formControl &&
|
||||
formControl->IsSingleLineTextControl(false);
|
||||
}
|
||||
|
||||
void
|
||||
nsFormFillController::MaybeStartControllingInput(nsIDOMHTMLInputElement* aInput)
|
||||
{
|
||||
@@ -1004,8 +1018,7 @@ nsFormFillController::MaybeStartControllingInput(nsIDOMHTMLInputElement* aInput)
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(aInput);
|
||||
if (!formControl || !formControl->IsSingleLineTextControl(false)) {
|
||||
if (!IsTextControl(inputNode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1022,6 +1035,8 @@ nsFormFillController::MaybeStartControllingInput(nsIDOMHTMLInputElement* aInput)
|
||||
bool hasList = datalist != nullptr;
|
||||
|
||||
bool isPwmgrInput = false;
|
||||
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(aInput);
|
||||
MOZ_ASSERT(formControl, "If we have a text control, we have a form control!");
|
||||
if (mPwmgrInputs.Get(inputNode) ||
|
||||
formControl->ControlType() == NS_FORM_INPUT_PASSWORD) {
|
||||
isPwmgrInput = true;
|
||||
|
||||
@@ -87,6 +87,8 @@ protected:
|
||||
void RemoveForDocument(nsIDocument* aDoc);
|
||||
bool IsEventTrusted(nsIDOMEvent *aEvent);
|
||||
|
||||
bool IsTextControl(nsINode* aNode);
|
||||
|
||||
// members //////////////////////////////////////////
|
||||
|
||||
nsCOMPtr<nsIAutoCompleteController> mController;
|
||||
|
||||
Reference in New Issue
Block a user