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

@ -366,6 +366,16 @@ HTMLTextAreaElement::SetUserInput(const nsAString& aValue)
return SetValueInternal(aValue, nsTextEditorState::eSetValue_BySetUserInput);
}
void
HTMLTextAreaElement::SetAutofilled(bool aAutofilled)
{
if (aAutofilled) {
AddStates(NS_EVENT_STATE_AUTOFILL);
} else {
RemoveStates(NS_EVENT_STATE_AUTOFILL);
}
}
NS_IMETHODIMP
HTMLTextAreaElement::SetValueChanged(bool aValueChanged)
{
@ -1633,6 +1643,11 @@ HTMLTextAreaElement::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);
}
// Update the validity state
bool validBefore = IsValid();
UpdateTooLongValidityState();