Bug 1182411 Part 1: Make plugin quirks available to the Parent as well as the Child. r=jimm
This commit is contained in:
@@ -197,7 +197,7 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface,
|
||||
#endif // OS_WIN
|
||||
#if defined(OS_WIN)
|
||||
InitPopupMenuHook();
|
||||
if (GetQuirks() & PluginModuleChild::QUIRK_UNITY_FIXUP_MOUSE_CAPTURE) {
|
||||
if (GetQuirks() & QUIRK_UNITY_FIXUP_MOUSE_CAPTURE) {
|
||||
SetUnityHooks();
|
||||
}
|
||||
#endif // OS_WIN
|
||||
@@ -207,7 +207,7 @@ PluginInstanceChild::~PluginInstanceChild()
|
||||
{
|
||||
#if defined(OS_WIN)
|
||||
NS_ASSERTION(!mPluginWindowHWND, "Destroying PluginInstanceChild without NPP_Destroy?");
|
||||
if (GetQuirks() & PluginModuleChild::QUIRK_UNITY_FIXUP_MOUSE_CAPTURE) {
|
||||
if (GetQuirks() & QUIRK_UNITY_FIXUP_MOUSE_CAPTURE) {
|
||||
ClearUnityHooks();
|
||||
}
|
||||
#endif
|
||||
@@ -405,7 +405,7 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar,
|
||||
}
|
||||
if (result == NPERR_NO_ERROR ||
|
||||
(GetQuirks() &
|
||||
PluginModuleChild::QUIRK_FLASH_RETURN_EMPTY_DOCUMENT_ORIGIN)) {
|
||||
QUIRK_FLASH_RETURN_EMPTY_DOCUMENT_ORIGIN)) {
|
||||
*static_cast<char**>(aValue) = ToNewCString(v);
|
||||
}
|
||||
return result;
|
||||
@@ -1028,7 +1028,7 @@ PluginInstanceChild::AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event,
|
||||
|
||||
mCARenderer->SetupRenderer(caLayer, mWindow.width, mWindow.height,
|
||||
mContentsScaleFactor,
|
||||
GetQuirks() & PluginModuleChild::QUIRK_ALLOW_OFFLINE_RENDERER ?
|
||||
GetQuirks() & QUIRK_ALLOW_OFFLINE_RENDERER ?
|
||||
ALLOW_OFFLINE_RENDERER : DISALLOW_OFFLINE_RENDERER);
|
||||
|
||||
// Flash needs to have the window set again after this step
|
||||
@@ -1254,7 +1254,7 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
|
||||
switch (aWindow.type) {
|
||||
case NPWindowTypeWindow:
|
||||
{
|
||||
if ((GetQuirks() & PluginModuleChild::QUIRK_QUICKTIME_AVOID_SETWINDOW) &&
|
||||
if ((GetQuirks() & QUIRK_QUICKTIME_AVOID_SETWINDOW) &&
|
||||
aWindow.width == 0 &&
|
||||
aWindow.height == 0) {
|
||||
// Skip SetWindow call for hidden QuickTime plugins
|
||||
@@ -1298,9 +1298,9 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
|
||||
|
||||
case NPWindowTypeDrawable:
|
||||
mWindow.type = aWindow.type;
|
||||
if (GetQuirks() & PluginModuleChild::QUIRK_WINLESS_TRACKPOPUP_HOOK)
|
||||
if (GetQuirks() & QUIRK_WINLESS_TRACKPOPUP_HOOK)
|
||||
CreateWinlessPopupSurrogate();
|
||||
if (GetQuirks() & PluginModuleChild::QUIRK_FLASH_THROTTLE_WMUSER_EVENTS)
|
||||
if (GetQuirks() & QUIRK_FLASH_THROTTLE_WMUSER_EVENTS)
|
||||
SetupFlashMsgThrottle();
|
||||
return SharedSurfaceSetWindow(aWindow);
|
||||
break;
|
||||
@@ -1554,7 +1554,7 @@ PluginInstanceChild::PluginWindowProcInternal(HWND hWnd,
|
||||
}
|
||||
|
||||
if (message == WM_USER+1 &&
|
||||
(self->GetQuirks() & PluginModuleChild::QUIRK_FLASH_THROTTLE_WMUSER_EVENTS)) {
|
||||
(self->GetQuirks() & QUIRK_FLASH_THROTTLE_WMUSER_EVENTS)) {
|
||||
self->FlashThrottleMessage(hWnd, message, wParam, lParam, true);
|
||||
return 0;
|
||||
}
|
||||
@@ -1571,7 +1571,7 @@ PluginInstanceChild::PluginWindowProcInternal(HWND hWnd,
|
||||
// caused by a bug in flash, since we are not setting the capture
|
||||
// on the window.
|
||||
if (message == WM_LBUTTONDOWN &&
|
||||
self->GetQuirks() & PluginModuleChild::QUIRK_FLASH_FIXUP_MOUSE_CAPTURE) {
|
||||
self->GetQuirks() & QUIRK_FLASH_FIXUP_MOUSE_CAPTURE) {
|
||||
wchar_t szClass[26];
|
||||
HWND hwnd = GetForegroundWindow();
|
||||
if (hwnd && GetClassNameW(hwnd, szClass,
|
||||
@@ -1732,7 +1732,7 @@ PluginInstanceChild::SetWindowLongWHook(HWND hWnd,
|
||||
void
|
||||
PluginInstanceChild::HookSetWindowLongPtr()
|
||||
{
|
||||
if (!(GetQuirks() & PluginModuleChild::QUIRK_FLASH_HOOK_SETLONGPTR))
|
||||
if (!(GetQuirks() & QUIRK_FLASH_HOOK_SETLONGPTR))
|
||||
return;
|
||||
|
||||
sUser32Intercept.Init("user32.dll");
|
||||
@@ -1819,7 +1819,7 @@ PluginInstanceChild::SetCaptureHook(HWND aHwnd)
|
||||
void
|
||||
PluginInstanceChild::SetUnityHooks()
|
||||
{
|
||||
if (!(GetQuirks() & PluginModuleChild::QUIRK_UNITY_FIXUP_MOUSE_CAPTURE)) {
|
||||
if (!(GetQuirks() & QUIRK_UNITY_FIXUP_MOUSE_CAPTURE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1946,7 +1946,7 @@ PluginInstanceChild::TrackPopupHookProc(HMENU hMenu,
|
||||
void
|
||||
PluginInstanceChild::InitPopupMenuHook()
|
||||
{
|
||||
if (!(GetQuirks() & PluginModuleChild::QUIRK_WINLESS_TRACKPOPUP_HOOK) ||
|
||||
if (!(GetQuirks() & QUIRK_WINLESS_TRACKPOPUP_HOOK) ||
|
||||
sUser32TrackPopupMenuStub)
|
||||
return;
|
||||
|
||||
@@ -2008,7 +2008,7 @@ PluginInstanceChild::WinlessHandleEvent(NPEvent& event)
|
||||
// TrackPopupMenu will fail if the parent window is not associated with
|
||||
// our ui thread. So we hook TrackPopupMenu so we can hand in a surrogate
|
||||
// parent created in the child process.
|
||||
if ((GetQuirks() & PluginModuleChild::QUIRK_WINLESS_TRACKPOPUP_HOOK) && // XXX turn on by default?
|
||||
if ((GetQuirks() & QUIRK_WINLESS_TRACKPOPUP_HOOK) && // XXX turn on by default?
|
||||
(event.event == WM_RBUTTONDOWN || // flash
|
||||
event.event == WM_RBUTTONUP)) { // silverlight
|
||||
sWinlessPopupSurrogateHWND = mWinlessPopupSurrogateHWND;
|
||||
@@ -2400,7 +2400,7 @@ PluginInstanceChild::AnswerSetPluginFocus()
|
||||
// this in response to a WM_SETFOCUS event on our parent, the parent
|
||||
// should have focus when we receive this. If not, ignore the call.
|
||||
if (::GetFocus() == mPluginWindowHWND ||
|
||||
((GetQuirks() & PluginModuleChild::QUIRK_SILVERLIGHT_FOCUS_CHECK_PARENT) &&
|
||||
((GetQuirks() & QUIRK_SILVERLIGHT_FOCUS_CHECK_PARENT) &&
|
||||
(::GetFocus() != mPluginParentHWND)))
|
||||
return true;
|
||||
::SetFocus(mPluginWindowHWND);
|
||||
@@ -2825,7 +2825,7 @@ PluginInstanceChild::DoAsyncSetWindow(const gfxSurfaceType& aSurfaceType,
|
||||
mContentsScaleFactor = aWindow.contentsScaleFactor;
|
||||
#endif
|
||||
|
||||
if (GetQuirks() & PluginModuleChild::QUIRK_SILVERLIGHT_DEFAULT_TRANSPARENT)
|
||||
if (GetQuirks() & QUIRK_SILVERLIGHT_DEFAULT_TRANSPARENT)
|
||||
mIsTransparent = true;
|
||||
|
||||
mLayersRendering = true;
|
||||
@@ -2833,9 +2833,9 @@ PluginInstanceChild::DoAsyncSetWindow(const gfxSurfaceType& aSurfaceType,
|
||||
UpdateWindowAttributes(true);
|
||||
|
||||
#ifdef XP_WIN
|
||||
if (GetQuirks() & PluginModuleChild::QUIRK_WINLESS_TRACKPOPUP_HOOK)
|
||||
if (GetQuirks() & QUIRK_WINLESS_TRACKPOPUP_HOOK)
|
||||
CreateWinlessPopupSurrogate();
|
||||
if (GetQuirks() & PluginModuleChild::QUIRK_FLASH_THROTTLE_WMUSER_EVENTS)
|
||||
if (GetQuirks() & QUIRK_FLASH_THROTTLE_WMUSER_EVENTS)
|
||||
SetupFlashMsgThrottle();
|
||||
#endif
|
||||
|
||||
@@ -3027,7 +3027,7 @@ PluginInstanceChild::EnsureCurrentBuffer(void)
|
||||
if (mDrawingModel == NPDrawingModelCoreGraphics) {
|
||||
if (!mCGLayer) {
|
||||
bool avoidCGCrashes = !nsCocoaFeatures::OnMountainLionOrLater() &&
|
||||
(GetQuirks() & PluginModuleChild::QUIRK_FLASH_AVOID_CGMODE_CRASHES);
|
||||
(GetQuirks() & QUIRK_FLASH_AVOID_CGMODE_CRASHES);
|
||||
caLayer = mozilla::plugins::PluginUtilsOSX::GetCGLayer(CallCGDraw, this,
|
||||
avoidCGCrashes,
|
||||
mContentsScaleFactor);
|
||||
@@ -3061,7 +3061,7 @@ PluginInstanceChild::EnsureCurrentBuffer(void)
|
||||
if (!mDoubleBufferCARenderer.HasFrontSurface()) {
|
||||
bool allocSurface = mDoubleBufferCARenderer.InitFrontSurface(
|
||||
mWindow.width, mWindow.height, mContentsScaleFactor,
|
||||
GetQuirks() & PluginModuleChild::QUIRK_ALLOW_OFFLINE_RENDERER ?
|
||||
GetQuirks() & QUIRK_ALLOW_OFFLINE_RENDERER ?
|
||||
ALLOW_OFFLINE_RENDERER : DISALLOW_OFFLINE_RENDERER);
|
||||
if (!allocSurface) {
|
||||
PLUGIN_LOG_DEBUG(("Fail to allocate front IOSurface"));
|
||||
@@ -3234,7 +3234,7 @@ PluginInstanceChild::PaintRectToSurface(const nsIntRect& aRect,
|
||||
nsIntRect plPaintRect(aRect);
|
||||
nsRefPtr<gfxASurface> renderSurface = aSurface;
|
||||
#ifdef MOZ_X11
|
||||
if (mIsTransparent && (GetQuirks() & PluginModuleChild::QUIRK_FLASH_EXPOSE_COORD_TRANSLATION)) {
|
||||
if (mIsTransparent && (GetQuirks() & QUIRK_FLASH_EXPOSE_COORD_TRANSLATION)) {
|
||||
// Work around a bug in Flash up to 10.1 d51 at least, where expose event
|
||||
// top left coordinates within the plugin-rect and not at the drawable
|
||||
// origin are misinterpreted. (We can move the top left coordinate
|
||||
|
||||
Reference in New Issue
Block a user