RESOLVED FIXED 48220
constraint validation: stepMismatch (rounding error)
https://bugs.webkit.org/show_bug.cgi?id=48220
Summary constraint validation: stepMismatch (rounding error)
Dai Mikurube
Reported 2010-10-24 23:56:30 PDT
Steps to reproduce: 1. use following input <input type="number" step="0.005" min="4" value="5.005" /> 2. check the validity-property (valid and stepMismatch Expected: validity.valid should be true. Actually happens: validity.valid is false and validity.stepMismatch is true.
Attachments
Patch (2.14 KB, patch)
2010-10-25 00:42 PDT, Dai Mikurube
no flags
Patch (3.63 KB, patch)
2010-10-26 04:10 PDT, Dai Mikurube
no flags
Patch (4.99 KB, patch)
2010-10-26 21:35 PDT, Dai Mikurube
no flags
Dai Mikurube
Comment 1 2010-10-25 00:42:12 PDT
Kent Tamura
Comment 2 2010-10-25 01:51:16 PDT
Comment on attachment 71719 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=71719&action=review You need to add a test case to LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js > WebCore/html/NumberInputType.cpp:120 > + // Accepts errors in the equvalent precision to IEEE 754 single-precision numbers and additional 7-bits. This comment doesn't match to the code?
Dai Mikurube
Comment 3 2010-10-26 04:10:39 PDT
Dai Mikurube
Comment 4 2010-10-26 04:12:02 PDT
(In reply to comment #2) Thank you for the comments. Added tests and modified the comment.
Kent Tamura
Comment 5 2010-10-26 07:01:29 PDT
Comment on attachment 71863 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=71863&action=review > WebCore/html/NumberInputType.cpp:119 > // is greater than step*2^DBL_MANT_DIG, the following fmod() makes no sense. Needs to update the comment. fmod() won't be used. > WebCore/html/NumberInputType.cpp:122 > + double remainder = fabs(doubleValue - step * round(doubleValue / step)); Would you explain why we need to use fabs() instead of fmod() in a code comment or ChangeLog please? > WebCore/html/NumberInputType.cpp:123 > + // Accepts errors in the equvalent precision to IEEE 754 single-precision This comment is confusing. "Accepts erros in lower fractional part which IEEE 754 single-precision can't represent." ?
Dai Mikurube
Comment 6 2010-10-26 21:35:22 PDT
Dai Mikurube
Comment 7 2010-10-26 21:46:27 PDT
Comment on attachment 71863 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=71863&action=review >> WebCore/html/NumberInputType.cpp:122 >> + double remainder = fabs(doubleValue - step * round(doubleValue / step)); > > Would you explain why we need to use fabs() instead of fmod() in a code comment or ChangeLog please? Ok, added a detailed description in ChangeLog. >> WebCore/html/NumberInputType.cpp:123 >> + // Accepts errors in the equvalent precision to IEEE 754 single-precision > > This comment is confusing. "Accepts erros in lower fractional part which IEEE 754 single-precision can't represent." ? Thank you. Replaced with your expression.
Kent Tamura
Comment 8 2010-10-26 22:25:16 PDT
Comment on attachment 71979 [details] Patch Looks good. Thanks!
WebKit Commit Bot
Comment 9 2010-10-26 22:42:46 PDT
Comment on attachment 71979 [details] Patch Clearing flags on attachment: 71979 Committed r70615: <http://trac.webkit.org/changeset/70615>
WebKit Commit Bot
Comment 10 2010-10-26 22:42:51 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.