summaryrefslogtreecommitdiffstats
path: root/android_webview
diff options
context:
space:
mode:
authorbenm@chromium.org <benm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-30 21:50:21 +0000
committerbenm@chromium.org <benm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-30 21:50:21 +0000
commit4a62cff7ebd17654792d0ffd6746cb0a58b6b100 (patch)
tree0d684bf02287b3cbd2b6f0f05f0549f6e5f30d63 /android_webview
parentf8e6aad21d6b80d3c317b83bfb66e4f9ac8e7310 (diff)
downloadchromium_src-4a62cff7ebd17654792d0ffd6746cb0a58b6b100.zip
chromium_src-4a62cff7ebd17654792d0ffd6746cb0a58b6b100.tar.gz
chromium_src-4a62cff7ebd17654792d0ffd6746cb0a58b6b100.tar.bz2
[Android WebView] Set WebView font renderer preferences
This achieves backwards compat with "Classic" Android WebView which would always set this level of font hinting and enable sub puxel positioning. BUG=281508 Review URL: https://chromiumcodereview.appspot.com/23461014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220668 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
-rw-r--r--android_webview/native/aw_contents.cc15
-rw-r--r--android_webview/native/aw_contents.h1
2 files changed, 14 insertions, 2 deletions
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc
index 6b67525..82100be 100644
--- a/android_webview/native/aw_contents.cc
+++ b/android_webview/native/aw_contents.cc
@@ -147,8 +147,7 @@ AwContents::AwContents(scoped_ptr<WebContents> web_contents)
if (autofill_manager_delegate)
InitAutofillIfNecessary(autofill_manager_delegate->GetSaveFormData());
- web_contents_->GetMutableRendererPrefs()->tap_multiple_targets_strategy =
- content::TAP_MULTIPLE_TARGETS_STRATEGY_NONE;
+ SetAndroidWebViewRendererPrefs();
}
void AwContents::SetJavaPeers(JNIEnv* env,
@@ -214,6 +213,18 @@ void AwContents::InitAutofillIfNecessary(bool enabled) {
AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER);
}
+void AwContents::SetAndroidWebViewRendererPrefs() {
+ content::RendererPreferences* prefs =
+ web_contents_->GetMutableRendererPrefs();
+ prefs->hinting = content::RENDERER_PREFERENCES_HINTING_SLIGHT;
+ prefs->tap_multiple_targets_strategy =
+ content::TAP_MULTIPLE_TARGETS_STRATEGY_NONE;
+ prefs->use_subpixel_positioning = true;
+ content::RenderViewHost* host = web_contents_->GetRenderViewHost();
+ if (host)
+ host->SyncRendererPrefs();
+}
+
void AwContents::SetAwAutofillManagerDelegate(jobject delegate) {
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
diff --git a/android_webview/native/aw_contents.h b/android_webview/native/aw_contents.h
index 272f0ae..bdfb6aa 100644
--- a/android_webview/native/aw_contents.h
+++ b/android_webview/native/aw_contents.h
@@ -178,6 +178,7 @@ class AwContents : public FindHelper::Listener,
private:
void InitAutofillIfNecessary(bool enabled);
+ void SetAndroidWebViewRendererPrefs();
JavaObjectWeakGlobalRef java_ref_;
scoped_ptr<content::WebContents> web_contents_;