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

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

Issue 2197773002: [ash-md] Properly scales windows with transient parents in overview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [ash-md] Disables rounded corners by default in overview mode (nits) 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
« no previous file with comments | « ash/common/wm/overview/scoped_transform_overview_window.h ('k') | ash/common/wm/overview/window_grid.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm/overview/scoped_transform_overview_window.cc
diff --git a/ash/common/wm/overview/scoped_transform_overview_window.cc b/ash/common/wm/overview/scoped_transform_overview_window.cc
index 8e5cf5fdf7a3266d9412d235f2b678951c82167c..dc643cd25bcd7965cff7c312cf0d083ef2decc00 100644
--- a/ash/common/wm/overview/scoped_transform_overview_window.cc
+++ b/ash/common/wm/overview/scoped_transform_overview_window.cc
@@ -343,6 +343,52 @@ gfx::Rect ScopedTransformOverviewWindow::GetTargetBoundsInScreen() const {
return bounds;
}
+gfx::Rect ScopedTransformOverviewWindow::GetTransformedBounds(
+ bool hide_header) const {
+ const bool material = ash::MaterialDesignController::IsOverviewMaterial();
+ const int top_inset = hide_header ? GetTopInset() : 0;
+ gfx::Rect bounds;
+ for (auto* window : GetTransientTreeIterator(window_)) {
+ // Ignore other window types when computing bounding box of window
+ // selector target item.
+ if (window != window_ &&
+ (!material || (window->GetType() != ui::wm::WINDOW_TYPE_NORMAL &&
+ window->GetType() != ui::wm::WINDOW_TYPE_PANEL))) {
+ continue;
+ }
+ gfx::RectF window_bounds(window->GetTargetBounds());
+ gfx::Transform new_transform =
+ TransformAboutPivot(gfx::Point(window_bounds.x(), window_bounds.y()),
+ window->GetTargetTransform());
+ new_transform.TransformRect(&window_bounds);
+
+ // 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 (material && top_inset > 0) {
+ gfx::RectF header_bounds(window_bounds);
+ header_bounds.set_height(top_inset);
+ new_transform.TransformRect(&header_bounds);
+ window_bounds.Inset(0, gfx::ToCeiledInt(header_bounds.height()), 0, 0);
+ }
+ bounds.Union(window->GetParent()->ConvertRectToScreen(
+ ToEnclosingRect(window_bounds)));
+ }
+ return bounds;
+}
+
+int ScopedTransformOverviewWindow::GetTopInset() const {
+ for (auto* window : GetTransientTreeIterator(window_)) {
+ // If there are regular windows in the transient ancestor tree, all those
+ // windows are shown in the same overview item and the header is not masked.
+ if (window != window_ && (window->GetType() == ui::wm::WINDOW_TYPE_NORMAL ||
+ window->GetType() == ui::wm::WINDOW_TYPE_PANEL)) {
+ return 0;
+ }
+ }
+ return window_->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET);
+}
+
void ScopedTransformOverviewWindow::ShowWindowIfMinimized() {
if ((original_visibility_ == ORIGINALLY_MINIMIZED &&
window_->GetShowState() == ui::SHOW_STATE_MINIMIZED) ||
@@ -439,10 +485,7 @@ void ScopedTransformOverviewWindow::SetTransform(
original_window_shape_.reset(new SkRegion(*window_shape));
}
gfx::Rect bounds(GetTargetBoundsInScreen().size());
- const int inset =
- (use_mask || use_shape)
- ? window()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET)
- : 0;
+ const int inset = (use_mask || use_shape) ? GetTopInset() : 0;
if (mask_) {
// Mask layer is used both to hide the window header and to use rounded
// corners. Its layout needs to be update when setting a transform.
« no previous file with comments | « ash/common/wm/overview/scoped_transform_overview_window.h ('k') | ash/common/wm/overview/window_grid.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698