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

Side by Side Diff: ui/aura/test/test_screen.cc

Issue 1078123002: Send resize event when the screen info changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/aura/test/test_screen.h" 5 #include "ui/aura/test/test_screen.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/aura/env.h" 8 #include "ui/aura/env.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/aura/window_event_dispatcher.h" 10 #include "ui/aura/window_event_dispatcher.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 void TestScreen::SetDisplayRotation(gfx::Display::Rotation rotation) { 58 void TestScreen::SetDisplayRotation(gfx::Display::Rotation rotation) {
59 gfx::Rect bounds_in_pixel(display_.GetSizeInPixel()); 59 gfx::Rect bounds_in_pixel(display_.GetSizeInPixel());
60 gfx::Rect new_bounds(bounds_in_pixel); 60 gfx::Rect new_bounds(bounds_in_pixel);
61 if (IsRotationPortrait(rotation) != IsRotationPortrait(display_.rotation())) { 61 if (IsRotationPortrait(rotation) != IsRotationPortrait(display_.rotation())) {
62 new_bounds.set_width(bounds_in_pixel.height()); 62 new_bounds.set_width(bounds_in_pixel.height());
63 new_bounds.set_height(bounds_in_pixel.width()); 63 new_bounds.set_height(bounds_in_pixel.width());
64 } 64 }
65 display_.set_rotation(rotation); 65 display_.set_rotation(rotation);
66 display_.SetScaleAndBounds(display_.device_scale_factor(), new_bounds); 66 display_.SetScaleAndBounds(display_.device_scale_factor(), new_bounds);
67 host_->SetRootTransform(GetRotationTransform() * GetUIScaleTransform()); 67 if (host_)
68 host_->SetRootTransform(GetRotationTransform() * GetUIScaleTransform());
sadrul 2015/04/10 22:58:30 We don't do null checks elsewhere in this file. Is
68 } 69 }
69 70
70 void TestScreen::SetUIScale(float ui_scale) { 71 void TestScreen::SetUIScale(float ui_scale) {
71 ui_scale_ = ui_scale; 72 ui_scale_ = ui_scale;
72 gfx::Rect bounds_in_pixel(display_.GetSizeInPixel()); 73 gfx::Rect bounds_in_pixel(display_.GetSizeInPixel());
73 gfx::Rect new_bounds = gfx::ToNearestRect( 74 gfx::Rect new_bounds = gfx::ToNearestRect(
74 gfx::ScaleRect(bounds_in_pixel, 1.0f / ui_scale)); 75 gfx::ScaleRect(bounds_in_pixel, 1.0f / ui_scale));
75 display_.SetScaleAndBounds(display_.device_scale_factor(), new_bounds); 76 display_.SetScaleAndBounds(display_.device_scale_factor(), new_bounds);
76 host_->SetRootTransform(GetRotationTransform() * GetUIScaleTransform()); 77 host_->SetRootTransform(GetRotationTransform() * GetUIScaleTransform());
77 } 78 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 167
167 TestScreen::TestScreen(const gfx::Rect& screen_bounds) 168 TestScreen::TestScreen(const gfx::Rect& screen_bounds)
168 : host_(NULL), 169 : host_(NULL),
169 ui_scale_(1.0f) { 170 ui_scale_(1.0f) {
170 static int64 synthesized_display_id = 2000; 171 static int64 synthesized_display_id = 2000;
171 display_.set_id(synthesized_display_id++); 172 display_.set_id(synthesized_display_id++);
172 display_.SetScaleAndBounds(1.0f, screen_bounds); 173 display_.SetScaleAndBounds(1.0f, screen_bounds);
173 } 174 }
174 175
175 } // namespace aura 176 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698