Closed Bug 1363258 Opened 6 years ago Closed 6 years ago

Factor ConvertStringToNumber/ConvertNumberToString out of HTMLInputElement

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: jessica, Assigned: jessica)

References

Details

Attachments

(2 files)

No description provided.
Comment on attachment 8866276 [details]
Bug 1363258 - Part 1: Factor ConvertStringToNumber out of HTMLInputElement.

https://reviewboard.mozilla.org/r/137898/#review141030

::: dom/html/input/InputType.cpp:224
(Diff revision 1)
> +InputType::ParseDate(const nsAString& aValue, uint32_t* aYear, uint32_t* aMonth,
> +                     uint32_t* aDay) const
> +{
> +  // TODO: move this function and implementation to DateTimeInpuTypeBase when
> +  // refactoring is completed. Now we can only call HTMLInputElement::ParseDate
> +  // from here, since the method is protected and only InpuyType is a friend

InputType

::: dom/html/input/NumericInputTypes.cpp:75
(Diff revision 1)
>    // Value has to be an integral multiple of step.
>    return NS_floorModulo(value - GetStepBase(), step) != mozilla::Decimal(0);
>  }
>  
> +bool
> +NumericInputTypeBase::ConvertStringToNumber(nsAString& aValue,

Took a bit time to figure out this deals with type=range too.
Attachment #8866276 - Flags: review?(bugs) → review+
Comment on attachment 8866277 [details]
Bug 1363258 - Part 2: Factor ConvertNumberToString out of HTMLInputElement.

https://reviewboard.mozilla.org/r/137900/#review141032

::: dom/html/input/InputType.h:84
(Diff revision 1)
> +   * to a date string if type=date or append the number string representing the
> +   * value if type=number.
> +   *
> +   * @param aValue the Decimal to be converted
> +   * @param aResultString [out] the string representing the Decimal
> +   * @return whether the function succeded, it will fail if the current input's

succeeded
Attachment #8866277 - Flags: review?(bugs) → review+
Comment on attachment 8866276 [details]
Bug 1363258 - Part 1: Factor ConvertStringToNumber out of HTMLInputElement.

https://reviewboard.mozilla.org/r/137898/#review141030

> InputType

Will do, thanks.

> Took a bit time to figure out this deals with type=range too.

Yep, NumericInputTypeBase is inherited by Number and Range.
Comment on attachment 8866277 [details]
Bug 1363258 - Part 2: Factor ConvertNumberToString out of HTMLInputElement.

https://reviewboard.mozilla.org/r/137900/#review141032

> succeeded

Will do, thanks.
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/6a2dedb04405
Part 1: Factor ConvertStringToNumber out of HTMLInputElement. r=smaug
https://hg.mozilla.org/integration/autoland/rev/d0bb5397ddef
Part 2: Factor ConvertNumberToString out of HTMLInputElement. r=smaug
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/6a2dedb04405
https://hg.mozilla.org/mozilla-central/rev/d0bb5397ddef
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.