Bug 501379 - Wheel scroll bustage fix for bug 478245. r=dougt.
authorJim Mathies <jmathies@mozilla.com>
Tue, 30 Jun 2009 13:19:15 -0500
changeset 29851 9b3b3169bf081894775a78d0501dd5b457ec15cf
parent 29850 e3ec5794180bc44d857a8314970b03a57541baee
child 29852 5aef00deba4c30f1d6d5894959f04adbc29df76e
push idunknown
push userunknown
push dateunknown
reviewersdougt
bugs501379, 478245
milestone1.9.2a1pre
Bug 501379 - Wheel scroll bustage fix for bug 478245. r=dougt.
widget/src/windows/nsWindow.cpp
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -4383,18 +4383,26 @@ PRBool nsWindow::ProcessMessage(UINT msg
   case WM_HIBERNATE:        
     nsMemory::HeapMinimize(PR_TRUE);
     break;
 #endif
 
 #if !defined(WINCE)
   case WM_MOUSEWHEEL:
   case WM_MOUSEHWHEEL:
-    if (OnMouseWheel(msg, wParam, lParam, getWheelInfo, result, aRetValue))
-      return result;
+    {
+      // If OnMouseWheel returns true, the event was forwarded directly to another
+      // mozilla window message handler (ProcessMessage). In this case the return
+      // value of the forwarded event is in 'result' which we should return immediately.
+      // If OnMouseWheel returns false, OnMouseWheel processed the event internally.
+      // 'result' and 'aRetValue' will be set based on what we did with the event, so
+      // we should fall through.
+      if (OnMouseWheel(msg, wParam, lParam, getWheelInfo, result, aRetValue))
+        return result;
+    }
     break;
 #endif
 
 #ifndef WINCE
   case WM_DWMCOMPOSITIONCHANGED:
     BroadcastMsg(mWnd, WM_DWMCOMPOSITIONCHANGED);
     DispatchStandardEvent(NS_THEMECHANGED);
     if (nsUXThemeData::CheckForCompositor() && mTransparencyMode == eTransparencyGlass) {
@@ -5022,17 +5030,17 @@ PRBool nsWindow::OnMouseWheel(UINT msg, 
   InitEvent(scrollEvent);
   if (nsnull != mEventCallback) {
     result = DispatchWindowEvent(&scrollEvent);
   }
   // Note that we should return zero if we process WM_MOUSEWHEEL.
   // But if we process WM_MOUSEHWHEEL, we should return non-zero.
 
   if (result)
-    result = isVertical ? 0 : TRUE;
+    *aRetValue = isVertical ? 0 : TRUE;
   
   return PR_FALSE; // break;
 } 
 #endif // !defined(WINCE)
 
 static PRBool
 StringCaseInsensitiveEquals(const PRUnichar* aChars1, const PRUint32 aNumChars1,
                             const PRUnichar* aChars2, const PRUint32 aNumChars2)