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

@@ -1869,7 +1869,7 @@ nsresult TextControlState::PrepareEditor(const nsAString* aValue) {
}
// Set max text field length
newTextEditor->SetMaxTextLength(GetMaxLength());
newTextEditor->SetMaxTextLength(mTextCtrlElement->UsedMaxLength());
editorFlags = newTextEditor->Flags();
@@ -2482,17 +2482,6 @@ void TextControlState::UnbindFromFrame(nsTextControlFrame* aFrame) {
}
}
int32_t TextControlState::GetMaxLength() {
if (NS_WARN_IF(!mTextCtrlElement)) {
return -1;
}
const nsAttrValue* attr =
mTextCtrlElement->GetParsedAttr(nsGkAtoms::maxlength);
return attr && attr->Type() == nsAttrValue::eInteger ? attr->GetIntegerValue()
: -1;
}
void TextControlState::GetValue(nsAString& aValue, bool aIgnoreWrap) const {
// While SetValue() is being called and requesting to commit composition to
// IME, GetValue() may be called for appending text or something. Then, we