Bug 1092121 - Get plugin quirks modes and nsPluginInstanceOwner::GetNetscapeWindow working with remote content. r=billm

This commit is contained in:
Jim Mathies 2015-01-23 04:10:52 -06:00
Родитель 9172ea0a9f
Коммит 0dd5439fbf
4 изменённых файлов: 22 добавлений и 12 удалений

Просмотреть файл

@ -115,6 +115,12 @@ parent:
*/
sync PPluginWidget();
/**
* Return native data of root widget
*/
sync GetWidgetNativeData() returns (WindowsHandle value);
parent:
/**
* When child sends this message, parent should move focus to
* the next or previous focusable element.
@ -302,11 +308,6 @@ parent:
*/
sync GetDefaultScale() returns (double value);
/**
* Return native data of root widget
*/
sync GetWidgetNativeData() returns (WindowsHandle value);
/**
* Set the native cursor.
* @param value

Просмотреть файл

@ -662,7 +662,6 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
nsViewManager* vm = mPluginFrame->PresContext()->GetPresShell()->GetViewManager();
if (!vm)
return NS_ERROR_FAILURE;
#if defined(XP_WIN)
// This property is provided to allow a "windowless" plugin to determine the window it is drawing
// in, so it can translate mouse coordinates it receives directly from the operating system
// to coordinates relative to itself.
@ -681,7 +680,8 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
// we only attempt to get the nearest window if this really is a "windowless" plugin so as not
// to change any behaviour for the much more common windowed plugins,
// though why this method would even be being called for a windowed plugin escapes me.
if (mPluginWindow && mPluginWindow->type == NPWindowTypeDrawable) {
if (XRE_GetProcessType() != GeckoProcessType_Content &&
mPluginWindow && mPluginWindow->type == NPWindowTypeDrawable) {
// it turns out that flash also uses this window for determining focus, and is currently
// unable to show a caret correctly if we return the enclosing window. Therefore for
// now we only return the enclosing window when there is an actual offset which
@ -706,12 +706,11 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
}
}
}
#endif
// simply return the topmost document window
nsCOMPtr<nsIWidget> widget;
vm->GetRootWidget(getter_AddRefs(widget));
if (widget) {
*pvalue = (void*)widget->GetNativeData(NS_NATIVE_WINDOW);
*pvalue = (void*)widget->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW);
} else {
NS_ASSERTION(widget, "couldn't get doc's widget in getting doc's window handle");
}

Просмотреть файл

@ -65,6 +65,7 @@ const wchar_t * kMozillaWindowClass = L"MozillaWindowClass";
#endif
namespace {
// see PluginModuleChild::GetChrome()
PluginModuleChild* gChromeInstance = nullptr;
nsTArray<PluginModuleChild*>* gAllInstances;
}
@ -191,6 +192,9 @@ PluginModuleChild::~PluginModuleChild()
PluginModuleChild*
PluginModuleChild::GetChrome()
{
// A special PluginModuleChild instance that talks to the chrome process
// during startup and shutdown. Synchronous messages to or from this actor
// should be avoided because they may lead to hangs.
MOZ_ASSERT(gChromeInstance);
return gChromeInstance;
}
@ -230,7 +234,6 @@ PluginModuleChild::InitForContent(base::ProcessHandle aParentProcessHandle,
mTransport = aChannel;
mLibrary = GetChrome()->mLibrary;
mQuirks = GetChrome()->mQuirks;
mFunctions = GetChrome()->mFunctions;
return true;
@ -2062,7 +2065,13 @@ PluginModuleChild::AllocPPluginInstanceChild(const nsCString& aMimeType,
PLUGIN_LOG_DEBUG_METHOD;
AssertPluginThread();
InitQuirksModes(aMimeType);
// In e10s, gChromeInstance hands out quirks to instances, but never
// allocates an instance on its own. Make sure it gets the latest copy
// of quirks once we have them. Also note, with process-per-tab, we may
// have multiple PluginModuleChilds in the same plugin process, so only
// initialize this once in gChromeInstance, which is a singleton.
GetChrome()->InitQuirksModes(aMimeType);
mQuirks = GetChrome()->mQuirks;
#ifdef XP_WIN
if ((mQuirks & QUIRK_FLASH_HOOK_GETWINDOWINFO) &&

Просмотреть файл

@ -2922,8 +2922,9 @@ void* nsWindow::GetNativeData(uint32_t aDataType)
case NS_NATIVE_PLUGIN_PORT:
case NS_NATIVE_WIDGET:
case NS_NATIVE_WINDOW:
case NS_NATIVE_SHAREABLE_WINDOW:
return (void*)mWnd;
case NS_NATIVE_SHAREABLE_WINDOW:
return (void*) WinUtils::GetTopLevelHWND(mWnd);
case NS_NATIVE_GRAPHIC:
// XXX: This is sleezy!! Remember to Release the DC after using it!
#ifdef MOZ_XUL