summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-14 03:39:48 +0000
committerjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-14 03:39:48 +0000
commit6918efd45cff878ba7934f3004ffc7344f5b9064 (patch)
tree54125e6e094192599a02e8437ed6eb9aec269a15 /ash
parent8ae7bd6ff36483becd1cf7cb37ce5a698c60a251 (diff)
downloadchromium_src-6918efd45cff878ba7934f3004ffc7344f5b9064.zip
chromium_src-6918efd45cff878ba7934f3004ffc7344f5b9064.tar.gz
chromium_src-6918efd45cff878ba7934f3004ffc7344f5b9064.tar.bz2
Revert 126539 - Ash: Allow resize along 1 pixel edge inside window content
Mocks call for resize handles to function along a single pixel edge inside the window, overlapping the web content. Use the aura::Window::set_hit_test_bounds_inset() functionality to make hover/click events along that border pass through to the non-client area of the window frames. This also allows windows to be resized when they are flush against the top/left/right edges of the screen. BUG=117542 TEST=aura_shell_unittests ShelfLayoutManager, manually resize window from left/right/bottom/top edges Review URL: http://codereview.chromium.org/9694012 TBR=jamescook@chromium.org Review URL: https://chromiumcodereview.appspot.com/9705011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126544 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/launcher/launcher.h3
-rw-r--r--ash/wm/frame_painter.cc41
-rw-r--r--ash/wm/frame_painter.h3
-rw-r--r--ash/wm/shelf_layout_manager.cc6
-rw-r--r--ash/wm/shelf_layout_manager.h8
-rw-r--r--ash/wm/shelf_layout_manager_unittest.cc8
6 files changed, 25 insertions, 44 deletions
diff --git a/ash/launcher/launcher.h b/ash/launcher/launcher.h
index dea112c..9404d2b 100644
--- a/ash/launcher/launcher.h
+++ b/ash/launcher/launcher.h
@@ -55,7 +55,8 @@ class ASH_EXPORT Launcher {
scoped_ptr<LauncherModel> model_;
- // Widget hosting the view.
+ // Widget hosting the view. May be hidden if we're not using a launcher,
+ // e.g. Aura compact window mode.
scoped_ptr<views::Widget> widget_;
aura::Window* window_container_;
diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc
index f61baad..9492cfc 100644
--- a/ash/wm/frame_painter.cc
+++ b/ash/wm/frame_painter.cc
@@ -28,12 +28,8 @@ const int kTopThickness = 1;
// TODO(jamescook): Border is specified to be a single pixel overlapping
// the web content and may need to be built into the shadow layers instead.
const int kBorderThickness = 0;
-// Ash windows do not have a traditional visible window frame. Window content
-// extends to the edge of the window. We consider a small region outside the
-// window bounds and an even smaller region overlapping the window to be the
-// "non-client" area and use it for resizing.
-const int kResizeOutsideBoundsSize = 6;
-const int kResizeInsideBoundsSize = 1;
+// Number of pixels outside the window frame to look for resize events.
+const int kResizeAreaOutsideBounds = 6;
// In the window corners, the resize areas don't actually expand bigger, but the
// 16 px at the end of each edge triggers diagonal resizing.
const int kResizeAreaCornerSize = 16;
@@ -141,8 +137,8 @@ void FramePainter::Init(views::Widget* frame,
rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_RIGHT).ToSkBitmap();
// Ensure we get resize cursors for a few pixels outside our bounds.
- frame_->GetNativeWindow()->SetHitTestBoundsOverride(kResizeOutsideBoundsSize,
- kResizeInsideBoundsSize);
+ frame_->GetNativeWindow()->set_hit_test_bounds_inset(
+ -kResizeAreaOutsideBounds);
}
gfx::Rect FramePainter::GetBoundsForClientView(
@@ -167,26 +163,13 @@ gfx::Rect FramePainter::GetWindowBoundsForClientBounds(
int FramePainter::NonClientHitTest(views::NonClientFrameView* view,
const gfx::Point& point) {
gfx::Rect expanded_bounds = view->bounds();
- expanded_bounds.Inset(-kResizeOutsideBoundsSize, -kResizeOutsideBoundsSize);
+ expanded_bounds.Inset(-kResizeAreaOutsideBounds, -kResizeAreaOutsideBounds);
if (!expanded_bounds.Contains(point))
return HTNOWHERE;
// No avatar button.
- // Check the frame first, as we allow a small area overlapping the contents
- // to be used for resize handles.
- bool can_resize = frame_->widget_delegate() ?
- frame_->widget_delegate()->CanResize() :
- false;
- int frame_component = view->GetHTComponentForFrame(point,
- kResizeInsideBoundsSize,
- kResizeInsideBoundsSize,
- kResizeAreaCornerSize,
- kResizeAreaCornerSize,
- can_resize);
- if (frame_component != HTNOWHERE)
- return frame_component;
-
+ // Check the client view first, as it overlaps the window caption area.
int client_component = frame_->client_view()->NonClientHitTest(point);
if (client_component != HTNOWHERE)
return client_component;
@@ -199,6 +182,18 @@ int FramePainter::NonClientHitTest(views::NonClientFrameView* view,
maximize_button_->GetMirroredBounds().Contains(point))
return HTMAXBUTTON;
+ bool can_resize = frame_->widget_delegate() ?
+ frame_->widget_delegate()->CanResize() :
+ false;
+ int frame_component = view->GetHTComponentForFrame(point,
+ kTopThickness,
+ kBorderThickness,
+ kResizeAreaCornerSize,
+ kResizeAreaCornerSize,
+ can_resize);
+ if (frame_component != HTNOWHERE)
+ return frame_component;
+
// Caption is a safe default.
return HTCAPTION;
}
diff --git a/ash/wm/frame_painter.h b/ash/wm/frame_painter.h
index 5be8ca1..2cf474d 100644
--- a/ash/wm/frame_painter.h
+++ b/ash/wm/frame_painter.h
@@ -27,8 +27,7 @@ class Widget;
namespace ash {
// Helper class for painting window frames. Exists to share code between
-// various implementations of views::NonClientFrameView. Canonical source of
-// layout constants for Ash window frames.
+// various implementations of views::NonClientFrameView.
class ASH_EXPORT FramePainter {
public:
FramePainter();
diff --git a/ash/wm/shelf_layout_manager.cc b/ash/wm/shelf_layout_manager.cc
index fff8c19..eca4c40c 100644
--- a/ash/wm/shelf_layout_manager.cc
+++ b/ash/wm/shelf_layout_manager.cc
@@ -26,9 +26,6 @@ ui::Layer* GetLayer(views::Widget* widget) {
} // namespace
-// static
-const int ShelfLayoutManager::kWorkspaceAreaBottomInset = 2;
-
////////////////////////////////////////////////////////////////////////////////
// ShelfLayoutManager, public:
@@ -147,8 +144,7 @@ void ShelfLayoutManager::CalculateTargetBounds(bool visible,
available_bounds.width(),
launcher_bounds.height());
if (visible)
- target_bounds->work_area_insets = gfx::Insets(
- 0, 0, max_height_ + kWorkspaceAreaBottomInset, 0);
+ target_bounds->work_area_insets = gfx::Insets(0, 0, max_height_, 0);
}
void ShelfLayoutManager::OnImplicitAnimationsCompleted() {
diff --git a/ash/wm/shelf_layout_manager.h b/ash/wm/shelf_layout_manager.h
index 5c4b6dd..8d69cc6 100644
--- a/ash/wm/shelf_layout_manager.h
+++ b/ash/wm/shelf_layout_manager.h
@@ -30,14 +30,6 @@ namespace internal {
class ASH_EXPORT ShelfLayoutManager : public aura::LayoutManager,
public ui::ImplicitAnimationObserver {
public:
- // We reserve a small area at the bottom of the workspace area to ensure that
- // the bottom-of-window resize handle can be hit.
- // TODO(jamescook): Some day we may want the workspace area to be an even
- // multiple of the size of the grid (currently 8 pixels), which will require
- // removing this and finding a way for hover and click events to pass through
- // the invisible parts of the launcher.
- static const int kWorkspaceAreaBottomInset;
-
ShelfLayoutManager(views::Widget* launcher, views::Widget* status);
virtual ~ShelfLayoutManager();
diff --git a/ash/wm/shelf_layout_manager_unittest.cc b/ash/wm/shelf_layout_manager_unittest.cc
index 46f60a2..fbf924d 100644
--- a/ash/wm/shelf_layout_manager_unittest.cc
+++ b/ash/wm/shelf_layout_manager_unittest.cc
@@ -53,9 +53,8 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
const ash::ScreenAsh* screen = Shell::GetInstance()->screen();
ASSERT_TRUE(screen);
- // Bottom inset should be the max of widget heights plus an adjustment.
- EXPECT_EQ(shelf->max_height() + ShelfLayoutManager::kWorkspaceAreaBottomInset,
- screen->work_area_insets().bottom());
+ // Bottom inset should be the max of widget heights.
+ EXPECT_EQ(shelf->max_height(), screen->work_area_insets().bottom());
// Hide the shelf.
shelf->SetVisible(false);
@@ -77,8 +76,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
StepWidgetLayerAnimatorToEnd(shelf->launcher());
StepWidgetLayerAnimatorToEnd(shelf->status());
EXPECT_TRUE(shelf->visible());
- EXPECT_EQ(shelf->max_height() + ShelfLayoutManager::kWorkspaceAreaBottomInset,
- screen->work_area_insets().bottom());
+ EXPECT_EQ(shelf->max_height(), screen->work_area_insets().bottom());
// Make sure the bounds of the two widgets changed.
gfx::Rect launcher_bounds(shelf->launcher()->GetNativeView()->bounds());