Commit 30a800ab authored by Elodie Banel's avatar Elodie Banel Committed by Commit Bot

Only reset autofill attributes if change is user-initiated.

The isTrusted attribute indicates that the change came from the user.
Use it to make sure we don't unset the autofill attributes when
sending our own "input" event.

Bug: 796224
Change-Id: I7502274ba3dbe7d323382af3d884ded005f79bf0
Reviewed-on: https://chromium-review.googlesource.com/840005Reviewed-by: default avatarSebastien Seguin-Gagnon <sebsg@chromium.org>
Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Commit-Queue: Elodie Banel <lod@chromium.org>
Cr-Commit-Position: refs/heads/master@{#525993}
parent 5e1363dc
......@@ -596,11 +596,13 @@ __gCrWeb.autofill['fillForm'] = function(data, forceFillFieldName) {
__gCrWeb.autofill.styleInjected = true;
}
// Remove Autofill styling when control element is edited.
// Remove Autofill styling when control element is edited by the user.
var controlElementInputListener = function(evt) {
evt.target.removeAttribute('chrome-autofilled');
evt.target.isAutofilled = false;
evt.target.removeEventListener('input', controlElementInputListener);
if (evt.isTrusted) {
evt.target.removeAttribute('chrome-autofilled');
evt.target.isAutofilled = false;
evt.target.removeEventListener('input', controlElementInputListener);
}
};
var form = __gCrWeb.common.getFormElementFromIdentifier(data.formName);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment