diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-17 17:15:05 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-17 17:15:05 +0000 |
commit | ef357f25e14abdb6d5c32d707bff16c7cb66a613 (patch) | |
tree | 570e0d4fbba928b56ab1c3616e46117fcc4b4173 /ash | |
parent | 31d53fa4d721eebcd428dffd5b65259726146e69 (diff) | |
download | chromium_src-ef357f25e14abdb6d5c32d707bff16c7cb66a613.zip chromium_src-ef357f25e14abdb6d5c32d707bff16c7cb66a613.tar.gz chromium_src-ef357f25e14abdb6d5c32d707bff16c7cb66a613.tar.bz2 |
Revert r168447 "Makes windows obey their maximum size constraints on chromeos."
- Prevents windows from resizing bigger than their max size
- Prevents windows from snapping when they have max size defined
- Prevents windows from maximizing when they have max size defined
This broke win_aura/linux_aura
BUG=152065
TBR=koz@chromium.org
Review URL: https://codereview.chromium.org/11316068
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168454 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/wm/custom_frame_view_ash.cc | 4 | ||||
-rw-r--r-- | ash/wm/custom_frame_view_ash.h | 1 | ||||
-rw-r--r-- | ash/wm/frame_painter.cc | 4 | ||||
-rw-r--r-- | ash/wm/frame_painter.h | 1 | ||||
-rw-r--r-- | ash/wm/window_resizer.cc | 6 | ||||
-rw-r--r-- | ash/wm/window_util.cc | 6 | ||||
-rw-r--r-- | ash/wm/window_util.h | 3 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_window_resizer.cc | 3 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_window_resizer.h | 1 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_window_resizer_unittest.cc | 58 |
10 files changed, 0 insertions, 87 deletions
diff --git a/ash/wm/custom_frame_view_ash.cc b/ash/wm/custom_frame_view_ash.cc index bb3c152..48a4ff7 100644 --- a/ash/wm/custom_frame_view_ash.cc +++ b/ash/wm/custom_frame_view_ash.cc @@ -149,10 +149,6 @@ gfx::Size CustomFrameViewAsh::GetMinimumSize() { return frame_painter_->GetMinimumSize(this); } -gfx::Size CustomFrameViewAsh::GetMaximumSize() { - return frame_painter_->GetMaximumSize(this); -} - //////////////////////////////////////////////////////////////////////////////// // views::ButtonListener overrides: void CustomFrameViewAsh::ButtonPressed(views::Button* sender, diff --git a/ash/wm/custom_frame_view_ash.h b/ash/wm/custom_frame_view_ash.h index 5c3f0c3..c09710f 100644 --- a/ash/wm/custom_frame_view_ash.h +++ b/ash/wm/custom_frame_view_ash.h @@ -71,7 +71,6 @@ class ASH_EXPORT CustomFrameViewAsh : public views::NonClientFrameView, virtual std::string GetClassName() const OVERRIDE; virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; virtual gfx::Size GetMinimumSize() OVERRIDE; - virtual gfx::Size GetMaximumSize() OVERRIDE; // views::ButtonListener overrides: virtual void ButtonPressed(views::Button* sender, diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc index 9a4415f..a4b4c70 100644 --- a/ash/wm/frame_painter.cc +++ b/ash/wm/frame_painter.cc @@ -329,10 +329,6 @@ gfx::Size FramePainter::GetMinimumSize(views::NonClientFrameView* view) { return min_size; } -gfx::Size FramePainter::GetMaximumSize(views::NonClientFrameView* view) { - return frame_->client_view()->GetMaximumSize(); -} - int FramePainter::GetRightInset() const { gfx::Size close_size = close_button_->GetPreferredSize(); gfx::Size size_button_size = size_button_->GetPreferredSize(); diff --git a/ash/wm/frame_painter.h b/ash/wm/frame_painter.h index c71255b..d2b6fb7 100644 --- a/ash/wm/frame_painter.h +++ b/ash/wm/frame_painter.h @@ -87,7 +87,6 @@ class ASH_EXPORT FramePainter : public aura::WindowObserver, int NonClientHitTest(views::NonClientFrameView* view, const gfx::Point& point); gfx::Size GetMinimumSize(views::NonClientFrameView* view); - gfx::Size GetMaximumSize(views::NonClientFrameView* view); // Returns the inset from the right edge. int GetRightInset() const; diff --git a/ash/wm/window_resizer.cc b/ash/wm/window_resizer.cc index 3773d07..16070e7 100644 --- a/ash/wm/window_resizer.cc +++ b/ash/wm/window_resizer.cc @@ -324,9 +324,6 @@ int WindowResizer::GetWidthForDrag(const Details& details, // And don't let the window go bigger than the display. int max_width = Shell::GetScreen()->GetDisplayNearestWindow( details.window).bounds().width(); - gfx::Size max_size = details.window->delegate()->GetMaximumSize(); - if (max_size.width() != 0) - max_width = std::min(max_width, max_size.width()); if (width > max_width) { width = max_width; *delta_x = -x_multiplier * (details.initial_bounds_in_parent.width() - @@ -357,9 +354,6 @@ int WindowResizer::GetHeightForDrag(const Details& details, // And don't let the window go bigger than the display. int max_height = Shell::GetScreen()->GetDisplayNearestWindow( details.window).bounds().height(); - gfx::Size max_size = details.window->delegate()->GetMaximumSize(); - if (max_size.height() != 0) - max_height = std::min(max_height, max_size.height()); if (height > max_height) { height = max_height; *delta_y = -y_multiplier * (details.initial_bounds_in_parent.height() - diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc index 3adb296..e3ce3fb 100644 --- a/ash/wm/window_util.cc +++ b/ash/wm/window_util.cc @@ -14,7 +14,6 @@ #include "ui/aura/client/aura_constants.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" -#include "ui/aura/window_delegate.h" #include "ui/compositor/layer.h" #include "ui/gfx/display.h" #include "ui/gfx/rect.h" @@ -84,11 +83,6 @@ bool CanResizeWindow(const aura::Window* window) { return window->GetProperty(aura::client::kCanResizeKey); } -bool CanSnapWindow(aura::Window* window) { - // If a window has a maximum size defined, snapping may make it too big. - return window->delegate()->GetMaximumSize().IsEmpty(); -} - bool IsWindowNormal(const aura::Window* window) { return IsWindowStateNormal(window->GetProperty(aura::client::kShowStateKey)); } diff --git a/ash/wm/window_util.h b/ash/wm/window_util.h index f1da5b8..83241e4 100644 --- a/ash/wm/window_util.h +++ b/ash/wm/window_util.h @@ -51,9 +51,6 @@ ASH_EXPORT bool CanMaximizeWindow(const aura::Window* window); // Returns true if |window| can be resized. ASH_EXPORT bool CanResizeWindow(const aura::Window* window); -// Returns true if |window| can be snapped to the left or right. -ASH_EXPORT bool CanSnapWindow(aura::Window* window); - // Returns true if |window| is normal or default. ASH_EXPORT bool IsWindowNormal(const aura::Window* window); diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc index a717314..eda27a4 100644 --- a/ash/wm/workspace/workspace_window_resizer.cc +++ b/ash/wm/workspace/workspace_window_resizer.cc @@ -754,9 +754,6 @@ void WorkspaceWindowResizer::UpdateSnapPhantomWindow(const gfx::Point& location, if (!did_move_or_resize_ || details_.window_component != HTCAPTION) return; - if (!wm::CanSnapWindow(window())) - return; - SnapType last_type = snap_type_; snap_type_ = GetSnapType(location); if (snap_type_ == SNAP_NONE || snap_type_ != last_type) { diff --git a/ash/wm/workspace/workspace_window_resizer.h b/ash/wm/workspace/workspace_window_resizer.h index c952f11..26065b13 100644 --- a/ash/wm/workspace/workspace_window_resizer.h +++ b/ash/wm/workspace/workspace_window_resizer.h @@ -77,7 +77,6 @@ class ASH_EXPORT WorkspaceWindowResizer : public WindowResizer { private: FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, PhantomStyle); FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, CancelSnapPhantom); - FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, PhantomSnapMaxSize); // Type of snapping. enum SnapType { diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc index d8570ee..47b3c08 100644 --- a/ash/wm/workspace/workspace_window_resizer_unittest.cc +++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc @@ -46,22 +46,13 @@ class TestWindowDelegate : public aura::test::TestWindowDelegate { min_size_ = size; } - void set_max_size(const gfx::Size& size) { - max_size_ = size; - } - private: // Overridden from aura::Test::TestWindowDelegate: virtual gfx::Size GetMinimumSize() const OVERRIDE { return min_size_; } - virtual gfx::Size GetMaximumSize() const OVERRIDE { - return max_size_; - } - gfx::Size min_size_; - gfx::Size max_size_; DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); }; @@ -1474,54 +1465,5 @@ TEST_F(WorkspaceWindowResizerTest, CheckUserWindowMangedFlags) { } } -// Test that a window with a specified max size doesn't exceed it when dragged. -TEST_F(WorkspaceWindowResizerTest, TestMaxSizeEnforced) { - window_->SetBounds(gfx::Rect(0, 0, 400, 300)); - delegate_.set_max_size(gfx::Size(401, 301)); - - scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( - window_.get(), gfx::Point(), HTBOTTOMRIGHT, empty_windows())); - resizer->Drag(CalculateDragPoint(*resizer, 2, 2), 0); - EXPECT_EQ(401, window_->bounds().width()); - EXPECT_EQ(301, window_->bounds().height()); -} - -// Test that a window with a specified max width doesn't restrict its height. -TEST_F(WorkspaceWindowResizerTest, TestPartialMaxSizeEnforced) { - window_->SetBounds(gfx::Rect(0, 0, 400, 300)); - delegate_.set_max_size(gfx::Size(401, 0)); - - scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( - window_.get(), gfx::Point(), HTBOTTOMRIGHT, empty_windows())); - resizer->Drag(CalculateDragPoint(*resizer, 2, 2), 0); - EXPECT_EQ(401, window_->bounds().width()); - EXPECT_EQ(302, window_->bounds().height()); -} - -// Test that a window with a specified max size can't be snapped. -TEST_F(WorkspaceWindowResizerTest, PhantomSnapMaxSize) { - { - // With max size not set we get a phantom window controller for dragging off - // the right hand side. - window_->SetBounds(gfx::Rect(0, 0, 300, 200)); - - scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( - window_.get(), gfx::Point(), HTCAPTION, empty_windows())); - EXPECT_FALSE(resizer->snap_phantom_window_controller_.get()); - resizer->Drag(CalculateDragPoint(*resizer, 801, 0), 0); - EXPECT_TRUE(resizer->snap_phantom_window_controller_.get()); - } - { - // With max size defined, we get no phantom window. - window_->SetBounds(gfx::Rect(0, 0, 300, 200)); - delegate_.set_max_size(gfx::Size(300, 200)); - - scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( - window_.get(), gfx::Point(), HTCAPTION, empty_windows())); - resizer->Drag(CalculateDragPoint(*resizer, 801, 0), 0); - EXPECT_FALSE(resizer->snap_phantom_window_controller_.get()); - } -} - } // namespace internal } // namespace ash |