- Revision
- 285992
- Author
- [email protected]
- Date
- 2021-11-18 02:06:53 -0800 (Thu, 18 Nov 2021)
Log Message
[GLIB] twitch.tv forces synchronous scrolling
https://bugs.webkit.org/show_bug.cgi?id=232376
<rdar://problem/85247010>
Reviewed by Simon Fraser.
Source/WebCore:
Make sure to keep the userScrollInProgress flag in sync for scrolling
nodes in the nicosia backend and add a utility function to determine
if user scroll is in progress for a given wheel event. This lets
EventDispatcher dispatch events asynchronously in that case.
No new tests, exercised by existing tests.
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::isUserScrollInProgressAtEventLocation):
* page/scrolling/ScrollingTree.h:
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::isUserScrollInProgress const):
(WebCore::ScrollingTreeScrollingNode::isUserScrollProgress const): Deleted.
* page/scrolling/ScrollingTreeScrollingNode.h:
* page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.cpp:
(WebCore::ScrollingTreeScrollingNodeDelegateNicosia::handleWheelEvent):
Source/WebKit:
Don't force synchronous wheel event delivery for scroll events when
a user scroll is in progress.
* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::wheelEvent):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (285991 => 285992)
--- trunk/Source/WebCore/ChangeLog 2021-11-18 09:51:41 UTC (rev 285991)
+++ trunk/Source/WebCore/ChangeLog 2021-11-18 10:06:53 UTC (rev 285992)
@@ -1,3 +1,28 @@
+2021-11-18 Chris Lord <[email protected]>
+
+ [GLIB] twitch.tv forces synchronous scrolling
+ https://bugs.webkit.org/show_bug.cgi?id=232376
+ <rdar://problem/85247010>
+
+ Reviewed by Simon Fraser.
+
+ Make sure to keep the userScrollInProgress flag in sync for scrolling
+ nodes in the nicosia backend and add a utility function to determine
+ if user scroll is in progress for a given wheel event. This lets
+ EventDispatcher dispatch events asynchronously in that case.
+
+ No new tests, exercised by existing tests.
+
+ * page/scrolling/ScrollingTree.cpp:
+ (WebCore::ScrollingTree::isUserScrollInProgressAtEventLocation):
+ * page/scrolling/ScrollingTree.h:
+ * page/scrolling/ScrollingTreeScrollingNode.cpp:
+ (WebCore::ScrollingTreeScrollingNode::isUserScrollInProgress const):
+ (WebCore::ScrollingTreeScrollingNode::isUserScrollProgress const): Deleted.
+ * page/scrolling/ScrollingTreeScrollingNode.h:
+ * page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.cpp:
+ (WebCore::ScrollingTreeScrollingNodeDelegateNicosia::handleWheelEvent):
+
2021-11-18 Carlos Garcia Campos <[email protected]>
AX: Use ObjectIdentifier for AXID
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (285991 => 285992)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2021-11-18 09:51:41 UTC (rev 285991)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2021-11-18 10:06:53 UTC (rev 285992)
@@ -63,6 +63,25 @@
ScrollingTree::~ScrollingTree() = default;
+bool ScrollingTree::isUserScrollInProgressAtEventLocation(const PlatformWheelEvent& wheelEvent)
+{
+ if (!m_rootNode)
+ return false;
+
+ // This method is invoked by the event handling thread
+ Locker locker { m_treeStateLock };
+
+ if (m_treeState.nodesWithActiveUserScrolls.isEmpty())
+ return false;
+
+ FloatPoint position = wheelEvent.position();
+ position.move(m_rootNode->viewToContentsOffset(m_treeState.mainFrameScrollPosition));
+ if (auto node = scrollingNodeForPoint(position))
+ return m_treeState.nodesWithActiveUserScrolls.contains(node->scrollingNodeID());
+
+ return false;
+}
+
OptionSet<WheelEventProcessingSteps> ScrollingTree::computeWheelProcessingSteps(const PlatformWheelEvent& wheelEvent)
{
if (!m_rootNode)
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (285991 => 285992)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h 2021-11-18 09:51:41 UTC (rev 285991)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h 2021-11-18 10:06:53 UTC (rev 285992)
@@ -103,6 +103,7 @@
bool momentumScrollingAnimatorEnabled() const { return m_momentumScrollingAnimatorEnabled; }
void setMomentumScrollingAnimatorEnabled(bool value) { m_momentumScrollingAnimatorEnabled = value; }
+ WEBCORE_EXPORT bool isUserScrollInProgressAtEventLocation(const PlatformWheelEvent&);
WEBCORE_EXPORT OptionSet<WheelEventProcessingSteps> determineWheelEventProcessing(const PlatformWheelEvent&);
WEBCORE_EXPORT virtual WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&, OptionSet<WheelEventProcessingSteps> = { });
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (285991 => 285992)
--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp 2021-11-18 09:51:41 UTC (rev 285991)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp 2021-11-18 10:06:53 UTC (rev 285992)
@@ -205,7 +205,7 @@
};
}
-bool ScrollingTreeScrollingNode::isUserScrollProgress() const
+bool ScrollingTreeScrollingNode::isUserScrollInProgress() const
{
return scrollingTree().isUserScrollInProgressForNode(scrollingNodeID());
}
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (285991 => 285992)
--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h 2021-11-18 09:51:41 UTC (rev 285991)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h 2021-11-18 10:06:53 UTC (rev 285992)
@@ -69,7 +69,7 @@
RectEdges<bool> edgePinnedState() const;
- bool isUserScrollProgress() const;
+ bool isUserScrollInProgress() const;
void setUserScrollInProgress(bool);
bool isScrollSnapInProgress() const;
Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.cpp (285991 => 285992)
--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.cpp 2021-11-18 09:51:41 UTC (rev 285991)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.cpp 2021-11-18 10:06:53 UTC (rev 285992)
@@ -80,11 +80,14 @@
WheelEventHandlingResult ScrollingTreeScrollingNodeDelegateNicosia::handleWheelEvent(const PlatformWheelEvent& wheelEvent, EventTargeting eventTargeting)
{
- if (!scrollingNode().canHandleWheelEvent(wheelEvent, eventTargeting)
- || !m_scrollController.handleWheelEvent(wheelEvent))
- return WheelEventHandlingResult::unhandled();
+ bool wasInUserScroll = m_scrollController.isUserScrollInProgress();
+ bool handled = scrollingNode().canHandleWheelEvent(wheelEvent, eventTargeting) && m_scrollController.handleWheelEvent(wheelEvent);
+ bool isInUserScroll = m_scrollController.isUserScrollInProgress();
- return WheelEventHandlingResult::handled();
+ if (isInUserScroll != wasInUserScroll)
+ scrollingNode().setUserScrollInProgress(isInUserScroll);
+
+ return handled ? WheelEventHandlingResult::handled() : WheelEventHandlingResult::unhandled();
}
std::unique_ptr<ScrollingEffectsControllerTimer> ScrollingTreeScrollingNodeDelegateNicosia::createTimer(Function<void()>&& function)
Modified: trunk/Source/WebKit/ChangeLog (285991 => 285992)
--- trunk/Source/WebKit/ChangeLog 2021-11-18 09:51:41 UTC (rev 285991)
+++ trunk/Source/WebKit/ChangeLog 2021-11-18 10:06:53 UTC (rev 285992)
@@ -1,3 +1,17 @@
+2021-11-18 Chris Lord <[email protected]>
+
+ [GLIB] twitch.tv forces synchronous scrolling
+ https://bugs.webkit.org/show_bug.cgi?id=232376
+ <rdar://problem/85247010>
+
+ Reviewed by Simon Fraser.
+
+ Don't force synchronous wheel event delivery for scroll events when
+ a user scroll is in progress.
+
+ * WebProcess/WebPage/EventDispatcher.cpp:
+ (WebKit::EventDispatcher::wheelEvent):
+
2021-11-18 Kimmo Kinnunen <[email protected]>
RemoteGraphicsContextGLProxyBase should not have platform-specific implementations
Modified: trunk/Source/WebKit/WebProcess/WebPage/EventDispatcher.cpp (285991 => 285992)
--- trunk/Source/WebKit/WebProcess/WebPage/EventDispatcher.cpp 2021-11-18 09:51:41 UTC (rev 285991)
+++ trunk/Source/WebKit/WebProcess/WebPage/EventDispatcher.cpp 2021-11-18 10:06:53 UTC (rev 285992)
@@ -48,6 +48,7 @@
#if ENABLE(SCROLLING_THREAD)
#include <WebCore/ScrollingThread.h>
+#include <WebCore/ScrollingTreeNode.h>
#include <WebCore/ThreadedScrollingTree.h>
#endif
@@ -125,17 +126,24 @@
scrollingTree->setMainFrameCanRubberBand(rubberBandableEdges);
auto processingSteps = scrollingTree->determineWheelEventProcessing(platformWheelEvent);
+ bool useMainThreadForScrolling = processingSteps.contains(WheelEventProcessingSteps::MainThreadForScrolling);
+#if !PLATFORM(COCOA)
+ // Deliver continuing scroll gestures directly to the scrolling thread.
+ if (platformWheelEvent.phase() == PlatformWheelEventPhase::Changed && scrollingTree->isUserScrollInProgressAtEventLocation(platformWheelEvent))
+ useMainThreadForScrolling = false;
+#endif
+
scrollingTree->willProcessWheelEvent();
- ScrollingThread::dispatch([scrollingTree, wheelEvent, platformWheelEvent, processingSteps, pageID, protectedThis = Ref { *this }] {
- if (processingSteps.contains(WheelEventProcessingSteps::MainThreadForScrolling)) {
+ ScrollingThread::dispatch([scrollingTree, wheelEvent, platformWheelEvent, processingSteps, useMainThreadForScrolling, pageID, protectedThis = Ref { *this }] {
+ if (useMainThreadForScrolling) {
scrollingTree->willSendEventToMainThread(platformWheelEvent);
protectedThis->dispatchWheelEventViaMainThread(pageID, wheelEvent, processingSteps);
scrollingTree->waitForEventToBeProcessedByMainThread(platformWheelEvent);
return;
}
-
+
auto result = scrollingTree->handleWheelEvent(platformWheelEvent, processingSteps);
if (result.needsMainThreadProcessing()) {