Title: [196861] trunk/Source/WebCore
Revision
196861
Author
[email protected]
Date
2016-02-20 08:42:24 -0800 (Sat, 20 Feb 2016)

Log Message

Do not require UDate in LocaleICU with !ENABLE_DATE_AND_TIME_INPUT_TYPES
https://bugs.webkit.org/show_bug.cgi?id=154483

Patch by Olivier Blin <[email protected]> on 2016-02-20
Reviewed by Michael Catanzaro.

Put initializeShortDateFormat(), dateFormat(), m_shortDateFormat and
m_didCreateShortDateFormat under flag, since they are only used by
code under the ENABLE_DATE_AND_TIME_INPUT_TYPES flag.

This helps to build with a light ICU that does not provide UDate
features (with UCONFIG_NO_FORMATTING).

* platform/text/LocaleICU.cpp:
(WebCore::LocaleICU::LocaleICU):
(WebCore::LocaleICU::~LocaleICU):
(WebCore::createFallbackMonthLabels): Deleted.
(WebCore::createFallbackAMPMLabels): Deleted.
* platform/text/LocaleICU.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (196860 => 196861)


--- trunk/Source/WebCore/ChangeLog	2016-02-20 16:31:28 UTC (rev 196860)
+++ trunk/Source/WebCore/ChangeLog	2016-02-20 16:42:24 UTC (rev 196861)
@@ -1,5 +1,26 @@
 2016-02-20  Olivier Blin  <[email protected]>
 
+        Do not require UDate in LocaleICU with !ENABLE_DATE_AND_TIME_INPUT_TYPES
+        https://bugs.webkit.org/show_bug.cgi?id=154483
+
+        Reviewed by Michael Catanzaro.
+
+        Put initializeShortDateFormat(), dateFormat(), m_shortDateFormat and
+        m_didCreateShortDateFormat under flag, since they are only used by
+        code under the ENABLE_DATE_AND_TIME_INPUT_TYPES flag.
+
+        This helps to build with a light ICU that does not provide UDate
+        features (with UCONFIG_NO_FORMATTING).
+
+        * platform/text/LocaleICU.cpp:
+        (WebCore::LocaleICU::LocaleICU):
+        (WebCore::LocaleICU::~LocaleICU):
+        (WebCore::createFallbackMonthLabels): Deleted.
+        (WebCore::createFallbackAMPMLabels): Deleted.
+        * platform/text/LocaleICU.h:
+
+2016-02-20  Olivier Blin  <[email protected]>
+
         Remove declaration of unimplemented methods in LocaleICU
         https://bugs.webkit.org/show_bug.cgi?id=154482
 

Modified: trunk/Source/WebCore/platform/text/LocaleICU.cpp (196860 => 196861)


--- trunk/Source/WebCore/platform/text/LocaleICU.cpp	2016-02-20 16:31:28 UTC (rev 196860)
+++ trunk/Source/WebCore/platform/text/LocaleICU.cpp	2016-02-20 16:42:24 UTC (rev 196861)
@@ -51,12 +51,12 @@
 LocaleICU::LocaleICU(const char* locale)
     : m_locale(locale)
     , m_numberFormat(0)
-    , m_shortDateFormat(0)
     , m_didCreateDecimalFormat(false)
-    , m_didCreateShortDateFormat(false)
 #if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+    , m_shortDateFormat(0)
     , m_mediumTimeFormat(0)
     , m_shortTimeFormat(0)
+    , m_didCreateShortDateFormat(false)
     , m_didCreateTimeFormat(false)
 #endif
 {
@@ -65,8 +65,8 @@
 LocaleICU::~LocaleICU()
 {
     unum_close(m_numberFormat);
-    udat_close(m_shortDateFormat);
 #if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+    udat_close(m_shortDateFormat);
     udat_close(m_mediumTimeFormat);
     udat_close(m_shortTimeFormat);
 #endif
@@ -130,6 +130,7 @@
     setLocaleData(symbols, decimalTextAttribute(UNUM_POSITIVE_PREFIX), decimalTextAttribute(UNUM_POSITIVE_SUFFIX), decimalTextAttribute(UNUM_NEGATIVE_PREFIX), decimalTextAttribute(UNUM_NEGATIVE_SUFFIX));
 }
 
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
 bool LocaleICU::initializeShortDateFormat()
 {
     if (m_didCreateShortDateFormat)
@@ -146,7 +147,6 @@
     return udat_open(timeStyle, dateStyle, m_locale.data(), gmtTimezone, WTF_ARRAY_LENGTH(gmtTimezone), 0, -1, &status);
 }
 
-#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
 static String getDateFormatPattern(const UDateFormat* dateFormat)
 {
     if (!dateFormat)
@@ -187,9 +187,7 @@
     }
     return WTFMove(labels);
 }
-#endif
 
-#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
 static std::unique_ptr<Vector<String>> createFallbackMonthLabels()
 {
     auto labels = std::make_unique<Vector<String>>();
@@ -211,9 +209,7 @@
     m_monthLabels = createFallbackMonthLabels();
     return *m_monthLabels;
 }
-#endif
 
-#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
 static std::unique_ptr<Vector<String>> createFallbackAMPMLabels()
 {
     auto labels = std::make_unique<Vector<String>>();

Modified: trunk/Source/WebCore/platform/text/LocaleICU.h (196860 => 196861)


--- trunk/Source/WebCore/platform/text/LocaleICU.h	2016-02-20 16:31:28 UTC (rev 196860)
+++ trunk/Source/WebCore/platform/text/LocaleICU.h	2016-02-20 16:42:24 UTC (rev 196861)
@@ -68,19 +68,17 @@
     String decimalTextAttribute(UNumberFormatTextAttribute);
     virtual void initializeLocaleData() override;
 
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
     bool initializeShortDateFormat();
     UDateFormat* openDateFormat(UDateFormatStyle timeStyle, UDateFormatStyle dateStyle) const;
 
-#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
     std::unique_ptr<Vector<String>> createLabelVector(const UDateFormat*, UDateFormatSymbolType, int32_t startIndex, int32_t size);
     void initializeDateTimeFormat();
 #endif
 
     CString m_locale;
     UNumberFormat* m_numberFormat;
-    UDateFormat* m_shortDateFormat;
     bool m_didCreateDecimalFormat;
-    bool m_didCreateShortDateFormat;
 
 #if ENABLE(DATE_AND_TIME_INPUT_TYPES)
     std::unique_ptr<Vector<String>> m_monthLabels;
@@ -91,12 +89,14 @@
     String m_timeFormatWithoutSeconds;
     String m_dateTimeFormatWithSeconds;
     String m_dateTimeFormatWithoutSeconds;
+    UDateFormat* m_shortDateFormat;
     UDateFormat* m_mediumTimeFormat;
     UDateFormat* m_shortTimeFormat;
     Vector<String> m_shortMonthLabels;
     Vector<String> m_standAloneMonthLabels;
     Vector<String> m_shortStandAloneMonthLabels;
     Vector<String> m_timeAMPMLabels;
+    bool m_didCreateShortDateFormat;
     bool m_didCreateTimeFormat;
 #endif
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to