Styling fixes

This commit is contained in:
Cheng Zhao 2017-09-14 14:43:22 +09:00
parent 0d69738bd6
commit 19a7c7ac39

View file

@ -1548,26 +1548,6 @@ void NativeWindowMac::SetBrowserView(NativeBrowserView* browser_view) {
native_view.hidden = NO; native_view.hidden = NO;
} }
void NativeWindowMac::InternalSetParentWindow(NativeWindow* parent, bool attach) {
if (is_modal())
return;
NativeWindow::SetParentWindow(parent);
// Do not remove/add if we are already properly attached.
if (attach && parent && [window_ parentWindow] == parent->GetNativeWindow())
return;
// Remove current parent window.
if ([window_ parentWindow])
[[window_ parentWindow] removeChildWindow:window_];
// Set new parent window.
// Note that this method will force the window to become visible.
if (parent && attach)
[parent->GetNativeWindow() addChildWindow:window_ ordered:NSWindowAbove];
}
void NativeWindowMac::SetParentWindow(NativeWindow* parent) { void NativeWindowMac::SetParentWindow(NativeWindow* parent) {
InternalSetParentWindow(parent, IsVisible()); InternalSetParentWindow(parent, IsVisible());
} }
@ -1576,7 +1556,7 @@ gfx::NativeView NativeWindowMac::GetNativeView() const {
return inspectable_web_contents()->GetView()->GetNativeView(); return inspectable_web_contents()->GetView()->GetNativeView();
} }
gfx::NativeWindow NativeWindowMac::GetNativeWindow() { gfx::NativeWindow NativeWindowMac::GetNativeWindow() const {
return window_; return window_;
} }
@ -1818,6 +1798,26 @@ void NativeWindowMac::UpdateDraggableRegions(
UpdateDraggableRegionViews(regions); UpdateDraggableRegionViews(regions);
} }
void NativeWindowMac::InternalSetParentWindow(NativeWindow* parent, bool attach) {
if (is_modal())
return;
NativeWindow::SetParentWindow(parent);
// Do not remove/add if we are already properly attached.
if (attach && parent && [window_ parentWindow] == parent->GetNativeWindow())
return;
// Remove current parent window.
if ([window_ parentWindow])
[[window_ parentWindow] removeChildWindow:window_];
// Set new parent window.
// Note that this method will force the window to become visible.
if (parent && attach)
[parent->GetNativeWindow() addChildWindow:window_ ordered:NSWindowAbove];
}
void NativeWindowMac::ShowWindowButton(NSWindowButton button) { void NativeWindowMac::ShowWindowButton(NSWindowButton button) {
auto view = [window_ standardWindowButton:button]; auto view = [window_ standardWindowButton:button];
[view.superview addSubview:view positioned:NSWindowAbove relativeTo:nil]; [view.superview addSubview:view positioned:NSWindowAbove relativeTo:nil];