summaryrefslogtreecommitdiff
path: root/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-17 16:21:14 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-17 16:21:14 +0200
commit8995b83bcbfbb68245f779b64e5517627c6cc6ea (patch)
tree17985605dab9263cc2444bd4d45f189e142cca7c /Source/WebKit/chromium/src/DateTimeChooserImpl.cpp
parentb9c9652036d5e9f1e29c574f40bc73a35c81ace6 (diff)
downloadqtwebkit-8995b83bcbfbb68245f779b64e5517627c6cc6ea.tar.gz
Imported WebKit commit cf4f8fc6f19b0629f51860cb2d4b25e139d07e00 (http://svn.webkit.org/repository/webkit/trunk@131592)
New snapshot that includes the build fixes for Mac OS X 10.6 and earlier as well as the previously cherry-picked changes
Diffstat (limited to 'Source/WebKit/chromium/src/DateTimeChooserImpl.cpp')
-rw-r--r--Source/WebKit/chromium/src/DateTimeChooserImpl.cpp37
1 files changed, 29 insertions, 8 deletions
diff --git a/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp b/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp
index 4e2c69e9f..20044add8 100644
--- a/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp
+++ b/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp
@@ -37,16 +37,18 @@
#include "ChromeClientImpl.h"
#include "DateComponents.h"
#include "DateTimeChooserClient.h"
+#include "FrameView.h"
#include "InputTypeNames.h"
#include "Language.h"
-#include "LocalizedDate.h"
+#include "Localizer.h"
#include "NotImplemented.h"
#include "PickerCommon.h"
#include "RenderTheme.h"
-#include "platform/WebKitPlatformSupport.h"
+#include "WebViewImpl.h"
+#include <public/Platform.h>
#include <public/WebLocalizedString.h>
-using namespace WTF::Unicode;
+using namespace WebCore;
namespace WebKit {
@@ -55,6 +57,7 @@ DateTimeChooserImpl::DateTimeChooserImpl(ChromeClientImpl* chromeClient, WebCore
, m_client(client)
, m_popup(0)
, m_parameters(parameters)
+ , m_localizer(WebCore::Localizer::createDefault())
{
ASSERT(m_chromeClient);
ASSERT(m_client);
@@ -85,6 +88,11 @@ void DateTimeChooserImpl::writeDocument(WebCore::DocumentWriter& writer)
date.setMillisecondsSinceEpochForDate(m_parameters.maximum);
String maxString = date.toString();
String stepString = String::number(m_parameters.step);
+ String stepBaseString = String::number(m_parameters.stepBase, 11, WTF::TruncateTrailingZeros);
+ IntRect anchorRectInScreen = m_chromeClient->rootViewToScreen(m_parameters.anchorRectInRootView);
+ FrameView* view = static_cast<WebViewImpl*>(m_chromeClient->webView())->page()->mainFrame()->view();
+ IntRect rootViewVisibleContentRect = view->visibleContentRect(true /* include scrollbars */);
+ IntRect rootViewRectInScreen = m_chromeClient->rootViewToScreen(rootViewVisibleContentRect);
addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer);
writer.addData(WebCore::pickerCommonCss, sizeof(WebCore::pickerCommonCss));
@@ -95,19 +103,27 @@ void DateTimeChooserImpl::writeDocument(WebCore::DocumentWriter& writer)
writer.addData(extraStyle.data(), extraStyle.length());
addString("</style></head><body><div id=main>Loading...</div><script>\n"
"window.dialogArguments = {\n", writer);
+ addProperty("anchorRectInScreen", anchorRectInScreen, writer);
+ addProperty("rootViewRectInScreen", rootViewRectInScreen, writer);
+#if OS(MAC_OS_X)
+ addProperty("confineToRootView", true, writer);
+#else
+ addProperty("confineToRootView", false, writer);
+#endif
addProperty("min", minString, writer);
addProperty("max", maxString, writer);
addProperty("step", stepString, writer);
+ addProperty("stepBase", stepBaseString, writer);
addProperty("required", m_parameters.required, writer);
addProperty("currentValue", m_parameters.currentValue, writer);
addProperty("locale", WebCore::defaultLanguage(), writer);
addProperty("todayLabel", Platform::current()->queryLocalizedString(WebLocalizedString::CalendarToday), writer);
addProperty("clearLabel", Platform::current()->queryLocalizedString(WebLocalizedString::CalendarClear), writer);
- addProperty("weekStartDay", WebCore::firstDayOfWeek(), writer);
- addProperty("monthLabels", WebCore::monthLabels(), writer);
- addProperty("dayLabels", WebCore::weekDayShortLabels(), writer);
- Direction dir = direction(WebCore::monthLabels()[0][0]);
- addProperty("isRTL", dir == RightToLeft || dir == RightToLeftArabic, writer);
+ addProperty("weekStartDay", m_localizer->firstDayOfWeek(), writer);
+ addProperty("monthLabels", m_localizer->monthLabels(), writer);
+ addProperty("dayLabels", m_localizer->weekDayShortLabels(), writer);
+ addProperty("isCalendarRTL", m_localizer->isRTL(), writer);
+ addProperty("isRTL", m_parameters.isAnchorElementRTL, writer);
if (m_parameters.suggestionValues.size()) {
addProperty("inputWidth", static_cast<unsigned>(m_parameters.anchorRectInRootView.width()), writer);
addProperty("suggestionValues", m_parameters.suggestionValues, writer);
@@ -126,6 +142,11 @@ void DateTimeChooserImpl::writeDocument(WebCore::DocumentWriter& writer)
addString("</script></body>\n", writer);
}
+WebCore::Localizer& DateTimeChooserImpl::localizer()
+{
+ return *m_localizer;
+}
+
void DateTimeChooserImpl::setValueAndClosePopup(int numValue, const String& stringValue)
{
if (numValue >= 0)