Bug 628872 - BBC iplayer fullscreen function broken since FF4 beta 9. r=bent@mozilla.com, a=blocker
authorJim Mathies <jmathies@mozilla.com>
Tue, 15 Feb 2011 21:18:02 -0800
changeset 62644 b096f6bfce3015a862470756cd2861ecc80ef80c
parent 62643 f9e8182eb1257804a319fc3b7eaa05e602b3ca1a
child 62645 1fd068c483d8013013ffe7bd12971f63db983dec
push id18812
push userjst@mozilla.com
push dateWed, 16 Feb 2011 05:18:33 +0000
treeherdermozilla-central@b096f6bfce30 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent, blocker
bugs628872
milestone2.0b12pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 628872 - BBC iplayer fullscreen function broken since FF4 beta 9. r=bent@mozilla.com, a=blocker
dom/plugins/PluginInstanceChild.cpp
dom/plugins/PluginModuleChild.cpp
dom/plugins/PluginModuleChild.h
--- a/dom/plugins/PluginInstanceChild.cpp
+++ b/dom/plugins/PluginInstanceChild.cpp
@@ -46,17 +46,17 @@
 #include "gfxASurface.h"
 #include "gfxContext.h"
 #ifdef MOZ_X11
 #include "gfxXlibSurface.h"
 #endif
 #ifdef XP_WIN
 #include "mozilla/gfx/SharedDIBSurface.h"
 #include "nsCrashOnException.h"
-
+extern const PRUnichar* kFlashFullscreenClass;
 using mozilla::gfx::SharedDIBSurface;
 #endif
 #include "gfxSharedImageSurface.h"
 #include "gfxUtils.h"
 #include "gfxAlphaRecovery.h"
 
 #include "mozilla/ipc/SyncChannel.h"
 
@@ -1208,35 +1208,37 @@ PluginInstanceChild::PluginWindowProcInt
       self->CallPluginFocusChange(false);
 
     if (message == WM_USER+1 &&
         (self->GetQuirks() & PluginModuleChild::QUIRK_FLASH_THROTTLE_WMUSER_EVENTS)) {
         self->FlashThrottleMessage(hWnd, message, wParam, lParam, true);
         return 0;
     }
 
-    NS_ASSERTION(self->mPluginWndProc != PluginWindowProc, "Self-referential windowproc happened inside our hook proc. Infinite recursion will happen soon.");
+    NS_ASSERTION(self->mPluginWndProc != PluginWindowProc,
+      "Self-referential windowproc happened inside our hook proc. "
+      "Infinite recursion will happen soon.");
 
     LRESULT res = CallWindowProc(self->mPluginWndProc, hWnd, message, wParam,
                                  lParam);
 
     // Make sure capture is released by the child on mouse events. Fixes a
     // problem with flash full screen mode mouse input. Appears to be
     // caused by a bug in flash, since we are not setting the capture
-    // on the window. (In non-oopp land, we would set and release via
-    // widget for other reasons.)
-    switch (message) {
-      case WM_LBUTTONDOWN:
-      case WM_MBUTTONDOWN:
-      case WM_RBUTTONDOWN:
-      case WM_LBUTTONUP:
-      case WM_MBUTTONUP:
-      case WM_RBUTTONUP:
-      ReleaseCapture();
-      break;
+    // on the window.
+    if (message == WM_LBUTTONDOWN &&
+        self->GetQuirks() & PluginModuleChild::QUIRK_FLASH_FIXUP_MOUSE_CAPTURE) {
+      PRUnichar szClass[26];
+      HWND hwnd = GetForegroundWindow();
+      if (hwnd && GetClassNameW(hwnd, szClass,
+                                sizeof(szClass)/sizeof(PRUnichar)) &&
+          !wcscmp(szClass, kFlashFullscreenClass)) {
+        ReleaseCapture();
+        SetFocus(hwnd);
+      }
     }
 
     if (message == WM_CLOSE)
         self->DestroyPluginWindow();
 
     if (message == WM_NCDESTROY)
         RemoveProp(hWnd, kPluginInstanceChildProperty);
 
--- a/dom/plugins/PluginModuleChild.cpp
+++ b/dom/plugins/PluginModuleChild.cpp
@@ -1857,16 +1857,17 @@ PluginModuleChild::InitQuirksModes(const
     // application/x-shockwave-flash
     NS_NAMED_LITERAL_CSTRING(flash, "application/x-shockwave-flash");
     if (FindInReadable(flash, aMimeType)) {
         mQuirks |= QUIRK_WINLESS_TRACKPOPUP_HOOK;
         mQuirks |= QUIRK_FLASH_THROTTLE_WMUSER_EVENTS; 
         mQuirks |= QUIRK_FLASH_HOOK_SETLONGPTR;
         mQuirks |= QUIRK_FLASH_HOOK_GETWINDOWINFO;
         mQuirks |= QUIRK_FLASH_MASK_CLEARTYPE_SETTINGS;
+        mQuirks |= QUIRK_FLASH_FIXUP_MOUSE_CAPTURE;
     }
 #endif
 }
 
 bool
 PluginModuleChild::AnswerPPluginInstanceConstructor(PPluginInstanceChild* aActor,
                                                     const nsCString& aMimeType,
                                                     const uint16_t& aMode,
--- a/dom/plugins/PluginModuleChild.h
+++ b/dom/plugins/PluginModuleChild.h
@@ -244,16 +244,19 @@ public:
         QUIRK_FLASH_EXPOSE_COORD_TRANSLATION            = 1 << 4,
         // Win32: Catch get window info calls on the browser and tweak the
         // results so mouse input works when flash is displaying it's settings
         // window.
         QUIRK_FLASH_HOOK_GETWINDOWINFO                  = 1 << 5,
         // Win: Flash trashes the alpha channel in our buffers when cleartype
         // is enabled. Mask this setting so they don't know it's enabled.
         QUIRK_FLASH_MASK_CLEARTYPE_SETTINGS             = 1 << 6,
+        // Win: Addresses a flash bug with mouse capture and full screen
+        // windows.
+        QUIRK_FLASH_FIXUP_MOUSE_CAPTURE                 = 1 << 7,
     };
 
     int GetQuirks() { return mQuirks; }
     void AddQuirk(PluginQuirks quirk) {
       if (mQuirks == QUIRKS_NOT_INITIALIZED)
         mQuirks = 0;
       mQuirks |= quirk;
     }