Bug 891316 part.4 Use widget::MSGResult at nsWindow::ProcessMessageForPlugin r=jimm
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 18 Jul 2013 17:12:31 +0900
changeset 152201 8e443a45b66c686e0556729cd57bbb5455d66ab3
parent 152200 7f1e77493ee6785a1ce58d918af901ce948693c1
child 152202 d9ddda63490012c3a34a9102d52ffd42eea4909a
push id382
push userakeybl@mozilla.com
push dateMon, 21 Oct 2013 21:47:13 +0000
treeherdermozilla-release@5f1868ee45cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs891316
milestone25.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 891316 part.4 Use widget::MSGResult at nsWindow::ProcessMessageForPlugin r=jimm
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -4344,57 +4344,58 @@ LRESULT CALLBACK nsWindow::WindowProcInt
 }
 
 // The main windows message processing method for plugins.
 // The result means whether this method processed the native
 // event for plugin. If false, the native event should be
 // processed by the caller self.
 bool
 nsWindow::ProcessMessageForPlugin(const MSG &aMsg,
-                                  LRESULT *aResult,
-                                  bool &aCallDefWndProc)
-{
-  NS_PRECONDITION(aResult, "aResult must be non-null.");
-  *aResult = 0;
-
-  aCallDefWndProc = false;
+                                  MSGResult& aResult)
+{
+  aResult.mResult = 0;
+  aResult.mConsumed = true;
+
   bool eventDispatched = false;
   switch (aMsg.message) {
     case WM_CHAR:
     case WM_SYSCHAR:
-      *aResult = ProcessCharMessage(aMsg, &eventDispatched);
+      aResult.mResult = ProcessCharMessage(aMsg, &eventDispatched);
       break;
 
     case WM_KEYUP:
     case WM_SYSKEYUP:
-      *aResult = ProcessKeyUpMessage(aMsg, &eventDispatched);
+      aResult.mResult = ProcessKeyUpMessage(aMsg, &eventDispatched);
       break;
 
     case WM_KEYDOWN:
     case WM_SYSKEYDOWN:
-      *aResult = ProcessKeyDownMessage(aMsg, &eventDispatched);
+      aResult.mResult = ProcessKeyDownMessage(aMsg, &eventDispatched);
       break;
 
     case WM_DEADCHAR:
     case WM_SYSDEADCHAR:
 
     case WM_CUT:
     case WM_COPY:
     case WM_PASTE:
     case WM_CLEAR:
     case WM_UNDO:
       break;
 
     default:
       return false;
   }
 
-  if (!eventDispatched)
-    aCallDefWndProc = !nsWindowBase::DispatchPluginEvent(aMsg);
-  DispatchPendingEvents();
+  if (!eventDispatched) {
+    aResult.mConsumed = nsWindowBase::DispatchPluginEvent(aMsg);
+  }
+  if (!Destroyed()) {
+    DispatchPendingEvents();
+  }
   return true;
 }
 
 static void ForceFontUpdate()
 {
   // update device context font cache
   // Dirty but easiest way:
   // Changing nsIPrefBranch entry which triggers callbacks
@@ -4438,21 +4439,18 @@ nsWindow::ExternalHandlerProcessMessage(
   }
 
   if (MouseScrollHandler::ProcessMessage(this, aMessage, aWParam, aLParam,
                                          aResult)) {
     return true;
   }
 
   if (PluginHasFocus()) {
-    bool callDefaultWndProc;
     MSG nativeMsg = WinUtils::InitMSG(aMessage, aWParam, aLParam, mWnd);
-    if (ProcessMessageForPlugin(nativeMsg, &aResult.mResult,
-                                callDefaultWndProc)) {
-      aResult.mConsumed = !callDefaultWndProc;
+    if (ProcessMessageForPlugin(nativeMsg, aResult)) {
       return true;
     }
   }
 
   return false;
 }
 
 // The main windows message processing method.
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -329,17 +329,17 @@ protected:
   bool                    DispatchCommandEvent(uint32_t aEventCommand);
   void                    RelayMouseEvent(UINT aMsg, WPARAM wParam, LPARAM lParam);
   virtual bool            ProcessMessage(UINT msg, WPARAM &wParam,
                                          LPARAM &lParam, LRESULT *aRetValue);
   bool                    ExternalHandlerProcessMessage(
                                          UINT aMessage, WPARAM& aWParam,
                                          LPARAM& aLParam, MSGResult& aResult);
   bool                    ProcessMessageForPlugin(const MSG &aMsg,
-                                                  LRESULT *aRetValue, bool &aCallDefWndProc);
+                                                  MSGResult& aResult);
   LRESULT                 ProcessCharMessage(const MSG &aMsg,
                                              bool *aEventDispatched);
   LRESULT                 ProcessKeyUpMessage(const MSG &aMsg,
                                               bool *aEventDispatched);
   LRESULT                 ProcessKeyDownMessage(const MSG &aMsg,
                                                 bool *aEventDispatched);
   static bool             EventIsInsideWindow(UINT Msg, nsWindow* aWindow);
   // Convert nsEventStatus value to a windows boolean