Index: chrome/browser/ui/panels/panel_window_controller_cocoa.mm |
diff --git a/chrome/browser/ui/panels/panel_window_controller_cocoa.mm b/chrome/browser/ui/panels/panel_window_controller_cocoa.mm |
index d79a02b7f8d3fa621971a74c5b0294150df3488c..c95c4e95cf36bec8f0b39f3c6bd7e6e050f35291 100644 |
--- a/chrome/browser/ui/panels/panel_window_controller_cocoa.mm |
+++ b/chrome/browser/ui/panels/panel_window_controller_cocoa.mm |
@@ -172,7 +172,8 @@ enum { |
// |pointInWindow| is in window coordinates. |
- (panel::ResizingSides)edgeHitTest:(NSPoint)pointInWindow { |
- DCHECK(panel_->CanResizeByMouse()); |
+ panel::Resizability resizability = panel_->CanResizeByMouse(); |
+ DCHECK_NE(panel::NOT_RESIZABLE, resizability); |
NSPoint point = [self convertPoint:pointInWindow fromView:nil]; |
BOOL flipped = [self isFlipped]; |
@@ -182,16 +183,25 @@ enum { |
return panel::RESIZE_RIGHT; |
if (NSMouseInRect(point, topCursorRect_, flipped)) |
return panel::RESIZE_TOP; |
- if (NSMouseInRect(point, bottomCursorRect_, flipped)) |
- return panel::RESIZE_BOTTOM; |
if (NSMouseInRect(point, topLeftCursorRect_, flipped)) |
return panel::RESIZE_TOP_LEFT; |
if (NSMouseInRect(point, topRightCursorRect_, flipped)) |
return panel::RESIZE_TOP_RIGHT; |
- if (NSMouseInRect(point, bottomLeftCursorRect_, flipped)) |
- return panel::RESIZE_BOTTOM_LEFT; |
- if (NSMouseInRect(point, bottomRightCursorRect_, flipped)) |
- return panel::RESIZE_BOTTOM_RIGHT; |
+ |
+ // Special handling if bottom edge is not resizable. |
+ if (panel::ALL_SIDES == resizability) { |
+ if (NSMouseInRect(point, bottomCursorRect_, flipped)) |
+ return panel::RESIZE_BOTTOM; |
+ if (NSMouseInRect(point, bottomLeftCursorRect_, flipped)) |
+ return panel::RESIZE_BOTTOM_LEFT; |
+ if (NSMouseInRect(point, bottomRightCursorRect_, flipped)) |
+ return panel::RESIZE_BOTTOM_RIGHT; |
+ } else if (panel::ALL_SIDES_EXCEPT_BOTTOM == resizability) { |
+ if (NSMouseInRect(point, bottomLeftCursorRect_, flipped)) |
Dmitry Titov
2012/04/13 02:55:45
Why do we want the bottom corners to do horizontal
jennb
2012/04/13 16:39:43
I tried ignoring the bottom corners, but it didn't
|
+ return panel::RESIZE_LEFT; |
+ if (NSMouseInRect(point, bottomRightCursorRect_, flipped)) |
+ return panel::RESIZE_RIGHT; |
+ } |
return panel::RESIZE_NONE; |
} |
@@ -204,7 +214,7 @@ enum { |
// |point| is in coordinate system of the parent view. |
- (NSView*)hitTest:(NSPoint)point { |
// If panel is not resizable, let the mouse events fall through. |
- if (!panel_->CanResizeByMouse()) |
+ if (panel::NOT_RESIZABLE == panel_->CanResizeByMouse()) |
return nil; |
NSPoint pointInWindow = [[self superview] convertPoint:point toView:nil]; |
@@ -214,7 +224,7 @@ enum { |
- (void)mouseDown:(NSEvent*)event { |
// If the panel is not resizable, hitTest should have failed and no mouse |
// events should have came here. |
- DCHECK(panel_->CanResizeByMouse()); |
+ DCHECK_NE(panel::NOT_RESIZABLE, panel_->CanResizeByMouse()); |
[self prepareForDrag:event]; |
} |
@@ -365,7 +375,7 @@ enum { |
} |
- (void)resetCursorRects { |
- if(!panel_->CanResizeByMouse()) |
+ if(panel::NOT_RESIZABLE == panel_->CanResizeByMouse()) |
return; |
NSRect bounds = [self bounds]; |