Commit d8e75830 authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Fix Autohide -> None frame traisntion

The transition didn't work correctly but no one was using
this transition except pinned mode. This is actually odd
transition, but this should work regardless.

I will look into why pinned mode does this separately.

Bug: b/112240082
Test: covered by unittests
Change-Id: I88db9dfb614895f19951fd822185460bf682948a
Reviewed-on: https://chromium-review.googlesource.com/1164570Reviewed-by: default avatarDaichi Hirono <hirono@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581104}
parent 281ab38e
......@@ -250,7 +250,8 @@ void HeaderView::OnTabletModeStarted() {
void HeaderView::OnTabletModeEnded() {
caption_button_container_->UpdateCaptionButtonState(true /*=animate*/);
parent()->Layout();
target_widget_->non_client_view()->Layout();
if (target_widget_->non_client_view())
target_widget_->non_client_view()->Layout();
}
void HeaderView::OnWindowPropertyChanged(aura::Window* window,
......
......@@ -907,8 +907,9 @@ gfx::Point ClientControlledShellSurface::GetSurfaceOrigin() const {
// ClientControlledShellSurface, private:
void ClientControlledShellSurface::UpdateFrame() {
if (!widget_ || !GetFrameView()->visible())
if (!widget_)
return;
gfx::Rect work_area =
display::Screen::GetScreen()
->GetDisplayNearestWindow(widget_->GetNativeWindow())
......
......@@ -555,6 +555,18 @@ TEST_F(ClientControlledShellSurfaceTest, Frame) {
EXPECT_EQ(client_bounds, widget->GetWindowBoundsInScreen());
EXPECT_EQ(client_bounds,
frame_view->GetClientBoundsForWindowBounds(client_bounds));
// Test NONE -> AUTOHIDE -> NONE
shell_surface->SetMaximized();
shell_surface->SetGeometry(fullscreen_bounds);
surface->SetFrame(SurfaceFrameType::AUTOHIDE);
surface->Commit();
EXPECT_TRUE(frame_view->visible());
EXPECT_TRUE(frame_view->GetHeaderView()->in_immersive_mode());
surface->SetFrame(SurfaceFrameType::NONE);
surface->Commit();
EXPECT_FALSE(frame_view->visible());
EXPECT_FALSE(frame_view->GetHeaderView()->in_immersive_mode());
}
namespace {
......@@ -1483,12 +1495,22 @@ TEST_F(ClientControlledShellSurfaceTest, WideFrame) {
ASSERT_TRUE(wide_frame);
EXPECT_FALSE(wide_frame->header_view()->in_immersive_mode());
// Set AutoHide mode.
// Test AUTOHIDE -> NORMAL
surface->SetFrame(SurfaceFrameType::AUTOHIDE);
surface->Commit();
EXPECT_TRUE(wide_frame->header_view()->in_immersive_mode());
// Exit AutoHide mode.
surface->SetFrame(SurfaceFrameType::NORMAL);
surface->Commit();
EXPECT_FALSE(wide_frame->header_view()->in_immersive_mode());
// Test AUTOHIDE -> NONE
surface->SetFrame(SurfaceFrameType::AUTOHIDE);
surface->Commit();
EXPECT_TRUE(wide_frame->header_view()->in_immersive_mode());
surface->SetFrame(SurfaceFrameType::NONE);
surface->Commit();
EXPECT_FALSE(wide_frame->header_view()->in_immersive_mode());
// Unmaximize it and the frame should be normal.
......
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