mac: Correctly unload previous content view
This commit is contained in:
parent
56735d4ff5
commit
cfd8ea8eb0
1 changed files with 9 additions and 3 deletions
|
@ -986,9 +986,15 @@ NativeWindowMac::~NativeWindowMac() {
|
||||||
|
|
||||||
void NativeWindowMac::SetContentView(
|
void NativeWindowMac::SetContentView(
|
||||||
brightray::InspectableWebContents* web_contents) {
|
brightray::InspectableWebContents* web_contents) {
|
||||||
// TODO(zcbenz): Uninstall view first.
|
// We might have vibrantView added to the contentView.
|
||||||
// TODO(zcbenz): Handle vibrancy.
|
NSArray* subviews = [[window_ contentView] subviews];
|
||||||
// TODO(zcbenz): Handle draggable regions.
|
if ([subviews count] == ([window_ vibrantView] != nil ? 2 : 1)) {
|
||||||
|
// The vibrantView is always bellow the web view.
|
||||||
|
NSView* content_view = static_cast<NSView*>(
|
||||||
|
[subviews objectAtIndex:([subviews count] - 1)]);
|
||||||
|
[content_view removeFromSuperview];
|
||||||
|
}
|
||||||
|
|
||||||
NSView* view = web_contents->GetView()->GetNativeView();
|
NSView* view = web_contents->GetView()->GetNativeView();
|
||||||
[view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
[view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||||
InstallView(web_contents->GetView()->GetNativeView());
|
InstallView(web_contents->GetView()->GetNativeView());
|
||||||
|
|
Loading…
Reference in a new issue