Issue #2790 - Part 5: Persistent highlight despite blur click

This commit is contained in:
MeladJM 2025-07-26 03:06:37 +08:00 committed by roytam1
commit 156c755085
5 changed files with 64 additions and 16 deletions

View file

@ -849,9 +849,8 @@ public:
/**
* Sets or clears the autofilled state of this input element.
* This is used by the browser's autofill system to indicate when
* a value has been automatically filled (e.g., from saved passwords
* or form data).
* When setting, also stores the autofilled value for persistence.
* When clearing, clears the stored autofilled value.
*
* @param aAutofilled Whether the element should be marked as autofilled
*/
@ -872,6 +871,8 @@ public:
void UpdateEntries(const nsTArray<OwningFileOrDirectory>& aFilesOrDirectories);
void SetAutofilledValue(const nsAString& aValue) { mAutofilledValue = aValue; }
protected:
virtual ~HTMLInputElement();
@ -1641,6 +1642,10 @@ protected:
bool mNumberControlSpinnerSpinsUp : 1;
bool mPickerRunning : 1;
bool mSelectionCached : 1;
/**
* The value that was autofilled by the browser. Used to persist the autofill
* highlight as long as the value matches, regardless of focus/blur.
*/
nsString mAutofilledValue;
private:
@ -1785,6 +1790,8 @@ private:
nsCOMPtr<nsIFilePicker> mFilePicker;
RefPtr<HTMLInputElement> mInput;
};
void EnsureAutofillState();
};
} // namespace dom