Title: [231511] trunk/Source/WebKit
Revision
231511
Author
[email protected]
Date
2018-05-08 14:19:36 -0700 (Tue, 08 May 2018)

Log Message

REGRESSION(r230743): Mousemove events are not coalesced properly, mousemove/drag is very laggy
https://bugs.webkit.org/show_bug.cgi?id=185425
<rdar://problem/39323336>

Reviewed by Simon Fraser.

When mousemove events come in faster than they can be processed, we should coalesce
pending mousemoves that have not yet been sent to WebProcess. This has the effect of
processing the most recent mousemove location, which is the old behavior that regressed.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleMouseEvent):
If there is >1 event in the mouse queue, then the first one is being processed by WebProcess
and the second one is eligible for coalescing. Replace it if the last event and new event
are both mousemoves.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (231510 => 231511)


--- trunk/Source/WebKit/ChangeLog	2018-05-08 20:34:05 UTC (rev 231510)
+++ trunk/Source/WebKit/ChangeLog	2018-05-08 21:19:36 UTC (rev 231511)
@@ -1,3 +1,21 @@
+2018-05-08  Brian Burg  <[email protected]>
+
+        REGRESSION(r230743): Mousemove events are not coalesced properly, mousemove/drag is very laggy
+        https://bugs.webkit.org/show_bug.cgi?id=185425
+        <rdar://problem/39323336>
+
+        Reviewed by Simon Fraser.
+
+        When mousemove events come in faster than they can be processed, we should coalesce
+        pending mousemoves that have not yet been sent to WebProcess. This has the effect of
+        processing the most recent mousemove location, which is the old behavior that regressed.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::handleMouseEvent):
+        If there is >1 event in the mouse queue, then the first one is being processed by WebProcess
+        and the second one is eligible for coalescing. Replace it if the last event and new event
+        are both mousemoves.
+
 2018-05-08  Per Arne Vollan  <[email protected]>
 
         The PDF context menu should not be created in the WebContent process.

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (231510 => 231511)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-05-08 20:34:05 UTC (rev 231510)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-05-08 21:19:36 UTC (rev 231511)
@@ -1928,8 +1928,16 @@
     if (!isValid())
         return;
 
-    LOG(MouseHandling, "UIProcess: enqueued mouse event %s (queue size %zu)", webMouseEventTypeString(event.type()), m_mouseEventQueue.size());
-    m_mouseEventQueue.append(event);
+    // If we receive multiple mousemove events and the most recent mousemove event has not been
+    // sent to WebProcess for processing, replace the pending mousemove event with a new one.
+    if (event.type() == WebEvent::MouseMove && m_mouseEventQueue.size() > 1 && m_mouseEventQueue.last().type() == WebEvent::MouseMove) {
+        LOG(MouseHandling, "UIProcess: updated pending mousemove event (queue size %zu)", m_mouseEventQueue.size());
+        m_mouseEventQueue.removeLast();
+        m_mouseEventQueue.append(event);
+    } else {
+        LOG(MouseHandling, "UIProcess: enqueued mouse event %s (queue size %zu)", webMouseEventTypeString(event.type()), m_mouseEventQueue.size());
+        m_mouseEventQueue.append(event);
+    }
     if (m_mouseEventQueue.size() == 1) // Otherwise, called from DidReceiveEvent message handler.
         processNextQueuedMouseEvent();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to