Bug 1555866 - [Wayland] Don't position windows with zero height/width, r=jhorak
authorMartin Stransky <stransky@redhat.com>
Mon, 03 Jun 2019 14:27:29 +0000
changeset 476673 aa776e6ed29a4f6e18ba0a3b30279e5fd5a1df66
parent 476672 b871bf099557a2098a127bf6b50a97728ff33ae5
child 476674 4967a509cea08492c842f457b7a56084d26fc34d
push id86972
push userccoroiu@mozilla.com
push dateMon, 03 Jun 2019 18:12:27 +0000
treeherderautoland@aa776e6ed29a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhorak
bugs1555866
milestone69.0a1
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
Bug 1555866 - [Wayland] Don't position windows with zero height/width, r=jhorak Differential Revision: https://phabricator.services.mozilla.com/D33492
widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -1251,27 +1251,32 @@ static void NativeMoveResizeWaylandPopup
 
 void nsWindow::NativeMoveResizeWaylandPopup(GdkPoint* aPosition,
                                             GdkRectangle* aSize) {
   // 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");
 
+  // Compositor may be confused by windows with width/height = 0
+  // and positioning such windows leads to Bug 1555866.
+  if (!AreBoundsSane()) {
+    return;
+  }
+
   if (aSize) {
     gtk_window_resize(GTK_WINDOW(mShell), aSize->width, aSize->height);
   }
 
   GdkWindow* gdkWindow = gtk_widget_get_window(GTK_WIDGET(mShell));
 
   // Use standard gtk_window_move() instead of gdk_window_move_to_rect() when:
   // - gdk_window_move_to_rect() is not available
   // - the widget doesn't have a valid GdkWindow
-  // - the widget hasn't beed positioned yet
-  if (!sGdkWindowMoveToRect || !gdkWindow || !AreBoundsSane()) {
+  if (!sGdkWindowMoveToRect || !gdkWindow) {
     gtk_window_move(GTK_WINDOW(mShell), aPosition->x, aPosition->y);
     return;
   }
 
   GtkWidget* parentWindow = ConfigureWaylandPopupWindows();
   LOG(("nsWindow::NativeMoveResizeWaylandPopup [%p] Set popup parent %p\n",
        (void*)this, parentWindow));