Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1919)

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwSettings.java

Issue 140913003: [Android WebView] Reflect system font scale in WebView text rendering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix presubmit warnings in AwSettings. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwSettings.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwSettings.java b/android_webview/java/src/org/chromium/android_webview/AwSettings.java
index 6cc8e532ef99d5912feb9acabd0788e3eb1ebefc..6ba9ac698cad8a554060a357fbddb3378c3ee7c6 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwSettings.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwSettings.java
@@ -10,6 +10,7 @@ import android.os.Handler;
import android.os.Message;
import android.os.Process;
import android.provider.Settings;
+import android.util.Log;
import android.webkit.WebSettings;
import android.webkit.WebSettings.PluginState;
@@ -87,6 +88,9 @@ public class AwSettings {
private final boolean mPasswordEchoEnabled;
+ // Font scale factor determined by Android system setting.
+ private final float mFontScale;
+
// Not accessed by the native side.
private boolean mBlockNetworkLoads; // Default depends on permission of embedding APK.
private boolean mAllowContentUrlAccess = true;
@@ -181,7 +185,9 @@ public class AwSettings {
while (mIsUpdateWebkitPrefsMessagePending) {
mAwSettingsLock.wait();
}
- } catch (InterruptedException e) {}
+ } catch (InterruptedException e) {
+ Log.e(TAG, "Interrupted waiting to sync settings to native", e);
+ }
}
}
}
@@ -215,6 +221,8 @@ public class AwSettings {
// Respect the system setting for password echoing.
mPasswordEchoEnabled = Settings.System.getInt(context.getContentResolver(),
Settings.System.TEXT_SHOW_PASSWORD, 1) == 1;
+ mFontScale = context.getResources().getConfiguration().fontScale;
+ mTextSizePercent *= mFontScale;
mSupportLegacyQuirks = supportsLegacyQuirks;
}
@@ -537,8 +545,9 @@ public class AwSettings {
*/
public void setTextZoom(final int textZoom) {
synchronized (mAwSettingsLock) {
- if (mTextSizePercent != textZoom) {
- mTextSizePercent = textZoom;
+ int scaledTextZoomPercent = (int)(textZoom * mFontScale);
+ if (mTextSizePercent != scaledTextZoomPercent) {
+ mTextSizePercent = scaledTextZoomPercent;
mEventHandler.updateWebkitPreferencesLocked();
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698