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

Unified Diff: ash/display/display_info.cc

Issue 12505005: Store rotation/ui scale to local state. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
Index: ash/display/display_info.cc
diff --git a/ash/display/display_info.cc b/ash/display/display_info.cc
index b46dceb12490548732c61498bf512cbd27262bbd..1e105df30f6ca34e28ba7300814d46847091770a 100644
--- a/ash/display/display_info.cc
+++ b/ash/display/display_info.cc
@@ -138,8 +138,21 @@ void DisplayInfo::CopyFromNative(const DisplayInfo& native_info) {
bounds_in_pixel_ = native_info.bounds_in_pixel_;
size_in_pixel_ = native_info.size_in_pixel_;
device_scale_factor_ = native_info.device_scale_factor_;
- rotation_ = native_info.rotation_;
- ui_scale_ = native_info.ui_scale_;
+
+ // Rotation_ and ui_scale_ are given by preference, or unit
+ // tests. Don't copy if this native_info came from
+ // DisplayChangeObserverX11.
+ if (native_info.ui_scale() >= 1.0f) {
+ rotation_ = native_info.rotation_;
+ ui_scale_ = native_info.ui_scale_;
+ }
+ // It makes little sense to scale beyond the original
+ // resolution. This guard is to protect applying
+ // ui_scale to an external display whose DPI has changed
+ // from 2.0 to 1.0 for some reason.
+ if (ui_scale_ > device_scale_factor_)
+ ui_scale_ = 1.0f;
+
// Don't copy insets as it may be given by preference. |rotation_|
// is treated as a native so that it can be specified in
// |CreateFromSpec|.

Powered by Google App Engine
This is Rietveld 408576698