Bug 1616620 - maxlength shouldn't apply to <input type=number>. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D63474
This commit is contained in:
Emilio Cobos Álvarez
2020-02-20 15:28:51 +00:00
parent b347c7f90f
commit 43e37e4a7e
10 changed files with 25 additions and 66 deletions

View File

@@ -532,6 +532,13 @@ class HTMLInputElement final : public TextControlElement,
int32_t MaxLength() const { return GetIntAttr(nsGkAtoms::maxlength, -1); }
int32_t UsedMaxLength() const final {
if (!mInputType->MinAndMaxLengthApply()) {
return -1;
}
return MaxLength();
}
void SetMaxLength(int32_t aValue, ErrorResult& aRv) {
int32_t minLength = MinLength();
if (aValue < 0 || (minLength >= 0 && aValue < minLength)) {
@@ -1489,7 +1496,7 @@ class HTMLInputElement final : public TextControlElement,
/*
* InputType object created based on input type.
*/
UniquePtr<InputType, DoNotDelete> mInputType;
UniquePtr<::InputType, DoNotDelete> mInputType;
// Memory allocated for mInputType, reused when type changes.
char mInputTypeMem[INPUT_TYPE_SIZE];