Changeset 133910 in webkit


Ignore:
Timestamp:
Nov 8, 2012 9:43:20 AM (11 years ago)
Author:
keishi@webkit.org
Message:

Add properties for week/month picker in DateTimeChooserImpl::writeDocument
https://bugs.webkit.org/show_bug.cgi?id=101552

Reviewed by Kent Tamura.

Source/Platform:

  • chromium/public/WebLocalizedString.h: Add WeekNumberLabel.

Source/WebKit/chromium:

Changing the arguments for calendar picker to support week/month picker.

  • src/DateTimeChooserImpl.cpp:

(WebKit::DateTimeChooserImpl::writeDocument):

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/Platform/ChangeLog

    r133901 r133910  
     12012-11-08  Keishi Hattori  <keishi@webkit.org>
     2
     3        Add properties for week/month picker in DateTimeChooserImpl::writeDocument
     4        https://bugs.webkit.org/show_bug.cgi?id=101552
     5
     6        Reviewed by Kent Tamura.
     7
     8        * chromium/public/WebLocalizedString.h: Add WeekNumberLabel.
     9
    1102012-11-08  Robert Kroeger  <rjkroege@chromium.org>
    211
  • trunk/Source/Platform/chromium/public/WebLocalizedString.h

    r132060 r133910  
    103103        ValidationValueMissingForSelect,
    104104        WeekFormatTemplate,
     105        WeekNumberLabel,
    105106    };
    106107};
  • trunk/Source/WebKit/chromium/ChangeLog

    r133904 r133910  
     12012-11-08  Keishi Hattori  <keishi@webkit.org>
     2
     3        Add properties for week/month picker in DateTimeChooserImpl::writeDocument
     4        https://bugs.webkit.org/show_bug.cgi?id=101552
     5
     6        Reviewed by Kent Tamura.
     7
     8        Changing the arguments for calendar picker to support week/month picker.
     9
     10        * src/DateTimeChooserImpl.cpp:
     11        (WebKit::DateTimeChooserImpl::writeDocument):
     12
    1132012-11-08  Dimitri Glazkov  <dglazkov@chromium.org>
    214
  • trunk/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp

    r133284 r133910  
    9191void DateTimeChooserImpl::writeDocument(WebCore::DocumentWriter& writer)
    9292{
    93     WebCore::DateComponents date;
    94     date.setMillisecondsSinceEpochForDate(m_parameters.minimum);
    95     String minString = date.toString();
    96     date.setMillisecondsSinceEpochForDate(m_parameters.maximum);
    97     String maxString = date.toString();
     93    WebCore::DateComponents minDate;
     94    WebCore::DateComponents maxDate;
     95    if (m_parameters.type == WebCore::InputTypeNames::month()) {
     96        minDate.setMonthsSinceEpoch(m_parameters.minimum);
     97        maxDate.setMonthsSinceEpoch(m_parameters.maximum);
     98    } else if (m_parameters.type == WebCore::InputTypeNames::week()) {
     99        minDate.setMillisecondsSinceEpochForWeek(m_parameters.minimum);
     100        maxDate.setMillisecondsSinceEpochForWeek(m_parameters.maximum);
     101    } else {
     102        minDate.setMillisecondsSinceEpochForDate(m_parameters.minimum);
     103        maxDate.setMillisecondsSinceEpochForDate(m_parameters.maximum);
     104    }
    98105    String stepString = String::number(m_parameters.step);
    99106    String stepBaseString = String::number(m_parameters.stepBase, 11, WTF::TruncateTrailingZeros);
     
    103110    IntRect rootViewRectInScreen = m_chromeClient->rootViewToScreen(rootViewVisibleContentRect);
    104111    rootViewRectInScreen.move(-view->scrollX(), -view->scrollY());
     112    String todayLabelString;
     113    if (m_parameters.type == WebCore::InputTypeNames::month())
     114        todayLabelString = Platform::current()->queryLocalizedString(WebLocalizedString::ThisMonthButtonLabel);
     115    else if (m_parameters.type == WebCore::InputTypeNames::week())
     116        todayLabelString = Platform::current()->queryLocalizedString(WebLocalizedString::ThisWeekButtonLabel);
     117    else
     118        todayLabelString = Platform::current()->queryLocalizedString(WebLocalizedString::CalendarToday);
    105119
    106120    addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer);
     
    120134    addProperty("confineToRootView", false, writer);
    121135#endif
    122     addProperty("min", minString, writer);
    123     addProperty("max", maxString, writer);
     136    addProperty("min", minDate.toString(), writer);
     137    addProperty("max", maxDate.toString(), writer);
    124138    addProperty("step", stepString, writer);
    125139    addProperty("stepBase", stepBaseString, writer);
     
    127141    addProperty("currentValue", m_parameters.currentValue, writer);
    128142    addProperty("locale", WebCore::defaultLanguage(), writer);
    129     addProperty("todayLabel", Platform::current()->queryLocalizedString(WebLocalizedString::CalendarToday), writer);
     143    addProperty("todayLabel", todayLabelString, writer);
    130144    addProperty("clearLabel", Platform::current()->queryLocalizedString(WebLocalizedString::CalendarClear), writer);
     145    addProperty("weekLabel", Platform::current()->queryLocalizedString(WebLocalizedString::WeekNumberLabel), writer);
    131146    addProperty("weekStartDay", m_locale->firstDayOfWeek(), writer);
    132147    addProperty("monthLabels", m_locale->monthLabels(), writer);
     
    134149    addProperty("isCalendarRTL", m_locale->isRTL(), writer);
    135150    addProperty("isRTL", m_parameters.isAnchorElementRTL, writer);
     151    addProperty("mode", m_parameters.type.string(), writer);
    136152    if (m_parameters.suggestionValues.size()) {
    137153        addProperty("inputWidth", static_cast<unsigned>(m_parameters.anchorRectInRootView.width()), writer);
Note: See TracChangeset for help on using the changeset viewer.