Bug 1466208 - part 37: Move trusted eMouseMove event preparation into the previous switch-case block r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 08 Mar 2019 23:37:34 +0000
changeset 521228 e5e798d73ac6
parent 521227 004ff60a5824
child 521229 9c7a5a08510a
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1466208
milestone67.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 1466208 - part 37: Move trusted eMouseMove event preparation into the previous switch-case block r=smaug Oddly, there are two trusted eMouseMove preparation code in `PresShell::EventHandler::HandleEventInternal()`. One is in the `switch` statement which is used only when `aEvent` is trusted. The other is after `TouchManager::PreHandleEvent()` is called and after `AutoHandlingUserInputStatePusher` is created. However, both of them do nothing if the event is `eMouseMove`. Therefore, we can move the latter into the former. Differential Revision: https://phabricator.services.mozilla.com/D21338
layout/base/PresShell.cpp
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -7738,16 +7738,23 @@ nsresult PresShell::EventHandler::Handle
         break;
 
       case eMouseMove:
         if (aEvent->mFlags.mHandledByAPZ) {
           Telemetry::AccumulateTimeDelta(
               Telemetry::INPUT_EVENT_QUEUED_APZ_MOUSE_MOVE_MS,
               aEvent->mTimeStamp);
         }
+
+        nsIPresShell::AllowMouseCapture(
+            EventStateManager::GetActiveEventStateManager() == manager);
+
+        GetPresContext()->RecordInteractionTime(
+            nsPresContext::InteractionType::eMouseMoveInteraction,
+            aEvent->mTimeStamp);
         break;
 
       case eDrop: {
         nsCOMPtr<nsIDragSession> session = nsContentUtils::GetDragSession();
         if (session) {
           bool onlyChromeDrop = false;
           session->GetOnlyChromeDrop(&onlyChromeDrop);
           if (onlyChromeDrop) {
@@ -7790,25 +7797,16 @@ nsresult PresShell::EventHandler::Handle
   if (aEvent->mMessage == eContextMenu &&
       !PrepareToDispatchContextMenuEvent(aEvent)) {
     return NS_OK;
   }
 
   AutoHandlingUserInputStatePusher userInpStatePusher(isHandlingUserInput,
                                                       aEvent, GetDocument());
 
-  if (aEvent->IsTrusted() && aEvent->mMessage == eMouseMove) {
-    nsIPresShell::AllowMouseCapture(
-        EventStateManager::GetActiveEventStateManager() == manager);
-
-    GetPresContext()->RecordInteractionTime(
-        nsPresContext::InteractionType::eMouseMoveInteraction,
-        aEvent->mTimeStamp);
-  }
-
   nsAutoPopupStatePusher popupStatePusher(
       PopupBlocker::GetEventPopupControlState(aEvent));
 
   // FIXME. If the event was reused, we need to clear the old target,
   // bug 329430
   aEvent->mTarget = nullptr;
 
   HandlingTimeAccumulator handlingTimeAccumulator(*this, aEvent);