Bug 648935 - Prevent focus event overhead when the dom sets the focus to a windowed plugin. r=bsmedberg.

This commit is contained in:
Jim Mathies 2011-05-18 06:57:08 -05:00
Родитель 83e1ea7193
Коммит ed5258cc64
2 изменённых файлов: 6 добавлений и 1 удалений

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

@ -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<bool> ar(mInAnswerFocusChange)
mInAnswerFocusChange = true;
::SendMessage(mPluginHWND, gOOPPPluginFocusEvent, gotFocus ? 1 : 0, 0);
return true;
#else

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

@ -349,6 +349,7 @@ private:
HWND mPluginHWND;
WNDPROC mPluginWndProc;
bool mNestedEventState;
bool mInAnswerFocusChange;
#endif // defined(XP_WIN)
#if defined(OS_MACOSX)
private: