| Index: chrome/browser/chrome_content_browser_client.cc
|
| diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
|
| index 49fe6b1d5b98ce3b0175ac24ff087f3c7d82b582..054a4cc2ee714940219862a854df1e96072c56d7 100644
|
| --- a/chrome/browser/chrome_content_browser_client.cc
|
| +++ b/chrome/browser/chrome_content_browser_client.cc
|
| @@ -182,6 +182,7 @@
|
|
|
| #if defined(OS_ANDROID)
|
| #include "ui/base/ui_base_paths.h"
|
| +#include "ui/gfx/android/device_display_info.h"
|
| #endif
|
|
|
| #if defined(USE_NSS)
|
| @@ -549,6 +550,7 @@ void HandleBlockedPopupOnUIThread(const BlockedWindowParams& params) {
|
| }
|
|
|
| #if defined(OS_ANDROID)
|
| +
|
| void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) {
|
| WebContents* web_contents =
|
| tab_util::GetWebContentsByID(params.render_process_id(),
|
| @@ -558,6 +560,33 @@ void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) {
|
|
|
| SingleTabModeTabHelper::FromWebContents(web_contents)->HandleOpenUrl(params);
|
| }
|
| +
|
| +float GetFontScaleMultiplier(const PrefService* prefs) {
|
| + if (prefs->GetBoolean(prefs::kWebKitFontScaleFactorQuirk)) {
|
| + // The value of kWebKitFontScaleFactor passed by Chrome for Android already
|
| + // includes the multiplier.
|
| + return 1.0f;
|
| + }
|
| +
|
| + static const float kMinFSM = 1.05f;
|
| + static const int kWidthForMinFSM = 320;
|
| + static const float kMaxFSM = 1.3f;
|
| + static const int kWidthForMaxFSM = 800;
|
| +
|
| + gfx::DeviceDisplayInfo info;
|
| + int minWidth = info.GetSmallestDIPWidth();
|
| +
|
| + if (minWidth <= kWidthForMinFSM)
|
| + return kMinFSM;
|
| + if (minWidth >= kWidthForMaxFSM)
|
| + return kMaxFSM;
|
| +
|
| + // The font scale multiplier varies linearly between kMinFSM and kMaxFSM.
|
| + float ratio = static_cast<float>(minWidth - kWidthForMinFSM) /
|
| + (kWidthForMaxFSM - kWidthForMinFSM);
|
| + return ratio * (kMaxFSM - kMinFSM) + kMinFSM;
|
| +}
|
| +
|
| #endif // defined(OS_ANDROID)
|
|
|
| } // namespace
|
| @@ -2157,8 +2186,9 @@ void ChromeContentBrowserClient::OverrideWebkitPrefs(
|
| web_prefs->allow_running_insecure_content =
|
| prefs->GetBoolean(prefs::kWebKitAllowRunningInsecureContent);
|
| #if defined(OS_ANDROID)
|
| - web_prefs->font_scale_factor =
|
| - static_cast<float>(prefs->GetDouble(prefs::kWebKitFontScaleFactor));
|
| + web_prefs->text_autosizing_font_scale_factor =
|
| + static_cast<float>(prefs->GetDouble(prefs::kWebKitFontScaleFactor)) *
|
| + GetFontScaleMultiplier(prefs);
|
| web_prefs->force_enable_zoom =
|
| prefs->GetBoolean(prefs::kWebKitForceEnableZoom);
|
| #endif
|
|
|