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

Side by Side Diff: ash/common/wm/overview/window_grid.cc

Issue 2203793003: [ash-md] Properly scales windows with transient parents in overview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 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 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 "ash/common/wm/overview/window_grid.h" 5 #include "ash/common/wm/overview/window_grid.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "ash/common/ash_switches.h" 13 #include "ash/common/ash_switches.h"
14 #include "ash/common/material_design/material_design_controller.h" 14 #include "ash/common/material_design/material_design_controller.h"
15 #include "ash/common/shelf/shelf_types.h" 15 #include "ash/common/shelf/shelf_types.h"
16 #include "ash/common/shelf/wm_shelf.h" 16 #include "ash/common/shelf/wm_shelf.h"
17 #include "ash/common/shell_window_ids.h" 17 #include "ash/common/shell_window_ids.h"
18 #include "ash/common/wm/overview/cleanup_animation_observer.h" 18 #include "ash/common/wm/overview/cleanup_animation_observer.h"
19 #include "ash/common/wm/overview/scoped_overview_animation_settings.h" 19 #include "ash/common/wm/overview/scoped_overview_animation_settings.h"
20 #include "ash/common/wm/overview/scoped_overview_animation_settings_factory.h" 20 #include "ash/common/wm/overview/scoped_overview_animation_settings_factory.h"
21 #include "ash/common/wm/overview/scoped_transform_overview_window.h"
22 #include "ash/common/wm/overview/window_selector.h" 21 #include "ash/common/wm/overview/window_selector.h"
23 #include "ash/common/wm/overview/window_selector_delegate.h" 22 #include "ash/common/wm/overview/window_selector_delegate.h"
24 #include "ash/common/wm/overview/window_selector_item.h" 23 #include "ash/common/wm/overview/window_selector_item.h"
25 #include "ash/common/wm/window_state.h" 24 #include "ash/common/wm/window_state.h"
26 #include "ash/common/wm/wm_screen_util.h" 25 #include "ash/common/wm/wm_screen_util.h"
27 #include "ash/common/wm_lookup.h" 26 #include "ash/common/wm_lookup.h"
28 #include "ash/common/wm_root_window_controller.h" 27 #include "ash/common/wm_root_window_controller.h"
29 #include "ash/common/wm_window.h" 28 #include "ash/common/wm_window.h"
30 #include "base/command_line.h" 29 #include "base/command_line.h"
31 #include "base/i18n/string_search.h" 30 #include "base/i18n/string_search.h"
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 // Right bound of the narrowest row. 972 // Right bound of the narrowest row.
974 *min_right = bounds.right(); 973 *min_right = bounds.right();
975 // Right bound of the widest row. 974 // Right bound of the widest row.
976 *max_right = bounds.x(); 975 *max_right = bounds.x();
977 976
978 // With Material Design all elements are of same height and only the height is 977 // With Material Design all elements are of same height and only the height is
979 // necessary to determine each item's scale. 978 // necessary to determine each item's scale.
980 const gfx::Size item_size(0, height); 979 const gfx::Size item_size(0, height);
981 size_t i = 0; 980 size_t i = 0;
982 for (auto* window : window_list_) { 981 for (auto* window : window_list_) {
983 const gfx::Rect target_bounds = window->GetWindow()->GetTargetBounds(); 982 const gfx::Rect target_bounds = window->GetTargetBoundsInScreen();
984 const int width = 983 const int width =
985 std::max(1, gfx::ToFlooredInt(target_bounds.width() * 984 std::max(1, gfx::ToFlooredInt(target_bounds.width() *
986 window->GetItemScale(item_size)) + 985 window->GetItemScale(item_size)) +
987 2 * kWindowMarginMD); 986 2 * kWindowMarginMD);
988 if (left + width > bounds.right()) { 987 if (left + width > bounds.right()) {
989 // Move to the next row if possible. 988 // Move to the next row if possible.
990 if (*min_right > left) 989 if (*min_right > left)
991 *min_right = left; 990 *min_right = left;
992 if (*max_right < left) 991 if (*max_right < left)
993 *max_right = left; 992 *max_right = left;
(...skipping 21 matching lines...) Expand all
1015 *min_right = left; 1014 *min_right = left;
1016 if (*max_right < left) 1015 if (*max_right < left)
1017 *max_right = left; 1016 *max_right = left;
1018 } 1017 }
1019 *max_bottom = top + height; 1018 *max_bottom = top + height;
1020 } 1019 }
1021 return windows_fit; 1020 return windows_fit;
1022 } 1021 }
1023 1022
1024 } // namespace ash 1023 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/overview/scoped_transform_overview_window.cc ('k') | ash/common/wm/overview/window_selector_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698