Bug 648935 - When paint events are deferred in WindowsMessageLoop, temporarily validate the plugin until painting can occur. r=bent.
authorJim Mathies <jmathies@mozilla.com>
Wed, 18 May 2011 06:57:08 -0500
changeset 69911 02f44011950845aff53434f43fd54c0031bad435
parent 69910 945d0adb6232146bab590a7d6fa171722dcf97e3
child 69912 d40eac0106f52ef4a6834616b7a53cefe62c0af0
push id76
push userbzbarsky@mozilla.com
push dateTue, 05 Jul 2011 17:00:57 +0000
treeherdermozilla-beta@d3a2732c35f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs648935
milestone6.0a1
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 648935 - When paint events are deferred in WindowsMessageLoop, temporarily validate the plugin until painting can occur. r=bent.
ipc/glue/WindowsMessageLoop.cpp
ipc/glue/WindowsMessageLoop.h
--- a/ipc/glue/WindowsMessageLoop.cpp
+++ b/ipc/glue/WindowsMessageLoop.cpp
@@ -991,29 +991,40 @@ DeferredRedrawMessage::Run()
 
 #ifdef DEBUG
   BOOL ret =
 #endif
   RedrawWindow(hWnd, NULL, NULL, flags);
   NS_ASSERTION(ret, "RedrawWindow failed!");
 }
 
+DeferredUpdateMessage::DeferredUpdateMessage(HWND aHWnd)
+{
+  mWnd = aHWnd;
+  if (!GetUpdateRect(mWnd, &mUpdateRect, FALSE)) {
+    memset(&mUpdateRect, 0, sizeof(RECT));
+    return;
+  }
+  ValidateRect(mWnd, &mUpdateRect);
+}
+
 void
 DeferredUpdateMessage::Run()
 {
-  AssertWindowIsNotNeutered(hWnd);
-  if (!IsWindow(hWnd)) {
+  AssertWindowIsNotNeutered(mWnd);
+  if (!IsWindow(mWnd)) {
     NS_ERROR("Invalid window!");
     return;
   }
 
+  InvalidateRect(mWnd, &mUpdateRect, FALSE);
 #ifdef DEBUG
   BOOL ret =
 #endif
-  UpdateWindow(hWnd);
+  UpdateWindow(mWnd);
   NS_ASSERTION(ret, "UpdateWindow failed!");
 }
 
 DeferredSettingChangeMessage::DeferredSettingChangeMessage(HWND aHWnd,
                                                            UINT aMessage,
                                                            WPARAM aWParam,
                                                            LPARAM aLParam)
 : DeferredSendMessage(aHWnd, aMessage, aWParam, aLParam)
--- a/ipc/glue/WindowsMessageLoop.h
+++ b/ipc/glue/WindowsMessageLoop.h
@@ -108,24 +108,23 @@ private:
   HWND hWnd;
   UINT flags;
 };
 
 // Uses UpdateWindow to generate a WM_PAINT message if needed.
 class DeferredUpdateMessage : public DeferredMessage
 {
 public:
-  DeferredUpdateMessage(HWND aHWnd)
-    : hWnd(aHWnd)
-  { }
+  DeferredUpdateMessage(HWND aHWnd);
 
   virtual void Run();
 
 private:
-  HWND hWnd;
+  HWND mWnd;
+  RECT mUpdateRect;
 };
 
 // This class duplicates a string that may exist in the lParam member of the
 // message.
 class DeferredSettingChangeMessage : public DeferredSendMessage
 {
 public:
   DeferredSettingChangeMessage(HWND aHWnd,