Bug 1345767 - Part 5: Factor HasPatternMismatch() out of HTMLInputElement. r=smaug
MozReview-Commit-ID: 2JWhbfEJhTm
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user