Loading dom/html/input/DateTimeInputTypes.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -334,6 +334,12 @@ nsresult TimeInputType::GetRangeUnderflowMessage(nsAString& aMessage) { // input type=week nsresult WeekInputType::GetBadInputMessage(nsAString& aMessage) { return nsContentUtils::GetMaybeLocalizedString( nsContentUtils::eDOM_PROPERTIES, "FormValidationInvalidWeek", mInputElement->OwnerDoc(), aMessage); } bool WeekInputType::ConvertStringToNumber(nsAString& aValue, Decimal& aResultValue) const { uint32_t year, week; Loading Loading @@ -397,6 +403,12 @@ bool WeekInputType::ConvertNumberToString(Decimal aValue, // input type=month nsresult MonthInputType::GetBadInputMessage(nsAString& aMessage) { return nsContentUtils::GetMaybeLocalizedString( nsContentUtils::eDOM_PROPERTIES, "FormValidationInvalidMonth", mInputElement->OwnerDoc(), aMessage); } bool MonthInputType::ConvertStringToNumber(nsAString& aValue, Decimal& aResultValue) const { uint32_t year, month; Loading Loading @@ -446,6 +458,12 @@ bool MonthInputType::ConvertNumberToString(Decimal aValue, // input type=datetime-local nsresult DateTimeLocalInputType::GetBadInputMessage(nsAString& aMessage) { return nsContentUtils::GetMaybeLocalizedString( nsContentUtils::eDOM_PROPERTIES, "FormValidationInvalidDateTime", mInputElement->OwnerDoc(), aMessage); } bool DateTimeLocalInputType::ConvertStringToNumber( nsAString& aValue, Decimal& aResultValue) const { uint32_t year, month, day, timeInMs; Loading dom/html/input/DateTimeInputTypes.h +5 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ class DateTimeInputTypeBase : public InputType { bool IsMutable() const override; nsresult GetBadInputMessage(nsAString& aMessage) override = 0; /** * This method converts aValue (milliseconds within a day) to hours, minutes, * seconds and milliseconds. Loading Loading @@ -106,6 +108,7 @@ class WeekInputType : public DateTimeInputTypeBase { return new (aMemory) WeekInputType(aInputElement); } nsresult GetBadInputMessage(nsAString& aMessage) override; bool ConvertStringToNumber(nsAString& aValue, Decimal& aResultValue) const override; bool ConvertNumberToString(Decimal aValue, Loading @@ -123,6 +126,7 @@ class MonthInputType : public DateTimeInputTypeBase { return new (aMemory) MonthInputType(aInputElement); } nsresult GetBadInputMessage(nsAString& aMessage) override; bool ConvertStringToNumber(nsAString& aValue, Decimal& aResultValue) const override; bool ConvertNumberToString(Decimal aValue, Loading @@ -140,6 +144,7 @@ class DateTimeLocalInputType : public DateTimeInputTypeBase { return new (aMemory) DateTimeLocalInputType(aInputElement); } nsresult GetBadInputMessage(nsAString& aMessage) override; bool ConvertStringToNumber(nsAString& aValue, Decimal& aResultValue) const override; bool ConvertNumberToString(Decimal aValue, Loading dom/locales/en-US/chrome/dom/dom.properties +3 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,9 @@ FormValidationInvalidEmail=Please enter an email address. FormValidationInvalidURL=Please enter a URL. FormValidationInvalidDate=Please enter a valid date. FormValidationInvalidTime=Please enter a valid time. FormValidationInvalidDateTime=Please enter valid date and time. FormValidationInvalidDateMonth=Please enter a valid month. FormValidationInvalidDateWeek=Please enter a valid week. FormValidationPatternMismatch=Please match the requested format. # LOCALIZATION NOTE (FormValidationPatternMismatchWithTitle): %S is the (possibly truncated) title attribute value. FormValidationPatternMismatchWithTitle=Please match the requested format: %S. Loading Loading
dom/html/input/DateTimeInputTypes.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -334,6 +334,12 @@ nsresult TimeInputType::GetRangeUnderflowMessage(nsAString& aMessage) { // input type=week nsresult WeekInputType::GetBadInputMessage(nsAString& aMessage) { return nsContentUtils::GetMaybeLocalizedString( nsContentUtils::eDOM_PROPERTIES, "FormValidationInvalidWeek", mInputElement->OwnerDoc(), aMessage); } bool WeekInputType::ConvertStringToNumber(nsAString& aValue, Decimal& aResultValue) const { uint32_t year, week; Loading Loading @@ -397,6 +403,12 @@ bool WeekInputType::ConvertNumberToString(Decimal aValue, // input type=month nsresult MonthInputType::GetBadInputMessage(nsAString& aMessage) { return nsContentUtils::GetMaybeLocalizedString( nsContentUtils::eDOM_PROPERTIES, "FormValidationInvalidMonth", mInputElement->OwnerDoc(), aMessage); } bool MonthInputType::ConvertStringToNumber(nsAString& aValue, Decimal& aResultValue) const { uint32_t year, month; Loading Loading @@ -446,6 +458,12 @@ bool MonthInputType::ConvertNumberToString(Decimal aValue, // input type=datetime-local nsresult DateTimeLocalInputType::GetBadInputMessage(nsAString& aMessage) { return nsContentUtils::GetMaybeLocalizedString( nsContentUtils::eDOM_PROPERTIES, "FormValidationInvalidDateTime", mInputElement->OwnerDoc(), aMessage); } bool DateTimeLocalInputType::ConvertStringToNumber( nsAString& aValue, Decimal& aResultValue) const { uint32_t year, month, day, timeInMs; Loading
dom/html/input/DateTimeInputTypes.h +5 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ class DateTimeInputTypeBase : public InputType { bool IsMutable() const override; nsresult GetBadInputMessage(nsAString& aMessage) override = 0; /** * This method converts aValue (milliseconds within a day) to hours, minutes, * seconds and milliseconds. Loading Loading @@ -106,6 +108,7 @@ class WeekInputType : public DateTimeInputTypeBase { return new (aMemory) WeekInputType(aInputElement); } nsresult GetBadInputMessage(nsAString& aMessage) override; bool ConvertStringToNumber(nsAString& aValue, Decimal& aResultValue) const override; bool ConvertNumberToString(Decimal aValue, Loading @@ -123,6 +126,7 @@ class MonthInputType : public DateTimeInputTypeBase { return new (aMemory) MonthInputType(aInputElement); } nsresult GetBadInputMessage(nsAString& aMessage) override; bool ConvertStringToNumber(nsAString& aValue, Decimal& aResultValue) const override; bool ConvertNumberToString(Decimal aValue, Loading @@ -140,6 +144,7 @@ class DateTimeLocalInputType : public DateTimeInputTypeBase { return new (aMemory) DateTimeLocalInputType(aInputElement); } nsresult GetBadInputMessage(nsAString& aMessage) override; bool ConvertStringToNumber(nsAString& aValue, Decimal& aResultValue) const override; bool ConvertNumberToString(Decimal aValue, Loading
dom/locales/en-US/chrome/dom/dom.properties +3 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,9 @@ FormValidationInvalidEmail=Please enter an email address. FormValidationInvalidURL=Please enter a URL. FormValidationInvalidDate=Please enter a valid date. FormValidationInvalidTime=Please enter a valid time. FormValidationInvalidDateTime=Please enter valid date and time. FormValidationInvalidDateMonth=Please enter a valid month. FormValidationInvalidDateWeek=Please enter a valid week. FormValidationPatternMismatch=Please match the requested format. # LOCALIZATION NOTE (FormValidationPatternMismatchWithTitle): %S is the (possibly truncated) title attribute value. FormValidationPatternMismatchWithTitle=Please match the requested format: %S. Loading