Commit e2215577 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

overview: Fix bug with rounded corners persisting after overview.

Minimized and non minimized windows have their rounded corners applied
in overview differently, minimized on the mirror view layer, and normal
windows on the actual window layer. Due to the setup of the current
logic, minimized windows do not reset the windows layer rounded corners
on exit.

This was problematic if the window was not minimized when entering, and
then minimized at exit which is a common workflow in tablet mode.

Bug: 1146240
Test: added tests
Change-Id: I9b3f9c465bb1bdfc5bf1acbe727ea9743472edcb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2542605Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828045}
parent 9d9cf613
......@@ -3954,6 +3954,30 @@ TEST_P(TabletModeOverviewSessionTest, MultiTouch) {
EXPECT_FALSE(overview_controller()->InOverviewSession());
}
// Tests that when exiting overview in a way that causes windows to minimize,
// rounded corners are removed, otherwise they will be visible after
// unminimizing. Regression test for https://crbug.com/1146240.
TEST_P(TabletModeOverviewSessionTest, MinimizedRoundedCorners) {
const gfx::Rect bounds(400, 400);
std::unique_ptr<aura::Window> window(CreateTestWindow(bounds));
// Enter overview. Spin the run loop since rounded corners are applied on a
// post task.
ToggleOverview();
base::RunLoop().RunUntilIdle();
ASSERT_TRUE(overview_controller()->InOverviewSession());
// Tap on a point on the wallpaper to minimize the window and exit overview.
GetEventGenerator()->set_current_screen_location(gfx::Point(10, 10));
GetEventGenerator()->ClickLeftButton();
// Tests that the window layer has rounded corners removed after exiting
// overview.
EXPECT_FALSE(overview_controller()->InOverviewSession());
EXPECT_TRUE(WindowState::Get(window.get())->IsMinimized());
EXPECT_EQ(gfx::RoundedCornersF(), window->layer()->rounded_corner_radii());
}
// Test the split view and overview functionalities in tablet mode.
class SplitViewOverviewSessionTest : public OverviewSessionTest {
public:
......
......@@ -227,8 +227,7 @@ ScopedOverviewTransformWindow::~ScopedOverviewTransformWindow() {
event_targeting_blocker_map_.erase(transient);
}
if (!IsMinimized())
UpdateRoundedCorners(/*show=*/false);
UpdateRoundedCorners(/*show=*/false);
aura::client::GetTransientWindowClient()->RemoveObserver(this);
window_observer_.RemoveAll();
......@@ -504,7 +503,8 @@ void ScopedOverviewTransformWindow::UpdateWindowDimensionsType() {
void ScopedOverviewTransformWindow::UpdateRoundedCorners(bool show) {
// Hide the corners if minimized, OverviewItemView will handle showing the
// rounded corners on the UI.
DCHECK(!IsMinimized());
if (IsMinimized())
DCHECK(!show);
ui::Layer* layer = window_->layer();
const float scale = layer->transform().Scale2d().x();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment