RESOLVED WONTFIX 96683
Add min and max input field values to Chromium API
https://bugs.webkit.org/show_bug.cgi?id=96683
Summary Add min and max input field values to Chromium API
Anthony Berent
Reported 2012-09-13 12:39:43 PDT
Add min and max input field values to Chromium API
Attachments
Patch (5.14 KB, patch)
2012-09-13 12:49 PDT, Anthony Berent
no flags
Patch (5.93 KB, patch)
2012-09-13 14:17 PDT, Anthony Berent
no flags
Patch (5.95 KB, patch)
2012-09-13 15:25 PDT, Anthony Berent
tkent: review-
Anthony Berent
Comment 1 2012-09-13 12:49:08 PDT
WebKit Review Bot
Comment 2 2012-09-13 12:54:30 PDT
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Anthony Berent
Comment 3 2012-09-13 13:58:28 PDT
These are needed by Chrome on Android to allow it to limit the range of, for example, dates when using Android native widgets and dialogs for input.
Anthony Berent
Comment 4 2012-09-13 14:17:38 PDT
Darin Adler
Comment 5 2012-09-13 14:20:07 PDT
Comment on attachment 163964 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=163964&action=review > Source/WebKit/chromium/src/WebTextInputInfo.cpp:45 > + && min == min > + && max == max; Missing the "other." prefix on both of these lines. > Source/WebKit/chromium/src/WebViewImpl.cpp:2162 > + if (input->isNumberField() > + || input->isRangeControl() > + || input->isDateField() > + || input->isDateTimeField() > + || input->isDateTimeLocalField() > + || input->isMonthField() > + || input->isWeekField() > + || input->isTimeField()) { > + info.min = input->minimum(); > + info.max = input->maximum(); This long if statement is bad for maintenance of HTMLInputElement. We may add new types or decide not to use this style of boolean getter. Is there some reason you can’t just call minimum and maximum unconditionally?
Anthony Berent
Comment 6 2012-09-13 14:37:46 PDT
(In reply to comment #5) > (From update of attachment 163964 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=163964&action=review > > > Source/WebKit/chromium/src/WebTextInputInfo.cpp:45 > > + && min == min > > + && max == max; > > Missing the "other." prefix on both of these lines. Agreed, will fix. > > > Source/WebKit/chromium/src/WebViewImpl.cpp:2162 > > + if (input->isNumberField() > > + || input->isRangeControl() > > + || input->isDateField() > > + || input->isDateTimeField() > > + || input->isDateTimeLocalField() > > + || input->isMonthField() > > + || input->isWeekField() > > + || input->isTimeField()) { > > + info.min = input->minimum(); > > + info.max = input->maximum(); > > This long if statement is bad for maintenance of HTMLInputElement. We may add new types or decide not to use this style of boolean getter. Is there some reason you can’t just call minimum and maximum unconditionally? There are comments in HTMLInputElement saying one should not call them for other types. As such it seemed the check was needed. // Returns the minimum value for type=date, number, or range. Don't call this for other types. double minimum() const; // Returns the maximum value for type=date, number, or range. Don't call this for other types. // This always returns a value which is >= minimum(). double maximum() const;
Anthony Berent
Comment 7 2012-09-13 15:25:08 PDT
Kent Tamura
Comment 8 2012-09-13 17:48:55 PDT
Comment on attachment 163982 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=163982&action=review > Source/WebKit/chromium/ChangeLog:8 > + Required to correctly bound values in native widgets used, for example, for date entry in Chrome on Android. I'm not sure this should be done in WebTextInputInfo. Can we obtain them from WebInputElement? Can we expose WebCore/platform/DateTimeChooser.h via WebKit API? > Source/WebKit/chromium/public/WebTextInputInfo.h:61 > + double min; > + > + // The maximum value of the field (only meaningful for numbers, ranges, > + // and date or time based fields). > + double max; > + min and max should be initialized in the constructor. Also, we should have "step" value. > Source/WebKit/chromium/tests/WebViewTest.cpp:377 > + EXPECT_EQ((double)1000*24*60*60, info.max); > + EXPECT_EQ((double)-1000*24*60*60*2, info.min); Do not use C-style cast. In this case, 1000.0 * 24 * 60 * 60 works without the cast.
yosin
Comment 9 2012-09-18 18:35:44 PDT
Comment on attachment 163982 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=163982&action=review > Source/WebKit/chromium/src/WebViewImpl.cpp:2153 > + if (input->isNumberField() How about using HTMLInputElement::isSteppable() and HTMLInputElement::createStepRange()? If we use them, we can write if (input->isSteppable()) { const StepRange stepRange = input->createStepRange(); info.min = stepRange.minimum(); info.max = stepRange.maximum(); } Note: HTMLInputElement::minimum() and maximum() call createStepRange().
Anthony Berent
Comment 10 2012-09-25 02:42:10 PDT
There is a plan to change how date and time are supported in WebKit (hence some of Kent's comments). As such we are suspending this work until that change has been made.
Stephen Chenney
Comment 11 2013-04-09 17:07:10 PDT
Marked LayoutTest bugs, bugs with Chromium IDs, and some others as WontFix. Test failure bugs still are trackable via TestExpectations or disabled unit tests.
Note You need to log in before you can comment on or make changes to this bug.