Bug 1816139 - In HeadlessWidget for default focus, check WindowType::TopLevel instead of mTopLevel. r=karlt

webrtcLegacyIndicator is a parentless window of type Popup, but should not
receive focus by default.

Differential Revision: https://phabricator.services.mozilla.com/D169787
This commit is contained in:
Andreas Pehrson 2023-02-20 08:05:08 +00:00
Родитель 763e9a2df6
Коммит dea5671716
1 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -156,7 +156,8 @@ void HeadlessWidget::GetCompositorWidgetInitData(
nsIWidget* HeadlessWidget::GetTopLevelWidget() { return mTopLevel; }
void HeadlessWidget::RaiseWindow() {
MOZ_ASSERT(mTopLevel == this || mWindowType == WindowType::Dialog ||
MOZ_ASSERT(mWindowType == WindowType::TopLevel ||
mWindowType == WindowType::Dialog ||
mWindowType == WindowType::Sheet,
"Raising a non-toplevel window.");
@ -195,8 +196,9 @@ void HeadlessWidget::Show(bool aState) {
LOG(("HeadlessWidget::Show [%p] state %d\n", (void*)this, aState));
// Top-level window and dialogs are activated/raised when shown.
if (aState && (mTopLevel == this || mWindowType == WindowType::Dialog ||
mWindowType == WindowType::Sheet)) {
if (aState &&
(mWindowType == WindowType::TopLevel ||
mWindowType == WindowType::Dialog || mWindowType == WindowType::Sheet)) {
RaiseWindow();
}