summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorskuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-14 02:44:22 +0000
committerskuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-14 02:44:22 +0000
commitdd8a8690b96bdfce0e90e538ed78290c8642d15f (patch)
tree49125bc997f573d822f4e47417e511df05f2bc6c /ash
parent8f969589f616f5162224c78f3a6dcc5af5f2e8ee (diff)
downloadchromium_src-dd8a8690b96bdfce0e90e538ed78290c8642d15f.zip
chromium_src-dd8a8690b96bdfce0e90e538ed78290c8642d15f.tar.gz
chromium_src-dd8a8690b96bdfce0e90e538ed78290c8642d15f.tar.bz2
Ignoring alignment when it pushes a window out of the screen
BUG=121580, 122841 TEST=None Review URL: http://codereview.chromium.org/9969164 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132316 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/wm/workspace/workspace_layout_manager.cc4
-rw-r--r--ash/wm/workspace/workspace_manager.cc19
-rw-r--r--ash/wm/workspace/workspace_manager.h3
-rw-r--r--ash/wm/workspace/workspace_manager_unittest.cc6
4 files changed, 5 insertions, 27 deletions
diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc
index 991db32..ca28cd4 100644
--- a/ash/wm/workspace/workspace_layout_manager.cc
+++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -44,10 +44,6 @@ void WorkspaceLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
if (child->IsVisible()) {
workspace_manager_->AddWindow(child);
- } else if (wm::IsWindowNormal(child)) {
- // Align non-maximized/fullscreen windows to a grid.
- SetChildBoundsDirect(
- child, workspace_manager_->AlignBoundsToGrid(child->GetTargetBounds()));
}
}
diff --git a/ash/wm/workspace/workspace_manager.cc b/ash/wm/workspace/workspace_manager.cc
index 05ab750..e710137 100644
--- a/ash/wm/workspace/workspace_manager.cc
+++ b/ash/wm/workspace/workspace_manager.cc
@@ -11,7 +11,6 @@
#include "ash/wm/property_util.h"
#include "ash/wm/shelf_layout_manager.h"
#include "ash/wm/window_animations.h"
-#include "ash/wm/window_resizer.h"
#include "ash/wm/window_util.h"
#include "ash/wm/workspace/managed_workspace.h"
#include "ash/wm/workspace/maximized_workspace.h"
@@ -43,15 +42,6 @@ void BuildWindowList(const std::vector<aura::Window*>& windows,
}
}
-gfx::Rect AlignRectToGrid(const gfx::Rect& rect, int grid_size) {
- if (grid_size <= 1)
- return rect;
- return gfx::Rect(ash::WindowResizer::AlignToGrid(rect.x(), grid_size),
- ash::WindowResizer::AlignToGrid(rect.y(), grid_size),
- ash::WindowResizer::AlignToGrid(rect.width(), grid_size),
- ash::WindowResizer::AlignToGrid(rect.height(), grid_size));
-}
-
}
namespace ash {
@@ -105,9 +95,6 @@ void WorkspaceManager::AddWindow(aura::Window* window) {
return;
}
- if (wm::IsWindowNormal(window) && grid_size_ > 1)
- SetWindowBounds(window, AlignBoundsToGrid(window->GetTargetBounds()));
-
Workspace* workspace = NULL;
Workspace::Type type_for_window = Workspace::TypeForWindow(window);
switch (type_for_window) {
@@ -143,12 +130,6 @@ void WorkspaceManager::SetActiveWorkspaceByWindow(aura::Window* window) {
workspace->Activate();
}
-gfx::Rect WorkspaceManager::AlignBoundsToGrid(const gfx::Rect& bounds) {
- if (grid_size_ <= 1)
- return bounds;
- return AlignRectToGrid(bounds, grid_size_);
-}
-
void WorkspaceManager::UpdateShelfVisibility() {
shelf_->UpdateVisibilityState();
}
diff --git a/ash/wm/workspace/workspace_manager.h b/ash/wm/workspace/workspace_manager.h
index 6da00e7..4f80f36 100644
--- a/ash/wm/workspace/workspace_manager.h
+++ b/ash/wm/workspace/workspace_manager.h
@@ -85,9 +85,6 @@ class ASH_EXPORT WorkspaceManager {
void set_grid_size(int size) { grid_size_ = size; }
int grid_size() const { return grid_size_; }
- // Returns a bounds aligned to the grid. Returns |bounds| if grid_size is 0.
- gfx::Rect AlignBoundsToGrid(const gfx::Rect& bounds);
-
void set_shelf(ShelfLayoutManager* shelf) { shelf_ = shelf; }
// Updates the visibility and whether any windows overlap the shelf.
diff --git a/ash/wm/workspace/workspace_manager_unittest.cc b/ash/wm/workspace/workspace_manager_unittest.cc
index 6d112c1..a46c35d 100644
--- a/ash/wm/workspace/workspace_manager_unittest.cc
+++ b/ash/wm/workspace/workspace_manager_unittest.cc
@@ -306,7 +306,11 @@ TEST_F(WorkspaceManagerTest, SnapToGrid) {
scoped_ptr<Window> w1(CreateTestWindowUnparented());
w1->SetBounds(gfx::Rect(1, 6, 25, 30));
w1->SetParent(GetViewport());
- EXPECT_EQ(gfx::Rect(0, 8, 24, 32), w1->bounds());
+ // We are not aligning this anymore this way. When the window gets shown
+ // the window is expected to be handled differently, but this cannot be
+ // tested with this test. So the result of this test should be that the
+ // bounds are exactly as passed in.
+ EXPECT_EQ(gfx::Rect(1, 6, 25, 30), w1->bounds());
}
// Assertions around a fullscreen window.