<!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>[270130] trunk/Source</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/270130">270130</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2020-11-20 13:21:25 -0800 (Fri, 20 Nov 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>Dispatch main-thread overflow scrolls to the scrolling thread as we do for page scrolls
https://bugs.webkit.org/show_bug.cgi?id=219213

Reviewed by Tim Horton.
Source/WebCore:

Unify the behavior of overflow scrolling and page scrolling for synchronous scrolls.

Somewhat surprisingly, synchronous page scrolls move layers via a dispatch to the scrolling thread in
FrameView::handleWheelEventForScrolling(), but overflow scrolls just did main thread compositing updates
to set the new layer positions.

A future patch will require that the "began" event for a synchronous scroll gets back to the scrolling thread,
so unify these code paths to have overflow scrolls also leverage handleWheelEventAfterMainThread(), via
RenderLayer::handleWheelEventForScrolling().

There's some fallout from this. ThreadedScrollingTree::handleWheelEventAfterMainThread() calls into handleWheelEventWithNode(),
but in this special case that codepath needs to know that we're in a special "post main thread" mode that should
    1. Behave as if the node is latched, i.e. don't propagate to parent nodes,
       and target the node if if it's scrolled to a the min or max to allow rubberbanding
    2. Scroll even if the node has synchronous scrolling reasons
This mode is represented by the EventTargeting value.

Finally, EventHandler::handleWheelEventInternal() should only clear latching state if the content has called preventDefault()
on the event.

* page/EventHandler.cpp:
(WebCore::EventHandler::handleWheelEventInternal):
* page/scrolling/ScrollLatchingController.cpp:
(WebCore::ScrollLatchingController::updateAndFetchLatchingStateForFrame):
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::handleWheelEventWithNode):
* page/scrolling/ScrollingTree.h:
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::canHandleWheelEvent const):
(WebCore::ScrollingTreeScrollingNode::handleWheelEvent):
* page/scrolling/ScrollingTreeScrollingNode.h:
* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::handleWheelEventAfterMainThread):
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
* page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
* page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
(WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent):
* platform/cocoa/ScrollController.mm:
(WebCore::ScrollController::handleWheelEvent):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::handleWheelEventForScrolling):
* rendering/RenderLayer.h:

Source/WebKit:

Unify the behavior of overflow scrolling and page scrolling for synchronous scrolls.

Somewhat surprisingly, synchronous page scrolls move layers via a dispatch to the scrolling thread in
FrameView::handleWheelEventForScrolling(), but overflow scrolls just did main thread compositing updates
to set the new layer positions.

A future patch will require that the "began" event for a synchronous scroll gets back to the scrolling thread,
so unify these code paths to have overflow scrolls also leverage handleWheelEventAfterMainThread(), via
RenderLayer::handleWheelEventForScrolling().

There's some fallout from this. ThreadedScrollingTree::handleWheelEventAfterMainThread() calls into handleWheelEventWithNode(),
but in this special case that codepath needs to know that we're in a special "post main thread" mode that should
    1. Behave as if the node is latched, i.e. don't propagate to parent nodes,
       and target the node if if it's scrolled to a the min or max to allow rubberbanding
    2. Scroll even if the node has synchronous scrolling reasons
This mode is represented by the EventTargeting value.

Finally, EventHandler::handleWheelEventInternal() should only clear latching state if the content has called preventDefault()
on the event.

* UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp:
(WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleWheelEvent):
* UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h:
* UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp:
(WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::handleWheelEvent):
* UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageEventHandlercpp">trunk/Source/WebCore/page/EventHandler.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollLatchingControllercpp">trunk/Source/WebCore/page/scrolling/ScrollLatchingController.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreecpp">trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreeh">trunk/Source/WebCore/page/scrolling/ScrollingTree.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreeScrollingNodecpp">trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreeScrollingNodeh">trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingThreadedScrollingTreecpp">trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingmacScrollingTreeFrameScrollingNodeMach">trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingmacScrollingTreeFrameScrollingNodeMacmm">trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm</a></li>
<li><a href="#trunkSourceWebCorepagescrollingmacScrollingTreeOverflowScrollingNodeMach">trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingmacScrollingTreeOverflowScrollingNodeMacmm">trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm</a></li>
<li><a href="#trunkSourceWebCorepagescrollingnicosiaScrollingTreeFrameScrollingNodeNicosiacpp">trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingnicosiaScrollingTreeFrameScrollingNodeNicosiah">trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingnicosiaScrollingTreeOverflowScrollingNodeNicosiacpp">trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingnicosiaScrollingTreeOverflowScrollingNodeNicosiah">trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h</a></li>
<li><a href="#trunkSourceWebCoreplatformcocoaScrollControllermm">trunk/Source/WebCore/platform/cocoa/ScrollController.mm</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerh">trunk/Source/WebCore/rendering/RenderLayer.h</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitUIProcessRemoteLayerTreemacScrollingTreeFrameScrollingNodeRemoteMaccpp">trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessRemoteLayerTreemacScrollingTreeFrameScrollingNodeRemoteMach">trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessRemoteLayerTreemacScrollingTreeOverflowScrollingNodeRemoteMaccpp">trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessRemoteLayerTreemacScrollingTreeOverflowScrollingNodeRemoteMach">trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/ChangeLog      2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -1,3 +1,55 @@
</span><ins>+2020-11-20  Simon Fraser  <simon.fraser@apple.com>
+
+        Dispatch main-thread overflow scrolls to the scrolling thread as we do for page scrolls
+        https://bugs.webkit.org/show_bug.cgi?id=219213
+
+        Reviewed by Tim Horton.
+
+        Unify the behavior of overflow scrolling and page scrolling for synchronous scrolls.
+
+        Somewhat surprisingly, synchronous page scrolls move layers via a dispatch to the scrolling thread in
+        FrameView::handleWheelEventForScrolling(), but overflow scrolls just did main thread compositing updates
+        to set the new layer positions.
+
+        A future patch will require that the "began" event for a synchronous scroll gets back to the scrolling thread,
+        so unify these code paths to have overflow scrolls also leverage handleWheelEventAfterMainThread(), via
+        RenderLayer::handleWheelEventForScrolling().
+
+        There's some fallout from this. ThreadedScrollingTree::handleWheelEventAfterMainThread() calls into handleWheelEventWithNode(),
+        but in this special case that codepath needs to know that we're in a special "post main thread" mode that should
+            1. Behave as if the node is latched, i.e. don't propagate to parent nodes,
+               and target the node if if it's scrolled to a the min or max to allow rubberbanding
+            2. Scroll even if the node has synchronous scrolling reasons
+        This mode is represented by the EventTargeting value.
+
+        Finally, EventHandler::handleWheelEventInternal() should only clear latching state if the content has called preventDefault()
+        on the event.
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleWheelEventInternal):
+        * page/scrolling/ScrollLatchingController.cpp:
+        (WebCore::ScrollLatchingController::updateAndFetchLatchingStateForFrame):
+        * page/scrolling/ScrollingTree.cpp:
+        (WebCore::ScrollingTree::handleWheelEventWithNode):
+        * page/scrolling/ScrollingTree.h:
+        * page/scrolling/ScrollingTreeScrollingNode.cpp:
+        (WebCore::ScrollingTreeScrollingNode::canHandleWheelEvent const):
+        (WebCore::ScrollingTreeScrollingNode::handleWheelEvent):
+        * page/scrolling/ScrollingTreeScrollingNode.h:
+        * page/scrolling/ThreadedScrollingTree.cpp:
+        (WebCore::ThreadedScrollingTree::handleWheelEventAfterMainThread):
+        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
+        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
+        * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
+        * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent):
+        * platform/cocoa/ScrollController.mm:
+        (WebCore::ScrollController::handleWheelEvent):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::handleWheelEventForScrolling):
+        * rendering/RenderLayer.h:
+
</ins><span class="cx"> 2020-11-20  Zalan Bujtas  <zalan@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [LFC][Integration] Rename LineIteratorLegacy::logicalLeft/right to contentLeft/right
</span></span></pre></div>
<a id="trunkSourceWebCorepageEventHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EventHandler.cpp (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EventHandler.cpp       2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/page/EventHandler.cpp  2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -2941,7 +2941,8 @@
</span><span class="cx">             m_isHandlingWheelEvent = false;
</span><span class="cx">             if (scrollableArea && scrollableArea->scrollShouldClearLatchedState()) {
</span><span class="cx">                 // Web developer is controlling scrolling, so don't attempt to latch.
</span><del>-                clearLatchedState();
</del><ins>+                if (handling.containsAll({ EventHandling::DispatchedToDOM, EventHandling::DefaultPrevented }))
+                    clearLatchedState();
</ins><span class="cx">                 scrollableArea->setScrollShouldClearLatchedState(false);
</span><span class="cx">             }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollLatchingControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollLatchingController.cpp (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollLatchingController.cpp 2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/page/scrolling/ScrollLatchingController.cpp    2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -120,6 +120,7 @@
</span><span class="cx">                 state.scrollableArea = scrollableArea;
</span><span class="cx">             state.isOverWidget = isOverWidget;
</span><span class="cx"> 
</span><ins>+            LOG_WITH_STREAM(ScrollLatching, stream << "ScrollLatchingController::updateAndFetchLatchingStateForFrame() - pushing state for Frame " << &frame << " element " << state.wheelEventElement.get() << " scrollableArea " << state.scrollableArea);
</ins><span class="cx">             m_frameStateStack.append(WTFMove(state));
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -143,6 +144,8 @@
</span><span class="cx">             latchedElement = state.wheelEventElement.get();
</span><span class="cx">             scrollableArea = state.scrollableArea;
</span><span class="cx">             isOverWidget = state.isOverWidget;
</span><ins>+
+            LOG_WITH_STREAM(ScrollLatching, stream << "ScrollLatchingController::updateAndFetchLatchingStateForFrame() - using state for Frame " << &frame << " element " << latchedElement.get() << " scrollableArea " << scrollableArea);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp    2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp       2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -168,12 +168,12 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WheelEventHandlingResult ScrollingTree::handleWheelEventWithNode(const PlatformWheelEvent& wheelEvent, OptionSet<WheelEventProcessingSteps> processingSteps, ScrollingTreeNode* node)
</del><ins>+WheelEventHandlingResult ScrollingTree::handleWheelEventWithNode(const PlatformWheelEvent& wheelEvent, OptionSet<WheelEventProcessingSteps> processingSteps, ScrollingTreeNode* node, EventTargeting eventTargeting)
</ins><span class="cx"> {
</span><span class="cx">     while (node) {
</span><span class="cx">         if (is<ScrollingTreeScrollingNode>(*node)) {
</span><span class="cx">             auto& scrollingNode = downcast<ScrollingTreeScrollingNode>(*node);
</span><del>-            auto result = scrollingNode.handleWheelEvent(wheelEvent);
</del><ins>+            auto result = scrollingNode.handleWheelEvent(wheelEvent, eventTargeting);
</ins><span class="cx"> 
</span><span class="cx">             if (result.wasHandled) {
</span><span class="cx">                 m_latchingController.nodeDidHandleEvent(scrollingNode.scrollingNodeID(), processingSteps, wheelEvent, m_allowLatching);
</span><span class="lines">@@ -181,7 +181,7 @@
</span><span class="cx">                 return result;
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            if (result.needsMainThreadProcessing())
</del><ins>+            if (result.needsMainThreadProcessing() || eventTargeting != EventTargeting::Propagate)
</ins><span class="cx">                 return result;
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h      2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h 2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -75,6 +75,8 @@
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+enum class EventTargeting : uint8_t { NodeOnly, Propagate };
+
</ins><span class="cx"> class ScrollingTree : public ThreadSafeRefCounted<ScrollingTree> {
</span><span class="cx"> friend class ScrollingTreeLatchingController;
</span><span class="cx"> public:
</span><span class="lines">@@ -233,7 +235,7 @@
</span><span class="cx">     Vector<ScrollUpdate> takePendingScrollUpdates();
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    WheelEventHandlingResult handleWheelEventWithNode(const PlatformWheelEvent&, OptionSet<WheelEventProcessingSteps>, ScrollingTreeNode*);
</del><ins>+    WheelEventHandlingResult handleWheelEventWithNode(const PlatformWheelEvent&, OptionSet<WheelEventProcessingSteps>, ScrollingTreeNode*, EventTargeting = EventTargeting::Propagate);
</ins><span class="cx"> 
</span><span class="cx">     FloatPoint mainFrameScrollPosition() const;
</span><span class="cx">     void setMainFrameScrollPosition(FloatPoint);
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreeScrollingNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp       2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp  2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -134,7 +134,7 @@
</span><span class="cx">     return scrollingTree().latchedNodeID() == scrollingNodeID();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool ScrollingTreeScrollingNode::canHandleWheelEvent(const PlatformWheelEvent& wheelEvent) const
</del><ins>+bool ScrollingTreeScrollingNode::canHandleWheelEvent(const PlatformWheelEvent& wheelEvent, EventTargeting eventTargeting) const
</ins><span class="cx"> {
</span><span class="cx">     if (!canHaveScrollbars())
</span><span class="cx">         return false;
</span><span class="lines">@@ -145,13 +145,13 @@
</span><span class="cx"> 
</span><span class="cx">     // We always rubber-band the latched node, or the root node.
</span><span class="cx">     // The stateless wheel event doesn't trigger rubber-band.
</span><del>-    if (isLatchedNode() || (isRootNode() && !wheelEvent.isNonGestureEvent()))
</del><ins>+    if (isLatchedNode() || eventTargeting == EventTargeting::NodeOnly || (isRootNode() && !wheelEvent.isNonGestureEvent()))
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     return eventCanScrollContents(wheelEvent);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WheelEventHandlingResult ScrollingTreeScrollingNode::handleWheelEvent(const PlatformWheelEvent&)
</del><ins>+WheelEventHandlingResult ScrollingTreeScrollingNode::handleWheelEvent(const PlatformWheelEvent&, EventTargeting)
</ins><span class="cx"> {
</span><span class="cx">     return WheelEventHandlingResult::unhandled();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreeScrollingNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h 2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h    2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -28,11 +28,9 @@
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span><span class="cx"> 
</span><span class="cx"> #include "IntRect.h"
</span><del>-#include "RectEdges.h"
</del><span class="cx"> #include "ScrollSnapOffsetsInfo.h"
</span><del>-#include "ScrollTypes.h"
</del><span class="cx"> #include "ScrollableArea.h"
</span><del>-#include "ScrollingCoordinator.h"
</del><ins>+#include "ScrollingTree.h"
</ins><span class="cx"> #include "ScrollingTreeNode.h"
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -55,8 +53,8 @@
</span><span class="cx">     void commitStateAfterChildren(const ScrollingStateNode&) override;
</span><span class="cx">     void didCompleteCommitForNode() final;
</span><span class="cx"> 
</span><del>-    virtual bool canHandleWheelEvent(const PlatformWheelEvent&) const;
-    virtual WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&);
</del><ins>+    virtual bool canHandleWheelEvent(const PlatformWheelEvent&, EventTargeting) const;
+    virtual WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&, EventTargeting = EventTargeting::Propagate);
</ins><span class="cx"> 
</span><span class="cx">     FloatPoint currentScrollPosition() const { return m_currentScrollPosition; }
</span><span class="cx">     FloatPoint currentScrollOffset() const { return ScrollableArea::scrollOffsetFromPosition(m_currentScrollPosition, toFloatSize(m_scrollOrigin)); }
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingThreadedScrollingTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp    2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp       2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -66,13 +66,13 @@
</span><span class="cx"> 
</span><span class="cx"> bool ThreadedScrollingTree::handleWheelEventAfterMainThread(const PlatformWheelEvent& wheelEvent, ScrollingNodeID targetNodeID)
</span><span class="cx"> {
</span><del>-    LOG_WITH_STREAM(Scrolling, stream << "ThreadedScrollingTree::handleWheelEventAfterMainThread " << wheelEvent);
</del><ins>+    LOG_WITH_STREAM(Scrolling, stream << "ThreadedScrollingTree::handleWheelEventAfterMainThread " << wheelEvent << " node " << targetNodeID);
</ins><span class="cx"> 
</span><span class="cx">     LockHolder locker(m_treeMutex);
</span><span class="cx"> 
</span><span class="cx">     SetForScope<bool> disallowLatchingScope(m_allowLatching, false);
</span><span class="cx">     RefPtr<ScrollingTreeNode> targetNode = nodeForID(targetNodeID);
</span><del>-    auto result = handleWheelEventWithNode(wheelEvent, { }, targetNode.get());
</del><ins>+    auto result = handleWheelEventWithNode(wheelEvent, { }, targetNode.get(), EventTargeting::NodeOnly);
</ins><span class="cx">     return result.wasHandled;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingTreeFrameScrollingNodeMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h     2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h        2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx">     void commitStateBeforeChildren(const ScrollingStateNode&) override;
</span><span class="cx">     void commitStateAfterChildren(const ScrollingStateNode&) override;
</span><span class="cx"> 
</span><del>-    WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&) override;
</del><ins>+    WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&, EventTargeting) override;
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void repositionRelatedLayers() override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingTreeFrameScrollingNodeMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm    2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm       2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -117,9 +117,9 @@
</span><span class="cx">         updateMainFramePinAndRubberbandState();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WheelEventHandlingResult ScrollingTreeFrameScrollingNodeMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
</del><ins>+WheelEventHandlingResult ScrollingTreeFrameScrollingNodeMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent, EventTargeting eventTargeting)
</ins><span class="cx"> {
</span><del>-    if (!canHandleWheelEvent(wheelEvent))
</del><ins>+    if (!canHandleWheelEvent(wheelEvent, eventTargeting))
</ins><span class="cx">         return WheelEventHandlingResult::unhandled();
</span><span class="cx"> 
</span><span class="cx">     bool handled = m_delegate.handleWheelEvent(wheelEvent);
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingTreeOverflowScrollingNodeMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h  2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h     2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx">     void repositionScrollingLayers() override;
</span><span class="cx">     void repositionRelatedLayers() override;
</span><span class="cx"> 
</span><del>-    WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&) override;
</del><ins>+    WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&, EventTargeting) override;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     void willBeDestroyed() final;
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingTreeOverflowScrollingNodeMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm 2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm    2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -73,14 +73,14 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WheelEventHandlingResult ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
</del><ins>+WheelEventHandlingResult ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent, EventTargeting eventTargeting)
</ins><span class="cx"> {
</span><span class="cx"> #if ENABLE(SCROLLING_THREAD)
</span><del>-    if (hasSynchronousScrollingReasons())
</del><ins>+    if (hasSynchronousScrollingReasons() && eventTargeting != EventTargeting::NodeOnly)
</ins><span class="cx">         return { { WheelEventProcessingSteps::MainThreadForScrolling, WheelEventProcessingSteps::MainThreadForNonBlockingDOMEventDispatch }, false };
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    if (!canHandleWheelEvent(wheelEvent))
</del><ins>+    if (!canHandleWheelEvent(wheelEvent, eventTargeting))
</ins><span class="cx">         return WheelEventHandlingResult::unhandled();
</span><span class="cx"> 
</span><span class="cx">     return WheelEventHandlingResult::result(m_delegate.handleWheelEvent(wheelEvent));
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingnicosiaScrollingTreeFrameScrollingNodeNicosiacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp   2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp      2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -158,9 +158,9 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-WheelEventHandlingResult ScrollingTreeFrameScrollingNodeNicosia::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
</del><ins>+WheelEventHandlingResult ScrollingTreeFrameScrollingNodeNicosia::handleWheelEvent(const PlatformWheelEvent& wheelEvent, EventTargeting eventTargeting)
</ins><span class="cx"> {
</span><del>-    if (!canHandleWheelEvent(wheelEvent))
</del><ins>+    if (!canHandleWheelEvent(wheelEvent, eventTargeting))
</ins><span class="cx">         return WheelEventHandlingResult::unhandled();
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(KINETIC_SCROLLING)
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingnicosiaScrollingTreeFrameScrollingNodeNicosiah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h     2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h        2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx">     void ensureScrollAnimationSmooth();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&) override;
</del><ins>+    WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&, EventTargeting) override;
</ins><span class="cx"> 
</span><span class="cx">     void stopScrollAnimations() override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingnicosiaScrollingTreeOverflowScrollingNodeNicosiacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp        2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp   2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -148,9 +148,9 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-WheelEventHandlingResult ScrollingTreeOverflowScrollingNodeNicosia::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
</del><ins>+WheelEventHandlingResult ScrollingTreeOverflowScrollingNodeNicosia::handleWheelEvent(const PlatformWheelEvent& wheelEvent, EventTargeting eventTargeting)
</ins><span class="cx"> {
</span><del>-    if (!canHandleWheelEvent(wheelEvent))
</del><ins>+    if (!canHandleWheelEvent(wheelEvent, eventTargeting))
</ins><span class="cx">         return WheelEventHandlingResult::unhandled();
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(KINETIC_SCROLLING)
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingnicosiaScrollingTreeOverflowScrollingNodeNicosiah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h  2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h     2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx">     void ensureScrollAnimationSmooth();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&) override;
</del><ins>+    WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&, EventTargeting) override;
</ins><span class="cx"> 
</span><span class="cx">     void stopScrollAnimations() override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaScrollControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cocoa/ScrollController.mm (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/ScrollController.mm  2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/platform/cocoa/ScrollController.mm     2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -256,6 +256,8 @@
</span><span class="cx">                 shouldStretch = true;
</span><span class="cx">             }
</span><span class="cx">         }
</span><ins>+
+        LOG_WITH_STREAM(Scrolling, stream << "ScrollController::handleWheelEvent() - deltaX " << deltaX << " deltaY " << deltaY << " pinned " << m_client.pinnedInDirection(FloatSize(deltaX, deltaY)) << " shouldStretch " << shouldStretch);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool handled = true;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp   2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp      2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -3165,6 +3165,21 @@
</span><span class="cx">     return backing()->scrollingNodeIDForRole(ScrollCoordinationRole::Scrolling);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool RenderLayer::handleWheelEventForScrolling(const PlatformWheelEvent& wheelEvent)
+{
+    if (!isScrollableOrRubberbandable())
+        return false;
+
+#if ENABLE(ASYNC_SCROLLING)
+    if (usesAsyncScrolling() && scrollingNodeID()) {
+        if (auto* scrollingCoordinator = page().scrollingCoordinator())
+            return scrollingCoordinator->handleWheelEventForScrolling(wheelEvent, scrollingNodeID());
+    }
+#endif
+
+    return ScrollableArea::handleWheelEventForScrolling(wheelEvent);
+}
+
</ins><span class="cx"> IntRect RenderLayer::visibleContentRectInternal(VisibleContentRectIncludesScrollbars scrollbarInclusion, VisibleContentRectBehavior) const
</span><span class="cx"> {
</span><span class="cx">     IntSize scrollbarSpace;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.h (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.h     2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebCore/rendering/RenderLayer.h        2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -493,6 +493,7 @@
</span><span class="cx">     Scrollbar* verticalScrollbar() const final { return m_vBar.get(); }
</span><span class="cx">     ScrollableArea* enclosingScrollableArea() const final;
</span><span class="cx"> 
</span><ins>+    bool handleWheelEventForScrolling(const PlatformWheelEvent&) final;
</ins><span class="cx">     bool isScrollableOrRubberbandable() final;
</span><span class="cx">     bool hasScrollableOrRubberbandableAncestor() final;
</span><span class="cx">     bool useDarkAppearance() const final;
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebKit/ChangeLog       2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -1,5 +1,39 @@
</span><span class="cx"> 2020-11-20  Simon Fraser  <simon.fraser@apple.com>
</span><span class="cx"> 
</span><ins>+        Dispatch main-thread overflow scrolls to the scrolling thread as we do for page scrolls
+        https://bugs.webkit.org/show_bug.cgi?id=219213
+
+        Reviewed by Tim Horton.
+        
+        Unify the behavior of overflow scrolling and page scrolling for synchronous scrolls.
+        
+        Somewhat surprisingly, synchronous page scrolls move layers via a dispatch to the scrolling thread in
+        FrameView::handleWheelEventForScrolling(), but overflow scrolls just did main thread compositing updates
+        to set the new layer positions.
+
+        A future patch will require that the "began" event for a synchronous scroll gets back to the scrolling thread,
+        so unify these code paths to have overflow scrolls also leverage handleWheelEventAfterMainThread(), via
+        RenderLayer::handleWheelEventForScrolling().
+
+        There's some fallout from this. ThreadedScrollingTree::handleWheelEventAfterMainThread() calls into handleWheelEventWithNode(),
+        but in this special case that codepath needs to know that we're in a special "post main thread" mode that should
+            1. Behave as if the node is latched, i.e. don't propagate to parent nodes,
+               and target the node if if it's scrolled to a the min or max to allow rubberbanding
+            2. Scroll even if the node has synchronous scrolling reasons
+        This mode is represented by the EventTargeting value.
+
+        Finally, EventHandler::handleWheelEventInternal() should only clear latching state if the content has called preventDefault()
+        on the event.
+
+        * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp:
+        (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleWheelEvent):
+        * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h:
+        * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp:
+        (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::handleWheelEvent):
+        * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.h:
+
+2020-11-20  Simon Fraser  <simon.fraser@apple.com>
+
</ins><span class="cx">         Rename some wheel-event handling functions for clarity
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=219211
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessRemoteLayerTreemacScrollingTreeFrameScrollingNodeRemoteMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp   2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp      2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -72,9 +72,9 @@
</span><span class="cx">         m_scrollerPair->updateValues();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WheelEventHandlingResult ScrollingTreeFrameScrollingNodeRemoteMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
</del><ins>+WheelEventHandlingResult ScrollingTreeFrameScrollingNodeRemoteMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent, EventTargeting eventTargeting)
</ins><span class="cx"> {
</span><del>-    ScrollingTreeFrameScrollingNodeMac::handleWheelEvent(wheelEvent);
</del><ins>+    ScrollingTreeFrameScrollingNodeMac::handleWheelEvent(wheelEvent, eventTargeting);
</ins><span class="cx"> 
</span><span class="cx">     return WheelEventHandlingResult::result(m_scrollerPair->handleWheelEvent(wheelEvent));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessRemoteLayerTreemacScrollingTreeFrameScrollingNodeRemoteMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h     2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h        2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx">     ScrollingTreeFrameScrollingNodeRemoteMac(WebCore::ScrollingTree&, WebCore::ScrollingNodeType, WebCore::ScrollingNodeID);
</span><span class="cx"> 
</span><span class="cx">     void commitStateBeforeChildren(const WebCore::ScrollingStateNode&) override;
</span><del>-    WebCore::WheelEventHandlingResult handleWheelEvent(const WebCore::PlatformWheelEvent&) override;
</del><ins>+    WebCore::WheelEventHandlingResult handleWheelEvent(const WebCore::PlatformWheelEvent&, EventTargeting) override;
</ins><span class="cx">     void repositionRelatedLayers() override;
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr<ScrollerPairMac> m_scrollerPair;
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessRemoteLayerTreemacScrollingTreeOverflowScrollingNodeRemoteMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp        2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp   2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -72,9 +72,9 @@
</span><span class="cx">     m_scrollerPair->updateValues();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WheelEventHandlingResult ScrollingTreeOverflowScrollingNodeRemoteMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
</del><ins>+WheelEventHandlingResult ScrollingTreeOverflowScrollingNodeRemoteMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent, EventTargeting eventTargeting)
</ins><span class="cx"> {
</span><del>-    ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent(wheelEvent);
</del><ins>+    ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent(wheelEvent, eventTargeting);
</ins><span class="cx"> 
</span><span class="cx">     return WheelEventHandlingResult::result(m_scrollerPair->handleWheelEvent(wheelEvent));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessRemoteLayerTreemacScrollingTreeOverflowScrollingNodeRemoteMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.h (270129 => 270130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.h  2020-11-20 20:56:12 UTC (rev 270129)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.h     2020-11-20 21:21:25 UTC (rev 270130)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx">     ScrollingTreeOverflowScrollingNodeRemoteMac(WebCore::ScrollingTree&, WebCore::ScrollingNodeID);
</span><span class="cx"> 
</span><span class="cx">     void commitStateBeforeChildren(const WebCore::ScrollingStateNode&) override;
</span><del>-    WebCore::WheelEventHandlingResult handleWheelEvent(const WebCore::PlatformWheelEvent&) override;
</del><ins>+    WebCore::WheelEventHandlingResult handleWheelEvent(const WebCore::PlatformWheelEvent&, EventTargeting) override;
</ins><span class="cx">     void repositionRelatedLayers() override;
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr<ScrollerPairMac> m_scrollerPair;
</span></span></pre>
</div>
</div>

</body>
</html>