Commit 6e145aaa authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS] Decouple Text Zoom flag from Dynamic Text size as default zoom

Before, this happened by default. However, this was confusing, so now
there are two separate flags, so zoom can be enabled without changing
the default zoom level.

Bug: 1113270
Change-Id: I34e340c585c5ccccdfd278d96c21a53510b6a234
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2339482
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795408}
parent 0b52c554
......@@ -4426,9 +4426,14 @@
"owners": [ "ayui", "goto" ],
"expiry_milestone": 86
},
{
"name": "webpage-default-zoom-from-dynamic-type",
"owners": [ "rkgibson", "bling-flags" ],
"expiry_milestone": 87
},
{
"name": "webpage-text-accessibility",
"owners": [ "rkgibson" ],
"owners": [ "rkgibson", "bling-flags" ],
"expiry_milestone": 86
},
{
......
......@@ -380,6 +380,11 @@ const flags_ui::FeatureEntry kFeatureEntries[] = {
flag_descriptions::kAutofillEnableCompanyNameName,
flag_descriptions::kAutofillEnableCompanyNameDescription, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(autofill::features::kAutofillEnableCompanyName)},
{"webpage-default-zoom-from-dynamic-type",
flag_descriptions::kWebPageDefaultZoomFromDynamicTypeName,
flag_descriptions::kWebPageDefaultZoomFromDynamicTypeDescription,
flags_ui::kOsIos,
FEATURE_VALUE_TYPE(web::kWebPageDefaultZoomFromDynamicType)},
{"webpage-text-accessibility",
flag_descriptions::kWebPageTextAccessibilityName,
flag_descriptions::kWebPageTextAccessibilityDescription, flags_ui::kOsIos,
......
......@@ -503,12 +503,17 @@ const char kWalletServiceUseSandboxName[] = "Use Google Payments sandbox";
const char kWalletServiceUseSandboxDescription[] =
"Uses the sandbox service for Google Payments API calls.";
const char kWebPageDefaultZoomFromDynamicTypeName[] =
"Use dynamic type size for default text zoom level";
const char kWebPageDefaultZoomFromDynamicTypeDescription[] =
"When enabled, the default text zoom level for a website comes from the "
"current dynamic type setting.";
const char kWebPageTextAccessibilityName[] =
"Enable text accessibility in web pages";
const char kWebPageTextAccessibilityDescription[] =
"When enabled, text in web pages will respect the user's Dynamic Type "
"setting.";
// Please insert your name/description above in alphabetical order.
} // namespace flag_descriptions
......@@ -442,6 +442,11 @@ extern const char kUseJSForErrorPageDescription[];
extern const char kWalletServiceUseSandboxName[];
extern const char kWalletServiceUseSandboxDescription[];
// Title and description for the flag to tie the default text zoom level to
// the dynamic type setting.
extern const char kWebPageDefaultZoomFromDynamicTypeName[];
extern const char kWebPageDefaultZoomFromDynamicTypeDescription[];
// Title and description for the flag to enable text accessibility in webpages.
extern const char kWebPageTextAccessibilityName[];
extern const char kWebPageTextAccessibilityDescription[];
......
......@@ -9,6 +9,9 @@ namespace web {
const base::Feature kWebPageTextAccessibility{"WebPageTextAccessibility",
base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kWebPageDefaultZoomFromDynamicType{
"WebPageDefaultZoomFromDynamicType", base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kMobileGoogleSRP{"MobileGoogleSRP",
base::FEATURE_DISABLED_BY_DEFAULT};
......
......@@ -13,6 +13,10 @@ namespace web {
// Used to control the state of the WebPageTextAccessibility feature.
extern const base::Feature kWebPageTextAccessibility;
// Feature flag to tie the default zoom level for webpages to the current
// dynamic type setting.
extern const base::Feature kWebPageDefaultZoomFromDynamicType;
// Feature flag to keep the mobile version for Google SRP. Should be used when
// the desktop version is requested by default.
extern const base::Feature kMobileGoogleSRP;
......
......@@ -20,6 +20,7 @@
#include "ios/chrome/browser/application_context.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/pref_names.h"
#include "ios/chrome/browser/web/features.h"
#include "ios/components/ui_util/dynamic_type_util.h"
#include "ios/web/public/js_messaging/web_frame.h"
#include "ios/web/public/js_messaging/web_frame_util.h"
......@@ -240,9 +241,13 @@ bool FontSizeTabHelper::CurrentPageSupportsTextZoom() const {
}
int FontSizeTabHelper::GetFontSize() const {
// Only add in the dynamic type multiplier if the flag is enabled.
double dynamic_type_multiplier =
base::FeatureList::IsEnabled(web::kWebPageDefaultZoomFromDynamicType)
? ui_util::SystemSuggestedFontSizeMultiplier()
: 1;
// Multiply by 100 as the web property needs a percentage.
return ui_util::SystemSuggestedFontSizeMultiplier() *
GetCurrentUserZoomMultiplier() * 100;
return dynamic_type_multiplier * GetCurrentUserZoomMultiplier() * 100;
}
void FontSizeTabHelper::WebStateDestroyed(web::WebState* web_state) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment