WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
98237
Implement localizeValue for TimeInputType
https://bugs.webkit.org/show_bug.cgi?id=98237
Summary
Implement localizeValue for TimeInputType
Keishi Hattori
Reported
2012-10-03 00:36:26 PDT
We need to implement localizeValue for TimeInputType
Attachments
Patch
(22.58 KB, patch)
2012-10-03 00:54 PDT
,
Keishi Hattori
no flags
Details
Formatted Diff
Diff
Patch
(24.22 KB, patch)
2012-10-03 04:13 PDT
,
Keishi Hattori
no flags
Details
Formatted Diff
Diff
Patch
(24.30 KB, patch)
2012-10-03 05:16 PDT
,
Keishi Hattori
no flags
Details
Formatted Diff
Diff
Just added if around DateTimeStringBuilder
(24.34 KB, patch)
2012-10-03 05:23 PDT
,
Keishi Hattori
no flags
Details
Formatted Diff
Diff
Added UNUSED_PARAM for Localizer::formatDateTime
(24.40 KB, patch)
2012-10-03 05:30 PDT
,
Keishi Hattori
no flags
Details
Formatted Diff
Diff
Patch
(25.51 KB, patch)
2012-10-03 06:30 PDT
,
Keishi Hattori
no flags
Details
Formatted Diff
Diff
Patch
(25.88 KB, patch)
2012-10-03 19:14 PDT
,
Keishi Hattori
no flags
Details
Formatted Diff
Diff
Show Obsolete
(6)
View All
Add attachment
proposed patch, testcase, etc.
Keishi Hattori
Comment 1
2012-10-03 00:54:18 PDT
Created
attachment 166822
[details]
Patch
Kent Tamura
Comment 2
2012-10-03 01:38:50 PDT
Comment on
attachment 166822
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=166822&action=review
> Source/WebCore/platform/text/Localizer.cpp:44 > + DateTimeStringBuilder(Localizer*, const DateComponents&);
The first argument should be Localizer& to make sure it's non-null.
> Source/WebCore/platform/text/Localizer.cpp:57 > + Localizer* m_localizer;
ditto. should be Localizer&.
> Source/WebCore/platform/text/Localizer.cpp:58 > + const DateComponents m_date;
should be "const DateComponents&"
> Source/WebCore/platform/text/Localizer.cpp:79 > + StringBuilder builder;
Existence of builder and m_builder in a function is confusing. Please rename builder to something else.
> Source/WebCore/platform/text/Localizer.cpp:83 > + builder.append(String::number(number)); > + for (size_t i = builder.length(); i < width; ++i) > + builder.append("0");
It looks wrong. String numberString = String::number(number); for (size_t i = numberString.length(); i < width; ++i) builder.append("0"); builder.append(numberString);
> Source/WebCore/platform/text/Localizer.cpp:111 > + appendNumber(hour24, numberOfPatternCharacters); > + appendNumber(hour24, numberOfPatternCharacters);
Why do you add twice?
> Source/WebCore/platform/text/Localizer.cpp:126 > + case DateTimeFormat::FieldTypeSecond: > + appendNumber(m_date.second(), numberOfPatternCharacters); > + return; > + case DateTimeFormat::FieldTypeFractionalSecond: { > + int fractionalSecond = m_date.millisecond(); > + if (numberOfPatternCharacters > 3) > + fractionalSecond *= pow(10, numberOfPatternCharacters - 3); > + String fractionalSecondString = String::format("%03d", fractionalSecond).left(numberOfPatternCharacters); > + m_builder.append(m_localizer->convertToLocalizedNumber(fractionalSecondString)); > + return;
We should serialize millisecond part of the DateComponents with non-zero millisecond even if the format has no fractional second field. So, you can ignore DateTimeFormat::FieldTypeFractionalSecond case, and can do everything for second and millisecond in the DateTimeFormat::FieldTypeSecond block above.
> Source/WebCore/platform/text/Localizer.cpp:329 > +{ > + DateTimeStringBuilder builder(this, date);
should reject non-time types.
> Source/WebCore/platform/text/Localizer.h:104 > + enum FormatType { UnspecifiedFormatType, ShortFormatType, MediumFormatType };
Enum names should be FormatTypeUnspecified, FormatTypeShort, FormatTypeMedium.
> Source/WebKit/chromium/tests/LocaleMacTest.cpp:157 > + EXPECT_STREQ("1:23:00 PM", formatTime("en_US", 13, 23).utf8().data()); > + EXPECT_STREQ("13:23:00", formatTime("fr_FR", 13, 23).utf8().data()); > + EXPECT_STREQ("13:23:00", formatTime("ja_JP", 13, 23).utf8().data()); > + EXPECT_STREQ("12:00:00 AM", formatTime("en_US", 00, 00).utf8().data()); > + EXPECT_STREQ("00:00:00", formatTime("fr_FR", 00, 00).utf8().data()); > + EXPECT_STREQ("0:00:00", formatTime("ja_JP", 00, 00).utf8().data());
We should have tests for: - the short format. - non-short format + non-zero second time. - non-zero millisecond time. - native digits such as "ar", "fa" locales
Keishi Hattori
Comment 3
2012-10-03 04:08:24 PDT
Comment on
attachment 166822
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=166822&action=review
>> Source/WebCore/platform/text/Localizer.cpp:44 >> + DateTimeStringBuilder(Localizer*, const DateComponents&); > > The first argument should be Localizer& to make sure it's non-null.
Done.
>> Source/WebCore/platform/text/Localizer.cpp:57 >> + Localizer* m_localizer; > > ditto. should be Localizer&.
Done.
>> Source/WebCore/platform/text/Localizer.cpp:58 >> + const DateComponents m_date; > > should be "const DateComponents&"
Done.
>> Source/WebCore/platform/text/Localizer.cpp:79 >> + StringBuilder builder; > > Existence of builder and m_builder in a function is confusing. Please rename builder to something else.
Done. Renamed to zeroPaddedStringBuilder.
>> Source/WebCore/platform/text/Localizer.cpp:83 >> + builder.append("0"); > > It looks wrong. > > String numberString = String::number(number); > for (size_t i = numberString.length(); i < width; ++i) > builder.append("0"); > builder.append(numberString);
Done.
>> Source/WebCore/platform/text/Localizer.cpp:111 >> + appendNumber(hour24, numberOfPatternCharacters); > > Why do you add twice?
Done.
>> Source/WebCore/platform/text/Localizer.cpp:126 >> + return; > > We should serialize millisecond part of the DateComponents with non-zero millisecond even if the format has no fractional second field. > So, you can ignore DateTimeFormat::FieldTypeFractionalSecond case, and can do everything for second and millisecond in the DateTimeFormat::FieldTypeSecond block above.
Done.
>> Source/WebCore/platform/text/Localizer.cpp:329 >> + DateTimeStringBuilder builder(this, date); > > should reject non-time types.
Done.
>> Source/WebKit/chromium/tests/LocaleMacTest.cpp:157 >> + EXPECT_STREQ("0:00:00", formatTime("ja_JP", 00, 00).utf8().data()); > > We should have tests for: > - the short format. > - non-short format + non-zero second time. > - non-zero millisecond time. > - native digits such as "ar", "fa" locales
Done.
Keishi Hattori
Comment 4
2012-10-03 04:13:54 PDT
Created
attachment 166853
[details]
Patch
Early Warning System Bot
Comment 5
2012-10-03 04:20:24 PDT
Comment on
attachment 166853
[details]
Patch
Attachment 166853
[details]
did not pass qt-ews (qt): Output:
http://queues.webkit.org/results/14126714
Peter Beverloo (cr-android ews)
Comment 6
2012-10-03 04:25:10 PDT
Comment on
attachment 166853
[details]
Patch
Attachment 166853
[details]
did not pass cr-android-ews (chromium-android): Output:
http://queues.webkit.org/results/14130700
Build Bot
Comment 7
2012-10-03 04:26:41 PDT
Comment on
attachment 166853
[details]
Patch
Attachment 166853
[details]
did not pass mac-ews (mac): Output:
http://queues.webkit.org/results/14118844
Gyuyoung Kim
Comment 8
2012-10-03 04:26:54 PDT
Comment on
attachment 166853
[details]
Patch
Attachment 166853
[details]
did not pass efl-ews (efl): Output:
http://queues.webkit.org/results/14142004
Early Warning System Bot
Comment 9
2012-10-03 04:28:52 PDT
Comment on
attachment 166853
[details]
Patch
Attachment 166853
[details]
did not pass qt-wk2-ews (qt): Output:
http://queues.webkit.org/results/14148002
Kent Tamura
Comment 10
2012-10-03 04:29:32 PDT
Comment on
attachment 166853
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=166853&action=review
> Source/WebCore/platform/text/Localizer.cpp:126 > + float second = m_date.second() + m_date.millisecond() / 1000.0; > + String zeroPaddedSecondString = zeroPadString(String::format("%.03f", second), numberOfPatternCharacters + 4);
The variable 'second' should be double because - printf accepts only double for floating point numbers - m_date.millisecond() / 1000.0 is double
Build Bot
Comment 11
2012-10-03 04:35:44 PDT
Comment on
attachment 166853
[details]
Patch
Attachment 166853
[details]
did not pass win-ews (win): Output:
http://queues.webkit.org/results/14137545
Keishi Hattori
Comment 12
2012-10-03 05:16:09 PDT
Created
attachment 166862
[details]
Patch
Build Bot
Comment 13
2012-10-03 05:20:26 PDT
Comment on
attachment 166862
[details]
Patch
Attachment 166862
[details]
did not pass mac-ews (mac): Output:
http://queues.webkit.org/results/14118854
Keishi Hattori
Comment 14
2012-10-03 05:23:30 PDT
Created
attachment 166864
[details]
Just added if around DateTimeStringBuilder
Build Bot
Comment 15
2012-10-03 05:26:53 PDT
Comment on
attachment 166864
[details]
Just added if around DateTimeStringBuilder
Attachment 166864
[details]
did not pass mac-ews (mac): Output:
http://queues.webkit.org/results/14152083
Keishi Hattori
Comment 16
2012-10-03 05:30:02 PDT
Created
attachment 166866
[details]
Added UNUSED_PARAM for Localizer::formatDateTime
Kent Tamura
Comment 17
2012-10-03 05:32:00 PDT
Comment on
attachment 166866
[details]
Added UNUSED_PARAM for Localizer::formatDateTime ok. Please make sure this won't break builds.
Peter Beverloo (cr-android ews)
Comment 18
2012-10-03 05:46:30 PDT
Comment on
attachment 166866
[details]
Added UNUSED_PARAM for Localizer::formatDateTime
Attachment 166866
[details]
did not pass cr-android-ews (chromium-android): Output:
http://queues.webkit.org/results/14123718
Build Bot
Comment 19
2012-10-03 05:59:32 PDT
Comment on
attachment 166866
[details]
Added UNUSED_PARAM for Localizer::formatDateTime
Attachment 166866
[details]
did not pass win-ews (win): Output:
http://queues.webkit.org/results/14125762
Keishi Hattori
Comment 20
2012-10-03 06:30:24 PDT
Created
attachment 166880
[details]
Patch
Peter Beverloo (cr-android ews)
Comment 21
2012-10-03 06:44:04 PDT
Comment on
attachment 166880
[details]
Patch
Attachment 166880
[details]
did not pass cr-android-ews (chromium-android): Output:
http://queues.webkit.org/results/14130747
Keishi Hattori
Comment 22
2012-10-03 19:14:22 PDT
Created
attachment 167020
[details]
Patch
WebKit Review Bot
Comment 23
2012-10-03 20:36:31 PDT
Comment on
attachment 167020
[details]
Patch Clearing flags on attachment: 167020 Committed
r130357
: <
http://trac.webkit.org/changeset/130357
>
WebKit Review Bot
Comment 24
2012-10-03 20:36:36 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.
Top of Page
Format For Printing
XML
Clone This Bug