Bug 1219215 - part 4: remove dispatching of MozMouseHittest on Windows, r=jimm draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 14 Jan 2016 16:57:34 +0000
changeset 323926 8d33f36462392e56654256a02bbf22bec74f4709
parent 323925 d88ee32370770af3222311fa05b5b76690635ce2
child 513297 5f90413da63dccbb61a7861e54a45d37ed53f6d7
push id9811
push usergijskruitbosch@gmail.com
push dateThu, 21 Jan 2016 15:39:14 +0000
reviewersjimm
bugs1219215
milestone46.0a1
Bug 1219215 - part 4: remove dispatching of MozMouseHittest on Windows, r=jimm
widget/windows/nsWindow.cpp
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -5304,34 +5304,21 @@ nsWindow::ProcessMessage(UINT msg, WPARA
         pos = lParamToClient(lParam);
       }
 
       result = DispatchMouseEvent(eContextMenu, wParam, pos, contextMenukey,
                                   contextMenukey ?
                                     WidgetMouseEvent::eLeftButton :
                                     WidgetMouseEvent::eRightButton,
                                   MOUSE_INPUT_SOURCE());
-      if (lParam != -1 && !result && mCustomNonClient) {
-        bool shouldShowMenu = false;
-        if (mDraggableRegion.Contains(GET_X_LPARAM(pos), GET_Y_LPARAM(pos))) {
-          shouldShowMenu = true;
-        } else {
-          WidgetMouseEvent event(true, eMouseHitTest, this,
-                                 WidgetMouseEvent::eReal,
-                                 WidgetMouseEvent::eNormal);
-          event.refPoint = LayoutDeviceIntPoint(GET_X_LPARAM(pos), GET_Y_LPARAM(pos));
-          event.inputSource = MOUSE_INPUT_SOURCE();
-          event.mFlags.mOnlyChromeDispatch = true;
-          shouldShowMenu = DispatchWindowEvent(&event);
-        }
-        if (shouldShowMenu) {
-          // Blank area hit, throw up the system menu.
-          DisplaySystemMenu(mWnd, mSizeMode, mIsRTL, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
-          result = true;
-        }
+      if (lParam != -1 && !result && mCustomNonClient &&
+          mDraggableRegion.Contains(GET_X_LPARAM(pos), GET_Y_LPARAM(pos))) {
+        // Blank area hit, throw up the system menu.
+        DisplaySystemMenu(mWnd, mSizeMode, mIsRTL, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
+        result = true;
       }
     }
     break;
 
     case WM_LBUTTONDBLCLK:
       result = DispatchMouseEvent(eMouseDoubleClick, wParam,
                                   lParam, false,
                                   WidgetMouseEvent::eLeftButton,
@@ -6006,34 +5993,21 @@ nsWindow::ClientMarginHitTestPoint(int32
   }
 
   if (!sIsInMouseCapture && allowContentOverride) {
     POINT pt = { mx, my };
     ::ScreenToClient(mWnd, &pt);
     if (pt.x == mCachedHitTestPoint.x && pt.y == mCachedHitTestPoint.y &&
         TimeStamp::Now() - mCachedHitTestTime < TimeDuration::FromMilliseconds(HITTEST_CACHE_LIFETIME_MS)) {
       return mCachedHitTestResult;
-    } else if (mDraggableRegion.Contains(pt.x, pt.y)) {
+    }
+    if (mDraggableRegion.Contains(pt.x, pt.y)) {
       testResult = HTCAPTION;
     } else {
-      WidgetMouseEvent event(true, eMouseHitTest, this,
-                             WidgetMouseEvent::eReal,
-                             WidgetMouseEvent::eNormal);
-      event.refPoint = LayoutDeviceIntPoint(pt.x, pt.y);
-      event.inputSource = MOUSE_INPUT_SOURCE();
-      event.mFlags.mOnlyChromeDispatch = true;
-      bool result = ConvertStatus(DispatchInputEvent(&event));
-      if (result) {
-        // The mouse is over a blank area
-        testResult = testResult == HTCLIENT ? HTCAPTION : testResult;
-      } else {
-        // There's content over the mouse pointer. Set HTCLIENT
-        // to possibly override a resizer border.
-        testResult = HTCLIENT;
-      }
+      testResult = HTCLIENT;
     }
     mCachedHitTestPoint = pt;
     mCachedHitTestTime = TimeStamp::Now();
     mCachedHitTestResult = testResult;
   }
 
   return testResult;
 }