Summary: | constraint validation: stepMismatch (rounding error) | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Dai Mikurube <dmikurube> | ||||||||
Component: | Forms | Assignee: | Nobody <webkit-unassigned> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | commit-queue, tkent | ||||||||
Priority: | P2 | ||||||||||
Version: | 528+ (Nightly build) | ||||||||||
Hardware: | PC | ||||||||||
OS: | All | ||||||||||
Bug Depends on: | 48221 | ||||||||||
Bug Blocks: | |||||||||||
Attachments: |
|
Description
Dai Mikurube
2010-10-24 23:56:30 PDT
Created attachment 71719 [details]
Patch
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? Created attachment 71863 [details]
Patch
(In reply to comment #2) Thank you for the comments. Added tests and modified the comment. 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." ? Created attachment 71979 [details]
Patch
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. Comment on attachment 71979 [details]
Patch
Looks good. Thanks!
Comment on attachment 71979 [details] Patch Clearing flags on attachment: 71979 Committed r70615: <http://trac.webkit.org/changeset/70615> All reviewed patches have been landed. Closing bug. |