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

Issue 9784010: Fixes bug where maximized window wasn't getting resized when toggling (Closed)

Created:
8 years, 9 months ago by sky
Modified:
8 years, 9 months ago
CC:
chromium-reviews, dhollowa+watch_chromium.org, sadrul, ben+watch_chromium.org
Visibility:
Public.

Description

Fixes bug where maximized window wasn't getting resized when toggling auto-hide behavior of launcher. BUG=120407 TEST=see bug, covered by unit tests now too R=ben@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=129410

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+37 lines, -15 lines) Patch
M ash/wm/shelf_layout_manager.cc View 1 chunk +7 lines, -2 lines 0 comments Download
M ash/wm/shelf_layout_manager_unittest.cc View 4 chunks +30 lines, -6 lines 0 comments Download
M ash/wm/workspace/workspace_layout_manager.h View 1 chunk +0 lines, -1 line 0 comments Download
M ash/wm/workspace/workspace_layout_manager.cc View 1 chunk +0 lines, -6 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
sky
8 years, 9 months ago (2012-03-27 23:54:45 UTC) #1
Ben Goodger (Google)
8 years, 9 months ago (2012-03-28 02:55:30 UTC) #2
LGTM

On Tue, Mar 27, 2012 at 4:54 PM, <sky@chromium.org> wrote:

> Reviewers: Ben Goodger (Google),
>
> Description:
> Fixes bug where maximized window wasn't getting resized when toggling
> auto-hide behavior of launcher.
>
> BUG=120407
> TEST=see bug, covered by unit tests now too
> R=ben@chromium.org
>
>
> Please review this at
http://codereview.chromium.**org/9784010/<http://codereview.chromium.org/9784...
>
> SVN Base:
svn://svn.chromium.org/chrome/**trunk/src<http://svn.chromium.org/chrome/trunk/src>
>
> Affected files:
>  M ash/wm/shelf_layout_manager.cc
>  M ash/wm/shelf_layout_manager_**unittest.cc
>  M ash/wm/workspace/workspace_**layout_manager.h
>  M ash/wm/workspace/workspace_**layout_manager.cc
>
>
> Index: ash/wm/shelf_layout_manager.cc
> diff --git a/ash/wm/shelf_layout_manager.**cc
> b/ash/wm/shelf_layout_manager.**cc
> index 348c05810fab21dc9c33865bec8cdd**6ca61e71f6..**
> 6af5daf2ec8ba4d0e2d752c72d5046**6f8679c938 100644
> --- a/ash/wm/shelf_layout_manager.**cc
> +++ b/ash/wm/shelf_layout_manager.**cc
> @@ -345,8 +345,13 @@ void ShelfLayoutManager::**CalculateTargetBounds(
>   target_bounds->opacity =
>       (state.visibility_state == VISIBLE ||
>        state.visibility_state == AUTO_HIDE) ? 1.0f : 0.0f;
> -  target_bounds->work_area_**insets =
> -      gfx::Insets(0, 0, shelf_height, 0);
> +
> +  int work_area_bottom = 0;
> +  if (state.visibility_state == VISIBLE)
> +    work_area_bottom = shelf_height_;
> +  else if (state.visibility_state == AUTO_HIDE)
> +    work_area_bottom = kAutoHideHeight;
> +  target_bounds->work_area_**insets.Set(0, 0, work_area_bottom, 0);
>  }
>
>  void ShelfLayoutManager::**UpdateShelfBackground(
> Index: ash/wm/shelf_layout_manager_**unittest.cc
> diff --git a/ash/wm/shelf_layout_manager_**unittest.cc
> b/ash/wm/shelf_layout_manager_**unittest.cc
> index a9b3879ccc4aff135b910511b33bfc**03b881389a..**
> 8f69a0b0bdaeb14c595629095e2925**b73b7e754b 100644
> --- a/ash/wm/shelf_layout_manager_**unittest.cc
> +++ b/ash/wm/shelf_layout_manager_**unittest.cc
> @@ -172,7 +172,11 @@ TEST_F(ShelfLayoutManagerTest,
> DontReferenceLauncherAfterDele**tion) {
>  }
>
>  // Various assertions around auto-hide.
> -TEST_F(**ShelfLayoutManagerTest, DISABLED_AutoHide) {
> +TEST_F(**ShelfLayoutManagerTest, AutoHide) {
> +  aura::RootWindow* root = Shell::GetRootWindow();
> +  aura::test::EventGenerator generator(root, root);
> +  generator.MoveMouseTo(0, 0);
> +
>   ShelfLayoutManager* shelf = GetShelfLayoutManager();
>   views::Widget* widget = new views::Widget;
>   views::Widget::InitParams params(views::Widget::**
> InitParams::TYPE_WINDOW);
> @@ -184,26 +188,28 @@ TEST_F(ShelfLayoutManagerTest, DISABLED_AutoHide) {
>   EXPECT_EQ(ShelfLayoutManager::**AUTO_HIDE, shelf->visibility_state());
>   EXPECT_EQ(ShelfLayoutManager::**AUTO_HIDE_HIDDEN,
> shelf->auto_hide_state());
>
> -  aura::RootWindow* root = Shell::GetRootWindow();
>   // LayoutShelf() forces the animation to completion, at which point the
>   // launcher should go off the screen.
>   shelf->LayoutShelf();
>   EXPECT_EQ(root->bounds().**bottom() - ShelfLayoutManager::**
> kAutoHideHeight,
>             shelf->launcher_widget()->**GetWindowScreenBounds().y());
> +  EXPECT_EQ(root->bounds().**bottom() - ShelfLayoutManager::**
> kAutoHideHeight,
> +            gfx::Screen::**GetMonitorWorkAreaNearestWindo**
> w(root).bottom());
>
>   // Move the mouse to the bottom of the screen.
> -  aura::test::EventGenerator generator(root, root);
> -  generator.MoveMouseTo(gfx::**Point(0, root->bounds().bottom() - 1));
> +  generator.MoveMouseTo(0, root->bounds().bottom() - 1);
>
> -  // Shelf should be shown again.
> +  // Shelf should be shown again (but it shouldn't have changed the work
> area).
>   SetState(shelf, ShelfLayoutManager::AUTO_HIDE)**;
>   EXPECT_EQ(ShelfLayoutManager::**AUTO_HIDE_SHOWN,
> shelf->auto_hide_state());
>   shelf->LayoutShelf();
>   EXPECT_EQ(root->bounds().**bottom() - shelf->shelf_height(),
>             shelf->launcher_widget()->**GetWindowScreenBounds().y());
> +  EXPECT_EQ(root->bounds().**bottom() - ShelfLayoutManager::**
> kAutoHideHeight,
> +            gfx::Screen::**GetMonitorWorkAreaNearestWindo**
> w(root).bottom());
>
>   // Move mouse back up.
> -  generator.MoveMouseTo(gfx::**Point(0, 0));
> +  generator.MoveMouseTo(0, 0);
>   SetState(shelf, ShelfLayoutManager::AUTO_HIDE)**;
>   EXPECT_EQ(ShelfLayoutManager::**AUTO_HIDE_HIDDEN,
> shelf->auto_hide_state());
>   shelf->LayoutShelf();
> @@ -263,6 +269,12 @@ TEST_F(ShelfLayoutManagerTest,
> VisibleWhenLockScreenShowing) {
>
>  // Assertions around SetAutoHideBehavior.
>  TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) {
> +  // Since ShelfLayoutManager queries for mouse location, move the mouse
> so
> +  // it isn't over the shelf.
> +  aura::test::EventGenerator generator(
> +      Shell::GetInstance()->**GetRootWindow(), gfx::Point());
> +  generator.MoveMouseTo(0, 0);
> +
>   ShelfLayoutManager* shelf = GetShelfLayoutManager();
>   views::Widget* widget = new views::Widget;
>   views::Widget::InitParams params(views::Widget::**
> InitParams::TYPE_WINDOW);
> @@ -293,6 +305,18 @@ TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) {
>
>   widget->Maximize();
>   EXPECT_EQ(ShelfLayoutManager::**VISIBLE, shelf->visibility_state());
> +  EXPECT_EQ(gfx::Screen::**GetMonitorWorkAreaNearestWindo**
> w(window).bottom(),
> +            widget->**GetWorkAreaBoundsInScreen().**bottom());
> +
> +  shelf->SetAutoHideBehavior(**SHELF_AUTO_HIDE_BEHAVIOR_**ALWAYS);
> +  EXPECT_EQ(ShelfLayoutManager::**AUTO_HIDE, shelf->visibility_state());
> +  EXPECT_EQ(gfx::Screen::**GetMonitorWorkAreaNearestWindo**
> w(window).bottom(),
> +            widget->**GetWorkAreaBoundsInScreen().**bottom());
> +
> +  shelf->SetAutoHideBehavior(**SHELF_AUTO_HIDE_BEHAVIOR_**NEVER);
> +  EXPECT_EQ(ShelfLayoutManager::**VISIBLE, shelf->visibility_state());
> +  EXPECT_EQ(gfx::Screen::**GetMonitorWorkAreaNearestWindo**
> w(window).bottom(),
> +            widget->**GetWorkAreaBoundsInScreen().**bottom());
>  }
>
>  }  // namespace internal
> Index: ash/wm/workspace/workspace_**layout_manager.cc
> diff --git a/ash/wm/workspace/workspace_**layout_manager.cc
> b/ash/wm/workspace/workspace_**layout_manager.cc
> index 9e311830a9150dff75c1e284e6eab6**fe510ac11a..**
> 9c60d06cb55b507ecfdc5c30a225e8**5b6f8ccda8 100644
> --- a/ash/wm/workspace/workspace_**layout_manager.cc
> +++ b/ash/wm/workspace/workspace_**layout_manager.cc
> @@ -100,12 +100,6 @@ void WorkspaceLayoutManager::**SetChildBounds(
>   workspace_manager_->**UpdateShelfVisibility();
>  }
>
> -void WorkspaceLayoutManager::**OnMonitorWorkAreaInsetsChanged**() {
> -  // The workspace is currently the only one that updates the shelf, so
> we can
> -  // safely ignore this. If we don't there are timing issues when
> transitioning
> -  // between maximized/fullscreen windows and normal windows.
> -}
> -
>  void WorkspaceLayoutManager::**OnWindowPropertyChanged(aura::**Window*
> window,
>                                                      const void* key,
>                                                      intptr_t old) {
> Index: ash/wm/workspace/workspace_**layout_manager.h
> diff --git a/ash/wm/workspace/workspace_**layout_manager.h
> b/ash/wm/workspace/workspace_**layout_manager.h
> index f1b8309d3ed571e9030b45e9180eac**75c890444c..**
> ff14a1d708d00c0928b7545fd997f0**4ff0f9dfc3 100644
> --- a/ash/wm/workspace/workspace_**layout_manager.h
> +++ b/ash/wm/workspace/workspace_**layout_manager.h
> @@ -48,7 +48,6 @@ class ASH_EXPORT WorkspaceLayoutManager : public
> BaseLayoutManager {
>                                               bool visibile) OVERRIDE;
>   virtual void SetChildBounds(aura::Window* child,
>                               const gfx::Rect& requested_bounds) OVERRIDE;
> -  virtual void OnMonitorWorkAreaInsetsChanged**() OVERRIDE;
>
>   // Overriden from aura::WindowObserver:
>   virtual void OnWindowPropertyChanged(aura::**Window* window,
>
>
>

Powered by Google App Engine
This is Rietveld 408576698