Title: [122430] trunk/Source/WebCore
Revision
122430
Author
[email protected]
Date
2012-07-12 02:00:18 -0700 (Thu, 12 Jul 2012)

Log Message

REGRESSION(r122184): LocaleMac::currentLocale should use current locale rather than newly create locale object.
https://bugs.webkit.org/show_bug.cgi?id=91057

Reviewed by Kent Tamura.

This patch changes NSLocale object of LocaleMac::m_locale variable to
current NSLocale object rather than newly created NSLocale object from
locale identifier.

No new tests. We don't have way to change system preferences from
test scripts and restoring them. To test this patch, we need to do so.

* platform/text/mac/LocaleMac.h:
(LocaleMac): Added a constructor which takes NSLocale object.
* platform/text/mac/LocaleMac.mm:
(WebCore::LocaleMac::LocaleMac): Added a constructor which takes NSLocale object.
(WebCore::LocaleMac::currentLocale): Changed to construct LocaleMac object from NSLocale object rather than locale identifier.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (122429 => 122430)


--- trunk/Source/WebCore/ChangeLog	2012-07-12 08:57:32 UTC (rev 122429)
+++ trunk/Source/WebCore/ChangeLog	2012-07-12 09:00:18 UTC (rev 122430)
@@ -1,3 +1,23 @@
+2012-07-12  Yoshifumi Inoue  <[email protected]>
+
+        REGRESSION(r122184): LocaleMac::currentLocale should use current locale rather than newly create locale object. 
+        https://bugs.webkit.org/show_bug.cgi?id=91057
+
+        Reviewed by Kent Tamura.
+
+        This patch changes NSLocale object of LocaleMac::m_locale variable to
+        current NSLocale object rather than newly created NSLocale object from
+        locale identifier.
+
+        No new tests. We don't have way to change system preferences from
+        test scripts and restoring them. To test this patch, we need to do so.
+
+        * platform/text/mac/LocaleMac.h:
+        (LocaleMac): Added a constructor which takes NSLocale object.
+        * platform/text/mac/LocaleMac.mm:
+        (WebCore::LocaleMac::LocaleMac): Added a constructor which takes NSLocale object.
+        (WebCore::LocaleMac::currentLocale): Changed to construct LocaleMac object from NSLocale object rather than locale identifier.
+
 2012-07-11  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Add webkit_cookie_manager_set_persistent_storage() to WebKit2 GTK+ API

Modified: trunk/Source/WebCore/platform/text/mac/LocaleMac.h (122429 => 122430)


--- trunk/Source/WebCore/platform/text/mac/LocaleMac.h	2012-07-12 08:57:32 UTC (rev 122429)
+++ trunk/Source/WebCore/platform/text/mac/LocaleMac.h	2012-07-12 09:00:18 UTC (rev 122430)
@@ -65,6 +65,7 @@
 #endif
 
 private:
+    explicit LocaleMac(NSLocale*);
     explicit LocaleMac(const String&);
     NSDateFormatter *createShortDateFormatter();
 

Modified: trunk/Source/WebCore/platform/text/mac/LocaleMac.mm (122429 => 122430)


--- trunk/Source/WebCore/platform/text/mac/LocaleMac.mm	2012-07-12 08:57:32 UTC (rev 122429)
+++ trunk/Source/WebCore/platform/text/mac/LocaleMac.mm	2012-07-12 09:00:18 UTC (rev 122430)
@@ -55,6 +55,11 @@
     return formatter;
 }
 
+LocaleMac::LocaleMac(NSLocale* locale)
+    : m_locale(locale)
+{
+}
+
 LocaleMac::LocaleMac(const String& localeIdentifier)
     : m_locale([[NSLocale alloc] initWithLocaleIdentifier:localeIdentifier])
 {
@@ -71,7 +76,7 @@
 
 LocaleMac* LocaleMac::currentLocale()
 {
-    static LocaleMac* currentLocale = LocaleMac::create([[NSLocale currentLocale] localeIdentifier]).leakPtr();
+    static LocaleMac* currentLocale = new LocaleMac([NSLocale currentLocale]);
     return currentLocale;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to