зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1103177 - When tabs are torn out, swap plugin widget parents. r=roc
This commit is contained in:
Родитель
ceb106d8e4
Коммит
a8bf5c7379
|
@ -76,6 +76,8 @@
|
||||||
#include "AppProcessChecker.h"
|
#include "AppProcessChecker.h"
|
||||||
#include "ContentParent.h"
|
#include "ContentParent.h"
|
||||||
#include "TabParent.h"
|
#include "TabParent.h"
|
||||||
|
#include "mozilla/plugins/PPluginWidgetParent.h"
|
||||||
|
#include "../plugins/ipc/PluginWidgetParent.h"
|
||||||
#include "mozilla/AsyncEventDispatcher.h"
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/GuardObjects.h"
|
#include "mozilla/GuardObjects.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
|
@ -970,6 +972,8 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
|
||||||
nsRefPtr<nsFrameLoader>& aFirstToSwap,
|
nsRefPtr<nsFrameLoader>& aFirstToSwap,
|
||||||
nsRefPtr<nsFrameLoader>& aSecondToSwap)
|
nsRefPtr<nsFrameLoader>& aSecondToSwap)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
Element* ourContent = mOwnerContent;
|
Element* ourContent = mOwnerContent;
|
||||||
Element* otherContent = aOther->mOwnerContent;
|
Element* otherContent = aOther->mOwnerContent;
|
||||||
|
|
||||||
|
@ -1024,6 +1028,17 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Native plugin windows used by this remote content need to be reparented.
|
||||||
|
const nsTArray<mozilla::plugins::PPluginWidgetParent*>& plugins =
|
||||||
|
aOther->mRemoteBrowser->ManagedPPluginWidgetParent();
|
||||||
|
nsPIDOMWindow* newWin = ourDoc->GetWindow();
|
||||||
|
if (newWin) {
|
||||||
|
nsRefPtr<nsIWidget> newParent = ((nsGlobalWindow*)newWin)->GetMainWidget();
|
||||||
|
for (uint32_t idx = 0; idx < plugins.Length(); ++idx) {
|
||||||
|
static_cast<mozilla::plugins::PluginWidgetParent*>(plugins[idx])->SetParent(newParent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SetOwnerContent(otherContent);
|
SetOwnerContent(otherContent);
|
||||||
aOther->SetOwnerContent(ourContent);
|
aOther->SetOwnerContent(ourContent);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
--- nsFrameLoader.cpp
|
||||||
|
+++ nsFrameLoader.cpp
|
||||||
|
@@ -48,17 +48,17 @@
|
||||||
|
#include "nsIDOMHTMLDocument.h"
|
||||||
|
#include "nsIXULWindow.h"
|
||||||
|
#include "nsIEditor.h"
|
||||||
|
#include "nsIMozBrowserFrame.h"
|
||||||
|
#include "nsIPermissionManager.h"
|
||||||
|
#include "nsISHistory.h"
|
||||||
|
#include "nsNullPrincipal.h"
|
||||||
|
#include "nsIScriptError.h"
|
||||||
|
-
|
||||||
|
+#include "nsGlobalWindow.h"
|
||||||
|
#include "nsLayoutUtils.h"
|
||||||
|
#include "nsView.h"
|
||||||
|
|
||||||
|
#include "nsIURI.h"
|
||||||
|
#include "nsIURL.h"
|
||||||
|
#include "nsNetUtil.h"
|
||||||
|
|
||||||
|
#include "nsGkAtoms.h"
|
|
@ -75,6 +75,14 @@ PluginWidgetParent::GetTabParent()
|
||||||
return static_cast<mozilla::dom::TabParent*>(Manager());
|
return static_cast<mozilla::dom::TabParent*>(Manager());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PluginWidgetParent::SetParent(nsIWidget* aParent)
|
||||||
|
{
|
||||||
|
if (mWidget && aParent) {
|
||||||
|
mWidget->SetParent(aParent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
// static
|
// static
|
||||||
void
|
void
|
||||||
|
|
|
@ -48,6 +48,9 @@ public:
|
||||||
// Called by PBrowser when it receives a Destroy() call from the child.
|
// Called by PBrowser when it receives a Destroy() call from the child.
|
||||||
void ParentDestroy();
|
void ParentDestroy();
|
||||||
|
|
||||||
|
// Sets mWidget's parent
|
||||||
|
void SetParent(nsIWidget* aParent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ShutdownCommon(bool aParentInitiated);
|
void ShutdownCommon(bool aParentInitiated);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче