Issue #2790 - Part 1: Add: event state, pseudo-class mapping, SetAutofilled methods

This commit is contained in:
MeladJM 2025-07-18 06:28:23 +08:00 committed by roytam1
commit 13d1054046
9 changed files with 73 additions and 0 deletions

View file

@ -2832,6 +2832,16 @@ HTMLInputElement::SetUserInput(const nsAString& aValue)
return NS_OK;
}
void
HTMLInputElement::SetAutofilled(bool aAutofilled)
{
if (aAutofilled) {
AddStates(NS_EVENT_STATE_AUTOFILL);
} else {
RemoveStates(NS_EVENT_STATE_AUTOFILL);
}
}
nsIEditor*
HTMLInputElement::GetEditor()
{
@ -8507,6 +8517,11 @@ HTMLInputElement::OnValueChanged(bool aNotify, bool aWasInteractiveUserChange)
{
mLastValueChangeWasInteractive = aWasInteractiveUserChange;
// Clear autofilled state if this was an interactive user change
if (aWasInteractiveUserChange && State().HasState(NS_EVENT_STATE_AUTOFILL)) {
RemoveStates(NS_EVENT_STATE_AUTOFILL);
}
UpdateAllValidityStates(aNotify);
if (HasDirAuto()) {