| Index: components/arc/intent_helper/font_size_util.cc
|
| diff --git a/components/arc/intent_helper/font_size_util.cc b/components/arc/intent_helper/font_size_util.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ec8acb76cae5dfb15a5d801882a8837ece616ba6
|
| --- /dev/null
|
| +++ b/components/arc/intent_helper/font_size_util.cc
|
| @@ -0,0 +1,34 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "components/arc/intent_helper/font_size_util.h"
|
| +
|
| +#include <algorithm>
|
| +
|
| +namespace arc {
|
| +
|
| +double ConvertFontSizeChromeToAndroid(int default_size,
|
| + int default_fixed_size,
|
| + int minimum_size) {
|
| + // kWebKitDefaultFixedFontSize is automatically set to be 3 pixels smaller
|
| + // than kWebKitDefaultFontSize when Chrome's settings page's main font
|
| + // dropdown control is adjusted. If the user specifically sets a higher
|
| + // fixed font size we will want to take into account the adjustment.
|
| + default_fixed_size += 3;
|
| + int max_chrome_size =
|
| + std::max(std::max(default_fixed_size, default_size), minimum_size);
|
| +
|
| + double android_scale = kAndroidFontScaleSmall;
|
| + if (max_chrome_size >= kChromeFontSizeVeryLarge) {
|
| + android_scale = kAndroidFontScaleHuge;
|
| + } else if (max_chrome_size >= kChromeFontSizeLarge) {
|
| + android_scale = kAndroidFontScaleLarge;
|
| + } else if (max_chrome_size >= kChromeFontSizeNormal) {
|
| + android_scale = kAndroidFontScaleNormal;
|
| + }
|
| +
|
| + return android_scale;
|
| +}
|
| +
|
| +} // namespace arc
|
|
|