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|. |