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

Unified Diff: services/ui/ws/display.cc

Issue 2356913002: Pass device scale factor from display to ws. (Closed)
Patch Set: Fix more tests. Created 4 years, 3 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
« no previous file with comments | « services/ui/ws/display.h ('k') | services/ui/ws/display_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/display.cc
diff --git a/services/ui/ws/display.cc b/services/ui/ws/display.cc
index 42807955e82786a5f8674f19d483439130bd9d34..a7574023736322cc4615a71f0f7c667c4f0a7313 100644
--- a/services/ui/ws/display.cc
+++ b/services/ui/ws/display.cc
@@ -285,6 +285,19 @@ void Display::CreateWindowManagerDisplayRootFromFactory(
std::move(display_root_ptr));
}
+void Display::CreateRootWindow(const gfx::Size& size) {
+ DCHECK(!root_);
+
+ root_.reset(window_server_->CreateServerWindow(
+ display_manager()->GetAndAdvanceNextRootId(),
+ ServerWindow::Properties()));
+ root_->SetBounds(gfx::Rect(size));
+ root_->SetVisible(true);
+ focus_controller_.reset(new FocusController(this, root_.get()));
+ focus_controller_->AddObserver(this);
+ InitWindowManagerDisplayRootsIfNecessary();
+}
+
ServerWindow* Display::GetRootWindow() {
return root_.get();
}
@@ -311,23 +324,15 @@ void Display::OnNativeCaptureLost() {
void Display::OnViewportMetricsChanged(const ViewportMetrics& old_metrics,
const ViewportMetrics& new_metrics) {
+ if (!root_)
+ return;
+
gfx::Rect new_bounds(new_metrics.bounds.size());
- if (!root_) {
- root_.reset(window_server_->CreateServerWindow(
- display_manager()->GetAndAdvanceNextRootId(),
- ServerWindow::Properties()));
- root_->SetBounds(new_bounds);
- root_->SetVisible(true);
- focus_controller_.reset(new FocusController(this, root_.get()));
- focus_controller_->AddObserver(this);
- InitWindowManagerDisplayRootsIfNecessary();
- } else {
- root_->SetBounds(new_bounds);
- for (auto& pair : window_manager_display_root_map_)
- pair.second->root()->SetBounds(new_bounds);
- }
- if (init_called_)
- display_manager()->OnDisplayUpdate(this);
+ root_->SetBounds(new_bounds);
+ for (auto& pair : window_manager_display_root_map_)
+ pair.second->root()->SetBounds(new_bounds);
+
+ display_manager()->OnDisplayUpdate(this);
}
void Display::OnCompositorFrameDrawn() {
« no previous file with comments | « services/ui/ws/display.h ('k') | services/ui/ws/display_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698