summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/browser_window_controller.mm
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/cocoa/browser_window_controller.mm')
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm39
1 files changed, 21 insertions, 18 deletions
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index 7c3eecb..2d3f258 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -1352,24 +1352,27 @@
NSWindow* window = [self window];
if ([window respondsToSelector:@selector(_growBoxRect)]) {
NSView* view = [source view];
- NSRect windowGrowBoxRect = [window _growBoxRect];
- NSRect viewRect = [[view superview] convertRect:frameRect toView:nil];
- NSRect growBoxRect = NSIntersectionRect(windowGrowBoxRect, viewRect);
- if (!NSIsEmptyRect(growBoxRect)) {
- // Before we return a rect, we need to convert it from window coordinates
- // to content area coordinates and flip the coordinate system.
- // Superview is used here because, first, it's a frame rect, so it is
- // specified in the parent's coordinates and, second, view is not
- // positioned yet.
- growBoxRect = [[view superview] convertRect:growBoxRect fromView:nil];
- growBoxRect.origin.y =
- NSHeight(frameRect) - NSHeight(growBoxRect);
- growBoxRect =
- NSOffsetRect(growBoxRect, -frameRect.origin.x, -frameRect.origin.y);
-
- reserved_rect =
- gfx::Rect(growBoxRect.origin.x, growBoxRect.origin.y,
- growBoxRect.size.width, growBoxRect.size.height);
+ if (view && [view superview]) {
+ NSRect windowGrowBoxRect = [window _growBoxRect];
+ NSRect viewRect = [[view superview] convertRect:frameRect toView:nil];
+ NSRect growBoxRect = NSIntersectionRect(windowGrowBoxRect, viewRect);
+ if (!NSIsEmptyRect(growBoxRect)) {
+ // Before we return a rect, we need to convert it from window
+ // coordinates to content area coordinates and flip the coordinate
+ // system.
+ // Superview is used here because, first, it's a frame rect, so it is
+ // specified in the parent's coordinates and, second, view is not
+ // positioned yet.
+ growBoxRect = [[view superview] convertRect:growBoxRect fromView:nil];
+ growBoxRect.origin.y =
+ NSHeight(frameRect) - NSHeight(growBoxRect);
+ growBoxRect =
+ NSOffsetRect(growBoxRect, -frameRect.origin.x, -frameRect.origin.y);
+
+ reserved_rect =
+ gfx::Rect(growBoxRect.origin.x, growBoxRect.origin.y,
+ growBoxRect.size.width, growBoxRect.size.height);
+ }
}
}