| Index: chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.mm
|
| ===================================================================
|
| --- chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.mm (revision 217358)
|
| +++ chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.mm (working copy)
|
| @@ -803,17 +803,32 @@
|
| }
|
|
|
| - (void)windowDidResize:(NSNotification*)notification {
|
| - // Hide the web contents view when the panel is not taller than the titlebar.
|
| - // This is to ensure that the titlebar view is not overlapped with the web
|
| - // contents view because the the web contents view assumes that its
|
| - // view will never be overlapped by another view in order to perform
|
| - // optimization. If we do not do this, some part of the web contents view
|
| - // will become visible and overlapp the bottom area of the titlebar.
|
| - if (WebContents* contents = windowShim_->panel()->GetWebContents()) {
|
| - BOOL hideContents =
|
| - NSHeight([self contentRectForFrameRect:[[self window] frame]]) <=
|
| - panel::kTitlebarHeight;
|
| - [contents->GetView()->GetNativeView() setHidden:hideContents];
|
| + // Remove the web contents view from the view hierarchy when the panel is not
|
| + // taller than the titlebar. Put it back when the panel grows taller than
|
| + // the titlebar. Note that RenderWidgetHostViewMac works for the case that
|
| + // the web contents view does not exist in the view hierarchy (i.e. the tab
|
| + // is not the main one), but it does not work well, like causing occasional
|
| + // crashes (http://crbug.com/265932), if the web contents view is made hidden.
|
| + //
|
| + // The reason for doing this is to ensure that our titlebar view, that is
|
| + // somewhat taller than the standard titlebar, does not overlap with the web
|
| + // contents view because the the web contents view assumes that its view will
|
| + // never overlap with another view in order to paint the web contents view
|
| + // directly. If we do not do this, some part of the web contents view will
|
| + // become visible and overlap the bottom area of the titlebar.
|
| + content::WebContents* webContents = windowShim_->panel()->GetWebContents();
|
| + if (!webContents)
|
| + return;
|
| + NSView* contentView = webContents->GetView()->GetNativeView();
|
| + if (NSHeight([self contentRectForFrameRect:[[self window] frame]]) <=
|
| + panel::kTitlebarHeight) {
|
| + // No need to retain the view before it is removed from its superview
|
| + // because WebContentsView keeps a reference to this view.
|
| + if ([contentView superview])
|
| + [contentView removeFromSuperview];
|
| + } else {
|
| + if (![contentView superview])
|
| + [[[self window] contentView] addSubview:contentView];
|
| }
|
| }
|
|
|
|
|