Bug 1728537 - Part 1: Move SaveState out of nsIFormControl; r=smaug

And make it return void as the return value isn't used at callsites.

Differential Revision: https://phabricator.services.mozilla.com/D124179
This commit is contained in:
Edgar Chen
2021-09-01 16:51:58 +00:00
parent 4b2047af0a
commit 3f6076d6b0
10 changed files with 40 additions and 53 deletions

View File

@@ -5791,15 +5791,14 @@ static nsTArray<FileContentData> SaveFileContentData(
return res;
}
NS_IMETHODIMP
HTMLInputElement::SaveState() {
void HTMLInputElement::SaveState() {
PresState* state = nullptr;
switch (GetValueMode()) {
case VALUE_MODE_DEFAULT_ON:
if (mCheckedChanged) {
state = GetPrimaryPresState();
if (!state) {
return NS_OK;
return;
}
state->contentData() = CheckedContentData(mChecked);
@@ -5809,7 +5808,7 @@ HTMLInputElement::SaveState() {
if (!mFileData->mFilesOrDirectories.IsEmpty()) {
state = GetPrimaryPresState();
if (!state) {
return NS_OK;
return;
}
state->contentData() =
@@ -5829,21 +5828,18 @@ HTMLInputElement::SaveState() {
state = GetPrimaryPresState();
if (!state) {
return NS_OK;
return;
}
nsAutoString value;
GetValue(value, CallerType::System);
if (!IsSingleLineTextControl(false)) {
nsresult rv = nsLinebreakConverter::ConvertStringLineBreaks(
value, nsLinebreakConverter::eLinebreakPlatform,
nsLinebreakConverter::eLinebreakContent);
if (NS_FAILED(rv)) {
NS_ERROR("Converting linebreaks failed!");
return rv;
}
if (!IsSingleLineTextControl(false) &&
NS_FAILED(nsLinebreakConverter::ConvertStringLineBreaks(
value, nsLinebreakConverter::eLinebreakPlatform,
nsLinebreakConverter::eLinebreakContent))) {
NS_ERROR("Converting linebreaks failed!");
return;
}
state->contentData() =
@@ -5862,8 +5858,6 @@ HTMLInputElement::SaveState() {
state->disabledSet() = true;
}
}
return NS_OK;
}
void HTMLInputElement::DoneCreatingElement() {