Backed out changeset acc3d38ec70b (bug 1768360) for causing build bustages on nsWindow.cpp. CLOSED TREE
authorcriss <ccozmuta@mozilla.com>
Thu, 19 May 2022 15:25:48 +0300
changeset 618230 0ad35291cbf14d48e2b312e1dcd8a4bb12578a6b
parent 618229 acc3d38ec70b021f4869b043e0b7174a4dbf5429
child 618231 63c68776cca8ef7039db25782ecac1bdf2e24054
push id39719
push usersmolnar@mozilla.com
push dateThu, 19 May 2022 16:03:14 +0000
treeherdermozilla-central@cc776278c4ea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1768360
milestone102.0a1
backs outacc3d38ec70b021f4869b043e0b7174a4dbf5429
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 acc3d38ec70b (bug 1768360) for causing build bustages on nsWindow.cpp. CLOSED TREE
widget/gtk/nsWindow.cpp
widget/gtk/nsWindow.h
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -2103,17 +2103,17 @@ void nsWindow::NativeMoveResizeWaylandPo
     }
     return;
   }
 
   mNewBoundsAfterMoveToRect = LayoutDeviceIntRect(0, 0, 0, 0);
 
   bool trackedInHierarchy = WaylandPopupConfigure();
 
-  // Read popup position from layout if it was moved or newly created.
+  // Read popup position from layout if it was moved.
   // This position is used by move-to-rect method as we need anchor and other
   // info to place popup correctly.
   // We need WaylandPopupConfigure() to be called before to have all needed
   // popup info in place (mainly the anchored flag).
   if (aMove) {
     mPopupMoveToRectParams = WaylandPopupGetPositionFromLayout();
   }
 
@@ -2351,56 +2351,43 @@ nsWindow::WaylandPopupGetPositionFromLay
     }
   }
   if (!WaylandPopupIsMenu()) {
     // we don't want to slide menus to fit the screen rather resize them
     hints = GdkAnchorHints(hints | GDK_ANCHOR_SLIDE);
   }
 
   return {
-      anchorRect,
-      rectAnchor,
-      menuAnchor,
-      hints,
+      anchorRect, rectAnchor, menuAnchor, hints,
       DevicePixelsToGdkPointRoundDown(LayoutDevicePoint::FromAppUnitsToNearest(
           popupMargin.mPopupOffset,
-          popupFrame->PresContext()->AppUnitsPerDevPixel())),
-      true};
+          popupFrame->PresContext()->AppUnitsPerDevPixel()))};
 }
 
 void nsWindow::WaylandPopupMove() {
   LOG("nsWindow::WaylandPopupMove\n");
 
   // Available as of GTK 3.24+
   static auto sGdkWindowMoveToRect = (void (*)(
       GdkWindow*, const GdkRectangle*, GdkGravity, GdkGravity, GdkAnchorHints,
       gint, gint))dlsym(RTLD_DEFAULT, "gdk_window_move_to_rect");
 
+  GdkWindow* gdkWindow = gtk_widget_get_window(GTK_WIDGET(mShell));
+  nsMenuPopupFrame* popupFrame = GetMenuPopupFrame(GetFrame());
+
   LOG("  original widget popup position [%d, %d]\n", mPopupPosition.x,
       mPopupPosition.y);
   LOG("  relative widget popup position [%d, %d]\n", mRelativePopupPosition.x,
       mRelativePopupPosition.y);
 
-  if (mPopupUseMoveToRect && !sGdkWindowMoveToRect) {
-    LOG("  can't use move-to-rect due missing gdk_window_move_to_rect()");
-    mPopupUseMoveToRect = false;
-  }
-
-  GdkWindow* gdkWindow = gtk_widget_get_window(GTK_WIDGET(mShell));
-  nsMenuPopupFrame* popupFrame = GetMenuPopupFrame(GetFrame());
-  if (mPopupUseMoveToRect && !gdkWindow || !popupFrame) {
-    LOG("  can't use move-to-rect due missing gdkWindow or popupFrame");
-    mPopupUseMoveToRect = false;
-  }
-  if (mPopupUseMoveToRect && !mPopupMoveToRectParams.mAnchorSet) {
-    LOG("  can't use move-to-rect due missing anchor");
-    mPopupUseMoveToRect = false;
-  }
-
-  LOG("  popup use move to rect %d\n", mPopupUseMoveToRect);
+  if (mPopupUseMoveToRect) {
+    mPopupUseMoveToRect = sGdkWindowMoveToRect && gdkWindow && popupFrame;
+  }
+
+  LOG(" popup use move to rect %d\n", mPopupUseMoveToRect);
 
   if (!mPopupUseMoveToRect) {
     if (mNeedsShow && mPopupType != ePopupTypeTooltip) {
       // Workaround for https://gitlab.gnome.org/GNOME/gtk/-/issues/4308
       // Tooltips are created as subsurfaces with relative position.
       LOG("  use gtk_window_move(%d, %d) for hidden widget\n", mPopupPosition.x,
           mPopupPosition.y);
       gtk_window_move(GTK_WINDOW(mShell), mPopupPosition.x, mPopupPosition.y);
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -700,22 +700,21 @@ class nsWindow final : public nsBaseWidg
    */
   bool mWaitingForMoveToRectCallback : 1;
 
   // Params used for popup placemend by GdkWindowMoveToRect.
   // When popup is only resized and not positioned,
   // we need to reuse last GdkWindowMoveToRect params to avoid
   // popup movement.
   struct WaylandPopupMoveToRectParams {
-    LayoutDeviceIntRect mAnchorRect = {0, 0, 0, 0};
-    GdkGravity mAnchorRectType = GDK_GRAVITY_NORTH_WEST;
-    GdkGravity mPopupAnchorType = GDK_GRAVITY_NORTH_WEST;
-    GdkAnchorHints mHints = GDK_ANCHOR_SLIDE;
-    GdkPoint mOffset = {0, 0};
-    bool mAnchorSet = false;
+    LayoutDeviceIntRect mAnchorRect;
+    GdkGravity mAnchorRectType;
+    GdkGravity mPopupAnchorType;
+    GdkAnchorHints mHints;
+    GdkPoint mOffset;
   };
 
   WaylandPopupMoveToRectParams mPopupMoveToRectParams;
 
   // Whether we've configured default clear color already.
   bool mConfiguredClearColor : 1;
   // Whether we've received a non-blank paint in which case we can reset the
   // clear color to transparent.