[Chromium-Win] Support shortTimeFormat
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Oct 2012 07:43:29 +0000 (07:43 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Oct 2012 07:43:29 +0000 (07:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=100471

Reviewed by Kentaro Hara.

Source/WebCore:

No new tests. Covered by fast/forms/time-multiple-fields/ and
WebKit/chromium/tests/LocaleWinTest.

* platform/text/LocaleWin.cpp:
(WebCore::LocaleWin::shortTimeFormat):
Gets a format by LOCALE_SSHORTTIME. If it fails, remove "<delimiter>ss"
from the format by LOCALE_STIMEFORMAT.
* platform/text/LocaleWin.h:
(LocaleWin): Declare m_timeFormatWithoutSeconds.

Source/WebKit/chromium:

* tests/LocaleWinTest.cpp:
(TEST_F): Update test expectations for the behavior change.

LayoutTests:

* platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic-expected.png:
* platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-disabled-readonly-expected.png:
* platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-pseudo-elements-expected.png:
* platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-style-expected.png:
* platform/chromium/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@132579 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic-expected.png
LayoutTests/platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-disabled-readonly-expected.png
LayoutTests/platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-pseudo-classes-expected.png
LayoutTests/platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-pseudo-elements-expected.png
LayoutTests/platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-style-expected.png
LayoutTests/platform/chromium/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/platform/text/LocaleWin.cpp
Source/WebCore/platform/text/LocaleWin.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/LocaleWinTest.cpp

index a968f2d..a175e63 100644 (file)
@@ -1,3 +1,17 @@
+2012-10-26  Kent Tamura  <tkent@chromium.org>
+
+        [Chromium-Win] Support shortTimeFormat
+        https://bugs.webkit.org/show_bug.cgi?id=100471
+
+        Reviewed by Kentaro Hara.
+
+        * platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic-expected.png:
+        * platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-disabled-readonly-expected.png:
+        * platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-pseudo-classes-expected.png:
+        * platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-pseudo-elements-expected.png:
+        * platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-style-expected.png:
+        * platform/chromium/TestExpectations:
+
 2012-10-26  Nandor Huszka  <hnandor@inf.u-szeged.hu>
 
         [Qt] Unreviewed gardening.
index 0a3abaf..fc3b7d7 100644 (file)
Binary files a/LayoutTests/platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic-expected.png and b/LayoutTests/platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic-expected.png differ
index e3a3548..4857769 100644 (file)
Binary files a/LayoutTests/platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-disabled-readonly-expected.png and b/LayoutTests/platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-disabled-readonly-expected.png differ
index b6b7bab..a20a7d6 100644 (file)
Binary files a/LayoutTests/platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-pseudo-classes-expected.png and b/LayoutTests/platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-pseudo-classes-expected.png differ
index 1c5d6dc..2bad5ca 100644 (file)
Binary files a/LayoutTests/platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-pseudo-elements-expected.png and b/LayoutTests/platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-pseudo-elements-expected.png differ
index a3633eb..6aef822 100644 (file)
Binary files a/LayoutTests/platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-style-expected.png and b/LayoutTests/platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-style-expected.png differ
index 0d222c6..bf89e57 100644 (file)
@@ -2805,6 +2805,14 @@ webkit.org/b/96720 fast/forms/time-multiple-fields/time-multiple-fields-preserve
 webkit.org/b/96720 fast/forms/date-multiple-fields/date-multiple-fields-preserve-value-after-history-back.html [ Pass Timeout ]
 webkit.org/b/98906 platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-mouse-operations.html [ Pass Failure ]
 
+# Need rebaseline 
+webkit.org/b/100471 fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic.html [ Pass ImageOnlyFailure ]
+webkit.org/b/100471 fast/forms/time-multiple-fields/time-multiple-fields-appearance-disabled-readonly.html [ Pass ImageOnlyFailure ]
+webkit.org/b/100471 fast/forms/time-multiple-fields/time-multiple-fields-appearance-pseudo-classes.html [ Pass ImageOnlyFailure ]
+webkit.org/b/100471 fast/forms/time-multiple-fields/time-multiple-fields-appearance-pseudo-elements.html [ Pass ImageOnlyFailure ]
+webkit.org/b/100471 fast/forms/time-multiple-fields/time-multiple-fields-appearance-style.html [ Pass ImageOnlyFailure ]
+webkit.org/b/100471 fast/forms/time-multiple-fields/time-multiple-fields-appearance-style.html [ Pass ImageOnlyFailure ]
+
 # New test added in r87324
 crbug.com/83994 [ Win ] platform/win/plugins/call-javascript-that-destroys-plugin.html [ Failure ]
 
index adf0645..45d00c7 100644 (file)
@@ -1,3 +1,20 @@
+2012-10-26  Kent Tamura  <tkent@chromium.org>
+
+        [Chromium-Win] Support shortTimeFormat
+        https://bugs.webkit.org/show_bug.cgi?id=100471
+
+        Reviewed by Kentaro Hara.
+
+        No new tests. Covered by fast/forms/time-multiple-fields/ and
+        WebKit/chromium/tests/LocaleWinTest.
+
+        * platform/text/LocaleWin.cpp:
+        (WebCore::LocaleWin::shortTimeFormat):
+        Gets a format by LOCALE_SSHORTTIME. If it fails, remove "<delimiter>ss"
+        from the format by LOCALE_STIMEFORMAT.
+        * platform/text/LocaleWin.h:
+        (LocaleWin): Declare m_timeFormatWithoutSeconds.
+
 2012-10-26  Adam Barth  <abarth@webkit.org>
 
         Unreviewed. Update run-bindings-tests results after recent active DOM
index c11c379..d939d81 100644 (file)
@@ -704,11 +704,23 @@ String LocaleWin::timeFormat()
     return m_localizedTimeFormatText;
 }
 
-// Note: To make XP/Vista and Windows 7/later same behavior, we don't use
-// LOCALE_SSHORTTIME.
 String LocaleWin::shortTimeFormat()
 {
-    return timeFormat();
+    if (!m_timeFormatWithoutSeconds.isNull())
+        return m_timeFormatWithoutSeconds;
+    String format = getLocaleInfoString(LOCALE_SSHORTTIME);
+    // Vista or older Windows doesn't support LOCALE_SSHORTTIME.
+    if (format.isEmpty()) {
+        format = timeFormat();
+        StringBuilder builder;
+        builder.append(getLocaleInfoString(LOCALE_STIME));
+        builder.append("ss");
+        size_t pos = format.reverseFind(builder.toString());
+        if (pos != notFound)
+            format.remove(pos, builder.length());
+    }
+    m_timeFormatWithoutSeconds = convertWindowsTimeFormatToLDML(format);
+    return m_timeFormatWithoutSeconds;
 }
 
 const Vector<String>& LocaleWin::shortMonthLabels()
index 0c300ab..c5175d5 100644 (file)
@@ -104,6 +104,7 @@ private:
 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
     String m_dateFormat;
     String m_monthFormat;
+    String m_timeFormatWithoutSeconds;
 #endif
 #if ENABLE(CALENDAR_PICKER)
     Vector<String> m_weekDayShortLabels;
index b22ff46..5e68f72 100644 (file)
@@ -1,3 +1,13 @@
+2012-10-26  Kent Tamura  <tkent@chromium.org>
+
+        [Chromium-Win] Support shortTimeFormat
+        https://bugs.webkit.org/show_bug.cgi?id=100471
+
+        Reviewed by Kentaro Hara.
+
+        * tests/LocaleWinTest.cpp:
+        (TEST_F): Update test expectations for the behavior change.
+
 2012-10-25  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r132514.
index 35f064a..7b2dc9c 100644 (file)
@@ -312,9 +312,9 @@ TEST_F(LocaleWinTest, timeFormat)
 
 TEST_F(LocaleWinTest, shortTimeFormat)
 {
-    EXPECT_STREQ("h:mm:ss a", shortTimeFormat(EnglishUS).utf8().data());
-    EXPECT_STREQ("HH:mm:ss", shortTimeFormat(FrenchFR).utf8().data());
-    EXPECT_STREQ("H:mm:ss", shortTimeFormat(JapaneseJP).utf8().data());
+    EXPECT_STREQ("h:mm a", shortTimeFormat(EnglishUS).utf8().data());
+    EXPECT_STREQ("HH:mm", shortTimeFormat(FrenchFR).utf8().data());
+    EXPECT_STREQ("H:mm", shortTimeFormat(JapaneseJP).utf8().data());
 }
 
 TEST_F(LocaleWinTest, shortMonthLabels)