Backed out changeset 19b9fd7a11d0 (bug 1585918) for bustage on nsWindow.cpp. CLOSED TREE
authorCsoregi Natalia <ncsoregi@mozilla.com>
Thu, 21 Nov 2019 13:02:52 +0200
changeset 503188 3cff7e1381665a48bff6c01dd0a924a0c6c96462
parent 503187 ec9f0ea75f0a306ef0edf608fd4ed15c9c702a82
child 503189 68a387538d047141a1d993e9c4e5861932f29799
push id101176
push userncsoregi@mozilla.com
push dateThu, 21 Nov 2019 11:03:41 +0000
treeherderautoland@3cff7e138166 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1585918
milestone72.0a1
backs out19b9fd7a11d07d3d28a7acf46b8a7f23d6dd44b9
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 19b9fd7a11d0 (bug 1585918) for bustage on nsWindow.cpp. CLOSED TREE
widget/gtk/nsWindow.cpp
widget/gtk/nsWindow.h
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -1160,24 +1160,16 @@ void nsWindow::HideWaylandTooltips() {
         static_cast<nsWindow*>(gVisibleWaylandPopupWindows->data);
     if (window->mPopupType != ePopupTypeTooltip) break;
     LOG(("nsWindow::HideWaylandTooltips [%p] hidding tooltip [%p].\n",
          (void*)this, window));
     window->HideWaylandWindow();
   }
 }
 
-void nsWindow::HideWaylandOpenedPopups() {
-  while (gVisibleWaylandPopupWindows) {
-    nsWindow* window =
-        static_cast<nsWindow*>(gVisibleWaylandPopupWindows->data);
-    window->HideWaylandWindow();
-  }
-}
-
 // Hide popup nsWindows which are no longer in the nsXULPopupManager widget
 // chain list.
 void nsWindow::CleanupWaylandPopups() {
   LOG(("nsWindow::CleanupWaylandPopups...\n"));
   nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
   AutoTArray<nsIWidget*, 5> widgetChain;
   pm->GetSubmenuWidgetChain(&widgetChain);
   GList* popupList = gVisibleWaylandPopupWindows;
@@ -1221,20 +1213,17 @@ bool nsWindow::IsMainMenuWindow() {
 }
 
 // Wayland keeps strong popup window hierarchy. We need to track active
 // (visible) popup windows and make sure we hide popup on the same level
 // before we open another one on that level. It means that every open
 // popup needs to have an unique parent.
 GtkWidget* nsWindow::ConfigureWaylandPopupWindows() {
   MOZ_ASSERT(this->mWindowType == eWindowType_popup);
-  LOG(
-      ("nsWindow::ConfigureWaylandPopupWindows [%p], frame %p hasRemoteContent "
-       "%d\n",
-       (void*)this, this->GetFrame(), this->HasRemoteContent()));
+  LOG(("nsWindow::ConfigureWaylandPopupWindows [%p]\n", (void*)this));
 #if DEBUG
   if (this->GetFrame() && this->GetFrame()->GetContent()->GetID()) {
     nsCString nodeId;
     this->GetFrame()->GetContent()->GetID()->ToUTF8String(nodeId);
     LOG(("  [%p] popup node id=%s\n", this, nodeId.get()));
   }
 #endif
 
@@ -1251,58 +1240,35 @@ GtkWidget* nsWindow::ConfigureWaylandPop
 
   GtkWindow* parentGtkWindow = nullptr;
 
   if (IsMainMenuWindow()) {
     // Remove and hide already closed popups from the
     // gVisibleWaylandPopupWindows which were not yet been hidden.
     CleanupWaylandPopups();
     // Since the popups are shown by unknown order it can happen that child
-    // popup is shown before parent popup.
+    // popup is shown before parent popup. The
     // We look for the current window parent in nsXULPopupManager since it
     // always has correct popup hierarchy while gVisibleWaylandPopupWindows may
     // not.
     nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
     AutoTArray<nsIWidget*, 5> widgetChain;
     pm->GetSubmenuWidgetChain(&widgetChain);
-    for (unsigned long i = 0; i < widgetChain.Length() - 1; i++) {
+    for (unsigned long i = 0; i < widgetChain.Length(); i++) {
       unsigned long parentIndex = i + 1;
       if (widgetChain.Length() > parentIndex && widgetChain[i] == this) {
         nsWindow* parentWindow =
             static_cast<nsWindow*>(widgetChain[parentIndex]);
         parentGtkWindow = GTK_WINDOW(parentWindow->GetGtkWidget());
         LOG(("  [%p] Found %p as parent in nsXULPopupManager.", this,
              parentWindow));
         break;
       }
     }
   } else {
-    // Panels usually ends there
-    if (gVisibleWaylandPopupWindows && HasRemoteContent()) {
-      // If the new panel is remote content, we need to close all other popups
-      // before to keep the correct hierarchy because the remote content popup
-      // can replace the overflow-widget panel.
-      HideWaylandOpenedPopups();
-    } else if (gVisibleWaylandPopupWindows) {
-      // If there is any remote content panel currently opened, close all
-      // opened popups to keep the correct hierarchy.
-      GList* popupList = gVisibleWaylandPopupWindows;
-      while (popupList) {
-        nsWindow* waylandWnd = static_cast<nsWindow*>(popupList->data);
-        LOG(("  Checking [%p] IsRemoteContent %d\n", popupList->data,
-             waylandWnd->IsRemoteContent()));
-        if (waylandWnd->IsRemoteContent()) {
-          // close all popups including remote content before showing our panel
-          // Most likely returning from addon panel to overflow-widget.
-          HideWaylandOpenedPopups();
-          break;
-        }
-        popupList = popupList->next;
-      }
-    }
     // For popups in panels use the last opened popup window as parent,
     // panels are not stored in nsXULPopupManager.
     if (gVisibleWaylandPopupWindows) {
       nsWindow* parentWindow =
           static_cast<nsWindow*>(gVisibleWaylandPopupWindows->data);
       parentGtkWindow = GTK_WINDOW(parentWindow->GetGtkWidget());
     }
   }
@@ -1319,17 +1285,17 @@ GtkWidget* nsWindow::ConfigureWaylandPop
   // Add current window to the visible popup list
   gVisibleWaylandPopupWindows =
       g_list_prepend(gVisibleWaylandPopupWindows, this);
 
   LOG(("  Parent window for %p: %p [GtkWindow]", this, parentGtkWindow));
   return GTK_WIDGET(parentGtkWindow);
 }
 
-#ifdef MOZ_LOGGING
+#ifdef DEBUG
 static void NativeMoveResizeWaylandPopupCallback(
     GdkWindow* window, const GdkRectangle* flipped_rect,
     const GdkRectangle* final_rect, gboolean flipped_x, gboolean flipped_y,
     void* aWindow) {
   LOG(("NativeMoveResizeWaylandPopupCallback [%p] flipped_x %d flipped_y %d\n",
        aWindow, flipped_x, flipped_y));
 
   LOG(("  flipped_rect x: %d y: %d width: %d height: %d\n", flipped_rect->x,
@@ -4398,17 +4364,16 @@ void nsWindow::NativeMoveResize() {
   if (mNeedsShow && mIsShown) {
     NativeShow(true);
   }
 }
 
 void nsWindow::HideWaylandWindow() {
 #ifdef MOZ_WAYLAND
   if (mWindowType == eWindowType_popup) {
-    LOG(("nsWindow::HideWaylandWindow: popup [%p]\n", this));
     GList* foundWindow = g_list_find(gVisibleWaylandPopupWindows, this);
     if (foundWindow) {
       gVisibleWaylandPopupWindows =
           g_list_delete_link(gVisibleWaylandPopupWindows, foundWindow);
     }
   }
   if (mContainer && moz_container_has_wl_egl_window(mContainer)) {
     // Because wl_egl_window is destroyed on moz_container_unmap(),
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -396,18 +396,16 @@ class nsWindow final : public nsBaseWidg
   static CSDSupportLevel GetSystemCSDSupportLevel();
 
   static bool HideTitlebarByDefault();
   static bool GetTopLevelWindowActiveState(nsIFrame* aFrame);
   static bool TitlebarCanUseShapeMask();
 #ifdef MOZ_WAYLAND
   virtual nsresult GetScreenRect(LayoutDeviceIntRect* aRect) override;
 #endif
-  bool IsRemoteContent() { return HasRemoteContent(); }
-  static void HideWaylandOpenedPopups();
 
  protected:
   virtual ~nsWindow();
 
   // event handling code
   void DispatchActivateEvent(void);
   void DispatchDeactivateEvent(void);
   void DispatchResized();