Backed out 2 changesets (bug 1549972, bug 1534389) for causing bug 1551961 a=backout
authorAndreea Pavel <apavel@mozilla.com>
Thu, 20 Jun 2019 08:24:21 +0300
changeset 537042 02be9e9185f4656f0c844d74132dc59655eeff5c
parent 537041 47c6c32852d33b1d5197e290aaa628a89e792098
child 537043 4690bfa8e77ba522a52acf1e81d4026b5238a5b7
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1549972, 1534389, 1551961
milestone68.0
backs out8f236d0ba0fac44d77a3098b85adf085feef9e3a
0930049c0ca984c909d11ba2853ef6d96e43e242
Backed out 2 changesets (bug 1549972, bug 1534389) for causing bug 1551961 a=backout Backed out changeset 8f236d0ba0fa (bug 1549972) Backed out changeset 0930049c0ca9 (bug 1534389)
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -589,17 +589,16 @@ nsWindow::nsWindow(bool aIsChildWindow)
   mUnicodeWidget = true;
   mDisplayPanFeedback = false;
   mTouchWindow = false;
   mFutureMarginsToUse = false;
   mCustomNonClient = false;
   mHideChrome = false;
   mFullscreenMode = false;
   mMousePresent = false;
-  mMouseInDraggableArea = false;
   mDestroyCalled = false;
   mIsEarlyBlankWindow = false;
   mHasTaskbarIconBeenCreated = false;
   mMouseTransparent = false;
   mPickerDisplayCount = 0;
   mWindowType = eWindowType_child;
   mBorderStyle = eBorderStyle_default;
   mOldSizeMode = nsSizeMode_Normal;
@@ -5307,34 +5306,31 @@ bool nsWindow::ProcessMessage(UINT msg, 
     case WM_ERASEBKGND:
       if (!AutoErase((HDC)wParam)) {
         *aRetValue = 1;
         result = true;
       }
       break;
 
     case WM_MOUSEMOVE: {
-      LPARAM lParamScreen = lParamToScreen(lParam);
-      mMouseInDraggableArea = WithinDraggableRegion(GET_X_LPARAM(lParamScreen),
-                                                    GET_Y_LPARAM(lParamScreen));
-
       if (!mMousePresent && !sIsInMouseCapture) {
         // First MOUSEMOVE over the client area. Ask for MOUSELEAVE
         TRACKMOUSEEVENT mTrack;
         mTrack.cbSize = sizeof(TRACKMOUSEEVENT);
         mTrack.dwFlags = TME_LEAVE;
         mTrack.dwHoverTime = 0;
         mTrack.hwndTrack = mWnd;
         TrackMouseEvent(&mTrack);
       }
       mMousePresent = true;
 
       // Suppress dispatch of pending events
       // when mouse moves are generated by widget
       // creation instead of user input.
+      LPARAM lParamScreen = lParamToScreen(lParam);
       POINT mp;
       mp.x = GET_X_LPARAM(lParamScreen);
       mp.y = GET_Y_LPARAM(lParamScreen);
       bool userMovedMouse = false;
       if ((sLastMouseMovePoint.x != mp.x) || (sLastMouseMovePoint.y != mp.y)) {
         userMovedMouse = true;
       }
 
@@ -5342,28 +5338,22 @@ bool nsWindow::ProcessMessage(UINT msg, 
           DispatchMouseEvent(eMouseMove, wParam, lParam, false,
                              MouseButton::eLeft, MOUSE_INPUT_SOURCE(),
                              mPointerEvents.GetCachedPointerInfo(msg, wParam));
       if (userMovedMouse) {
         DispatchPendingEvents();
       }
     } break;
 
-    case WM_NCMOUSEMOVE: {
-      LPARAM lParamClient = lParamToClient(lParam);
-      if (WithinDraggableRegion(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))) {
-        // If we noticed the mouse moving in our draggable region, forward the
-        // message as a normal WM_MOUSEMOVE.
-        SendMessage(mWnd, WM_MOUSEMOVE, 0, lParamClient);
-      } else if (mMousePresent && !sIsInMouseCapture) {
-        // If we receive a mouse move event on non-client chrome, make sure and
-        // send an eMouseExitFromWidget event as well.
+    case WM_NCMOUSEMOVE:
+      // If we receive a mouse move event on non-client chrome, make sure and
+      // send an eMouseExitFromWidget event as well.
+      if (mMousePresent && !sIsInMouseCapture)
         SendMessage(mWnd, WM_MOUSELEAVE, 0, 0);
-      }
-    } break;
+      break;
 
     case WM_LBUTTONDOWN: {
       result =
           DispatchMouseEvent(eMouseDown, wParam, lParam, false,
                              MouseButton::eLeft, MOUSE_INPUT_SOURCE(),
                              mPointerEvents.GetCachedPointerInfo(msg, wParam));
       DispatchPendingEvents();
     } break;
@@ -5373,17 +5363,16 @@ bool nsWindow::ProcessMessage(UINT msg, 
           DispatchMouseEvent(eMouseUp, wParam, lParam, false,
                              MouseButton::eLeft, MOUSE_INPUT_SOURCE(),
                              mPointerEvents.GetCachedPointerInfo(msg, wParam));
       DispatchPendingEvents();
     } break;
 
     case WM_MOUSELEAVE: {
       if (!mMousePresent) break;
-      if (mMouseInDraggableArea) break;
       mMousePresent = false;
 
       // Check if the mouse is over the fullscreen transition window, if so
       // clear sLastMouseMovePoint. This way the WM_MOUSEMOVE we get after the
       // transition window disappears will not be ignored, even if the mouse
       // hasn't moved.
       if (mTransitionWnd && WindowAtMouse() == mTransitionWnd) {
         sLastMouseMovePoint = {0};
@@ -6158,41 +6147,34 @@ int32_t nsWindow::ClientMarginHitTestPoi
       testResult = HTCAPTION;
     else if (bottom || left || right)
       testResult = HTBORDER;
   }
 
   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;
     }
-
-    mCachedHitTestPoint = {pt.x, pt.y};
-    mCachedHitTestTime = TimeStamp::Now();
-
     if (mDraggableRegion.Contains(pt.x, pt.y)) {
       testResult = HTCAPTION;
     } else {
       testResult = HTCLIENT;
     }
+    mCachedHitTestPoint = pt;
+    mCachedHitTestTime = TimeStamp::Now();
     mCachedHitTestResult = testResult;
   }
 
   return testResult;
 }
 
-bool nsWindow::WithinDraggableRegion(int32_t screenX, int32_t screenY) {
-  return ClientMarginHitTestPoint(screenX, screenY) == HTCAPTION;
-}
-
 TimeStamp nsWindow::GetMessageTimeStamp(LONG aEventTime) const {
   CurrentWindowsTimeGetter getCurrentTime(mWnd);
   return TimeConverter().GetTimeStampFromSystemTime(aEventTime, getCurrentTime);
 }
 
 void nsWindow::PostSleepWakeNotification(const bool aIsSleepMode) {
   if (aIsSleepMode == gIsSleepMode) return;
 
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -479,17 +479,16 @@ class nsWindow final : public nsWindowBa
    */
 #ifdef MOZ_XUL
  private:
   void SetWindowTranslucencyInner(nsTransparencyMode aMode);
   nsTransparencyMode GetWindowTranslucencyInner() const {
     return mTransparencyMode;
   }
   void UpdateGlass();
-  bool WithinDraggableRegion(int32_t clientX, int32_t clientY);
 
  protected:
 #endif  // MOZ_XUL
 
   static bool IsAsyncResponseEvent(UINT aMsg, LRESULT& aResult);
   void IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam);
 
   /**
@@ -545,17 +544,16 @@ class nsWindow final : public nsWindowBa
   bool mUnicodeWidget;
   bool mPainting;
   bool mTouchWindow;
   bool mDisplayPanFeedback;
   bool mHideChrome;
   bool mIsRTL;
   bool mFullscreenMode;
   bool mMousePresent;
-  bool mMouseInDraggableArea;
   bool mDestroyCalled;
   bool mOpeningAnimationSuppressed;
   bool mAlwaysOnTop;
   bool mIsEarlyBlankWindow;
   uint32_t mBlurSuppressLevel;
   DWORD_PTR mOldStyle;
   DWORD_PTR mOldExStyle;
   nsNativeDragTarget* mNativeDragTarget;
@@ -659,28 +657,27 @@ class nsWindow final : public nsWindowBa
   bool mMouseTransparent;
 
   // Whether we're in the process of sending a WM_SETTEXT ourselves
   bool mSendingSetText;
 
   // Whether we we're created as a child window (aka ChildWindow) or not.
   bool mIsChildWindow : 1;
 
-  int32_t mCachedHitTestResult;
-
   // The point in time at which the last paint completed. We use this to avoid
   //  painting too rapidly in response to frequent input events.
   TimeStamp mLastPaintEndTime;
 
   // The location of the window buttons in the window.
   mozilla::Maybe<LayoutDeviceIntRect> mWindowButtonsRect;
 
   // Caching for hit test results
   POINT mCachedHitTestPoint;
   TimeStamp mCachedHitTestTime;
+  int32_t mCachedHitTestResult;
 
   RefPtr<mozilla::widget::WinCompositorWidget> mBasicLayersSurface;
 
   static bool sNeedsToInitMouseWheelSettings;
   static void InitMouseWheelScrollData();
 
   double mSizeConstraintsScale;  // scale in effect when setting constraints