Commit 800a927e authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

RemoteMacViews: Make fullscreen mode not crash

Fix a few places where we would dereference a BridgedNativeWidgetImpl
which is null when out-of-process. This doesn't guarantee correct
behavior, but avoids a crash.

Make WebContentsNSViewBridge::Show resize the web contents view and
also all of its children.

Bug: 859152
Change-Id: I948de1e4f79db4a51c5b86e7960356133eff4342
Reviewed-on: https://chromium-review.googlesource.com/c/1278533Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599119}
parent d64bfc8e
......@@ -28,15 +28,18 @@
- (BOOL)isFullscreenTransitionInProgress {
views::BridgedNativeWidgetImpl* bridge_widget =
views::BridgedNativeWidgetImpl::GetFromNativeWindow([self window]);
return bridge_widget->in_fullscreen_transition();
if (bridge_widget)
return bridge_widget->in_fullscreen_transition();
return NO;
}
- (NSWindow*)window {
NSWindow* ns_window = browserView_->GetNativeWindow();
if (!ns_view_) {
ns_view_.reset(
[views::BridgedNativeWidgetImpl::GetFromNativeWindow(ns_window)
->ns_view() retain]);
views::BridgedNativeWidgetImpl* bridge_widget =
views::BridgedNativeWidgetImpl::GetFromNativeWindow(ns_window);
if (bridge_widget)
ns_view_.reset([bridge_widget->ns_view() retain]);
}
return ns_window;
}
......
......@@ -50,6 +50,10 @@ void WebContentsNSViewBridge::Show(const gfx::Rect& bounds_in_window) {
NSRect ns_bounds_in_superview =
[[cocoa_view_ superview] convertRect:ns_bounds_in_window fromView:nil];
[cocoa_view_ setFrame:ns_bounds_in_superview];
// Ensure that the child RenderWidgetHostViews have the same frame as the
// WebContentsView.
for (NSView* child in [cocoa_view_ subviews])
[child setFrame:[cocoa_view_ bounds]];
[cocoa_view_ setHidden:NO];
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment