diff --git a/dom/plugins/PluginInstanceChild.cpp b/dom/plugins/PluginInstanceChild.cpp index ab60999def1..802496e9038 100644 --- a/dom/plugins/PluginInstanceChild.cpp +++ b/dom/plugins/PluginInstanceChild.cpp @@ -662,6 +662,8 @@ PluginInstanceChild::SizePluginWindow(int width, int height) { if (mPluginWindowHWND) { + mPluginSize.x = width; + mPluginSize.y = height; SetWindowPos(mPluginWindowHWND, NULL, 0, 0, width, height, SWP_NOZORDER | SWP_NOREPOSITION); } @@ -697,6 +699,27 @@ PluginInstanceChild::PluginWindowProc(HWND hWnd, NS_ASSERTION(self->mPluginWindowHWND == hWnd, "Wrong window!"); + // Adobe's shockwave positions the plugin window relative to the browser + // frame when it initializes. With oopp disabled, this wouldn't have an + // effect. With oopp, GeckoPluginWindow is a child of the parent plugin + // window, so the move offsets the child within the parent. Generally + // we don't want plugins moving or sizing our window, so we prevent these + // changes here. + if (message == WM_WINDOWPOSCHANGING) { + WINDOWPOS* pos = reinterpret_cast(lParam); + if (pos && (!(pos->flags & SWP_NOMOVE) || !(pos->flags & SWP_NOSIZE))) { + pos->x = pos->y = 0; + pos->cx = self->mPluginSize.x; + pos->cy = self->mPluginSize.y; + LRESULT res = CallWindowProc(self->mPluginWndProc, hWnd, message, wParam, + lParam); + pos->x = pos->y = 0; + pos->cx = self->mPluginSize.x; + pos->cy = self->mPluginSize.y; + return res; + } + } + // The plugin received keyboard focus, let the parent know so the dom is up to date. if (message == WM_MOUSEACTIVATE) self->CallPluginGotFocus(); diff --git a/dom/plugins/PluginInstanceChild.h b/dom/plugins/PluginInstanceChild.h index 47af9102690..ef2ce58a1dc 100644 --- a/dom/plugins/PluginInstanceChild.h +++ b/dom/plugins/PluginInstanceChild.h @@ -51,6 +51,7 @@ #include "nsTArray.h" #include "ChildAsyncCall.h" #include "ChildTimer.h" +#include "nsRect.h" namespace mozilla { namespace plugins { @@ -229,6 +230,7 @@ private: bool mNestedEventState; HWND mCachedWinlessPluginHWND; UINT_PTR mEventPumpTimer; + nsIntPoint mPluginSize; #endif friend class ChildAsyncCall;