Bug 1345767 - Part 5: Factor HasPatternMismatch() out of HTMLInputElement. r=smaug

MozReview-Commit-ID: 2JWhbfEJhTm
This commit is contained in:
Jessica Jong
2017-05-04 15:10:57 +08:00
parent f088bfb913
commit 8a807e1a27
6 changed files with 30 additions and 34 deletions

View File

@@ -7379,17 +7379,6 @@ HTMLInputElement::PlaceholderApplies() const
return IsSingleLineTextControl(false);
}
bool
HTMLInputElement::DoesPatternApply() const
{
// TODO: temporary until bug 773205 is fixed.
if (IsExperimentalMobileType(mType) || IsDateTimeInputType(mType)) {
return false;
}
return IsSingleLineTextControl(false);
}
bool
HTMLInputElement::DoesMinMaxApply() const
{
@@ -7553,24 +7542,7 @@ HTMLInputElement::HasTypeMismatch() const
bool
HTMLInputElement::HasPatternMismatch() const
{
if (!DoesPatternApply() ||
!HasAttr(kNameSpaceID_None, nsGkAtoms::pattern)) {
return false;
}
nsAutoString pattern;
GetAttr(kNameSpaceID_None, nsGkAtoms::pattern, pattern);
nsAutoString value;
GetNonFileValueInternal(value);
if (value.IsEmpty()) {
return false;
}
nsIDocument* doc = OwnerDoc();
return !nsContentUtils::IsPatternMatching(value, pattern, doc);
return mInputType->HasPatternMismatch();
}
bool