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 NotifyWindowWillLeaveFullScreen();
|
||||
|
||||
// Ensure the buttons view are always floated on the top.
|
||||
void ReorderButtonsView();
|
||||
|
||||
// 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
|
||||
// cleanup in destructor.
|
||||
|
|
|
@ -460,11 +460,8 @@ void NativeWindowMac::SetContentView(views::View* view) {
|
|||
set_content_view(view);
|
||||
root_view->AddChildView(content_view());
|
||||
|
||||
if (buttons_view_) {
|
||||
// Ensure the buttons view are always floated on the top.
|
||||
[buttons_view_ removeFromSuperview];
|
||||
[[window_ contentView] addSubview:buttons_view_];
|
||||
}
|
||||
if (buttons_view_)
|
||||
ReorderButtonsView();
|
||||
|
||||
root_view->Layout();
|
||||
}
|
||||
|
@ -1150,6 +1147,8 @@ void NativeWindowMac::AddBrowserView(NativeBrowserView* view) {
|
|||
}
|
||||
|
||||
[CATransaction commit];
|
||||
|
||||
ReorderButtonsView();
|
||||
}
|
||||
|
||||
void NativeWindowMac::RemoveBrowserView(NativeBrowserView* view) {
|
||||
|
@ -1191,6 +1190,8 @@ void NativeWindowMac::SetTopBrowserView(NativeBrowserView* view) {
|
|||
}
|
||||
|
||||
[CATransaction commit];
|
||||
|
||||
ReorderButtonsView();
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetParentWindow(NativeWindow* parent) {
|
||||
|
@ -1653,6 +1654,13 @@ bool NativeWindowMac::IsActive() const {
|
|||
return is_active_;
|
||||
}
|
||||
|
||||
void NativeWindowMac::ReorderButtonsView() {
|
||||
if (buttons_view_) {
|
||||
[buttons_view_ removeFromSuperview];
|
||||
[[window_ contentView] addSubview:buttons_view_];
|
||||
}
|
||||
}
|
||||
|
||||
void NativeWindowMac::Cleanup() {
|
||||
DCHECK(!IsClosed());
|
||||
ui::NativeTheme::GetInstanceForNativeUi()->RemoveObserver(this);
|
||||
|
|
Loading…
Reference in a new issue