Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(840)

Side by Side Diff: Source/web/DateTimeChooserImpl.cpp

Issue 72683003: Auto-generate InputTypeNames source from InputTypeNames.in. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 32 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
33 #include "DateTimeChooserImpl.h" 33 #include "DateTimeChooserImpl.h"
34 34
35 #include "CalendarPicker.h" 35 #include "CalendarPicker.h"
36 #include "ChromeClientImpl.h" 36 #include "ChromeClientImpl.h"
37 #include "InputTypeNames.h"
37 #include "PickerCommon.h" 38 #include "PickerCommon.h"
38 #include "WebViewImpl.h" 39 #include "WebViewImpl.h"
39 #include "core/html/forms/InputTypeNames.h"
40 #include "core/frame/FrameView.h" 40 #include "core/frame/FrameView.h"
41 #include "core/rendering/RenderTheme.h" 41 #include "core/rendering/RenderTheme.h"
42 #include "platform/DateComponents.h" 42 #include "platform/DateComponents.h"
43 #include "platform/DateTimeChooserClient.h" 43 #include "platform/DateTimeChooserClient.h"
44 #include "platform/Language.h" 44 #include "platform/Language.h"
45 #include "platform/text/PlatformLocale.h" 45 #include "platform/text/PlatformLocale.h"
46 46
47 using namespace WebCore; 47 using namespace WebCore;
48 48
49 namespace blink { 49 namespace blink {
(...skipping 28 matching lines...) Expand all
78 78
79 WebCore::IntSize DateTimeChooserImpl::contentSize() 79 WebCore::IntSize DateTimeChooserImpl::contentSize()
80 { 80 {
81 return WebCore::IntSize(0, 0); 81 return WebCore::IntSize(0, 0);
82 } 82 }
83 83
84 void DateTimeChooserImpl::writeDocument(WebCore::DocumentWriter& writer) 84 void DateTimeChooserImpl::writeDocument(WebCore::DocumentWriter& writer)
85 { 85 {
86 WebCore::DateComponents minDate; 86 WebCore::DateComponents minDate;
87 WebCore::DateComponents maxDate; 87 WebCore::DateComponents maxDate;
88 if (m_parameters.type == WebCore::InputTypeNames::month()) { 88 if (m_parameters.type == WebCore::InputTypeNames::month) {
89 minDate.setMonthsSinceEpoch(m_parameters.minimum); 89 minDate.setMonthsSinceEpoch(m_parameters.minimum);
90 maxDate.setMonthsSinceEpoch(m_parameters.maximum); 90 maxDate.setMonthsSinceEpoch(m_parameters.maximum);
91 } else if (m_parameters.type == WebCore::InputTypeNames::week()) { 91 } else if (m_parameters.type == WebCore::InputTypeNames::week) {
92 minDate.setMillisecondsSinceEpochForWeek(m_parameters.minimum); 92 minDate.setMillisecondsSinceEpochForWeek(m_parameters.minimum);
93 maxDate.setMillisecondsSinceEpochForWeek(m_parameters.maximum); 93 maxDate.setMillisecondsSinceEpochForWeek(m_parameters.maximum);
94 } else { 94 } else {
95 minDate.setMillisecondsSinceEpochForDate(m_parameters.minimum); 95 minDate.setMillisecondsSinceEpochForDate(m_parameters.minimum);
96 maxDate.setMillisecondsSinceEpochForDate(m_parameters.maximum); 96 maxDate.setMillisecondsSinceEpochForDate(m_parameters.maximum);
97 } 97 }
98 String stepString = String::number(m_parameters.step); 98 String stepString = String::number(m_parameters.step);
99 String stepBaseString = String::number(m_parameters.stepBase, 11, WTF::Trunc ateTrailingZeros); 99 String stepBaseString = String::number(m_parameters.stepBase, 11, WTF::Trunc ateTrailingZeros);
100 IntRect anchorRectInScreen = m_chromeClient->rootViewToScreen(m_parameters.a nchorRectInRootView); 100 IntRect anchorRectInScreen = m_chromeClient->rootViewToScreen(m_parameters.a nchorRectInRootView);
101 String todayLabelString; 101 String todayLabelString;
102 String otherDateLabelString; 102 String otherDateLabelString;
103 if (m_parameters.type == WebCore::InputTypeNames::month()) { 103 if (m_parameters.type == WebCore::InputTypeNames::month) {
104 todayLabelString = locale().queryString(WebLocalizedString::ThisMonthBut tonLabel); 104 todayLabelString = locale().queryString(WebLocalizedString::ThisMonthBut tonLabel);
105 otherDateLabelString = locale().queryString(WebLocalizedString::OtherMon thLabel); 105 otherDateLabelString = locale().queryString(WebLocalizedString::OtherMon thLabel);
106 } else if (m_parameters.type == WebCore::InputTypeNames::week()) { 106 } else if (m_parameters.type == WebCore::InputTypeNames::week) {
107 todayLabelString = locale().queryString(WebLocalizedString::ThisWeekButt onLabel); 107 todayLabelString = locale().queryString(WebLocalizedString::ThisWeekButt onLabel);
108 otherDateLabelString = locale().queryString(WebLocalizedString::OtherWee kLabel); 108 otherDateLabelString = locale().queryString(WebLocalizedString::OtherWee kLabel);
109 } else { 109 } else {
110 todayLabelString = locale().queryString(WebLocalizedString::CalendarToda y); 110 todayLabelString = locale().queryString(WebLocalizedString::CalendarToda y);
111 otherDateLabelString = locale().queryString(WebLocalizedString::OtherDat eLabel); 111 otherDateLabelString = locale().queryString(WebLocalizedString::OtherDat eLabel);
112 } 112 }
113 113
114 addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer); 114 addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer);
115 writer.addData(pickerCommonCss, sizeof(pickerCommonCss)); 115 writer.addData(pickerCommonCss, sizeof(pickerCommonCss));
116 writer.addData(pickerButtonCss, sizeof(pickerButtonCss)); 116 writer.addData(pickerButtonCss, sizeof(pickerButtonCss));
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 void DateTimeChooserImpl::didClosePopup() 179 void DateTimeChooserImpl::didClosePopup()
180 { 180 {
181 ASSERT(m_client); 181 ASSERT(m_client);
182 m_popup = 0; 182 m_popup = 0;
183 m_client->didEndChooser(); 183 m_client->didEndChooser();
184 } 184 }
185 185
186 } // namespace blink 186 } // namespace blink
187 187
188 #endif // ENABLE(INPUT_MULTIPLE_FIELDS_UI) 188 #endif // ENABLE(INPUT_MULTIPLE_FIELDS_UI)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698