Bug 1842027 - Don't localize <input type=number>'s default value unless for display. r=masayuki

This avoids a lot of useless time on things like GetValueAsDecimal(),
where we get the default value as a string, parse it as a number for
sanitization reasons, localize it to a string, just to parse it back to
a number.

Differential Revision: https://phabricator.services.mozilla.com/D183284
This commit is contained in:
Emilio Cobos Álvarez
2023-07-12 16:55:36 +00:00
parent bc14b823d3
commit e7d711fad5
7 changed files with 41 additions and 33 deletions

View File

@@ -166,7 +166,7 @@ void HTMLTextAreaElement::GetValue(nsAString& aValue) {
void HTMLTextAreaElement::GetValueInternal(nsAString& aValue,
bool aIgnoreWrap) const {
MOZ_ASSERT(mState);
mState->GetValue(aValue, aIgnoreWrap);
mState->GetValue(aValue, aIgnoreWrap, /* aForDisplay = */ true);
}
nsIEditor* HTMLTextAreaElement::GetEditorForBindings() {
@@ -1105,7 +1105,7 @@ int32_t HTMLTextAreaElement::GetRows() {
return DEFAULT_ROWS_TEXTAREA;
}
void HTMLTextAreaElement::GetDefaultValueFromContent(nsAString& aValue) {
void HTMLTextAreaElement::GetDefaultValueFromContent(nsAString& aValue, bool) {
GetDefaultValue(aValue, IgnoreErrors());
}
@@ -1113,7 +1113,7 @@ bool HTMLTextAreaElement::ValueChanged() const { return mValueChanged; }
void HTMLTextAreaElement::GetTextEditorValue(nsAString& aValue) const {
MOZ_ASSERT(mState);
mState->GetValue(aValue, /* aIgnoreWrap = */ true);
mState->GetValue(aValue, /* aIgnoreWrap = */ true, /* aForDisplay = */ true);
}
void HTMLTextAreaElement::InitializeKeyboardEventListeners() {