Bug 1635224 - Preserve mLastValueChangeWasInteractive between SaveState and RestoreState r=emilio,masayuki

Modify PresState's string variant to also store whether the last change was
interactive, and preserve that property when saving and restoring state.

Differential Revision: https://phabricator.services.mozilla.com/D73920
This commit is contained in:
sanketh
2020-05-08 15:15:04 +00:00
parent 6bdc0eb98c
commit c8a0829e08
5 changed files with 107 additions and 9 deletions

View File

@@ -735,7 +735,8 @@ HTMLTextAreaElement::SaveState() {
return rv;
}
state->contentData() = std::move(value);
state->contentData() =
TextContentData(value, mLastValueChangeWasInteractive);
}
}
@@ -757,12 +758,15 @@ HTMLTextAreaElement::SaveState() {
bool HTMLTextAreaElement::RestoreState(PresState* aState) {
const PresContentData& state = aState->contentData();
if (state.type() == PresContentData::TnsString) {
if (state.type() == PresContentData::TTextContentData) {
ErrorResult rv;
SetValue(state.get_nsString(), rv);
SetValue(state.get_TextContentData().value(), rv);
ENSURE_SUCCESS(rv, false);
if (state.get_TextContentData().lastValueChangeWasInteractive()) {
mLastValueChangeWasInteractive = true;
UpdateState(true);
}
}
if (aState->disabledSet() && !aState->disabled()) {
SetDisabled(false, IgnoreErrors());
}