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

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

Issue 173943002: [Android WebView] Allow embedders to override text from scaling by system font scale. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 928c73e04a9e94c2fda82c4f266feaa4d5193543..9c8f3b451014cfbcf3a873da96f2c9b0a0067ab5 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwSettings.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwSettings.java
@@ -88,9 +88,6 @@ 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;
@@ -223,8 +220,10 @@ 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;
+
+ // By default, scale the text size by the system font scale factor. Embedders
+ // may override this by invoking setTextZoom().
+ mTextSizePercent *= context.getResources().getConfiguration().fontScale;
mSupportLegacyQuirks = supportsLegacyQuirks;
}
@@ -561,9 +560,8 @@ public class AwSettings {
*/
public void setTextZoom(final int textZoom) {
synchronized (mAwSettingsLock) {
- int scaledTextZoomPercent = (int)(textZoom * mFontScale);
- if (mTextSizePercent != scaledTextZoomPercent) {
- mTextSizePercent = scaledTextZoomPercent;
+ if (mTextSizePercent != textZoom) {
+ mTextSizePercent = textZoom;
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