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

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: 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/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..4e2be5a286c5e674e27cb1285b6f9992c79f95dd 100644
--- a/ash/common/wm/overview/scoped_transform_overview_window.cc
+++ b/ash/common/wm/overview/scoped_transform_overview_window.cc
@@ -343,6 +343,53 @@ gfx::Rect ScopedTransformOverviewWindow::GetTargetBoundsInScreen() const {
return bounds;
}
+gfx::Rect ScopedTransformOverviewWindow::GetTransformedBounds(
+ bool hide_header) const {
+ const bool material = ash::MaterialDesignController::IsOverviewMaterial();
+ int top_inset = hide_header ? GetTopInset() : 0;
tdanderson 2016/07/29 20:20:02 nit: const
varkha 2016/07/29 20:45:12 Done.
+ 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_)) {
+ // Ignore other window types when computing bounding box of window
+ // selector target item.
tdanderson 2016/07/29 20:20:02 Did you mean to have this comment here? I think so
varkha 2016/07/29 20:45:12 Done.
+ if (window == window_ || (window->GetType() != ui::wm::WINDOW_TYPE_NORMAL &&
tdanderson 2016/07/29 20:20:02 Perhaps restructure as this instead: for (...) {
varkha 2016/07/29 20:45:12 Done.
+ window->GetType() != ui::wm::WINDOW_TYPE_PANEL)) {
+ continue;
+ }
+ 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 +486,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.

Powered by Google App Engine
This is Rietveld 408576698