Bug 1345767 - Part 3: Factor IsValueMissing() out of HTMLInputElement. r=smaug

MozReview-Commit-ID: AE6SSA43Vx5
This commit is contained in:
Jessica Jong
2017-05-04 14:47:08 +08:00
parent 91f88b282b
commit 01efebe7f7
15 changed files with 185 additions and 25 deletions

View File

@@ -7544,31 +7544,7 @@ HTMLInputElement::IsValueMissing() const
// Should use UpdateValueMissingValidityStateForRadio() for type radio.
MOZ_ASSERT(mType != NS_FORM_INPUT_RADIO);
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::required) ||
!DoesRequiredApply()) {
return false;
}
if (!IsMutable()) {
return false;
}
switch (GetValueMode()) {
case VALUE_MODE_VALUE:
return IsValueEmpty();
case VALUE_MODE_FILENAME:
return GetFilesOrDirectoriesInternal().IsEmpty();
case VALUE_MODE_DEFAULT_ON:
// This should not be used for type radio.
// See the MOZ_ASSERT at the beginning of the method.
return !mChecked;
case VALUE_MODE_DEFAULT:
default:
return false;
}
return mInputType->IsValueMissing();
}
bool