Correctly handle synchronization of overview items for multiple displays
This CL fixes two bugs: 1. `rounded_contents_bounds` were being calculated in screen bounds, however ScopedWindowTreeSynchronizer expect these bounds in the coordinate space of the root window of the transformed window. 2. When the overview window was being dragged to another display, we were experiencing a crash since our current way of finding the root window was returning the old root window. (i.e root window of the display from which the window is being dragged from) Bug: b/334906012 Change-Id: I7c6795b127d1bb7fbf41d763f6046c89a6f8e004 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5463913 Reviewed-by: Sammie Quon <sammiequon@chromium.org> Commit-Queue: Zoraiz Naeem <zoraiznaeem@chromium.org> Cr-Commit-Position: refs/heads/main@{#1291015}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
176afe807a
commit
c361cf097a
@ -209,13 +209,8 @@ ScopedOverviewTransformWindow::ScopedOverviewTransformWindow(
|
||||
// Note: windows in the overview belong to different containers. For instance,
|
||||
// normal windows belong to a desk container, floated windows to a float
|
||||
// container, and always-on-top windows to their respective container.
|
||||
const display::Display display =
|
||||
display::Screen::GetScreen()->GetDisplayMatching(
|
||||
window->GetBoundsInScreen());
|
||||
aura::Window* root_window = Shell::GetRootWindowForDisplayId(display.id());
|
||||
|
||||
window_tree_synchronizer_ = std::make_unique<ScopedWindowTreeSynchronizer>(
|
||||
root_window, /*restore_tree=*/true);
|
||||
window_->GetRootWindow(), /*restore_tree=*/true);
|
||||
}
|
||||
|
||||
ScopedOverviewTransformWindow::~ScopedOverviewTransformWindow() {
|
||||
@ -553,12 +548,12 @@ void ScopedOverviewTransformWindow::UpdateRoundedCorners(bool show) {
|
||||
return;
|
||||
}
|
||||
|
||||
const gfx::RectF contents_bounds = GetTransformedBounds();
|
||||
const gfx::RectF contents_bounds_in_screen = GetTransformedBounds();
|
||||
|
||||
// Depending on the size of `backdrop_view`, we might not want to round the
|
||||
// window associated with `layer`.
|
||||
const bool has_rounding = window_util::ShouldRoundThumbnailWindow(
|
||||
overview_item_->GetBackDropView(), contents_bounds);
|
||||
overview_item_->GetBackDropView(), contents_bounds_in_screen);
|
||||
|
||||
const float scale = layer->transform().To2dScale().x();
|
||||
layer->SetRoundedCornerRadius(
|
||||
@ -570,12 +565,17 @@ void ScopedOverviewTransformWindow::UpdateRoundedCorners(bool show) {
|
||||
return;
|
||||
}
|
||||
|
||||
gfx::RRectF rounded_contents_bounds(
|
||||
contents_bounds, window_util::GetMiniWindowRoundedCorners(
|
||||
window(), /*include_header_rounding=*/false));
|
||||
gfx::RectF contents_bounds_in_root(contents_bounds_in_screen);
|
||||
wm::TranslateRectFromScreen(window_->GetRootWindow(),
|
||||
&contents_bounds_in_root);
|
||||
|
||||
const gfx::RRectF rounded_contents_bounds(
|
||||
contents_bounds_in_root,
|
||||
window_util::GetMiniWindowRoundedCorners(
|
||||
window(), /*include_header_rounding=*/false));
|
||||
|
||||
// Synchronizing the rounded corners of a window and its transient hierarchy
|
||||
// against `contents_bounds` yields two outcomes:
|
||||
// against `rounded_contents_bounds` yields two outcomes:
|
||||
// * We can apply the specified rounding without the need for a render
|
||||
// surface.
|
||||
// * It ensures that the transient windows' corners are correctly rounded,
|
||||
|
Reference in New Issue
Block a user