Bug 1712255 - Defer SetMaxLength in SetValueFromSetRangeText r=masayuki

Capping selection range in SetValue early makes the subsequent SetSelectionRange call unable to detect actual selection range change. This patch defers it so that select events can be consistently fired.

Differential Revision: https://phabricator.services.mozilla.com/D115729
This commit is contained in:
Kagami Sascha Rosylight
2021-05-24 03:11:27 +00:00
parent 9c36f0af49
commit 55be2e6e45
6 changed files with 58 additions and 7 deletions

View File

@@ -660,6 +660,7 @@ void HTMLTextAreaElement::GetValueFromSetRangeText(nsAString& aValue) {
nsresult HTMLTextAreaElement::SetValueFromSetRangeText(
const nsAString& aValue) {
return SetValueInternal(aValue, {ValueSetterOption::ByContentAPI,
ValueSetterOption::BySetRangeTextAPI,
ValueSetterOption::SetValueChanged});
}