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

Side by Side Diff: ui/aura/window_tree_host_platform.cc

Issue 2739113002: Simplify calls for scale factor (Closed)
Patch Set: nit Created 3 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 unified diff | Download patch
« no previous file with comments | « ui/aura/window_tree_host.cc ('k') | ui/aura/window_tree_host_x11.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/window_tree_host_platform.h" 5 #include "ui/aura/window_tree_host_platform.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "ui/aura/window_event_dispatcher.h" 11 #include "ui/aura/window_event_dispatcher.h"
12 #include "ui/aura/window_port.h" 12 #include "ui/aura/window_port.h"
13 #include "ui/base/layout.h"
13 #include "ui/compositor/compositor.h" 14 #include "ui/compositor/compositor.h"
14 #include "ui/display/display.h"
15 #include "ui/display/screen.h"
16 #include "ui/events/event.h" 15 #include "ui/events/event.h"
17 16
18 #if defined(OS_ANDROID) 17 #if defined(OS_ANDROID)
19 #include "ui/platform_window/android/platform_window_android.h" 18 #include "ui/platform_window/android/platform_window_android.h"
20 #endif 19 #endif
21 20
22 #if defined(USE_OZONE) 21 #if defined(USE_OZONE)
23 #include "ui/ozone/public/ozone_platform.h" 22 #include "ui/ozone/public/ozone_platform.h"
24 #endif 23 #endif
25 24
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 const gfx::Point& location_in_pixels) { 126 const gfx::Point& location_in_pixels) {
128 platform_window_->MoveCursorTo(location_in_pixels); 127 platform_window_->MoveCursorTo(location_in_pixels);
129 } 128 }
130 129
131 void WindowTreeHostPlatform::OnCursorVisibilityChangedNative(bool show) { 130 void WindowTreeHostPlatform::OnCursorVisibilityChangedNative(bool show) {
132 NOTIMPLEMENTED(); 131 NOTIMPLEMENTED();
133 } 132 }
134 133
135 void WindowTreeHostPlatform::OnBoundsChanged(const gfx::Rect& new_bounds) { 134 void WindowTreeHostPlatform::OnBoundsChanged(const gfx::Rect& new_bounds) {
136 float current_scale = compositor()->device_scale_factor(); 135 float current_scale = compositor()->device_scale_factor();
137 float new_scale = display::Screen::GetScreen() 136 float new_scale = ui::GetScaleFactorForNativeView(window());
138 ->GetDisplayNearestWindow(window())
139 .device_scale_factor();
140 gfx::Rect old_bounds = bounds_; 137 gfx::Rect old_bounds = bounds_;
141 bounds_ = new_bounds; 138 bounds_ = new_bounds;
142 if (bounds_.origin() != old_bounds.origin()) { 139 if (bounds_.origin() != old_bounds.origin()) {
143 OnHostMovedInPixels(bounds_.origin()); 140 OnHostMovedInPixels(bounds_.origin());
144 } 141 }
145 if (bounds_.size() != old_bounds.size() || current_scale != new_scale) { 142 if (bounds_.size() != old_bounds.size() || current_scale != new_scale) {
146 OnHostResizedInPixels(bounds_.size()); 143 OnHostResizedInPixels(bounds_.size());
147 } 144 }
148 } 145 }
149 146
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 DCHECK_EQ(widget, widget_); 185 DCHECK_EQ(widget, widget_);
189 widget_ = gfx::kNullAcceleratedWidget; 186 widget_ = gfx::kNullAcceleratedWidget;
190 } 187 }
191 188
192 void WindowTreeHostPlatform::OnActivationChanged(bool active) { 189 void WindowTreeHostPlatform::OnActivationChanged(bool active) {
193 if (active) 190 if (active)
194 OnHostActivated(); 191 OnHostActivated();
195 } 192 }
196 193
197 } // namespace aura 194 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window_tree_host.cc ('k') | ui/aura/window_tree_host_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698