|
|
b686f27 |
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|
|
b686f27 |
--- a/widget/gtk/nsWindow.cpp
|
|
|
b686f27 |
+++ b/widget/gtk/nsWindow.cpp
|
|
|
b686f27 |
@@ -1155,6 +1155,28 @@
|
|
|
b686f27 |
}
|
|
|
b686f27 |
}
|
|
|
b686f27 |
|
|
|
b686f27 |
+bool IsPopupWithoutToplevelParent(nsMenuPopupFrame* aMenuPopupFrame) {
|
|
|
b686f27 |
+ // Check if the popup is autocomplete (like tags autocomplete
|
|
|
b686f27 |
+ // in the bookmark edit popup).
|
|
|
b686f27 |
+ nsAtom* popupId = aMenuPopupFrame->GetContent()->GetID();
|
|
|
b686f27 |
+ if (popupId && popupId->Equals(NS_LITERAL_STRING("PopupAutoComplete"))) {
|
|
|
b686f27 |
+ return true;
|
|
|
b686f27 |
+ }
|
|
|
b686f27 |
+
|
|
|
b686f27 |
+ // Check if the popup is in popupnotificationcontent (like choosing capture
|
|
|
b686f27 |
+ // device when starting webrtc session).
|
|
|
b686f27 |
+ nsIFrame* parentFrame = aMenuPopupFrame->GetParent();
|
|
|
b686f27 |
+ if (!parentFrame) {
|
|
|
b686f27 |
+ return false;
|
|
|
b686f27 |
+ }
|
|
|
b686f27 |
+ parentFrame = parentFrame->GetParent();
|
|
|
b686f27 |
+ if (parentFrame && parentFrame->GetContent()->NodeName().EqualsLiteral(
|
|
|
b686f27 |
+ "popupnotificationcontent")) {
|
|
|
b686f27 |
+ return true;
|
|
|
b686f27 |
+ }
|
|
|
b686f27 |
+ return false;
|
|
|
b686f27 |
+}
|
|
|
b686f27 |
+
|
|
|
b686f27 |
// Wayland keeps strong popup window hierarchy. We need to track active
|
|
|
b686f27 |
// (visible) popup windows and make sure we hide popup on the same level
|
|
|
b686f27 |
// before we open another one on that level. It means that every open
|
|
|
b686f27 |
@@ -1211,10 +1233,14 @@
|
|
|
b686f27 |
LOG(("...[%p] GetParentMenuWidget() = %p\n", (void*)this, parentWindow));
|
|
|
b686f27 |
|
|
|
b686f27 |
// If the popup is a regular menu but GetParentMenuWidget() returns
|
|
|
b686f27 |
- // nullptr which means it's connected non-menu parent
|
|
|
b686f27 |
- // (bookmark toolbar for instance).
|
|
|
b686f27 |
+ // nullptr which means is not a submenu of any other menu.
|
|
|
b686f27 |
// In this case use a parent given at nsWindow::Create().
|
|
|
b686f27 |
- if (!parentWindow && !menuPopupFrame->IsContextMenu()) {
|
|
|
b686f27 |
+ // But we have to avoid using mToplevelParentWindow in case the popup
|
|
|
b686f27 |
+ // is in 'popupnotificationcontent' element or autocomplete popup,
|
|
|
b686f27 |
+ // otherwise the popupnotification would disappear when for
|
|
|
b686f27 |
+ // example opening a popup with microphone selection.
|
|
|
b686f27 |
+ if (!parentWindow && !menuPopupFrame->IsContextMenu() &&
|
|
|
b686f27 |
+ !IsPopupWithoutToplevelParent(menuPopupFrame)) {
|
|
|
b686f27 |
parentWindow =
|
|
|
b686f27 |
get_window_for_gtk_widget(GTK_WIDGET(mToplevelParentWindow));
|
|
|
b686f27 |
}
|
|
|
b686f27 |
|