mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1095754 - Provide a way to force an update on a plugin window asyncronously from chrome. Trigger an update when we adjust the widget configurations. r=aklotz
This commit is contained in:
parent
b93a28f5fb
commit
4c3194fc91
@ -53,6 +53,11 @@ child:
|
||||
* the child actor may not be on the other side.
|
||||
*/
|
||||
async ParentShutdown();
|
||||
|
||||
/**
|
||||
* Requests a full update of the plugin window.
|
||||
*/
|
||||
async UpdateWindow(uintptr_t aChildId);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -25,6 +25,12 @@ using namespace mozilla::widget;
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
||||
#if defined(XP_WIN)
|
||||
// For nsWindow
|
||||
const wchar_t* kPluginWidgetParentProperty =
|
||||
L"kPluginWidgetParentProperty";
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_CID(kWidgetCID, NS_CHILD_CID);
|
||||
|
||||
// This macro returns true to prevent an abort in the child process when
|
||||
@ -54,6 +60,10 @@ PluginWidgetParent::~PluginWidgetParent()
|
||||
// with the last out-of-process page, make sure and cleanup any left
|
||||
// over widgets if we have them.
|
||||
if (mWidget) {
|
||||
#if defined(XP_WIN)
|
||||
::RemovePropW((HWND)mWidget->GetNativeData(NS_NATIVE_WINDOW),
|
||||
kPluginWidgetParentProperty);
|
||||
#endif
|
||||
mWidget->UnregisterPluginWindowForRemoteUpdates();
|
||||
mWidget->Destroy();
|
||||
mWidget = nullptr;
|
||||
@ -66,6 +76,25 @@ PluginWidgetParent::GetTabParent()
|
||||
return static_cast<mozilla::dom::TabParent*>(Manager());
|
||||
}
|
||||
|
||||
#if defined(XP_WIN)
|
||||
// static
|
||||
void
|
||||
PluginWidgetParent::SendAsyncUpdate(nsIWidget* aWidget)
|
||||
{
|
||||
if (!aWidget || aWidget->Destroyed()) {
|
||||
return;
|
||||
}
|
||||
// Fire off an async request to the plugin to paint its window
|
||||
HWND hwnd = (HWND)aWidget->GetNativeData(NS_NATIVE_WINDOW);
|
||||
NS_ASSERTION(hwnd, "Expected valid hwnd value.");
|
||||
PluginWidgetParent* parent = reinterpret_cast<PluginWidgetParent*>(
|
||||
::GetPropW(hwnd, mozilla::plugins::kPluginWidgetParentProperty));
|
||||
if (parent && !parent->ActorDestroyed()) {
|
||||
parent->SendUpdateWindow((uintptr_t)hwnd);
|
||||
}
|
||||
}
|
||||
#endif // defined(XP_WIN)
|
||||
|
||||
// When plugins run in chrome, nsPluginNativeWindow(Plat) implements platform
|
||||
// specific functionality that wraps plugin widgets. With e10s we currently
|
||||
// bypass this code on Window, and reuse a bit of it on Linux. Content still
|
||||
@ -127,6 +156,11 @@ PluginWidgetParent::RecvCreate()
|
||||
NS_ASSERTION(NS_SUCCEEDED(drv), "widget call failure");
|
||||
mWrapper->SetAllocation();
|
||||
PWLOG("Plugin XID=%p\n", (void*)mWrapper->window);
|
||||
#elif defined(XP_WIN)
|
||||
DebugOnly<DWORD> winres =
|
||||
::SetPropW((HWND)mWidget->GetNativeData(NS_NATIVE_WINDOW),
|
||||
kPluginWidgetParentProperty, this);
|
||||
NS_ASSERTION(winres, "SetPropW call failure");
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
@ -23,6 +23,15 @@ namespace plugins {
|
||||
|
||||
class PluginWidgetParent : public PPluginWidgetParent
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Windows helper for firing off an update window request to a plugin.
|
||||
*
|
||||
* aWidget - the eWindowType_plugin_ipc_chrome widget associated with
|
||||
* this plugin window.
|
||||
*/
|
||||
static void SendAsyncUpdate(nsIWidget* aWidget);
|
||||
|
||||
public:
|
||||
PluginWidgetParent();
|
||||
virtual ~PluginWidgetParent();
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
#include "mozilla/plugins/PluginInstanceParent.h"
|
||||
using mozilla::plugins::PluginInstanceParent;
|
||||
#include "mozilla/plugins/PluginWidgetParent.h"
|
||||
using mozilla::plugins::PluginWidgetParent;
|
||||
|
||||
#include "nsWindowGfx.h"
|
||||
#include "nsAppRunner.h"
|
||||
@ -55,10 +57,18 @@ extern "C" {
|
||||
#include "pixman.h"
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
// For plugins with e10s
|
||||
extern const wchar_t* kPluginWidgetParentProperty;
|
||||
}
|
||||
}
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::layers;
|
||||
using namespace mozilla::widget;
|
||||
using namespace mozilla::plugins;
|
||||
|
||||
/**************************************************************
|
||||
**************************************************************
|
||||
@ -193,12 +203,6 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
|
||||
// dummy paint so that Windows stops dispatching WM_PAINT in an inifinite
|
||||
// loop. See bug 543788.
|
||||
if (IsPlugin()) {
|
||||
// XXX Ignore for now when we're running with full blown e10s
|
||||
if (mozilla::BrowserTabsRemoteAutostart()) {
|
||||
printf_stderr("nsWindow::OnPaint() bailing on paint!\n");
|
||||
ValidateRect(mWnd, nullptr);
|
||||
return true;
|
||||
}
|
||||
RECT updateRect;
|
||||
if (!GetUpdateRect(mWnd, &updateRect, FALSE) ||
|
||||
(updateRect.left == updateRect.right &&
|
||||
@ -209,6 +213,13 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mWindowType == eWindowType_plugin_ipc_chrome) {
|
||||
// Fire off an async request to the plugin to paint its window
|
||||
PluginWidgetParent::SendAsyncUpdate(this);
|
||||
ValidateRect(mWnd, nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
PluginInstanceParent* instance = reinterpret_cast<PluginInstanceParent*>(
|
||||
::GetPropW(mWnd, L"PluginInstanceParentProperty"));
|
||||
if (instance) {
|
||||
|
Loading…
Reference in New Issue
Block a user