Bug 618683 - Quirk the full screen focus fix landed in bug 608013 to silverlight. r=bsmedberg
authorJim Mathies <jmathies@mozilla.com>
Tue, 26 Jul 2011 14:18:23 -0500
changeset 73357 0a936ddb70e99b60653d6a1d2245f84f694aebb1
parent 73356 ee09d7de0640207bf001e81d44bad6e7c990d1f4
child 73358 23d79d41a5936ac81c94222da3ab001be598fc78
push id20852
push userjmathies@mozilla.com
push dateTue, 26 Jul 2011 19:19:23 +0000
treeherdermozilla-central@0a936ddb70e9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs618683, 608013
milestone8.0a1
first release with
nightly linux32
0a936ddb70e9 / 8.0a1 / 20110727030839 / files
nightly linux64
0a936ddb70e9 / 8.0a1 / 20110727030839 / files
nightly mac
0a936ddb70e9 / 8.0a1 / 20110727030839 / files
nightly win32
0a936ddb70e9 / 8.0a1 / 20110727030839 / files
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 618683 - Quirk the full screen focus fix landed in bug 608013 to silverlight. r=bsmedberg
dom/plugins/ipc/PluginInstanceChild.cpp
dom/plugins/ipc/PluginModuleChild.cpp
dom/plugins/ipc/PluginModuleChild.h
--- a/dom/plugins/ipc/PluginInstanceChild.cpp
+++ b/dom/plugins/ipc/PluginInstanceChild.cpp
@@ -1998,17 +1998,19 @@ PluginInstanceChild::AnswerSetPluginFocu
     PR_LOG(gPluginLog, PR_LOG_DEBUG, ("%s", FULLFUNCTION));
 
 #if defined(OS_WIN)
     // Parent is letting us know the dom set focus to the plugin. Note,
     // focus can change during transit in certain edge cases, for example
     // when a button click brings up a full screen window. Since we send
     // 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 || ::GetFocus() != mPluginParentHWND)
+    if (::GetFocus() == mPluginWindowHWND ||
+        ((GetQuirks() & PluginModuleChild::QUIRK_SILVERLIGHT_FOCUS_CHECK_PARENT) &&
+         (::GetFocus() != mPluginParentHWND)))
         return true;
     ::SetFocus(mPluginWindowHWND);
     return true;
 #else
     NS_NOTREACHED("PluginInstanceChild::AnswerSetPluginFocus not implemented!");
     return false;
 #endif
 }
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -1905,16 +1905,17 @@ PluginModuleChild::InitQuirksModes(const
     mQuirks = 0;
     // application/x-silverlight
     // application/x-silverlight-2
     NS_NAMED_LITERAL_CSTRING(silverlight, "application/x-silverlight");
     if (FindInReadable(silverlight, aMimeType)) {
         mQuirks |= QUIRK_SILVERLIGHT_DEFAULT_TRANSPARENT;
 #ifdef OS_WIN
         mQuirks |= QUIRK_WINLESS_TRACKPOPUP_HOOK;
+        mQuirks |= QUIRK_SILVERLIGHT_FOCUS_CHECK_PARENT;
 #endif
     }
 
 #ifdef OS_WIN
     // application/x-shockwave-flash
     NS_NAMED_LITERAL_CSTRING(flash, "application/x-shockwave-flash");
     if (FindInReadable(flash, aMimeType)) {
         mQuirks |= QUIRK_WINLESS_TRACKPOPUP_HOOK;
--- a/dom/plugins/ipc/PluginModuleChild.h
+++ b/dom/plugins/ipc/PluginModuleChild.h
@@ -289,16 +289,20 @@ public:
         // window.
         QUIRK_FLASH_HOOK_GETWINDOWINFO                  = 1 << 5,
         // Win: Addresses a flash bug with mouse capture and full screen
         // windows.
         QUIRK_FLASH_FIXUP_MOUSE_CAPTURE                 = 1 << 6,
         // Win: QuickTime steals focus on SetWindow calls even if it's hidden.
         // Avoid calling SetWindow in that case.
         QUIRK_QUICKTIME_AVOID_SETWINDOW                 = 1 << 7,
+        // Win: Check to make sure the parent window has focus before calling
+        // set focus on the child. Addresses a full screen dialog prompt
+        // problem in Silverlight.
+        QUIRK_SILVERLIGHT_FOCUS_CHECK_PARENT            = 1 << 8,
     };
 
     int GetQuirks() { return mQuirks; }
 
 private:
     void AddQuirk(PluginQuirks quirk) {
       if (mQuirks == QUIRKS_NOT_INITIALIZED)
         mQuirks = 0;