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:
@@ -223,7 +223,7 @@ class HTMLInputElement final : public TextControlElement,
|
||||
int32_t GetCols() override;
|
||||
int32_t GetWrapCols() override;
|
||||
int32_t GetRows() override;
|
||||
void GetDefaultValueFromContent(nsAString& aValue) override;
|
||||
void GetDefaultValueFromContent(nsAString& aValue, bool aForDisplay) override;
|
||||
bool ValueChanged() const override;
|
||||
void GetTextEditorValue(nsAString& aValue) const override;
|
||||
MOZ_CAN_RUN_SCRIPT TextEditor* GetTextEditor() override;
|
||||
@@ -1063,7 +1063,7 @@ class HTMLInputElement final : public TextControlElement,
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
void HandleTypeChange(FormControlType aNewType, bool aNotify);
|
||||
|
||||
enum class ForValueGetter { No, Yes };
|
||||
enum class SanitizationKind { ForValueGetter, ForDisplay, Other };
|
||||
|
||||
/**
|
||||
* If the input range has a list, this function will snap the given value to
|
||||
@@ -1077,7 +1077,8 @@ class HTMLInputElement final : public TextControlElement,
|
||||
* See:
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/#value-sanitization-algorithm
|
||||
*/
|
||||
void SanitizeValue(nsAString& aValue, ForValueGetter = ForValueGetter::No);
|
||||
void SanitizeValue(nsAString& aValue,
|
||||
SanitizationKind = SanitizationKind::Other);
|
||||
|
||||
/**
|
||||
* Returns whether the placeholder attribute applies for the current type.
|
||||
|
||||
Reference in New Issue
Block a user