Bug 91197 - REGRESSION(r119948): [Forms] Spin button Up/Down actions make value to zero for input type "number" when step mismatched and value is smaller than step
Summary: REGRESSION(r119948): [Forms] Spin button Up/Down actions make value to zero f...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: yosin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-13 00:27 PDT by yosin
Modified: 2012-07-13 01:56 PDT (History)
1 user (show)

See Also:


Attachments
Patch 1 (7.57 KB, patch)
2012-07-13 00:56 PDT, yosin
no flags Details | Formatted Diff | Diff
Patch 2 (8.04 KB, patch)
2012-07-13 01:31 PDT, yosin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description yosin 2012-07-13 00:27:58 PDT
Step Up: <input type=number step=300 value=7>
Step Down: <input type=number step=300 value=-7>

This is caused by following line in InputType::stepUpFromRenderer:

if (sign < 0)
    newValue = base + ((current - base) / step).floor() * step; 
else if (sign > 0)
    newValue = base + ((current - base) / step).ceiling() * step; 

Implementation of Decimal::ceiling and Decimal::floor are wrong.
Comment 1 yosin 2012-07-13 00:56:18 PDT
Created attachment 152177 [details]
Patch 1
Comment 2 yosin 2012-07-13 01:02:31 PDT
Comment on attachment 152177 [details]
Patch 1

Could you review this patch?
Thanks in advance.
Comment 3 Kent Tamura 2012-07-13 01:12:24 PDT
Comment on attachment 152177 [details]
Patch 1

View in context: https://bugs.webkit.org/attachment.cgi?id=152177&action=review

> Source/WebCore/ChangeLog:9
> +        REGRESSION(r119948): [Forms] Spin button Up/Down actions make value to zero for input type "number"
> +        https://bugs.webkit.org/show_bug.cgi?id=91197
> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        This patch fixes implementation of Decimal::ceiling() and floor().
> +        They return wrong value for small fractional numbers.

Would you explain in what condition this bug occurs in ChangeLog?
It's unclear why Decimal::ceiling() or floor() affects the case with value=7 step=300.
Comment 4 Kent Tamura 2012-07-13 01:13:51 PDT
Please file a Chromium bug to handle a merge to M21 branch.
Comment 5 yosin 2012-07-13 01:31:40 PDT
Created attachment 152184 [details]
Patch 2
Comment 6 yosin 2012-07-13 01:34:01 PDT
Comment on attachment 152184 [details]
Patch 2

Could you review this patch?
Thanks in advance.

= Changes since the last review =
* Add explanation of bug condition to Source/WebCore/ChangeLog
* Update ChangeLog for the bug summary change
Comment 7 Kent Tamura 2012-07-13 01:44:23 PDT
Comment on attachment 152184 [details]
Patch 2

ok
Comment 8 yosin 2012-07-13 01:56:19 PDT
Comment on attachment 152184 [details]
Patch 2

Clearing flags on attachment: 152184

Committed r122552: <http://trac.webkit.org/changeset/122552>
Comment 9 yosin 2012-07-13 01:56:26 PDT
All reviewed patches have been landed.  Closing bug.