Bug 591559 and bug 575567 - "Drop X[Parent/Child] widget embedding from remote browser" [r=cjones] [a=bustage-fix+blocking]

This commit is contained in:
Oleg Romashin 2010-07-16 06:57:00 -05:00
parent f2f89b964c
commit 12114374e2
2 changed files with 2 additions and 75 deletions

View File

@ -767,75 +767,11 @@ nsFrameLoader::ShowRemoteFrame(nsIFrameFrame* frame, nsIView* view)
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);
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;

View File

@ -90,7 +90,6 @@
#include "nsGeolocation.h"
#ifdef MOZ_WIDGET_QT
#include <QX11EmbedWidget>
#include <QGraphicsView>
#include <QGraphicsWidget>
#endif
@ -430,17 +429,9 @@ TabChild::RecvCreateWidget(const MagicWindowHandle& parentWidget)
}
#ifdef MOZ_WIDGET_GTK2
GtkWidget* win = gtk_plug_new((GdkNativeWindow)parentWidget);
gtk_widget_show(win);
GtkWidget* win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
#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);
QGraphicsView *view = new QGraphicsView(new QGraphicsScene());
NS_ENSURE_TRUE(view, false);
QGraphicsWidget *win = new QGraphicsWidget();
NS_ENSURE_TRUE(win, false);