fix: correctly emit BrowserWindow alwaysOnTop status in change event (#19463)

* fix: correctly emit alwaysOnTop in change event

* add a test for emitted alwaysOnTop value
This commit is contained in:
Shelley Vohr 2019-07-26 15:53:31 -07:00 committed by GitHub
parent 4d23b9e031
commit 504407c5df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 11 deletions

View file

@ -756,9 +756,7 @@ void NativeWindowViews::SetAlwaysOnTop(ui::ZOrderLevel z_order,
const std::string& level,
int relativeLevel,
std::string* error) {
if (z_order != widget()->GetZOrderLevel())
NativeWindow::NotifyWindowAlwaysOnTopChanged();
bool level_changed = z_order != widget()->GetZOrderLevel();
widget()->SetZOrderLevel(z_order);
#if defined(OS_WIN)
@ -773,6 +771,11 @@ void NativeWindowViews::SetAlwaysOnTop(ui::ZOrderLevel z_order,
}
#endif
MoveBehindTaskBarIfNeeded();
// This must be notified at the very end or IsAlwaysOnTop
// will not yet have been updated to reflect the new status
if (level_changed)
NativeWindow::NotifyWindowAlwaysOnTopChanged();
}
ui::ZOrderLevel NativeWindowViews::GetZOrderLevel() {