summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android/jni/WebViewCore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/android/jni/WebViewCore.cpp')
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index 1bba9b8..0eb49fa 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -54,6 +54,7 @@
#include "ExceptionCode.h"
#include "FocusController.h"
#include "Font.h"
+#include "FontCache.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameLoaderClientAndroid.h"
@@ -135,6 +136,7 @@
#include <JNIHelp.h>
#include <JNIUtility.h>
#include <androidfw/KeycodeLabels.h>
+#include <cutils/properties.h>
#include <v8.h>
#include <wtf/CurrentTime.h>
#include <wtf/text/AtomicString.h>
@@ -729,6 +731,7 @@ void WebViewCore::clearContent()
m_content.clear();
m_addInval.setEmpty();
m_rebuildInval.setEmpty();
+ updateLocale();
}
bool WebViewCore::focusBoundsChanged()
@@ -4255,6 +4258,41 @@ String WebViewCore::getText(int startX, int startY, int endX, int endY)
return text;
}
+/**
+ * Read the persistent locale.
+ */
+void WebViewCore::getLocale(String& language, String& region)
+{
+ char propLang[PROPERTY_VALUE_MAX], propRegn[PROPERTY_VALUE_MAX];
+
+ property_get("persist.sys.language", propLang, "");
+ property_get("persist.sys.country", propRegn, "");
+ if (*propLang == 0 && *propRegn == 0) {
+ /* Set to ro properties, default is en_US */
+ property_get("ro.product.locale.language", propLang, "en");
+ property_get("ro.product.locale.region", propRegn, "US");
+ }
+ language = String(propLang, 2);
+ region = String(propRegn, 2);
+}
+
+void WebViewCore::updateLocale()
+{
+ static String prevLang;
+ static String prevRegn;
+ String language;
+ String region;
+
+ getLocale(language, region);
+
+ if ((language != prevLang) || (region != prevRegn)) {
+ prevLang = language;
+ prevRegn = region;
+ GlyphPageTreeNode::resetRoots();
+ fontCache()->invalidate();
+ }
+}
+
//----------------------------------------------------------------------
// Native JNI methods
//----------------------------------------------------------------------