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

Side by Side Diff: services/ui/public/cpp/window_tree_client.cc

Issue 2540773002: Fix mus-in-renderer scale factor crash (Closed)
Patch Set: Created 4 years 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "services/ui/public/cpp/window_tree_client.h" 5 #include "services/ui/public/cpp/window_tree_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 24 matching lines...) Expand all
35 35
36 namespace ui { 36 namespace ui {
37 37
38 Id MakeTransportId(ClientSpecificId client_id, ClientSpecificId local_id) { 38 Id MakeTransportId(ClientSpecificId client_id, ClientSpecificId local_id) {
39 return (client_id << 16) | local_id; 39 return (client_id << 16) | local_id;
40 } 40 }
41 41
42 // Helper function to get the device_scale_factor() of the display::Display 42 // Helper function to get the device_scale_factor() of the display::Display
43 // with |display_id|. 43 // with |display_id|.
44 float ScaleFactorForDisplay(int64_t display_id) { 44 float ScaleFactorForDisplay(int64_t display_id) {
45 // TODO(jonross): Remove this once aura-mus is complete. Currently the screen
46 // is not being set properly for mus-in-rendered. (http://crbug.com/659155)
sky 2016/11/29 20:27:47 'rendered' -> 'renderer'
jonross 2016/11/29 20:57:57 Done.
47 if (!display::Screen::GetScreen())
48 return 1.f;
49
45 // TODO(riajiang): Change to use display::GetDisplayWithDisplayId() after 50 // TODO(riajiang): Change to use display::GetDisplayWithDisplayId() after
46 // https://codereview.chromium.org/2361283002/ is landed. 51 // https://codereview.chromium.org/2361283002/ is landed.
47 std::vector<display::Display> displays = 52 std::vector<display::Display> displays =
48 display::Screen::GetScreen()->GetAllDisplays(); 53 display::Screen::GetScreen()->GetAllDisplays();
49 auto iter = std::find_if(displays.begin(), displays.end(), 54 auto iter = std::find_if(displays.begin(), displays.end(),
50 [display_id](const display::Display& display) { 55 [display_id](const display::Display& display) {
51 return display.id() == display_id; 56 return display.id() == display_id;
52 }); 57 });
53 if (iter != displays.end()) 58 if (iter != displays.end())
54 return iter->device_scale_factor(); 59 return iter->device_scale_factor();
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 // TODO(riajiang): Figure out if |offset| needs to be converted. 1478 // TODO(riajiang): Figure out if |offset| needs to be converted.
1474 // (http://crbugs.com/646932) 1479 // (http://crbugs.com/646932)
1475 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( 1480 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea(
1476 server_id(window), offset.x(), offset.y(), 1481 server_id(window), offset.x(), offset.y(),
1477 gfx::ConvertInsetsToDIP(ScaleFactorForDisplay(window->display_id()), 1482 gfx::ConvertInsetsToDIP(ScaleFactorForDisplay(window->display_id()),
1478 hit_area)); 1483 hit_area));
1479 } 1484 }
1480 } 1485 }
1481 1486
1482 } // namespace ui 1487 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698