<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[285301] branches/safari-612-branch/Source/WebKit</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/285301">285301</a></dd>
<dt>Author</dt> <dd>repstein@apple.com</dd>
<dt>Date</dt> <dd>2021-11-04 12:40:25 -0700 (Thu, 04 Nov 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Cherry-pick <a href="http://trac.webkit.org/projects/webkit/changeset/285165">r285165</a>. rdar://problem/84908023

    Revert the wheel event coalescing added in <a href="http://trac.webkit.org/projects/webkit/changeset/277587">r277587</a>
    https://bugs.webkit.org/show_bug.cgi?id=232602
    <rdar://84908023>

    Reviewed by Wenson Hsieh.

    This wheel event coalescing was added to allow the tail end of momentum scrolls on
    120Hz devices to fall back to 60fps for power reasons. However, the OS does this for
    us, so we don't need to do our own coalescing.

    * Shared/WebWheelEventCoalescer.cpp:
    (WebKit::WebWheelEventCoalescer::shouldDispatchEvent):
    (WebKit::WebWheelEventCoalescer::isMomentumPhaseEvent): Deleted.
    * Shared/WebWheelEventCoalescer.h:
    (WebKit::WebWheelEventCoalescer::shouldCoalesceEventsDuringDeceleration const): Deleted.
    (WebKit::WebWheelEventCoalescer::setShouldCoalesceEventsDuringDeceleration): Deleted.
    (): Deleted.
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::wheelEventCoalescer):
    (WebKit::WebPageProxy::windowScreenDidChange):
    (WebKit::WebPageProxy::shouldCoalesceWheelEventsDuringDeceleration const): Deleted.
    * UIProcess/WebPageProxy.h:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285165 268f45cc-cd09-0410-ab3c-d52691b4dbfc</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari612branchSourceWebKitChangeLog">branches/safari-612-branch/Source/WebKit/ChangeLog</a></li>
<li><a href="#branchessafari612branchSourceWebKitSharedWebWheelEventCoalescercpp">branches/safari-612-branch/Source/WebKit/Shared/WebWheelEventCoalescer.cpp</a></li>
<li><a href="#branchessafari612branchSourceWebKitSharedWebWheelEventCoalescerh">branches/safari-612-branch/Source/WebKit/Shared/WebWheelEventCoalescer.h</a></li>
<li><a href="#branchessafari612branchSourceWebKitUIProcessWebPageProxycpp">branches/safari-612-branch/Source/WebKit/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#branchessafari612branchSourceWebKitUIProcessWebPageProxyh">branches/safari-612-branch/Source/WebKit/UIProcess/WebPageProxy.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari612branchSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebKit/ChangeLog (285300 => 285301)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebKit/ChangeLog       2021-11-04 19:40:22 UTC (rev 285300)
+++ branches/safari-612-branch/Source/WebKit/ChangeLog  2021-11-04 19:40:25 UTC (rev 285301)
</span><span class="lines">@@ -1,5 +1,60 @@
</span><span class="cx"> 2021-11-04  Russell Epstein  <repstein@apple.com>
</span><span class="cx"> 
</span><ins>+        Cherry-pick r285165. rdar://problem/84908023
+
+    Revert the wheel event coalescing added in r277587
+    https://bugs.webkit.org/show_bug.cgi?id=232602
+    <rdar://84908023>
+    
+    Reviewed by Wenson Hsieh.
+    
+    This wheel event coalescing was added to allow the tail end of momentum scrolls on
+    120Hz devices to fall back to 60fps for power reasons. However, the OS does this for
+    us, so we don't need to do our own coalescing.
+    
+    * Shared/WebWheelEventCoalescer.cpp:
+    (WebKit::WebWheelEventCoalescer::shouldDispatchEvent):
+    (WebKit::WebWheelEventCoalescer::isMomentumPhaseEvent): Deleted.
+    * Shared/WebWheelEventCoalescer.h:
+    (WebKit::WebWheelEventCoalescer::shouldCoalesceEventsDuringDeceleration const): Deleted.
+    (WebKit::WebWheelEventCoalescer::setShouldCoalesceEventsDuringDeceleration): Deleted.
+    (): Deleted.
+    * UIProcess/WebPageProxy.cpp:
+    (WebKit::WebPageProxy::wheelEventCoalescer):
+    (WebKit::WebPageProxy::windowScreenDidChange):
+    (WebKit::WebPageProxy::shouldCoalesceWheelEventsDuringDeceleration const): Deleted.
+    * UIProcess/WebPageProxy.h:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285165 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-11-02  Simon Fraser  <simon.fraser@apple.com>
+
+            Revert the wheel event coalescing added in r277587
+            https://bugs.webkit.org/show_bug.cgi?id=232602
+            <rdar://84908023>
+
+            Reviewed by Wenson Hsieh.
+
+            This wheel event coalescing was added to allow the tail end of momentum scrolls on
+            120Hz devices to fall back to 60fps for power reasons. However, the OS does this for
+            us, so we don't need to do our own coalescing.
+
+            * Shared/WebWheelEventCoalescer.cpp:
+            (WebKit::WebWheelEventCoalescer::shouldDispatchEvent):
+            (WebKit::WebWheelEventCoalescer::isMomentumPhaseEvent): Deleted.
+            * Shared/WebWheelEventCoalescer.h:
+            (WebKit::WebWheelEventCoalescer::shouldCoalesceEventsDuringDeceleration const): Deleted.
+            (WebKit::WebWheelEventCoalescer::setShouldCoalesceEventsDuringDeceleration): Deleted.
+            (): Deleted.
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::wheelEventCoalescer):
+            (WebKit::WebPageProxy::windowScreenDidChange):
+            (WebKit::WebPageProxy::shouldCoalesceWheelEventsDuringDeceleration const): Deleted.
+            * UIProcess/WebPageProxy.h:
+
+2021-11-04  Russell Epstein  <repstein@apple.com>
+
</ins><span class="cx">         Cherry-pick r285089. rdar://problem/84522357
</span><span class="cx"> 
</span><span class="cx">     Layer tree should not be stuck in frozen state after explicitly stopping a page load
</span></span></pre></div>
<a id="branchessafari612branchSourceWebKitSharedWebWheelEventCoalescercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebKit/Shared/WebWheelEventCoalescer.cpp (285300 => 285301)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebKit/Shared/WebWheelEventCoalescer.cpp       2021-11-04 19:40:22 UTC (rev 285300)
+++ branches/safari-612-branch/Source/WebKit/Shared/WebWheelEventCoalescer.cpp  2021-11-04 19:40:25 UTC (rev 285301)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "NativeWebWheelEvent.h"
</span><span class="cx"> #include "WebEventConversion.h"
</span><del>-#include <WebCore/AnimationFrameRate.h>
</del><span class="cx"> #include <wtf/text/TextStream.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -87,11 +86,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool WebWheelEventCoalescer::isMomentumPhaseEvent(const WebWheelEvent& event)
-{
-    return event.phase() == WebWheelEvent::Phase::PhaseNone && event.momentumPhase() == WebWheelEvent::Phase::PhaseChanged;
-}
-
</del><span class="cx"> bool WebWheelEventCoalescer::shouldDispatchEventNow(const WebWheelEvent& event) const
</span><span class="cx"> {
</span><span class="cx"> #if PLATFORM(GTK)
</span><span class="lines">@@ -141,26 +135,10 @@
</span><span class="cx"> 
</span><span class="cx"> bool WebWheelEventCoalescer::shouldDispatchEvent(const NativeWebWheelEvent& event)
</span><span class="cx"> {
</span><del>-    LOG_WITH_STREAM(WheelEvents, stream << "WebWheelEventCoalescer::shouldDispatchEvent " << event << " (" << m_wheelEventQueue.size() << " events in the queue, " << m_eventsBeingProcessed.size() << " event sequences being processed, coalesce during decleration " << m_shouldCoalesceEventsDuringDeceleration << ")");
</del><ins>+    LOG_WITH_STREAM(WheelEvents, stream << "WebWheelEventCoalescer::shouldDispatchEvent " << event << " (" << m_wheelEventQueue.size() << " events in the queue, " << m_eventsBeingProcessed.size() << " event sequences being processed)");
</ins><span class="cx"> 
</span><span class="cx">     m_wheelEventQueue.append(event);
</span><span class="cx"> 
</span><del>-    auto lastEventInterval = event.timestamp() - m_lastEventTime;
-    m_lastEventTime = event.timestamp();
-
-    if (isMomentumPhaseEvent(event) && shouldCoalesceEventsDuringDeceleration() && lastEventInterval) {
-        constexpr double momentumVelocityEventFrequencyReductionThreashold = 320.0; // Points per second.
-        auto instantaneousVelocity = std::max(std::abs(event.delta().width()), std::abs(event.delta().height())) / lastEventInterval.seconds();
-
-        constexpr auto maxCoalescingInterval = WebCore::FullSpeedAnimationInterval;
-        auto lastDispatchedEventInterval = event.timestamp() - m_lastDispatchedEventTime;
-
-        if (instantaneousVelocity < momentumVelocityEventFrequencyReductionThreashold && lastDispatchedEventInterval < maxCoalescingInterval) {
-            LOG_WITH_STREAM(WheelEvents, stream << " coalesced event that came within " << lastDispatchedEventInterval.milliseconds() << " of previous dispatch");
-            return false;
-        }
-    }
-
</del><span class="cx">     if (!m_eventsBeingProcessed.isEmpty()) {
</span><span class="cx">         if (!shouldDispatchEventNow(m_wheelEventQueue.last())) {
</span><span class="cx">             LOG_WITH_STREAM(WheelEvents, stream << "WebWheelEventCoalescer::shouldDispatchEvent -  " << m_wheelEventQueue.size() << " events queued; not dispatching");
</span><span class="lines">@@ -170,7 +148,6 @@
</span><span class="cx">         // FIXME: This logic is confusing, and possibly not necessary.
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_lastDispatchedEventTime = event.timestamp();
</del><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari612branchSourceWebKitSharedWebWheelEventCoalescerh"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebKit/Shared/WebWheelEventCoalescer.h (285300 => 285301)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebKit/Shared/WebWheelEventCoalescer.h 2021-11-04 19:40:22 UTC (rev 285300)
+++ branches/safari-612-branch/Source/WebKit/Shared/WebWheelEventCoalescer.h    2021-11-04 19:40:25 UTC (rev 285301)
</span><span class="lines">@@ -28,7 +28,6 @@
</span><span class="cx"> #include "NativeWebWheelEvent.h"
</span><span class="cx"> #include <wtf/Deque.h>
</span><span class="cx"> #include <wtf/FastMalloc.h>
</span><del>-#include <wtf/WallTime.h>
</del><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="lines">@@ -43,9 +42,6 @@
</span><span class="cx"> 
</span><span class="cx">     bool hasEventsBeingProcessed() const { return !m_eventsBeingProcessed.isEmpty(); }
</span><span class="cx">     
</span><del>-    bool shouldCoalesceEventsDuringDeceleration() const { return m_shouldCoalesceEventsDuringDeceleration; }
-    void setShouldCoalesceEventsDuringDeceleration(bool shouldCoalsce) { m_shouldCoalesceEventsDuringDeceleration = shouldCoalsce; }
-
</del><span class="cx">     void clear();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -54,16 +50,10 @@
</span><span class="cx">     static bool canCoalesce(const WebWheelEvent&, const WebWheelEvent&);
</span><span class="cx">     static WebWheelEvent coalesce(const WebWheelEvent&, const WebWheelEvent&);
</span><span class="cx"> 
</span><del>-    static bool isMomentumPhaseEvent(const WebWheelEvent&);
-
</del><span class="cx">     bool shouldDispatchEventNow(const WebWheelEvent&) const;
</span><span class="cx"> 
</span><span class="cx">     Deque<NativeWebWheelEvent, 2> m_wheelEventQueue;
</span><span class="cx">     Deque<std::unique_ptr<CoalescedEventSequence>> m_eventsBeingProcessed;
</span><del>-
-    WallTime m_lastEventTime;
-    WallTime m_lastDispatchedEventTime;
-    bool m_shouldCoalesceEventsDuringDeceleration { false };
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="branchessafari612branchSourceWebKitUIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (285300 => 285301)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebKit/UIProcess/WebPageProxy.cpp      2021-11-04 19:40:22 UTC (rev 285300)
+++ branches/safari-612-branch/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-11-04 19:40:25 UTC (rev 285301)
</span><span class="lines">@@ -2935,27 +2935,12 @@
</span><span class="cx"> 
</span><span class="cx"> WebWheelEventCoalescer& WebPageProxy::wheelEventCoalescer()
</span><span class="cx"> {
</span><del>-    if (!m_wheelEventCoalescer) {
</del><ins>+    if (!m_wheelEventCoalescer)
</ins><span class="cx">         m_wheelEventCoalescer = makeUnique<WebWheelEventCoalescer>();
</span><del>-        m_wheelEventCoalescer->setShouldCoalesceEventsDuringDeceleration(shouldCoalesceWheelEventsDuringDeceleration());
-    }
</del><span class="cx"> 
</span><span class="cx">     return *m_wheelEventCoalescer;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool WebPageProxy::shouldCoalesceWheelEventsDuringDeceleration() const
-{
-#if HAVE(CVDISPLAYLINK)
-    if (!m_displayID)
-        return false;
-
-    auto framesPerSecond = m_process->processPool().nominalFramesPerSecondForDisplay(*m_displayID);
-    return framesPerSecond > WebCore::FullSpeedFramesPerSecond;
-#else
-    return false;
-#endif
-}
-
</del><span class="cx"> bool WebPageProxy::hasQueuedKeyEvent() const
</span><span class="cx"> {
</span><span class="cx">     return !m_keyEventQueue.isEmpty();
</span><span class="lines">@@ -3995,9 +3980,6 @@
</span><span class="cx"> {
</span><span class="cx">     m_displayID = displayID;
</span><span class="cx"> 
</span><del>-    if (m_wheelEventCoalescer)
-        m_wheelEventCoalescer->setShouldCoalesceEventsDuringDeceleration(shouldCoalesceWheelEventsDuringDeceleration());
-
</del><span class="cx">     if (!hasRunningProcess())
</span><span class="cx">         return;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari612branchSourceWebKitUIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebKit/UIProcess/WebPageProxy.h (285300 => 285301)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebKit/UIProcess/WebPageProxy.h        2021-11-04 19:40:22 UTC (rev 285300)
+++ branches/safari-612-branch/Source/WebKit/UIProcess/WebPageProxy.h   2021-11-04 19:40:25 UTC (rev 285301)
</span><span class="lines">@@ -2380,7 +2380,6 @@
</span><span class="cx">     void sendWheelEvent(const WebWheelEvent&);
</span><span class="cx"> 
</span><span class="cx">     WebWheelEventCoalescer& wheelEventCoalescer();
</span><del>-    bool shouldCoalesceWheelEventsDuringDeceleration() const;
</del><span class="cx"> 
</span><span class="cx"> #if HAVE(CVDISPLAYLINK)
</span><span class="cx">     void wheelEventHysteresisUpdated(PAL::HysteresisState);
</span></span></pre>
</div>
</div>

</body>
</html>