Bug 1849122, allowing getting and modifying the autofill state directly within the input and select elements, and reset this state when its value changes, r=webidl,emilio

Resetting the state when the value is modified is bug 1359355.

Differential Revision: https://phabricator.services.mozilla.com/D210999
This commit is contained in:
Neil Deakin
2024-05-28 23:39:59 +00:00
parent 1419487012
commit e9102d05aa
10 changed files with 72 additions and 1 deletions

View File

@@ -6975,6 +6975,10 @@ void HTMLInputElement::OnValueChanged(ValueChangeKind aKind,
MOZ_ASSERT_IF(aKnownNewValue, aKnownNewValue->IsEmpty() == aNewValueEmpty);
if (aKind != ValueChangeKind::Internal) {
mLastValueChangeWasInteractive = aKind == ValueChangeKind::UserInteraction;
if (State().HasState(ElementState::AUTOFILL)) {
RemoveStates(ElementState::AUTOFILL | ElementState::AUTOFILL_PREVIEW);
}
}
if (aNewValueEmpty != IsValueEmpty()) {