Bug 1390342 - Skip pattern matching in HasPatternMismatch() if @pattern is not set. r=ehsan

We use a bitfield in HTMLInputElement to cache whether the input element has the
@pattern set, and skip pattern mathching in HasPatternMismatch() if the
attribute is not set.
This commit is contained in:
Jessica Jong
2017-08-17 23:57:00 -04:00
parent 6b9125b7d9
commit c991e197b3
3 changed files with 21 additions and 3 deletions

View File

@@ -339,6 +339,11 @@ public:
return mSelectionProperties;
}
bool HasPatternAttribute() const
{
return mHasPatternAttribute;
}
// nsIConstraintValidation
bool IsTooLong();
bool IsTooShort();
@@ -1667,6 +1672,7 @@ protected:
bool mPickerRunning : 1;
bool mSelectionCached : 1;
bool mIsPreviewEnabled : 1;
bool mHasPatternAttribute : 1;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,