b=821749 remove unnecessary mTransientParent r=roc
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 03 Jan 2013 09:44:19 +1300
changeset 126485 8ed517f540d197fc607cd704bed2d38c5ddab9ea
parent 126484 6a02044628381b1ff5c0ad1841922f21f7674f63
child 126486 54501cee764e7ef9675e872c1aa5c39bcded898f
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs821749
milestone20.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
b=821749 remove unnecessary mTransientParent r=roc
widget/gtk2/nsWindow.cpp
widget/gtk2/nsWindow.h
--- a/widget/gtk2/nsWindow.cpp
+++ b/widget/gtk2/nsWindow.cpp
@@ -355,17 +355,16 @@ nsWindow::nsWindow()
     mCreated          = false;
 
     mContainer           = nullptr;
     mGdkWindow           = nullptr;
     mShell               = nullptr;
     mHasMappedToplevel   = false;
     mIsFullyObscured     = false;
     mRetryPointerGrab    = false;
-    mTransientParent     = nullptr;
     mWindowType          = eWindowType_child;
     mSizeState           = nsSizeMode_Normal;
     mLastSizeMode        = nsSizeMode_Normal;
     mSizeConstraints.mMaxSize = GetSafeWindowSize(mSizeConstraints.mMaxSize);
 
 #ifdef MOZ_X11
     mOldFocusWindow      = 0;
 #endif /* MOZ_X11 */
@@ -762,18 +761,16 @@ nsWindow::GetDPI()
 NS_IMETHODIMP
 nsWindow::SetParent(nsIWidget *aNewParent)
 {
     if (mContainer || !mGdkWindow) {
         NS_NOTREACHED("nsWindow::SetParent called illegally");
         return NS_ERROR_NOT_IMPLEMENTED;
     }
 
-    NS_ASSERTION(!mTransientParent, "child widget with transient parent");
-
     nsCOMPtr<nsIWidget> kungFuDeathGrip = this;
     if (mParent) {
         mParent->RemoveChild(this);
     }
 
     mParent = aNewParent;
 
     GtkWidget* oldContainer = GetMozContainerWidget();
@@ -817,22 +814,22 @@ nsWindow::ReparentNativeWidget(nsIWidget
         return NS_OK;
     }
     NS_ABORT_IF_FALSE(!gdk_window_is_destroyed(mGdkWindow),
                       "destroyed GdkWindow with widget");
     
     nsWindow* newParent = static_cast<nsWindow*>(aNewParent);
     GdkWindow* newParentWindow = newParent->mGdkWindow;
     GtkWidget* newContainer = newParent->GetMozContainerWidget();
-
-    if (mTransientParent) {
+    GtkWindow* shell = GTK_WINDOW(mShell);
+
+    if (shell && gtk_window_get_transient_for(shell)) {
       GtkWindow* topLevelParent =
           GTK_WINDOW(gtk_widget_get_toplevel(newContainer));
-      gtk_window_set_transient_for(GTK_WINDOW(mShell), topLevelParent);
-      mTransientParent = topLevelParent;
+      gtk_window_set_transient_for(shell, topLevelParent);
     }
 
     ReparentNativeWidgetInternal(aNewParent, newContainer, newParentWindow,
                                  oldContainer);
     return NS_OK;
 }
 
 void
@@ -3424,17 +3421,16 @@ nsWindow::Create(nsIWidget        *aPare
             mShell = gtk_window_new(GTK_WINDOW_TOPLEVEL);
             SetDefaultIcon();
             gtk_window_set_wmclass(GTK_WINDOW(mShell), "Dialog", 
                                    gdk_get_program_class());
             gtk_window_set_type_hint(GTK_WINDOW(mShell),
                                      GDK_WINDOW_TYPE_HINT_DIALOG);
             gtk_window_set_transient_for(GTK_WINDOW(mShell),
                                          topLevelParent);
-            mTransientParent = topLevelParent;
         }
         else if (mWindowType == eWindowType_popup) {
             // With popup windows, we want to control their position, so don't
             // wait for the window manager to place them (which wouldn't
             // happen with override-redirect windows anyway).
             mNeedsMove = true;
 
             // Popups that are not noautohide are only temporary. The are used
@@ -3511,17 +3507,16 @@ nsWindow::Create(nsIWidget        *aPare
                         break;
                 }
             }
             gtk_window_set_type_hint(GTK_WINDOW(mShell), gtkTypeHint);
 
             if (topLevelParent) {
                 gtk_window_set_transient_for(GTK_WINDOW(mShell),
                                             topLevelParent);
-                mTransientParent = topLevelParent;
             }
         }
         else { // must be eWindowType_toplevel
             mShell = gtk_window_new(GTK_WINDOW_TOPLEVEL);
             SetDefaultIcon();
             gtk_window_set_wmclass(GTK_WINDOW(mShell), "Toplevel", 
                                    gdk_get_program_class());
 
--- a/widget/gtk2/nsWindow.h
+++ b/widget/gtk2/nsWindow.h
@@ -345,17 +345,16 @@ private:
 
     GtkWidget          *mShell;
     MozContainer       *mContainer;
     GdkWindow          *mGdkWindow;
 
     uint32_t            mHasMappedToplevel : 1,
                         mIsFullyObscured : 1,
                         mRetryPointerGrab : 1;
-    GtkWindow          *mTransientParent;
     nsSizeMode          mSizeState;
     PluginType          mPluginType;
 
     int32_t             mTransparencyBitmapWidth;
     int32_t             mTransparencyBitmapHeight;
 
 #ifdef MOZ_HAVE_SHMIMAGE
     // If we're using xshm rendering, mThebesSurface wraps mShmImage