Bug 582057, part k: Gut platform widgets from content processes. sr=bsmedberg
authorChris Jones <jones.chris.g@gmail.com>
Fri, 20 Aug 2010 18:24:40 -0500
changeset 54008 daeab9b5b99bbc50099ae3a66b87bd339db48940
parent 54007 314680412c410a310691a0e5c60a0b0d5aaf7f41
child 54009 a13fca21e6a8f6eebb9ec249da0e1c5cb4c7d5c9
push id15768
push userdougt@mozilla.com
push dateThu, 16 Sep 2010 01:40:23 +0000
treeherdermozilla-central@cdb90b48f19f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs582057
milestone2.0b5pre
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 582057, part k: Gut platform widgets from content processes. sr=bsmedberg
content/base/src/Makefile.in
content/base/src/nsFrameLoader.cpp
content/base/src/nsFrameLoader.h
dom/ipc/ContentChild.cpp
dom/ipc/Makefile.in
dom/ipc/PBrowser.ipdl
dom/ipc/PContent.ipdl
dom/ipc/PContentDialog.ipdl
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
dom/ipc/TabTypes.h
--- a/content/base/src/Makefile.in
+++ b/content/base/src/Makefile.in
@@ -186,11 +186,9 @@ INCLUDES	+= \
 		-I$(srcdir)/../../../dom/base \
 		-I$(srcdir)/../../xml/document/src \
 		-I$(topsrcdir)/xpcom/io \
 		-I$(topsrcdir)/dom/ipc \
 		-I$(topsrcdir)/js/src/xpconnect/src \
 		-I$(topsrcdir)/caps/include \
 		$(NULL)
 
-CXXFLAGS += $(TK_CFLAGS)
-
 DEFINES += -D_IMPL_NS_LAYOUT
--- a/content/base/src/nsFrameLoader.cpp
+++ b/content/base/src/nsFrameLoader.cpp
@@ -39,22 +39,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 /*
  * Class for managing loading of a subframe (creation of the docshell,
  * handling of loads in it, recursion-checking).
  */
 
-#ifdef MOZ_WIDGET_QT
-#include <QtGui/QX11EmbedWidget>
-#include <QGraphicsWidget>
-#include <QGraphicsProxyWidget>
-#endif
-
 #ifdef MOZ_IPC
 #  include "base/basictypes.h"
 #endif
 
 #include "prenv.h"
 
 #include "nsIDOMHTMLIFrameElement.h"
 #include "nsIDOMHTMLFrameElement.h"
@@ -109,23 +103,16 @@
 #include "nsIContentViewer.h"
 #include "nsIView.h"
 
 #include "nsIDOMChromeWindow.h"
 #include "nsInProcessTabChildGlobal.h"
 #include "mozilla/AutoRestore.h"
 #include "mozilla/unused.h"
 
-#ifdef MOZ_WIDGET_GTK2
-#include "mozcontainer.h"
-
-#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
-#endif
-
 #ifdef MOZ_IPC
 #include "ContentParent.h"
 #include "TabParent.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 #endif
 
@@ -301,17 +288,17 @@ nsFrameLoader::ReallyStartLoadingInterna
   nsresult rv = MaybeCreateDocShell();
   if (NS_FAILED(rv)) {
     return rv;
   }
 
 #ifdef MOZ_IPC
   if (mRemoteFrame) {
     if (!mRemoteBrowser) {
-      TryNewProcess();
+      TryRemoteBrowser();
     }
 
     if (!mRemoteBrowser) {
       NS_WARNING("Couldn't create child process for iframe.");
       return NS_ERROR_FAILURE;
     }
 
     // FIXME get error codes from child
@@ -428,17 +415,17 @@ nsFrameLoader::GetDocShell(nsIDocShell *
 NS_IMETHODIMP
 nsFrameLoader::GetWebProgress(nsIWebProgress **aWebProgress)
 {
   nsresult rv;
   *aWebProgress = nsnull;
 #ifdef MOZ_IPC
   if (mRemoteFrame) {
     if (!mRemoteBrowser) {
-      TryNewProcess();
+      TryRemoteBrowser();
     }
     if (!mRemoteBrowser) {
       return NS_ERROR_UNEXPECTED;
     }
     *aWebProgress = mRemoteBrowser;
     NS_ADDREF(*aWebProgress);
     return NS_OK;
   }
@@ -704,17 +691,17 @@ nsFrameLoader::Show(PRInt32 marginWidth,
   }
 
   nsIView* view = frame->CreateViewAndWidget(contentType);
   if (!view)
     return PR_FALSE;
 
 #ifdef MOZ_IPC
   if (mRemoteFrame) {
-    return ShowRemoteFrame(frame, view);
+    return ShowRemoteFrame(GetSubDocumentSize(frame->GetFrame()));
   }
 #endif
 
   nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(mDocShell);
   NS_ASSERTION(baseWindow, "Found a nsIDocShell that isn't a nsIBaseWindow.");
   baseWindow->InitWindow(nsnull, view->GetWidget(), 0, 0, 10, 10);
   // This is kinda whacky, this "Create()" call doesn't really
   // create anything, one starts to wonder why this was named
@@ -749,101 +736,32 @@ nsFrameLoader::Show(PRInt32 marginWidth,
     Hide();
     return PR_FALSE;
   }
   return PR_TRUE;
 }
 
 #ifdef MOZ_IPC
 bool
-nsFrameLoader::ShowRemoteFrame(nsIFrameFrame* frame, nsIView* view)
+nsFrameLoader::ShowRemoteFrame(const nsIntSize& size)
 {
   NS_ASSERTION(mRemoteFrame, "ShowRemote only makes sense on remote frames.");
 
   if (!mRemoteBrowser) {
-    TryNewProcess();
+    TryRemoteBrowser();
   }
 
   if (!mRemoteBrowser) {
     NS_ERROR("Couldn't create child process.");
     return false;
   }
 
-  nsIWidget* w = view->GetWidget();
-  if (!w) {
-    NS_ERROR("Our view doesn't have a widget. Totally stuffed!");
-    return false;
-  }
-
-  nsIntSize size = GetSubDocumentSize(frame->GetFrame());
-
-#ifdef XP_WIN
-  HWND parentwin =
-    static_cast<HWND>(w->GetNativeData(NS_NATIVE_WINDOW));
-
-  if (!mRemoteBrowser->SendCreateWidget(parentwin))
-    return false;
-#elif defined(MOZ_WIDGET_GTK2)
-  GdkWindow* parent_win =
-    static_cast<GdkWindow*>(w->GetNativeData(NS_NATIVE_WINDOW));
-
-  gpointer user_data = nsnull;
-  gdk_window_get_user_data(parent_win, &user_data);
-
-  MozContainer* parentMozContainer = MOZ_CONTAINER(user_data);
-  GtkContainer* container = GTK_CONTAINER(parentMozContainer);
-
-  // create the socket for the child and add it to our view's widget
-  mRemoteSocket = gtk_socket_new();
-  gtk_widget_set_parent_window(mRemoteSocket, parent_win);
-  gtk_container_add(container, mRemoteSocket);
-  gtk_widget_realize(mRemoteSocket);
-
-  // set the child window's size and position
-  GtkAllocation alloc = { 0, 0, size.width, size.height };
-  gtk_widget_size_allocate(mRemoteSocket, &alloc);
+  mRemoteBrowser->Show(size);
+  mRemoteBrowserShown = PR_TRUE;
 
-  gtk_widget_show(mRemoteSocket);
-  GdkNativeWindow id = gtk_socket_get_id(GTK_SOCKET(mRemoteSocket));
-  if (!mRemoteBrowser->SendCreateWidget(id))
-    return false;
-
-#elif defined(MOZ_WIDGET_QT)
-  if (getenv("USE_XEMBED_PROXY")) {
-    // Very bad idea to use Xembedding for IPC, but test-ipc.xul still rendering with XEmbed
-    QGraphicsWidget *widget = static_cast<QGraphicsWidget*>(w->GetNativeData(NS_NATIVE_WINDOW));
-    NS_ENSURE_TRUE(widget, false);
-    QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(widget);
-    NS_ENSURE_TRUE(proxy, false);
-    mRemoteSocket = new QX11EmbedContainer();
-    NS_ENSURE_TRUE(mRemoteSocket, false);
-    proxy->setWidget(mRemoteSocket);
-    mRemoteSocket->show();
-    mRemoteSocket->resize(size.width, size.height);
-    if (!mRemoteBrowser->SendCreateWidget(0))
-      return false;
-  } else {
-    // Don't create any parent/child XEmbed, because we are painting with shared memory
-    if (!mRemoteBrowser->SendCreateWidget(0))
-      return false;
-  }
-#elif defined(ANDROID)
-  // Painting with shared memory
-
-  if (!mRemoteBrowser->SendCreateWidget(0))
-    return false;
-#elif defined(XP_MACOSX)
-#  warning IMPLEMENT ME
-
-#else
-#error TODO for this platform
-#endif
-
-  mRemoteBrowser->Move(0, 0, size.width, size.height);
-  mRemoteWidgetCreated = PR_TRUE;
   nsCOMPtr<nsIChromeFrameMessageManager> dummy;
   GetMessageManager(getter_AddRefs(dummy)); // Initialize message manager.
 
   return true;
 }
 #endif
 
 void
@@ -1562,28 +1480,17 @@ nsFrameLoader::CheckForRecursiveLoad(nsI
 
 NS_IMETHODIMP
 nsFrameLoader::UpdatePositionAndSize(nsIFrame *aIFrame)
 {
 #ifdef MOZ_IPC
   if (mRemoteFrame) {
     if (mRemoteBrowser) {
       nsIntSize size = GetSubDocumentSize(aIFrame);
-
-#ifdef MOZ_WIDGET_GTK2
-      if (mRemoteSocket) {
-        GtkAllocation alloc = {0, 0, size.width, size.height };
-        gtk_widget_size_allocate(mRemoteSocket, &alloc);
-      }
-#elif defined(MOZ_WIDGET_QT)
-      if (mRemoteSocket)
-        mRemoteSocket->resize(size.width, size.height);
-#endif
-
-      mRemoteBrowser->Move(0, 0, size.width, size.height);
+      mRemoteBrowser->Move(size);
     }
     return NS_OK;
   }
 #endif
   return UpdateBaseWindowPositionAndSize(aIFrame);
 }
 
 nsresult
@@ -1628,19 +1535,19 @@ nsFrameLoader::GetSubDocumentSize(const 
     docSizeAppUnits = aIFrame->GetContentRect().Size();
   }
   return nsIntSize(presContext->AppUnitsToDevPixels(docSizeAppUnits.width),
                    presContext->AppUnitsToDevPixels(docSizeAppUnits.height));
 }
 
 #ifdef MOZ_IPC
 bool
-nsFrameLoader::TryNewProcess()
+nsFrameLoader::TryRemoteBrowser()
 {
-  NS_ASSERTION(!mRemoteBrowser, "TryNewProcess called with a process already?");
+  NS_ASSERTION(!mRemoteBrowser, "TryRemoteBrowser called with a remote browser already?");
 
   nsIDocument* doc = mOwnerContent->GetDocument();
   if (!doc) {
     return false;
   }
 
   if (doc->GetDisplayDocument()) {
     // Don't allow subframe loads in external reference documents
@@ -1919,17 +1826,17 @@ nsFrameLoader::EnsureMessageManager()
 #endif
       ) {
     return NS_OK;
   }
 
   if (mMessageManager) {
 #ifdef MOZ_IPC
     if (ShouldUseRemoteProcess()) {
-      mMessageManager->SetCallbackData(mRemoteWidgetCreated ? this : nsnull);
+      mMessageManager->SetCallbackData(mRemoteBrowserShown ? this : nsnull);
     }
 #endif
     return NS_OK;
   }
 
   nsIScriptContext* sctx = mOwnerContent->GetContextForEventHandlers(&rv);
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_STATE(sctx);
@@ -1943,17 +1850,17 @@ nsFrameLoader::EnsureMessageManager()
   chromeWindow->GetMessageManager(getter_AddRefs(parentManager));
 
 #ifdef MOZ_IPC
   if (ShouldUseRemoteProcess()) {
     mMessageManager = new nsFrameMessageManager(PR_TRUE,
                                                 nsnull,
                                                 SendAsyncMessageToChild,
                                                 LoadScript,
-                                                mRemoteWidgetCreated ? this : nsnull,
+                                                mRemoteBrowserShown ? this : nsnull,
                                                 static_cast<nsFrameMessageManager*>(parentManager.get()),
                                                 cx);
     NS_ENSURE_TRUE(mMessageManager, NS_ERROR_OUT_OF_MEMORY);
   } else
 #endif
   {
 
     mMessageManager = new nsFrameMessageManager(PR_TRUE,
--- a/content/base/src/nsFrameLoader.h
+++ b/content/base/src/nsFrameLoader.h
@@ -91,22 +91,19 @@ protected:
     mDestroyCalled(PR_FALSE),
     mNeedsAsyncDestroy(PR_FALSE),
     mInSwap(PR_FALSE),
     mInShow(PR_FALSE),
     mHideCalled(PR_FALSE),
     mNetworkCreated(aNetworkCreated)
 #ifdef MOZ_IPC
     , mDelayRemoteDialogs(PR_FALSE)
-    , mRemoteWidgetCreated(PR_FALSE)
+    , mRemoteBrowserShown(PR_FALSE)
     , mRemoteFrame(false)
     , mRemoteBrowser(nsnull)
-#if defined(MOZ_WIDGET_GTK2) || defined(MOZ_WIDGET_QT)
-    , mRemoteSocket(nsnull)
-#endif
 #endif
   {}
 
 public:
   ~nsFrameLoader() {
     mNeedsAsyncDestroy = PR_TRUE;
     if (mMessageManager) {
       mMessageManager->Disconnect();
@@ -194,22 +191,21 @@ private:
   // Updates the subdocument position and size. This gets called only
   // when we have our own in-process DocShell.
   NS_HIDDEN_(nsresult) UpdateBaseWindowPositionAndSize(nsIFrame *aIFrame);
   nsresult CheckURILoad(nsIURI* aURI);
   void FireErrorEvent();
   nsresult ReallyStartLoadingInternal();
 
 #ifdef MOZ_IPC
-  // True means new process started; nothing else to do
-  bool TryNewProcess();
+  // Return true if remote browser created; nothing else to do
+  bool TryRemoteBrowser();
 
-  // Do the hookup necessary to actually show a remote frame once the view and
-  // widget are available.
-  bool ShowRemoteFrame(nsIFrameFrame* frame, nsIView* view);
+  // Tell the remote browser that it's now "virtually visible"
+  bool ShowRemoteFrame(const nsIntSize& size);
 #endif
 
   nsCOMPtr<nsIDocShell> mDocShell;
   nsCOMPtr<nsIURI> mURIToLoad;
   nsIContent *mOwnerContent; // WEAK
 public:
   // public because a callback needs these.
   nsRefPtr<nsFrameMessageManager> mMessageManager;
@@ -224,24 +220,18 @@ private:
   PRPackedBool mHideCalled : 1;
   // True when the object is created for an element which the parser has
   // created using NS_FROM_PARSER_NETWORK flag. If the element is modified,
   // it may lose the flag.
   PRPackedBool mNetworkCreated : 1;
 
 #ifdef MOZ_IPC
   PRPackedBool mDelayRemoteDialogs : 1;
-  PRPackedBool mRemoteWidgetCreated : 1;
+  PRPackedBool mRemoteBrowserShown : 1;
   bool mRemoteFrame;
   // XXX leaking
   nsCOMPtr<nsIObserver> mChildHost;
   TabParent* mRemoteBrowser;
-
-#ifdef MOZ_WIDGET_GTK2
-  GtkWidget* mRemoteSocket;
-#elif defined(MOZ_WIDGET_QT)
-  QX11EmbedContainer* mRemoteSocket;
-#endif
 #endif
 
 };
 
 #endif
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -198,18 +198,18 @@ ContentChild::Init(MessageLoop* aIOLoop,
     sSingleton = this;
 
     return true;
 }
 
 PBrowserChild*
 ContentChild::AllocPBrowser(const PRUint32& aChromeFlags)
 {
-  nsRefPtr<TabChild> iframe = new TabChild(aChromeFlags);
-  return NS_SUCCEEDED(iframe->Init()) ? iframe.forget().get() : NULL;
+    nsRefPtr<TabChild> iframe = new TabChild(aChromeFlags);
+    return NS_SUCCEEDED(iframe->Init()) ? iframe.forget().get() : NULL;
 }
 
 bool
 ContentChild::DeallocPBrowser(PBrowserChild* iframe)
 {
     TabChild* child = static_cast<TabChild*>(iframe);
     NS_RELEASE(child);
     return true;
--- a/dom/ipc/Makefile.in
+++ b/dom/ipc/Makefile.in
@@ -44,21 +44,17 @@ include $(DEPTH)/config/autoconf.mk
 MODULE = dom
 LIBRARY_NAME = domipc_s
 LIBXUL_LIBRARY = 1
 FORCE_STATIC_LIB = 1
 EXPORT_LIBRARY = 1
 
 EXPORTS = TabMessageUtils.h
 
-EXPORTS_NAMESPACES = mozilla mozilla/dom
-
-EXPORTS_mozilla = \
-  TabTypes.h \
-  $(NULL)
+EXPORTS_NAMESPACES = mozilla/dom
 
 EXPORTS_mozilla/dom = \
   ContentChild.h \
   ContentParent.h \
   ContentProcess.h \
   TabParent.h \
   TabChild.h \
   $(NULL)
@@ -81,11 +77,9 @@ LOCAL_INCLUDES += \
 		-I$(srcdir)/../../content/events/src \
 		-I$(srcdir)/../../toolkit/components/places/src \
 		-I$(srcdir)/../src/geolocation \
 		-I$(topsrcdir)/chrome/src \
 		-I$(topsrcdir)/uriloader/exthandler \
 		-I$(srcdir)/../../netwerk/base/src \
 		$(NULL)
 
-CXXFLAGS += $(TK_CFLAGS)
-
 DEFINES += -DBIN_SUFFIX='"$(BIN_SUFFIX)"'
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -40,30 +40,29 @@
 include protocol PContent;
 include protocol PContentDialog;
 include protocol PDocumentRenderer;
 include protocol PDocumentRendererShmem;
 include protocol PDocumentRendererNativeID;
 include protocol PGeolocationRequest;
 include protocol PExternalHelperApp;
 
-include "mozilla/TabTypes.h";
 include "TabMessageUtils.h";
 include "gfxMatrix.h";
 include "mozilla/net/NeckoMessageUtils.h";
 include "IPC/nsGUIEventIPC.h";
 
+using gfxMatrix;
 using IPC::URI;
-using MagicWindowHandle;
-using RemoteDOMEvent;
-using gfxMatrix;
+using nsIntSize;
 using nsCompositionEvent;
 using nsTextEvent;
 using nsQueryContentEvent;
 using nsSelectionEvent;
+using RemoteDOMEvent;
 
 namespace mozilla {
 namespace dom {
 
 rpc protocol PBrowser
 {
     manager PContent;
 
@@ -119,24 +118,30 @@ parent:
     PContentDialog(PRUint32 aType, nsCString aName, nsCString aFeatures,
                    PRInt32[] aIntParams, nsString[] aStringParams);
 
     __delete__();
 
     PExternalHelperApp(URI uri, nsCString aMimeContentType, bool aForceSave, PRInt64 aContentLength);
 
 child:
-    CreateWidget(MagicWindowHandle parentWidget);
+    /**
+     * Notify the remote browser that it has been Show()n on this
+     * side, with the given |visibleRect|.  This message is expected
+     * to trigger creation of the remote browser's "widget".
+     *
+     * |Show()| and |Move()| take IntSizes rather than Rects because
+     * content processes always render to a virtual <0, 0> top-left
+     * point.
+     */
+    Show(nsIntSize size);
 
     LoadURL(nsCString uri);
 
-    Move(PRUint32 x,
-         PRUint32 y,
-         PRUint32 width,
-         PRUint32 height);
+    Move(nsIntSize size);
 
     /**
      * Sending an activate message moves focus to the child.
      */
     Activate();
 
     /**
      * @see nsIDOMWindowUtils sendMouseEvent.
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -35,17 +35,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 include protocol PBrowser;
 include protocol PTestShell;
 include protocol PNecko;
 
-include "mozilla/TabTypes.h";
 include "mozilla/chrome/RegistryMessageUtils.h";
 include "mozilla/net/NeckoMessageUtils.h";
 
 using ChromePackage;
 using ResourceMapping;
 using OverrideMapping;
 using IPC::URI;
 
--- a/dom/ipc/PContentDialog.ipdl
+++ b/dom/ipc/PContentDialog.ipdl
@@ -31,17 +31,16 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 include protocol PBrowser;
-include "mozilla/TabTypes.h";
 
 namespace mozilla {
 namespace dom {
 
 protocol PContentDialog
 {
   manager PBrowser;
 
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -82,27 +82,16 @@
 #include "nsIScriptGlobalObject.h"
 #include "nsWeakReference.h"
 #include "nsISecureBrowserUI.h"
 #include "nsISSLStatusProvider.h"
 #include "nsSerializationHelper.h"
 #include "nsIFrame.h"
 #include "nsIView.h"
 
-#ifdef MOZ_WIDGET_QT
-#include <QX11EmbedWidget>
-#include <QGraphicsView>
-#include <QGraphicsWidget>
-#endif
-
-#ifdef MOZ_WIDGET_GTK2
-#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
-#endif
-
 using namespace mozilla::dom;
 
 NS_IMPL_ISUPPORTS1(ContentListener, nsIDOMEventListener)
 
 NS_IMETHODIMP
 ContentListener::HandleEvent(nsIDOMEvent* aEvent)
 {
   RemoteDOMEvent remoteEvent;
@@ -125,20 +114,16 @@ TabChild::TabChild(PRUint32 aChromeFlags
   , mChromeFlags(aChromeFlags)
 {
     printf("creating %d!\n", NS_IsMainThread());
 }
 
 nsresult
 TabChild::Init()
 {
-#ifdef MOZ_WIDGET_GTK2
-  gtk_init(NULL, NULL);
-#endif
-
   nsCOMPtr<nsIWebBrowser> webBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID);
   if (!webBrowser) {
     NS_ERROR("Couldn't create a nsWebBrowser?");
     return NS_ERROR_FAILURE;
   }
 
   webBrowser->SetContainerWindow(this);
   nsCOMPtr<nsIWeakReference> weak =
@@ -413,82 +398,23 @@ TabChild::ArraysToParams(const nsTArray<
       aParams->SetInt(i, aIntParams[i]);
     }
     for (PRInt32 j = 0; PRUint32(j) < aStringParams.Length(); ++j) {
       aParams->SetString(j, aStringParams[j].get());
     }
   }
 }
 
-bool
-TabChild::RecvCreateWidget(const MagicWindowHandle& parentWidget)
-{
-    nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(mWebNav);
-    if (!baseWindow) {
-        NS_ERROR("mWebNav doesn't QI to nsIBaseWindow");
-        return true;
-    }
 
-#ifdef MOZ_WIDGET_GTK2
-    GtkWidget* win = gtk_plug_new((GdkNativeWindow)parentWidget);
-    gtk_widget_show(win);
-#elif defined(MOZ_WIDGET_QT)
-    QX11EmbedWidget *embedWin = nsnull;
-    if (parentWidget) {
-      embedWin = new QX11EmbedWidget();
-      NS_ENSURE_TRUE(embedWin, false);
-      embedWin->embedInto(parentWidget);
-      embedWin->show();
-    }
-    QGraphicsView *view = new QGraphicsView(new QGraphicsScene(), embedWin);
-    NS_ENSURE_TRUE(view, false);
-    QGraphicsWidget *win = new QGraphicsWidget();
-    NS_ENSURE_TRUE(win, false);
-    view->scene()->addItem(win);
-#elif defined(XP_WIN)
-    HWND win = parentWidget;
-#elif defined(ANDROID)
-    // Fake pointer to make baseWindow->InitWindow work
-    // The android widget code is mostly disabled in the child process
-    // so it won't choke on this
-    void *win = (void *)0x1234;
-#elif defined(XP_MACOSX)
-#  warning IMPLEMENT ME
-#else
-#error You lose!
-#endif
-
-#if !defined(XP_MACOSX)
-    baseWindow->InitWindow(win, 0, 0, 0, 0, 0);
-    baseWindow->Create();
-    baseWindow->SetVisibility(PR_TRUE);
-#endif
-
-    // IPC uses a WebBrowser object for which DNS prefetching is turned off
-    // by default. But here we really want it, so enable it explicitly
-    nsCOMPtr<nsIWebBrowserSetup> webBrowserSetup = do_QueryInterface(baseWindow);
-    if (webBrowserSetup) {
-      webBrowserSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_DNS_PREFETCH,
-                                   PR_TRUE);
-    } else {
-        NS_WARNING("baseWindow doesn't QI to nsIWebBrowserSetup, skipping "
-                   "DNS prefetching enable step.");
-    }
-
-    return InitTabChildGlobal();
-}
-
-bool
-TabChild::DestroyWidget()
+void
+TabChild::DestroyWindow()
 {
     nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(mWebNav);
     if (baseWindow)
         baseWindow->Destroy();
-
-    return true;
 }
 
 void
 TabChild::ActorDestroy(ActorDestroyReason why)
 {
   // The messageManager relays messages via the TabChild which
   // no longer exists.
   static_cast<nsFrameMessageManager*>
@@ -654,30 +580,57 @@ TabChild::RecvLoadURL(const nsCString& u
 
     nsresult rv = mWebNav->LoadURI(NS_ConvertUTF8toUTF16(uri).get(),
                                    nsIWebNavigation::LOAD_FLAGS_NONE,
                                    NULL, NULL, NULL);
     if (NS_FAILED(rv)) {
         NS_WARNING("mWebNav->LoadURI failed. Eating exception, what else can I do?");
     }
 
-    return true;
+    return NS_SUCCEEDED(rv);
 }
 
 bool
-TabChild::RecvMove(const PRUint32& x,
-                   const PRUint32& y,
-                   const PRUint32& width,
-                   const PRUint32& height)
+TabChild::RecvShow(const nsIntSize& size)
 {
-    printf("[TabChild] MOVE to (x,y)=(%ud, %ud), (w,h)= (%ud, %ud)\n",
-           x, y, width, height);
+    printf("[TabChild] SHOW (w,h)= (%d, %d)\n", size.width, size.height);
+
+    nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(mWebNav);
+    if (!baseWindow) {
+        NS_ERROR("mWebNav doesn't QI to nsIBaseWindow");
+        return false;
+    }
+
+    // FIXME/cjones: implement using fake widget
+    baseWindow->InitWindow(0, 0, 0, 0, 0, 0);
+    baseWindow->Create();
+    baseWindow->SetVisibility(PR_TRUE);
+
+    // IPC uses a WebBrowser object for which DNS prefetching is turned off
+    // by default. But here we really want it, so enable it explicitly
+    nsCOMPtr<nsIWebBrowserSetup> webBrowserSetup = do_QueryInterface(baseWindow);
+    if (webBrowserSetup) {
+      webBrowserSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_DNS_PREFETCH,
+                                   PR_TRUE);
+    } else {
+        NS_WARNING("baseWindow doesn't QI to nsIWebBrowserSetup, skipping "
+                   "DNS prefetching enable step.");
+    }
+
+    return InitTabChildGlobal();
+}
+
+bool
+TabChild::RecvMove(const nsIntSize& size)
+{
+    printf("[TabChild] RESIZE to (w,h)= (%ud, %ud)\n", size.width, size.height);
 
     nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(mWebNav);
-    baseWin->SetPositionAndSize(x, y, width, height, PR_TRUE);
+    baseWin->SetPositionAndSize(0, 0, size.width, size.height,
+                                PR_TRUE);
     return true;
 }
 
 bool
 TabChild::RecvActivate()
 {
   nsCOMPtr<nsIWebBrowserFocus> browser = do_QueryInterface(mWebNav);
   browser->Activate();
@@ -1050,17 +1003,17 @@ bool
 TabChild::RecvDestroy()
 {
   // Let the frame scripts know the child is being closed
   nsContentUtils::AddScriptRunner(
     new UnloadScriptEvent(this, mTabChildGlobal)
   );
 
   // XXX what other code in ~TabChild() should we be running here?
-  DestroyWidget();
+  DestroyWindow();
 
   return Send__delete__(this);
 }
 
 bool
 TabChild::InitTabChildGlobal()
 {
   nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(mWebNav);
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -153,37 +153,33 @@ class TabChild : public PBrowserChild,
                  public nsIWindowProvider,
                  public nsSupportsWeakReference,
                  public nsIDialogCreator,
                  public nsITabChild
 {
 public:
     TabChild(PRUint32 aChromeFlags);
     virtual ~TabChild();
-    bool DestroyWidget();
     nsresult Init();
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIWEBPROGRESSLISTENER
     NS_DECL_NSIWEBPROGRESSLISTENER2
     NS_DECL_NSIWEBBROWSERCHROME
     NS_DECL_NSIWEBBROWSERCHROME2
     NS_DECL_NSIEMBEDDINGSITEWINDOW
     NS_DECL_NSIEMBEDDINGSITEWINDOW2
     NS_DECL_NSIWEBBROWSERCHROMEFOCUS
     NS_DECL_NSIINTERFACEREQUESTOR
     NS_DECL_NSIWINDOWPROVIDER
     NS_DECL_NSIDIALOGCREATOR
 
-    virtual bool RecvCreateWidget(const MagicWindowHandle& parentWidget);
     virtual bool RecvLoadURL(const nsCString& uri);
-    virtual bool RecvMove(const PRUint32& x,
-                          const PRUint32& y,
-                          const PRUint32& width,
-                          const PRUint32& height);
+    virtual bool RecvShow(const nsIntSize& size);
+    virtual bool RecvMove(const nsIntSize& size);
     virtual bool RecvActivate();
     virtual bool RecvMouseEvent(const nsString& aType,
                                 const float&    aX,
                                 const float&    aY,
                                 const PRInt32&  aButton,
                                 const PRInt32&  aClickCount,
                                 const PRInt32&  aModifiers,
                                 const bool&     aIgnoreRootScrollFrame);
@@ -297,16 +293,17 @@ protected:
     virtual bool RecvDestroy();
 
     bool DispatchWidgetEvent(nsGUIEvent& event);
 
 private:
     void ActorDestroy(ActorDestroyReason why);
 
     bool InitTabChildGlobal();
+    void DestroyWindow();
 
     nsCOMPtr<nsIWebNavigation> mWebNav;
     TabChildGlobal* mTabChildGlobal;
     PRUint32 mChromeFlags;
 
     DISALLOW_EVIL_CONSTRUCTORS(TabChild);
 };
 
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -432,19 +432,26 @@ TabParent::LoadURL(nsIURI* aURI)
 {
     nsCString spec;
     aURI->GetSpec(spec);
 
     unused << SendLoadURL(spec);
 }
 
 void
-TabParent::Move(PRUint32 x, PRUint32 y, PRUint32 width, PRUint32 height)
+TabParent::Show(const nsIntSize& size)
 {
-    unused << SendMove(x, y, width, height);
+    // sigh
+    unused << SendShow(size);
+}
+
+void
+TabParent::Move(const nsIntSize& size)
+{
+    unused << SendMove(size);
 }
 
 void
 TabParent::Activate()
 {
     unused << SendActivate();
 }
 
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -150,17 +150,21 @@ public:
     virtual PExternalHelperAppParent* AllocPExternalHelperApp(
             const IPC::URI& uri,
             const nsCString& aMimeContentType,
             const bool& aForceSave,
             const PRInt64& aContentLength);
     virtual bool DeallocPExternalHelperApp(PExternalHelperAppParent* aService);
 
     void LoadURL(nsIURI* aURI);
-    void Move(PRUint32 x, PRUint32 y, PRUint32 width, PRUint32 height);
+    // XXX/cjones: it's not clear what we gain by hiding these
+    // message-sending functions under a layer of indirection and
+    // eating the return values
+    void Show(const nsIntSize& size);
+    void Move(const nsIntSize& size);
     void Activate();
     void SendMouseEvent(const nsAString& aType, float aX, float aY,
                         PRInt32 aButton, PRInt32 aClickCount,
                         PRInt32 aModifiers, PRBool aIgnoreRootScrollFrame);
     void SendKeyEvent(const nsAString& aType, PRInt32 aKeyCode,
                       PRInt32 aCharCode, PRInt32 aModifiers,
                       PRBool aPreventDefault);
 
deleted file mode 100644
--- a/dom/ipc/TabTypes.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim: set sw=4 ts=8 et tw=80 : */
-
-#ifndef mozilla_tabs_TabTypes_h
-#define mozilla_tabs_TabTypes_h
-
-#include "base/basictypes.h"
-
-#ifdef XP_WIN
-#include <windows.h>
-
-typedef HWND MagicWindowHandle;
-#elif defined(MOZ_WIDGET_GTK2)
-#include <X11/X.h>
-
-typedef XID MagicWindowHandle;
-
-#elif defined(MOZ_WIDGET_QT)
-
-typedef unsigned long MagicWindowHandle;
-
-#elif defined(XP_MACOSX)
-#  warning This is a placeholder
-typedef long MagicWindowHandle;
-
-#elif defined(ANDROID)
-/* we don't really use this */
-typedef unsigned long MagicWindowHandle;
-
-#else
-#error Not implemented, stooge
-#endif
-
-#endif