From ed5258cc647121f9765501faf57f370abcba8199 Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Wed, 18 May 2011 06:57:08 -0500 Subject: [PATCH] Bug 648935 - Prevent focus event overhead when the dom sets the focus to a windowed plugin. r=bsmedberg. --- dom/plugins/ipc/PluginInstanceParent.cpp | 6 +++++- dom/plugins/ipc/PluginInstanceParent.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dom/plugins/ipc/PluginInstanceParent.cpp b/dom/plugins/ipc/PluginInstanceParent.cpp index 3e4588826be..8279176e175 100644 --- a/dom/plugins/ipc/PluginInstanceParent.cpp +++ b/dom/plugins/ipc/PluginInstanceParent.cpp @@ -96,6 +96,7 @@ PluginInstanceParent::PluginInstanceParent(PluginModuleParent* parent, , mPluginHWND(NULL) , mPluginWndProc(NULL) , mNestedEventState(false) + , mInAnswerFocusChange(false) #endif // defined(XP_WIN) , mQuirks(0) #if defined(XP_MACOSX) @@ -1559,7 +1560,8 @@ PluginInstanceParent::PluginWindowHookProc(HWND hWnd, switch (message) { case WM_SETFOCUS: // Let the child plugin window know it should take focus. - self->CallSetPluginFocus(); + if (!self->mInAnswerFocusChange) + self->CallSetPluginFocus(); break; case WM_CLOSE: @@ -1739,6 +1741,8 @@ PluginInstanceParent::AnswerPluginFocusChange(const bool& gotFocus) // focus. We forward the event down to widget so the dom/focus manager can // be updated. #if defined(OS_WIN) + AutoRestore ar(mInAnswerFocusChange) + mInAnswerFocusChange = true; ::SendMessage(mPluginHWND, gOOPPPluginFocusEvent, gotFocus ? 1 : 0, 0); return true; #else diff --git a/dom/plugins/ipc/PluginInstanceParent.h b/dom/plugins/ipc/PluginInstanceParent.h index 77c486876a0..f3c526198f8 100644 --- a/dom/plugins/ipc/PluginInstanceParent.h +++ b/dom/plugins/ipc/PluginInstanceParent.h @@ -349,6 +349,7 @@ private: HWND mPluginHWND; WNDPROC mPluginWndProc; bool mNestedEventState; + bool mInAnswerFocusChange; #endif // defined(XP_WIN) #if defined(OS_MACOSX) private: