summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/web/DateTimeChooserImpl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/WebKit/Source/web/DateTimeChooserImpl.cpp')
-rw-r--r--chromium/third_party/WebKit/Source/web/DateTimeChooserImpl.cpp94
1 files changed, 50 insertions, 44 deletions
diff --git a/chromium/third_party/WebKit/Source/web/DateTimeChooserImpl.cpp b/chromium/third_party/WebKit/Source/web/DateTimeChooserImpl.cpp
index 2ada30bcf9c..170e498df1e 100644
--- a/chromium/third_party/WebKit/Source/web/DateTimeChooserImpl.cpp
+++ b/chromium/third_party/WebKit/Source/web/DateTimeChooserImpl.cpp
@@ -30,19 +30,19 @@
#include "config.h"
#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
-#include "DateTimeChooserImpl.h"
+#include "web/DateTimeChooserImpl.h"
#include "CalendarPicker.h"
-#include "ChromeClientImpl.h"
-#include "InputTypeNames.h"
#include "PickerCommon.h"
-#include "WebViewImpl.h"
+#include "core/InputTypeNames.h"
#include "core/frame/FrameView.h"
#include "core/rendering/RenderTheme.h"
#include "platform/DateComponents.h"
#include "platform/DateTimeChooserClient.h"
#include "platform/Language.h"
#include "platform/text/PlatformLocale.h"
+#include "web/ChromeClientImpl.h"
+#include "web/WebViewImpl.h"
using namespace WebCore;
@@ -60,9 +60,9 @@ DateTimeChooserImpl::DateTimeChooserImpl(ChromeClientImpl* chromeClient, WebCore
m_popup = m_chromeClient->openPagePopup(this, m_parameters.anchorRectInRootView);
}
-PassRefPtr<DateTimeChooserImpl> DateTimeChooserImpl::create(ChromeClientImpl* chromeClient, WebCore::DateTimeChooserClient* client, const WebCore::DateTimeChooserParameters& parameters)
+PassRefPtrWillBeRawPtr<DateTimeChooserImpl> DateTimeChooserImpl::create(ChromeClientImpl* chromeClient, WebCore::DateTimeChooserClient* client, const WebCore::DateTimeChooserParameters& parameters)
{
- return adoptRef(new DateTimeChooserImpl(chromeClient, client, parameters));
+ return adoptRefWillBeNoop(new DateTimeChooserImpl(chromeClient, client, parameters));
}
DateTimeChooserImpl::~DateTimeChooserImpl()
@@ -99,7 +99,7 @@ static String valueToDateTimeString(double value, AtomicString type)
return components.type() == WebCore::DateComponents::Invalid ? String() : components.toString();
}
-void DateTimeChooserImpl::writeDocument(WebCore::DocumentWriter& writer)
+void DateTimeChooserImpl::writeDocument(WebCore::SharedBuffer* data)
{
String stepString = String::number(m_parameters.step);
String stepBaseString = String::number(m_parameters.stepBase, 11, WTF::TruncateTrailingZeros);
@@ -117,30 +117,30 @@ void DateTimeChooserImpl::writeDocument(WebCore::DocumentWriter& writer)
otherDateLabelString = locale().queryString(WebLocalizedString::OtherDateLabel);
}
- addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer);
- writer.addData(pickerCommonCss, sizeof(pickerCommonCss));
- writer.addData(pickerButtonCss, sizeof(pickerButtonCss));
- writer.addData(suggestionPickerCss, sizeof(suggestionPickerCss));
- writer.addData(calendarPickerCss, sizeof(calendarPickerCss));
+ addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", data);
+ data->append(pickerCommonCss, sizeof(pickerCommonCss));
+ data->append(pickerButtonCss, sizeof(pickerButtonCss));
+ data->append(suggestionPickerCss, sizeof(suggestionPickerCss));
+ data->append(calendarPickerCss, sizeof(calendarPickerCss));
addString("</style></head><body><div id=main>Loading...</div><script>\n"
- "window.dialogArguments = {\n", writer);
- addProperty("anchorRectInScreen", anchorRectInScreen, writer);
- addProperty("min", valueToDateTimeString(m_parameters.minimum, m_parameters.type), writer);
- addProperty("max", valueToDateTimeString(m_parameters.maximum, m_parameters.type), writer);
- addProperty("step", stepString, writer);
- addProperty("stepBase", stepBaseString, writer);
- addProperty("required", m_parameters.required, writer);
- addProperty("currentValue", valueToDateTimeString(m_parameters.doubleValue, m_parameters.type), writer);
- addProperty("locale", m_parameters.locale.string(), writer);
- addProperty("todayLabel", todayLabelString, writer);
- addProperty("clearLabel", locale().queryString(WebLocalizedString::CalendarClear), writer);
- addProperty("weekLabel", locale().queryString(WebLocalizedString::WeekNumberLabel), writer);
- addProperty("weekStartDay", m_locale->firstDayOfWeek(), writer);
- addProperty("shortMonthLabels", m_locale->shortMonthLabels(), writer);
- addProperty("dayLabels", m_locale->weekDayShortLabels(), writer);
- addProperty("isLocaleRTL", m_locale->isRTL(), writer);
- addProperty("isRTL", m_parameters.isAnchorElementRTL, writer);
- addProperty("mode", m_parameters.type.string(), writer);
+ "window.dialogArguments = {\n", data);
+ addProperty("anchorRectInScreen", anchorRectInScreen, data);
+ addProperty("min", valueToDateTimeString(m_parameters.minimum, m_parameters.type), data);
+ addProperty("max", valueToDateTimeString(m_parameters.maximum, m_parameters.type), data);
+ addProperty("step", stepString, data);
+ addProperty("stepBase", stepBaseString, data);
+ addProperty("required", m_parameters.required, data);
+ addProperty("currentValue", valueToDateTimeString(m_parameters.doubleValue, m_parameters.type), data);
+ addProperty("locale", m_parameters.locale.string(), data);
+ addProperty("todayLabel", todayLabelString, data);
+ addProperty("clearLabel", locale().queryString(WebLocalizedString::CalendarClear), data);
+ addProperty("weekLabel", locale().queryString(WebLocalizedString::WeekNumberLabel), data);
+ addProperty("weekStartDay", m_locale->firstDayOfWeek(), data);
+ addProperty("shortMonthLabels", m_locale->shortMonthLabels(), data);
+ addProperty("dayLabels", m_locale->weekDayShortLabels(), data);
+ addProperty("isLocaleRTL", m_locale->isRTL(), data);
+ addProperty("isRTL", m_parameters.isAnchorElementRTL, data);
+ addProperty("mode", m_parameters.type.string(), data);
if (m_parameters.suggestions.size()) {
Vector<String> suggestionValues;
Vector<String> localizedSuggestionValues;
@@ -150,21 +150,21 @@ void DateTimeChooserImpl::writeDocument(WebCore::DocumentWriter& writer)
localizedSuggestionValues.append(m_parameters.suggestions[i].localizedValue);
suggestionLabels.append(m_parameters.suggestions[i].label);
}
- addProperty("suggestionValues", suggestionValues, writer);
- addProperty("localizedSuggestionValues", localizedSuggestionValues, writer);
- addProperty("suggestionLabels", suggestionLabels, writer);
- addProperty("inputWidth", static_cast<unsigned>(m_parameters.anchorRectInRootView.width()), writer);
- addProperty("showOtherDateEntry", WebCore::RenderTheme::theme().supportsCalendarPicker(m_parameters.type), writer);
- addProperty("otherDateLabel", otherDateLabelString, writer);
- addProperty("suggestionHighlightColor", WebCore::RenderTheme::theme().activeListBoxSelectionBackgroundColor().serialized(), writer);
- addProperty("suggestionHighlightTextColor", WebCore::RenderTheme::theme().activeListBoxSelectionForegroundColor().serialized(), writer);
+ addProperty("suggestionValues", suggestionValues, data);
+ addProperty("localizedSuggestionValues", localizedSuggestionValues, data);
+ addProperty("suggestionLabels", suggestionLabels, data);
+ addProperty("inputWidth", static_cast<unsigned>(m_parameters.anchorRectInRootView.width()), data);
+ addProperty("showOtherDateEntry", WebCore::RenderTheme::theme().supportsCalendarPicker(m_parameters.type), data);
+ addProperty("otherDateLabel", otherDateLabelString, data);
+ addProperty("suggestionHighlightColor", WebCore::RenderTheme::theme().activeListBoxSelectionBackgroundColor().serialized(), data);
+ addProperty("suggestionHighlightTextColor", WebCore::RenderTheme::theme().activeListBoxSelectionForegroundColor().serialized(), data);
}
- addString("}\n", writer);
+ addString("}\n", data);
- writer.addData(pickerCommonJs, sizeof(pickerCommonJs));
- writer.addData(suggestionPickerJs, sizeof(suggestionPickerJs));
- writer.addData(calendarPickerJs, sizeof(calendarPickerJs));
- addString("</script></body>\n", writer);
+ data->append(pickerCommonJs, sizeof(pickerCommonJs));
+ data->append(suggestionPickerJs, sizeof(suggestionPickerJs));
+ data->append(calendarPickerJs, sizeof(calendarPickerJs));
+ addString("</script></body>\n", data);
}
WebCore::Locale& DateTimeChooserImpl::locale()
@@ -174,7 +174,7 @@ WebCore::Locale& DateTimeChooserImpl::locale()
void DateTimeChooserImpl::setValueAndClosePopup(int numValue, const String& stringValue)
{
- RefPtr<DateTimeChooserImpl> protector(this);
+ RefPtrWillBeRawPtr<DateTimeChooserImpl> protector(this);
if (numValue >= 0)
setValue(stringValue);
endChooser();
@@ -197,6 +197,12 @@ void DateTimeChooserImpl::didClosePopup()
m_client->didEndChooser();
}
+void DateTimeChooserImpl::trace(Visitor* visitor)
+{
+ visitor->trace(m_client);
+ DateTimeChooser::trace(visitor);
+}
+
} // namespace blink
#endif // ENABLE(INPUT_MULTIPLE_FIELDS_UI)