fix: ensure custom traffic lights float to top (#29595)
* fix: ensure custom traffic lights float to top * chore: split into separate function
This commit is contained in:
parent
73266f8f3d
commit
63cc82d91d
2 changed files with 16 additions and 5 deletions
|
@ -154,6 +154,9 @@ class NativeWindowMac : public NativeWindow,
|
||||||
void NotifyWindowWillEnterFullScreen();
|
void NotifyWindowWillEnterFullScreen();
|
||||||
void NotifyWindowWillLeaveFullScreen();
|
void NotifyWindowWillLeaveFullScreen();
|
||||||
|
|
||||||
|
// Ensure the buttons view are always floated on the top.
|
||||||
|
void ReorderButtonsView();
|
||||||
|
|
||||||
// Cleanup observers when window is getting closed. Note that the destructor
|
// Cleanup observers when window is getting closed. Note that the destructor
|
||||||
// can be called much later after window gets closed, so we should not do
|
// can be called much later after window gets closed, so we should not do
|
||||||
// cleanup in destructor.
|
// cleanup in destructor.
|
||||||
|
|
|
@ -460,11 +460,8 @@ void NativeWindowMac::SetContentView(views::View* view) {
|
||||||
set_content_view(view);
|
set_content_view(view);
|
||||||
root_view->AddChildView(content_view());
|
root_view->AddChildView(content_view());
|
||||||
|
|
||||||
if (buttons_view_) {
|
if (buttons_view_)
|
||||||
// Ensure the buttons view are always floated on the top.
|
ReorderButtonsView();
|
||||||
[buttons_view_ removeFromSuperview];
|
|
||||||
[[window_ contentView] addSubview:buttons_view_];
|
|
||||||
}
|
|
||||||
|
|
||||||
root_view->Layout();
|
root_view->Layout();
|
||||||
}
|
}
|
||||||
|
@ -1150,6 +1147,8 @@ void NativeWindowMac::AddBrowserView(NativeBrowserView* view) {
|
||||||
}
|
}
|
||||||
|
|
||||||
[CATransaction commit];
|
[CATransaction commit];
|
||||||
|
|
||||||
|
ReorderButtonsView();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::RemoveBrowserView(NativeBrowserView* view) {
|
void NativeWindowMac::RemoveBrowserView(NativeBrowserView* view) {
|
||||||
|
@ -1191,6 +1190,8 @@ void NativeWindowMac::SetTopBrowserView(NativeBrowserView* view) {
|
||||||
}
|
}
|
||||||
|
|
||||||
[CATransaction commit];
|
[CATransaction commit];
|
||||||
|
|
||||||
|
ReorderButtonsView();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::SetParentWindow(NativeWindow* parent) {
|
void NativeWindowMac::SetParentWindow(NativeWindow* parent) {
|
||||||
|
@ -1653,6 +1654,13 @@ bool NativeWindowMac::IsActive() const {
|
||||||
return is_active_;
|
return is_active_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NativeWindowMac::ReorderButtonsView() {
|
||||||
|
if (buttons_view_) {
|
||||||
|
[buttons_view_ removeFromSuperview];
|
||||||
|
[[window_ contentView] addSubview:buttons_view_];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void NativeWindowMac::Cleanup() {
|
void NativeWindowMac::Cleanup() {
|
||||||
DCHECK(!IsClosed());
|
DCHECK(!IsClosed());
|
||||||
ui::NativeTheme::GetInstanceForNativeUi()->RemoveObserver(this);
|
ui::NativeTheme::GetInstanceForNativeUi()->RemoveObserver(this);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue