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

Unified Diff: ash/common/wm/overview/window_selector_item.cc

Issue 2146323004: [ash-md] Improves smoothness with many windows in overview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [ash-md] Improves smoothness with many windows in overview (rebased) Created 4 years, 5 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
Index: ash/common/wm/overview/window_selector_item.cc
diff --git a/ash/common/wm/overview/window_selector_item.cc b/ash/common/wm/overview/window_selector_item.cc
index 023d9bc029d337e7dfcb4dba1123329f08403184..0af7f92c67ced3663d8273d33f52dc0a6d14d4f6 100644
--- a/ash/common/wm/overview/window_selector_item.cc
+++ b/ash/common/wm/overview/window_selector_item.cc
@@ -106,7 +106,7 @@ static const float kPreCloseScale = 0.02f;
// Calculates the |window| bounds after being transformed to the selector's
// space. The returned Rect is in virtual screen coordinates.
-gfx::Rect GetTransformedBounds(WmWindow* window) {
+gfx::Rect GetTransformedBounds(WmWindow* window, bool hide_header) {
gfx::RectF bounds(
window->GetRootWindow()->ConvertRectToScreen(window->GetTargetBounds()));
gfx::Transform new_transform = TransformAboutPivot(
@@ -116,7 +116,7 @@ gfx::Rect GetTransformedBounds(WmWindow* window) {
// With Material Design the preview title is shown above the preview window.
// Hide the window header for apps or browser windows with no tabs (web apps)
// to avoid showing both the window header and the preview title.
- if (ash::MaterialDesignController::IsOverviewMaterial()) {
+ if (ash::MaterialDesignController::IsOverviewMaterial() && hide_header) {
gfx::RectF header_bounds(bounds);
header_bounds.set_height(
window->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET));
@@ -281,6 +281,7 @@ WindowSelectorItem::WindowSelectorItem(WmWindow* window,
root_window_(window->GetRootWindow()),
transform_window_(window),
in_bounds_update_(false),
+ hide_header_(false),
tdanderson 2016/07/18 16:26:58 IIUC at any point in time, either all of the Windo
varkha 2016/07/19 00:29:07 Done (made static and controlled by flags).
caption_container_view_(nullptr),
window_label_button_view_(nullptr),
close_button_(new OverviewCloseButton(this)),
@@ -454,9 +455,12 @@ void WindowSelectorItem::OnWindowTitleChanged(WmWindow* window) {
float WindowSelectorItem::GetItemScale(const gfx::Size& size) {
gfx::Size inset_size(size.width(), size.height() - 2 * kWindowMarginMD);
+ const int header_inset =
+ hide_header_
+ ? GetWindow()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET)
+ : 0;
return ScopedTransformOverviewWindow::GetItemScale(
- GetWindow()->GetTargetBounds().size(), inset_size,
- GetWindow()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET),
+ GetWindow()->GetTargetBounds().size(), inset_size, header_inset,
close_button_->GetPreferredSize().height());
}
@@ -473,8 +477,10 @@ void WindowSelectorItem::SetItemBounds(const gfx::Rect& target_bounds,
int top_view_inset = 0;
int title_height = 0;
if (ash::MaterialDesignController::IsOverviewMaterial()) {
- top_view_inset =
- GetWindow()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET);
+ if (hide_header_) {
+ top_view_inset =
+ GetWindow()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET);
+ }
title_height = close_button_->GetPreferredSize().height();
}
gfx::Rect selector_item_bounds =
@@ -488,7 +494,7 @@ void WindowSelectorItem::SetItemBounds(const gfx::Rect& target_bounds,
// before the transform. Dividing by scale factor obtains the corner radius
// which when scaled will yield |kLabelBackgroundRadius|.
transform_window_.SetTransform(
- root_window_, transform,
+ root_window_, transform, hide_header_,
(kLabelBackgroundRadius / GetItemScale(target_bounds.size())));
transform_window_.set_overview_transform(transform);
}
@@ -580,8 +586,8 @@ void WindowSelectorItem::CreateWindowLabel(const base::string16& title) {
void WindowSelectorItem::UpdateHeaderLayout(
OverviewAnimationType animation_type) {
- gfx::Rect transformed_window_bounds =
- root_window_->ConvertRectFromScreen(GetTransformedBounds(GetWindow()));
+ gfx::Rect transformed_window_bounds = root_window_->ConvertRectFromScreen(
+ GetTransformedBounds(GetWindow(), hide_header_));
if (ash::MaterialDesignController::IsOverviewMaterial()) {
gfx::Rect label_rect(close_button_->GetPreferredSize());

Powered by Google App Engine
This is Rietveld 408576698