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 463363 e5e798d73ac60837904e9e84753be4173c3a0924
parent 463362 004ff60a582409935f5a4a9d2c24c946c085b482
child 463364 9c7a5a08510aa3eed5ba6d7da49344ef7691e8bd
push id80096
push usermasayuki@d-toybox.com
push dateSat, 09 Mar 2019 04:15:15 +0000
treeherderautoland@e5e798d73ac6 [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);