Commit 10dc3f9a authored by Malay Keshav's avatar Malay Keshav

Fix default usge of display zoom and ui scale

Enabling the flag for display zoom does not disable or change the ui
scale being applied. The same is true for when we disable the display
zoom. We do not change or remove the zoom value.

This patch disables applying any display zoom when the flag is disabled
and disables applying any ui scale when the flag is enabled.

Bug: 834950
Change-Id: I07593806f54ee7daf3b5df38023c525501d85a95
Component: Display Manager, ui scale, display zoom
Reviewed-on: https://chromium-review.googlesource.com/1020532Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#552457}
parent a9b6ba0f
......@@ -65,20 +65,27 @@ const base::Feature kHighDynamicRange{"HighDynamicRange",
base::FEATURE_ENABLED_BY_DEFAULT};
#if defined(OS_CHROMEOS)
// Enables using the monitor's provided color space information when
// rendering.
// TODO(mcasas): remove this flag http://crbug.com/771345.
const base::Feature kUseMonitorColorSpace{"UseMonitorColorSpace",
base::FEATURE_ENABLED_BY_DEFAULT};
#endif // OS_CHROMEOS
// Enables the slider in display settings to modify the display zoom/size.
// TODO(malaykeshav): Remove this in M68 when the feature has been in stable for
// atleast one milestone.
constexpr base::Feature kEnableDisplayZoomSetting{
"EnableDisplayZoomSetting", base::FEATURE_ENABLED_BY_DEFAULT};
// Enables using the monitor's provided color space information when rendering.
// TODO(mcasas): remove this flag http://crbug.com/771345.
const base::Feature kUseMonitorColorSpace{"UseMonitorColorSpace",
base::FEATURE_ENABLED_BY_DEFAULT};
"EnableDisplayZoomSetting",
#if defined(OS_CHROMEOS)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
};
bool IsDisplayZoomSettingEnabled() {
return base::FeatureList::IsEnabled(kEnableDisplayZoomSetting);
}
#endif // OS_CHROMEOS
} // namespace features
......@@ -35,12 +35,13 @@ namespace features {
DISPLAY_EXPORT extern const base::Feature kHighDynamicRange;
#if defined(OS_CHROMEOS)
DISPLAY_EXPORT extern const base::Feature kEnableDisplayZoomSetting;
DISPLAY_EXPORT extern const base::Feature kUseMonitorColorSpace;
#endif
DISPLAY_EXPORT extern const base::Feature kEnableDisplayZoomSetting;
// Returns true if experimental display zoom setting is enabled.
DISPLAY_EXPORT bool IsDisplayZoomSettingEnabled();
#endif
} // namespace features
......
......@@ -655,11 +655,12 @@ void DisplayManager::RegisterDisplayProperty(
Display::RotationSource::USER);
display_info_[display_id].SetRotation(rotation,
Display::RotationSource::ACTIVE);
// Just in case the preference file was corrupted.
// TODO(mukai): register |display_modes_| here as well, so the lookup for the
// default mode in GetActiveModeForDisplayId() gets much simpler.
if (0.5f <= ui_scale && ui_scale <= 2.0f)
if (features::IsDisplayZoomSettingEnabled())
display_info_[display_id].set_zoom_factor(display_zoom_factor);
else if (0.5f <= ui_scale && ui_scale <= 2.0f)
display_info_[display_id].set_configured_ui_scale(ui_scale);
if (overscan_insets)
display_info_[display_id].SetOverscanInsets(*overscan_insets);
......@@ -671,8 +672,6 @@ void DisplayManager::RegisterDisplayProperty(
device_scale_factor);
display_modes_[display_id] = mode;
}
display_info_[display_id].set_zoom_factor(display_zoom_factor);
}
bool DisplayManager::GetActiveModeForDisplayId(int64_t display_id,
......
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