Backed out changeset 71ef10fe925e (bug 1300996)

This commit is contained in:
Carsten "Tomcat" Book 2017-06-07 11:46:12 +02:00
Родитель 838de5a688
Коммит 1b75fcf138
1 изменённых файлов: 0 добавлений и 49 удалений

Просмотреть файл

@ -134,57 +134,8 @@ FormAutofillHandler.prototype = {
}
}
}
// Unlike using setUserInput directly, FormFillController dispatches an
// asynchronous "DOMAutoComplete" event with an "input" event follows right
// after. So, we need to suppress the first "input" event fired off from
// focused input to make sure the latter change handler won't be affected
// by auto filling.
if (element === focusedInput) {
const suppressFirstInputHandler = e => {
if (e.isTrusted) {
e.stopPropagation();
element.removeEventListener("input", suppressFirstInputHandler);
}
};
element.addEventListener("input", suppressFirstInputHandler);
}
element.previewValue = "";
}
// Handle the highlight style resetting caused by user's correction afterward.
log.debug("register change handler for filled form:", this.form);
const onChangeHandler = e => {
let hasFilledFields;
if (!e.isTrusted) {
return;
}
for (let fieldDetail of this.fieldDetails) {
let element = fieldDetail.elementWeakRef.get();
if (!element) {
return;
}
if (e.target == element || (e.target == element.form && e.type == "reset")) {
this.changeFieldState(fieldDetail, "NORMAL");
}
hasFilledFields |= (fieldDetail.state == "AUTO_FILLED");
}
// Unregister listeners once no field is in AUTO_FILLED state.
if (!hasFilledFields) {
this.form.rootElement.removeEventListener("input", onChangeHandler);
this.form.rootElement.removeEventListener("reset", onChangeHandler);
}
};
this.form.rootElement.addEventListener("input", onChangeHandler);
this.form.rootElement.addEventListener("reset", onChangeHandler);
},
/**