RESOLVED FIXED Bug 97299
[Forms] Multiple fields month input UI
https://bugs.webkit.org/show_bug.cgi?id=97299
Summary [Forms] Multiple fields month input UI
yosin
Reported 2012-09-20 23:50:01 PDT
Chromium port wants to have multiple fields month input UI like multiple fields time input UI.
Attachments
Proof of Concept (46.04 KB, patch)
2012-09-25 22:54 PDT, yosin
no flags
Patch 1 (97.43 KB, patch)
2012-09-27 03:08 PDT, yosin
no flags
Patch 2 (97.39 KB, patch)
2012-09-27 03:10 PDT, yosin
no flags
Patch 3 (10.11 KB, patch)
2012-09-28 01:05 PDT, yosin
no flags
Patch 4 (10.45 KB, patch)
2012-09-28 01:53 PDT, yosin
no flags
Patch 5 (10.45 KB, patch)
2012-09-28 01:56 PDT, yosin
no flags
Patch 6 (14.40 KB, patch)
2012-09-28 02:15 PDT, yosin
no flags
yosin
Comment 1 2012-09-25 22:54:32 PDT
Created attachment 165731 [details] Proof of Concept
yosin
Comment 2 2012-09-27 03:08:07 PDT
yosin
Comment 3 2012-09-27 03:10:04 PDT
yosin
Comment 4 2012-09-27 03:10:47 PDT
Comment on attachment 165963 [details] Patch 2 Could you review this patch? Thanks in advance.
WebKit Review Bot
Comment 5 2012-09-27 03:13:45 PDT
Attachment 165963 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/fast..." exit_code: 1 LayoutTests/platform/chromium-android/TestExpectations:1: No port uses path LayoutTests/platform/chromium-android/TestExpectations for test_expectations [test/expectations] [5] Total errors found: 1 in 29 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Review Bot
Comment 6 2012-09-27 03:16:35 PDT
Comment on attachment 165963 [details] Patch 2 Attachment 165963 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/14027863
Kent Tamura
Comment 7 2012-09-27 07:33:36 PDT
Comment on attachment 165963 [details] Patch 2 View in context: https://bugs.webkit.org/attachment.cgi?id=165963&action=review Let's split. 1. Adding placeholder feature to DateTimeNumericElement, and update its existing subclasses. 2. Adding DateTimeMonthFieldElement and DateTimeYearFieldElement 3. Remaining C++/CSS changes 4. Tests > Source/WebCore/html/shadow/DateTimeEditElement.cpp:71 > + const String& m_placeholderForMonth; > + const String& m_placeholderForYear; Let's use "const String" instead of "const String&". I understand "const String&" works in this case, but it is not robust for the future changes. Copying String objects is not expensive. > Source/WebCore/html/shadow/DateTimeEditElement.cpp:127 > + case DateTimeFormat::FieldTypeMonth: > + m_editElement.addField(DateTimeMonthFieldElement::create(document, m_editElement, m_placeholderForMonth)); This code seems to support only M and MM. Don't you support MMM, MMMM, MMMMM ? > Source/WebCore/html/shadow/DateTimeFieldElements.cpp:351 > +static const int minimumYear = 1; > +// Date in ECMAScript can't represent dates later than 275760-09-13T00:00Z. > +// So, we have the same upper limit in HTML5 dates. > +static const int maximumYear = 275760; > + > +DateTimeYearFieldElement::DateTimeYearFieldElement(Document* document, FieldOwner& fieldOwner, const String& placeholder) > + : DateTimeNumericFieldElement(document, fieldOwner, minimumYear, maximumYear, placeholder) We had better apply actual min/max years of the host <input>. > Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp:194 > String DateTimeNumericFieldElement::visibleValue() const > { > - if (m_hasValue) > - return value(); > - > - StringBuilder builder; > - for (int numberOfDashs = std::max(displaySizeOfNumber(m_range.maximum), displaySizeOfNumber(m_range.minimum)); numberOfDashs; --numberOfDashs) > - builder.append('-'); > - return builder.toString(); > + return m_hasValue ? value() : m_placeholder; You assume the length of m_placeholder is longer than or equal to the length of the maximum value?
yosin
Comment 8 2012-09-27 22:49:17 PDT
(In reply to comment #7) > (From update of attachment 165963 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=165963&action=review > > > Source/WebCore/html/shadow/DateTimeEditElement.cpp:127 > > + case DateTimeFormat::FieldTypeMonth: > > + m_editElement.addField(DateTimeMonthFieldElement::create(document, m_editElement, m_placeholderForMonth)); > > This code seems to support only M and MM. Don't you support MMM, MMMM, MMMMM ? > No, we don't support short month name and full month name in month field. Month is always displayed as zero-padded two digits. When using month name we need to have padding space for shorter month name. > > Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp:194 > > String DateTimeNumericFieldElement::visibleValue() const > > { > > - if (m_hasValue) > > - return value(); > > - > > - StringBuilder builder; > > - for (int numberOfDashs = std::max(displaySizeOfNumber(m_range.maximum), displaySizeOfNumber(m_range.minimum)); numberOfDashs; --numberOfDashs) > > - builder.append('-'); > > - return builder.toString(); > > + return m_hasValue ? value() : m_placeholder; > > You assume the length of m_placeholder is longer than or equal to the length of the maximum value? Yes, we'll ask localizer to choose text longer than four dashes, "----", in browser.
yosin
Comment 9 2012-09-28 01:05:34 PDT
yosin
Comment 10 2012-09-28 01:07:46 PDT
Comment on attachment 166167 [details] Patch 3 Could you review this patch? Thanks in advance. P.S. Supporting min/max attributes for year field will be in another patch with a test.
Kent Tamura
Comment 11 2012-09-28 01:31:03 PDT
Comment on attachment 166167 [details] Patch 3 View in context: https://bugs.webkit.org/attachment.cgi?id=166167&action=review > Source/WebCore/ChangeLog:11 > + Note: This patch affects ports which enable both ENABLE_INPUT_TYPE_TIME Looks wrong. ENABLE_INPUT_TYPE_TIME is unrelated. > Source/WebCore/html/MonthInputType.cpp:152 > + return String::format("%u-%02u", dateTimeFieldsState.year(), dateTimeFieldsState.month()); Don't you need %04u-%02u? > Source/WebCore/html/MonthInputType.h:39 > +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) > +#include "BaseMultipleFieldsDateAndTimeInputType.h" > +#else > +#include "BaseDateAndTimeInputType.h" > +#endif You may just include BaseMultipleFieldsDateAndTimeInputType.h. > Source/WebCore/html/shadow/DateTimeEditElement.cpp:71 > + const String& m_placeholderForMonth; > + const String& m_placeholderForYear; See Comment #7: > Let's use "const String" instead of "const String&". I understand "const String&" works in this case, but it is not robust for the future changes. Copying String objects is not expensive. > Source/WebCore/html/shadow/DateTimeEditElement.cpp:127 > + case DateTimeFormat::FieldTypeMonth: > + m_editElement.addField(DateTimeMonthFieldElement::create(document, m_editElement, m_placeholderForMonth)); Need a comment about MMM, MMMM, MMMMM.
yosin
Comment 12 2012-09-28 01:53:18 PDT
yosin
Comment 13 2012-09-28 01:56:06 PDT
yosin
Comment 14 2012-09-28 01:58:32 PDT
Comment on attachment 166174 [details] Patch 5 Could you review this patch? Thanks in advance. = Changes since the last review = * Not to use reference in DateTimeEditBuilder member variables. * Use "%04u-%02u" for MonthInputType::formatDateTimeFieldsState * Added comment for month specifier in DateTimeEditBuilder::visitField
Kent Tamura
Comment 15 2012-09-28 02:04:11 PDT
Comment on attachment 166174 [details] Patch 5 I think we need to add LayoutTests/platform/chromium/fast/forms/month/month-input-visible-string-expected.txt and LayoutTests/platform/chromium/fast/forms/month/month-stepup-stepdown-from-renderer-expected.txt to this patch.
yosin
Comment 16 2012-09-28 02:15:39 PDT
yosin
Comment 17 2012-09-28 02:16:42 PDT
Comment on attachment 166181 [details] Patch 6 Could you review this patch? Thanks in advance. = Changes since the last review = * Add test expectations for knowing failure tests.
Kent Tamura
Comment 18 2012-09-28 02:20:12 PDT
Comment on attachment 166181 [details] Patch 6 ok. Please land this after confirming green EWS, or land this with commit-queue.
WebKit Review Bot
Comment 19 2012-09-28 02:40:26 PDT
Comment on attachment 166181 [details] Patch 6 Clearing flags on attachment: 166181 Committed r129867: <http://trac.webkit.org/changeset/129867>
WebKit Review Bot
Comment 20 2012-09-28 02:40:32 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.