bug 1362404 - Handle out-of-order overlapping event coalescing. r?masayuki draft
authorChris H-C <chutten@mozilla.com>
Tue, 09 May 2017 11:07:40 -0400
changeset 574911 1a11c7b25b75b3a548d759896d11f19feaa977f0
parent 573462 9d46ca4e00c2c8111b1df15ab4cf185de23a2b50
child 627734 db754cd1451f241923730f83818ce82ab2eaf049
push id57853
push userbmo:chutten@mozilla.com
push dateTue, 09 May 2017 15:12:35 +0000
reviewersmasayuki
bugs1362404
milestone55.0a1
bug 1362404 - Handle out-of-order overlapping event coalescing. r?masayuki There are situations where events may be handled out-of-order. Allow coalescing to happen backwards in time as well as forwards to cover them. MozReview-Commit-ID: 3k7vNFxE1cz
layout/base/PresShell.cpp
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -8280,16 +8280,20 @@ PresShell::HandleEventInternal(WidgetEve
       if (sLastInputProcessed) {
         // This input event was created after we handled the last one.
         // Accumulate the previous events' coalesced duration.
         double lastMillis = (sLastInputProcessed - sLastInputCreated).ToMilliseconds();
         Telemetry::Accumulate(Telemetry::INPUT_EVENT_RESPONSE_COALESCED_MS,
                               lastMillis);
       }
       sLastInputCreated = aEvent->mTimeStamp;
+    } else if (aEvent->mTimeStamp < sLastInputCreated) {
+      // This event was created before the last input. May be processing out
+      // of order, so coalesce backwards, too.
+      sLastInputCreated = aEvent->mTimeStamp;
     }
     sLastInputProcessed = now;
   }
 
   return rv;
 }
 
 /* static */ void