Bug 99963 - Introduce Localizer::standAloneMonthLabels
Summary: Introduce Localizer::standAloneMonthLabels
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kent Tamura
URL:
Keywords:
Depends on:
Blocks: 100060
  Show dependency treegraph
 
Reported: 2012-10-22 00:24 PDT by Kent Tamura
Modified: 2012-10-22 19:12 PDT (History)
2 users (show)

See Also:


Attachments
Patch (22.91 KB, patch)
2012-10-22 00:52 PDT, Kent Tamura
haraken: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kent Tamura 2012-10-22 00:24:25 PDT
We realized full stand-alone month names were necessary for input[type=month] UI in addition to short stand-alone month names.
Comment 1 Kent Tamura 2012-10-22 00:52:05 PDT
Created attachment 169841 [details]
Patch
Comment 2 Kentaro Hara 2012-10-22 05:53:19 PDT
Comment on attachment 169841 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=169841&action=review

> Source/WebCore/platform/text/LocaleICU.cpp:334
> +    if (m_monthLabels)

This should be:

  if (!m_monthLabels.isEmpty())

> Source/WebCore/platform/text/LocaleICU.cpp:343
> +    if (!initializeShortDateFormat()) {
> +        m_monthLabels = createFallbackMonthLabels();
> +        return *m_monthLabels;
> +    }
> +    m_monthLabels = createLabelVector(m_shortDateFormat, UDAT_MONTHS, UCAL_JANUARY, 12);
> +    if (m_monthLabels)
> +        return *m_monthLabels;
> +    m_monthLabels = createFallbackMonthLabels();

Just like LocaleICU::standAloneMonthLabels(), I would prefer:

if (initializeShortDateFormat()) {
  if (OwnPtr<Vector<String> > labels = createLabelVector(m_shortDateFormat, UDAT_MONTHS, UCAL_JANUARY, 12)) {
    m_monthLabels = labels;
    return *m_monthLabels;
  }
}
m_monthLabels = createFallbackMonthLabels();
Comment 3 Kent Tamura 2012-10-22 18:22:58 PDT
Committed r132170: <http://trac.webkit.org/changeset/132170>
Comment 4 Kent Tamura 2012-10-22 18:24:47 PDT
Comment on attachment 169841 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=169841&action=review

>> Source/WebCore/platform/text/LocaleICU.cpp:343
>> +    m_monthLabels = createFallbackMonthLabels();
> 
> Just like LocaleICU::standAloneMonthLabels(), I would prefer:
> 
> if (initializeShortDateFormat()) {
>   if (OwnPtr<Vector<String> > labels = createLabelVector(m_shortDateFormat, UDAT_MONTHS, UCAL_JANUARY, 12)) {
>     m_monthLabels = labels;
>     return *m_monthLabels;
>   }
> }
> m_monthLabels = createFallbackMonthLabels();

ok.
Because m_monthLabels is OwnPtr and I'd like to minimize the change, I have changed this function as follows:

{
    if (m_monthLabels)
        return *m_monthLabels;
    if (initializeShortDateFormat()) {
        m_monthLabels = createLabelVector(m_shortDateFormat, UDAT_MONTHS, UCAL_JANUARY, 12);
        if (m_monthLabels)
            return *m_monthLabels;
    }
    m_monthLabels = createFallbackMonthLabels();
    return *m_monthLabels;
}