Title: [268913] releases/WebKitGTK/webkit-2.30/Source
Revision
268913
Author
[email protected]
Date
2020-10-23 01:25:56 -0700 (Fri, 23 Oct 2020)

Log Message

Merge r268522 - [GTK][WPE] Add support for smooth scrolling animation with async scrolling
https://bugs.webkit.org/show_bug.cgi?id=210382

Reviewed by Carlos Garcia Campos.

Source/WebCore:

Respect smooth-scrolling setting and fix deadlock issues with async
scrolling on nicosia path.

No new tests, no functional change.

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::scrollAnimatorEnabled const):
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::ThreadedScrollingTree):
* page/scrolling/ThreadedScrollingTree.h:
(WebCore::ThreadedScrollingTree::scrollAnimatorEnabled const):
* page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp:
(WebCore::ScrollingTreeFrameScrollingNodeNicosia::ScrollingTreeFrameScrollingNodeNicosia):
(WebCore::ScrollingTreeFrameScrollingNodeNicosia::commitStateAfterChildren):
(WebCore::ScrollingTreeFrameScrollingNodeNicosia::ensureScrollAnimationKinetic):
(WebCore::ScrollingTreeFrameScrollingNodeNicosia::ensureScrollAnimationSmooth):
(WebCore::ScrollingTreeFrameScrollingNodeNicosia::handleWheelEvent):
(WebCore::ScrollingTreeFrameScrollingNodeNicosia::stopScrollAnimations):
(WebCore::ScrollingTreeFrameScrollingNodeNicosia::repositionRelatedLayers):
* page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h:
* page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp:
(WebCore::ScrollingTreeOverflowScrollingNodeNicosia::ScrollingTreeOverflowScrollingNodeNicosia):
(WebCore::ScrollingTreeOverflowScrollingNodeNicosia::commitStateAfterChildren):
(WebCore::ScrollingTreeOverflowScrollingNodeNicosia::repositionScrollingLayers):
(WebCore::ScrollingTreeOverflowScrollingNodeNicosia::ensureScrollAnimationKinetic):
(WebCore::ScrollingTreeOverflowScrollingNodeNicosia::ensureScrollAnimationSmooth):
(WebCore::ScrollingTreeOverflowScrollingNodeNicosia::handleWheelEvent):
(WebCore::ScrollingTreeOverflowScrollingNodeNicosia::stopScrollAnimations):
* page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h:
* platform/PlatformWheelEvent.h:
* platform/ScrollAnimation.h:
* platform/ScrollAnimationKinetic.cpp:
(WebCore::ScrollAnimationKinetic::isActive const):
* platform/ScrollAnimationKinetic.h:
* platform/ScrollAnimationSmooth.cpp:
(WebCore::ScrollAnimationSmooth::scroll):
(WebCore::ScrollAnimationSmooth::isActive const):
* platform/ScrollAnimationSmooth.h:
* platform/generic/ScrollAnimatorGeneric.cpp:
(WebCore::ScrollAnimatorGeneric::ensureSmoothScrollingAnimation):

Source/WebKit:

Add hasPreciseScrollingDeltas to GTK/WPE wheel events.

No new tests needed.

* Shared/WebEventConversion.cpp:
(WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
* Shared/WebWheelEvent.cpp:
(WebKit::WebWheelEvent::WebWheelEvent):
(WebKit::WebWheelEvent::encode const):
(WebKit::WebWheelEvent::decode):
* Shared/WebWheelEvent.h:
* Shared/WebWheelEventCoalescer.cpp:
(WebKit::WebWheelEventCoalescer::canCoalesce):
(WebKit::WebWheelEventCoalescer::coalesce):
* Shared/gtk/NativeWebWheelEventGtk.cpp:
(WebKit::NativeWebWheelEvent::NativeWebWheelEvent):
* Shared/gtk/WebEventFactory.cpp:
(WebKit::WebEventFactory::createWebWheelEvent):
* Shared/libwpe/WebEventFactory.cpp:
(WebKit::WebEventFactory::createWebWheelEvent):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/ChangeLog (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/ChangeLog	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/ChangeLog	2020-10-23 08:25:56 UTC (rev 268913)
@@ -1,3 +1,52 @@
+2020-10-15  Chris Lord  <[email protected]>
+
+        [GTK][WPE] Add support for smooth scrolling animation with async scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=210382
+
+        Reviewed by Carlos Garcia Campos.
+
+        Respect smooth-scrolling setting and fix deadlock issues with async
+        scrolling on nicosia path.
+
+        No new tests, no functional change.
+
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::scrollAnimatorEnabled const):
+        * page/scrolling/AsyncScrollingCoordinator.h:
+        * page/scrolling/ThreadedScrollingTree.cpp:
+        (WebCore::ThreadedScrollingTree::ThreadedScrollingTree):
+        * page/scrolling/ThreadedScrollingTree.h:
+        (WebCore::ThreadedScrollingTree::scrollAnimatorEnabled const):
+        * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp:
+        (WebCore::ScrollingTreeFrameScrollingNodeNicosia::ScrollingTreeFrameScrollingNodeNicosia):
+        (WebCore::ScrollingTreeFrameScrollingNodeNicosia::commitStateAfterChildren):
+        (WebCore::ScrollingTreeFrameScrollingNodeNicosia::ensureScrollAnimationKinetic):
+        (WebCore::ScrollingTreeFrameScrollingNodeNicosia::ensureScrollAnimationSmooth):
+        (WebCore::ScrollingTreeFrameScrollingNodeNicosia::handleWheelEvent):
+        (WebCore::ScrollingTreeFrameScrollingNodeNicosia::stopScrollAnimations):
+        (WebCore::ScrollingTreeFrameScrollingNodeNicosia::repositionRelatedLayers):
+        * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h:
+        * page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp:
+        (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::ScrollingTreeOverflowScrollingNodeNicosia):
+        (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::commitStateAfterChildren):
+        (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::repositionScrollingLayers):
+        (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::ensureScrollAnimationKinetic):
+        (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::ensureScrollAnimationSmooth):
+        (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::handleWheelEvent):
+        (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::stopScrollAnimations):
+        * page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h:
+        * platform/PlatformWheelEvent.h:
+        * platform/ScrollAnimation.h:
+        * platform/ScrollAnimationKinetic.cpp:
+        (WebCore::ScrollAnimationKinetic::isActive const):
+        * platform/ScrollAnimationKinetic.h:
+        * platform/ScrollAnimationSmooth.cpp:
+        (WebCore::ScrollAnimationSmooth::scroll):
+        (WebCore::ScrollAnimationSmooth::isActive const):
+        * platform/ScrollAnimationSmooth.h:
+        * platform/generic/ScrollAnimatorGeneric.cpp:
+        (WebCore::ScrollAnimatorGeneric::ensureSmoothScrollingAnimation):
+
 2020-09-01  Chris Lord  <[email protected]>
 
         [GTK][WPE] Add support for smooth scrolling animation with async scrolling

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2020-10-23 08:25:56 UTC (rev 268913)
@@ -946,6 +946,15 @@
         m_page->performanceLoggingClient()->logScrollingEvent(PerformanceLoggingClient::ScrollingEvent::SwitchedScrollingMode, timestamp, reasons.toRaw());
 }
 
+#if ENABLE(SMOOTH_SCROLLING)
+bool AsyncScrollingCoordinator::scrollAnimatorEnabled() const
+{
+    ASSERT(isMainThread());
+    auto& settings = m_page->mainFrame().settings();
+    return settings.scrollAnimatorEnabled();
+}
+#endif
+
 } // namespace WebCore
 
 #endif // ENABLE(ASYNC_SCROLLING)

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2020-10-23 08:25:56 UTC (rev 268913)
@@ -71,6 +71,10 @@
     void reportExposedUnfilledArea(MonotonicTime, unsigned unfilledArea);
     void reportSynchronousScrollingReasonsChanged(MonotonicTime, OptionSet<SynchronousScrollingReason>);
 
+#if ENABLE(SMOOTH_SCROLLING)
+    bool scrollAnimatorEnabled() const;
+#endif
+
 protected:
     WEBCORE_EXPORT AsyncScrollingCoordinator(Page*);
 

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2020-10-23 08:25:56 UTC (rev 268913)
@@ -47,6 +47,9 @@
 ThreadedScrollingTree::ThreadedScrollingTree(AsyncScrollingCoordinator& scrollingCoordinator)
     : m_scrollingCoordinator(&scrollingCoordinator)
 {
+#if ENABLE(SMOOTH_SCROLLING)
+    m_scrollAnimatorEnabled = scrollingCoordinator.scrollAnimatorEnabled();
+#endif
 }
 
 ThreadedScrollingTree::~ThreadedScrollingTree()

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/ThreadedScrollingTree.h (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/ThreadedScrollingTree.h	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/ThreadedScrollingTree.h	2020-10-23 08:25:56 UTC (rev 268913)
@@ -58,6 +58,8 @@
 
     Lock& treeMutex() { return m_treeMutex; }
 
+    bool scrollAnimatorEnabled() const { return m_scrollAnimatorEnabled; }
+
 protected:
     explicit ThreadedScrollingTree(AsyncScrollingCoordinator&);
 
@@ -101,6 +103,8 @@
 
     // Dynamically allocated because it has to use the ScrollingThread's runloop.
     std::unique_ptr<RunLoop::Timer<ThreadedScrollingTree>> m_delayedRenderingUpdateDetectionTimer;
+
+    bool m_scrollAnimatorEnabled { false };
 };
 
 } // namespace WebCore

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp	2020-10-23 08:25:56 UTC (rev 268913)
@@ -35,7 +35,7 @@
 #include "Logging.h"
 #include "NicosiaPlatformLayer.h"
 #include "ScrollingStateFrameScrollingNode.h"
-#include "ScrollingTree.h"
+#include "ThreadedScrollingTree.h"
 
 #if ENABLE(KINETIC_SCROLLING)
 #include "ScrollAnimationKinetic.h"
@@ -54,40 +54,7 @@
 ScrollingTreeFrameScrollingNodeNicosia::ScrollingTreeFrameScrollingNodeNicosia(ScrollingTree& scrollingTree, ScrollingNodeType nodeType, ScrollingNodeID nodeID)
     : ScrollingTreeFrameScrollingNode(scrollingTree, nodeType, nodeID)
 {
-#if ENABLE(KINETIC_SCROLLING)
-    m_kineticAnimation = makeUnique<ScrollAnimationKinetic>(
-        [this]() -> ScrollExtents {
-            return { IntPoint(minimumScrollPosition()), IntPoint(maximumScrollPosition()), IntSize(scrollableAreaSize()) };
-        },
-        [this](FloatPoint&& position) {
-#if ENABLE(SMOOTH_SCROLLING)
-            m_smoothAnimation->setCurrentPosition(position);
-#endif
-
-            auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrolledContentsLayer());
-            ASSERT(scrollLayer);
-            auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
-
-            auto updateScope = compositionLayer.createUpdateScope();
-            scrollTo(position);
-        });
-#endif
-#if ENABLE(SMOOTH_SCROLLING)
-    m_smoothAnimation = makeUnique<ScrollAnimationSmooth>(
-        [this]() -> ScrollExtents {
-            return { IntPoint(minimumScrollPosition()), IntPoint(maximumScrollPosition()), IntSize(scrollableAreaSize()) };
-        },
-        currentScrollPosition(),
-        [this](FloatPoint&& position) {
-            auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrolledContentsLayer());
-            ASSERT(scrollLayer);
-            auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
-
-            auto updateScope = compositionLayer.createUpdateScope();
-            scrollTo(position);
-        },
-        [] { });
-#endif
+    m_scrollAnimatorEnabled = downcast<ThreadedScrollingTree>(scrollingTree).scrollAnimatorEnabled();
 }
 
 ScrollingTreeFrameScrollingNodeNicosia::~ScrollingTreeFrameScrollingNodeNicosia() = default;
@@ -136,11 +103,61 @@
         const auto& requestedScrollData = scrollingStateNode.requestedScrollData();
         scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
 #if ENABLE(SMOOTH_SCROLLING)
-        m_smoothAnimation->setCurrentPosition(currentScrollPosition());
+        if (m_smoothAnimation)
+            m_smoothAnimation->setCurrentPosition(currentScrollPosition());
 #endif
     }
 }
 
+#if ENABLE(KINETIC_SCROLLING)
+void ScrollingTreeFrameScrollingNodeNicosia::ensureScrollAnimationKinetic()
+{
+    if (m_kineticAnimation)
+        return;
+
+    m_kineticAnimation = makeUnique<ScrollAnimationKinetic>(
+        [this]() -> ScrollExtents {
+            return { IntPoint(minimumScrollPosition()), IntPoint(maximumScrollPosition()), IntSize(scrollableAreaSize()) };
+        },
+        [this](FloatPoint&& position) {
+#if ENABLE(SMOOTH_SCROLLING)
+            if (m_smoothAnimation)
+                m_smoothAnimation->setCurrentPosition(position);
+#endif
+
+            auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrolledContentsLayer());
+            ASSERT(scrollLayer);
+            auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
+
+            auto updateScope = compositionLayer.createUpdateScope();
+            scrollTo(position);
+        });
+}
+#endif
+
+#if ENABLE(SMOOTH_SCROLLING)
+void ScrollingTreeFrameScrollingNodeNicosia::ensureScrollAnimationSmooth()
+{
+    if (m_smoothAnimation)
+        return;
+
+    m_smoothAnimation = makeUnique<ScrollAnimationSmooth>(
+        [this]() -> ScrollExtents {
+            return { IntPoint(minimumScrollPosition()), IntPoint(maximumScrollPosition()), IntSize(scrollableAreaSize()) };
+        },
+        currentScrollPosition(),
+        [this](FloatPoint&& position) {
+            auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrolledContentsLayer());
+            ASSERT(scrollLayer);
+            auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
+
+            auto updateScope = compositionLayer.createUpdateScope();
+            scrollTo(position);
+        },
+        [] { });
+}
+#endif
+
 WheelEventHandlingResult ScrollingTreeFrameScrollingNodeNicosia::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
 {
     if (!canHandleWheelEvent(wheelEvent))
@@ -147,6 +164,7 @@
         return WheelEventHandlingResult::unhandled();
 
 #if ENABLE(KINETIC_SCROLLING)
+    ensureScrollAnimationKinetic();
     m_kineticAnimation->appendToScrollHistory(wheelEvent);
     m_kineticAnimation->stop();
     if (wheelEvent.isEndOfNonMomentumScroll()) {
@@ -189,9 +207,14 @@
     }
 
 #if ENABLE(SMOOTH_SCROLLING)
-    m_smoothAnimation->scroll(HorizontalScrollbar, ScrollByPixel, 1, -deltaX);
-    m_smoothAnimation->scroll(VerticalScrollbar, ScrollByPixel, 1, -deltaY);
-#else
+    if (m_scrollAnimatorEnabled && !wheelEvent.hasPreciseScrollingDeltas()) {
+        ensureScrollAnimationSmooth();
+        m_smoothAnimation->scroll(HorizontalScrollbar, ScrollByPixel, 1, -deltaX);
+        m_smoothAnimation->scroll(VerticalScrollbar, ScrollByPixel, 1, -deltaY);
+        return WheelEventHandlingResult::handled();
+    }
+#endif
+
     auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrolledContentsLayer());
     ASSERT(scrollLayer);
     auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
@@ -198,7 +221,6 @@
 
     auto updateScope = compositionLayer.createUpdateScope();
     scrollBy({ -deltaX, -deltaY });
-#endif
 
     return WheelEventHandlingResult::handled();
 }
@@ -206,11 +228,14 @@
 void ScrollingTreeFrameScrollingNodeNicosia::stopScrollAnimations()
 {
 #if ENABLE(KINETIC_SCROLLING)
-    m_kineticAnimation->stop();
-    m_kineticAnimation->clearScrollHistory();
+    if (m_kineticAnimation) {
+        m_kineticAnimation->stop();
+        m_kineticAnimation->clearScrollHistory();
+    }
 #endif
 #if ENABLE(SMOOTH_SCROLLING)
-    m_smoothAnimation->stop();
+    if (m_smoothAnimation)
+        m_smoothAnimation->stop();
 #endif
 }
 
@@ -289,6 +314,11 @@
         if (m_footerLayer)
             applyLayerPosition(*m_footerLayer, FloatPoint(horizontalScrollOffsetForBanner, FrameView::yPositionForFooterLayer(scrollPosition, topContentInset, totalContentsSize().height(), footerHeight())));
     }
+
+#if ENABLE(SMOOTH_SCROLLING)
+    if (m_smoothAnimation)
+        m_smoothAnimation->updateVisibleLengths();
+#endif
 }
 
 } // namespace WebCore

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h	2020-10-23 08:25:56 UTC (rev 268913)
@@ -53,6 +53,13 @@
     void commitStateBeforeChildren(const ScrollingStateNode&) override;
     void commitStateAfterChildren(const ScrollingStateNode&) override;
 
+#if ENABLE(KINETIC_SCROLLING)
+    void ensureScrollAnimationKinetic();
+#endif
+#if ENABLE(SMOOTH_SCROLLING)
+    void ensureScrollAnimationSmooth();
+#endif
+
     WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&) override;
 
     void stopScrollAnimations() override;
@@ -71,6 +78,7 @@
     RefPtr<Nicosia::CompositionLayer> m_headerLayer;
     RefPtr<Nicosia::CompositionLayer> m_footerLayer;
 
+    bool m_scrollAnimatorEnabled { false };
 #if ENABLE(KINETIC_SCROLLING)
     std::unique_ptr<ScrollAnimationKinetic> m_kineticAnimation;
 #endif

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp	2020-10-23 08:25:56 UTC (rev 268913)
@@ -39,7 +39,7 @@
 #include "ScrollAnimationSmooth.h"
 #endif
 #include "ScrollingStateOverflowScrollingNode.h"
-#include "ScrollingTree.h"
+#include "ThreadedScrollingTree.h"
 
 namespace WebCore {
 
@@ -51,40 +51,7 @@
 ScrollingTreeOverflowScrollingNodeNicosia::ScrollingTreeOverflowScrollingNodeNicosia(ScrollingTree& scrollingTree, ScrollingNodeID nodeID)
     : ScrollingTreeOverflowScrollingNode(scrollingTree, nodeID)
 {
-#if ENABLE(KINETIC_SCROLLING)
-    m_kineticAnimation = makeUnique<ScrollAnimationKinetic>(
-        [this]() -> ScrollExtents {
-            return { IntPoint(minimumScrollPosition()), IntPoint(maximumScrollPosition()), IntSize(scrollableAreaSize()) };
-        },
-        [this](FloatPoint&& position) {
-#if ENABLE(SMOOTH_SCROLLING)
-            m_smoothAnimation->setCurrentPosition(position);
-#endif
-
-            auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrollContainerLayer());
-            ASSERT(scrollLayer);
-            auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
-
-            auto updateScope = compositionLayer.createUpdateScope();
-            scrollTo(position);
-        });
-#endif
-#if ENABLE(SMOOTH_SCROLLING)
-    m_smoothAnimation = makeUnique<ScrollAnimationSmooth>(
-        [this]() -> ScrollExtents {
-            return { IntPoint(minimumScrollPosition()), IntPoint(maximumScrollPosition()), IntSize(scrollableAreaSize()) };
-        },
-        currentScrollPosition(),
-        [this](FloatPoint&& position) {
-            auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrollContainerLayer());
-            ASSERT(scrollLayer);
-            auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
-
-            auto updateScope = compositionLayer.createUpdateScope();
-            scrollTo(position);
-        },
-        [] { });
-#endif
+    m_scrollAnimatorEnabled = downcast<ThreadedScrollingTree>(scrollingTree).scrollAnimatorEnabled();
 }
 
 ScrollingTreeOverflowScrollingNodeNicosia::~ScrollingTreeOverflowScrollingNodeNicosia() = default;
@@ -99,7 +66,8 @@
         const auto& requestedScrollData = overflowStateNode.requestedScrollData();
         scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
 #if ENABLE(SMOOTH_SCROLLING)
-        m_smoothAnimation->setCurrentPosition(currentScrollPosition());
+        if (m_smoothAnimation)
+            m_smoothAnimation->setCurrentPosition(currentScrollPosition());
 #endif
     }
 }
@@ -124,8 +92,62 @@
             state.boundsOrigin = scrollOffset;
             state.delta.boundsOriginChanged = true;
         });
+
+#if ENABLE(SMOOTH_SCROLLING)
+    if (m_smoothAnimation)
+        m_smoothAnimation->updateVisibleLengths();
+#endif
 }
 
+#if ENABLE(KINETIC_SCROLLING)
+void ScrollingTreeOverflowScrollingNodeNicosia::ensureScrollAnimationKinetic()
+{
+    if (m_kineticAnimation)
+        return;
+
+    m_kineticAnimation = makeUnique<ScrollAnimationKinetic>(
+        [this]() -> ScrollExtents {
+            return { IntPoint(minimumScrollPosition()), IntPoint(maximumScrollPosition()), IntSize(scrollableAreaSize()) };
+        },
+        [this](FloatPoint&& position) {
+#if ENABLE(SMOOTH_SCROLLING)
+            if (m_smoothAnimation)
+                m_smoothAnimation->setCurrentPosition(position);
+#endif
+
+            auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrollContainerLayer());
+            ASSERT(scrollLayer);
+            auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
+
+            auto updateScope = compositionLayer.createUpdateScope();
+            scrollTo(position);
+        });
+}
+#endif
+
+#if ENABLE(SMOOTH_SCROLLING)
+void ScrollingTreeOverflowScrollingNodeNicosia::ensureScrollAnimationSmooth()
+{
+    if (m_smoothAnimation)
+        return;
+
+    m_smoothAnimation = makeUnique<ScrollAnimationSmooth>(
+        [this]() -> ScrollExtents {
+            return { IntPoint(minimumScrollPosition()), IntPoint(maximumScrollPosition()), IntSize(scrollableAreaSize()) };
+        },
+        currentScrollPosition(),
+        [this](FloatPoint&& position) {
+            auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrollContainerLayer());
+            ASSERT(scrollLayer);
+            auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
+
+            auto updateScope = compositionLayer.createUpdateScope();
+            scrollTo(position);
+        },
+        [] { });
+}
+#endif
+
 WheelEventHandlingResult ScrollingTreeOverflowScrollingNodeNicosia::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
 {
     if (!canHandleWheelEvent(wheelEvent))
@@ -132,6 +154,7 @@
         return WheelEventHandlingResult::unhandled();
 
 #if ENABLE(KINETIC_SCROLLING)
+    ensureScrollAnimationKinetic();
     m_kineticAnimation->appendToScrollHistory(wheelEvent);
     m_kineticAnimation->stop();
     if (wheelEvent.isEndOfNonMomentumScroll()) {
@@ -174,9 +197,14 @@
     }
 
 #if ENABLE(SMOOTH_SCROLLING)
-    m_smoothAnimation->scroll(HorizontalScrollbar, ScrollByPixel, 1, -deltaX);
-    m_smoothAnimation->scroll(VerticalScrollbar, ScrollByPixel, 1, -deltaY);
-#else
+    if (m_scrollAnimatorEnabled && !wheelEvent.hasPreciseScrollingDeltas()) {
+        ensureScrollAnimationSmooth();
+        m_smoothAnimation->scroll(HorizontalScrollbar, ScrollByPixel, 1, -deltaX);
+        m_smoothAnimation->scroll(VerticalScrollbar, ScrollByPixel, 1, -deltaY);
+        return WheelEventHandlingResult::handled();
+    }
+#endif
+
     auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrollContainerLayer());
     ASSERT(scrollLayer);
     auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
@@ -183,7 +211,6 @@
 
     auto updateScope = compositionLayer.createUpdateScope();
     scrollBy({ -deltaX, -deltaY });
-#endif
 
     return WheelEventHandlingResult::handled();
 }
@@ -191,11 +218,14 @@
 void ScrollingTreeOverflowScrollingNodeNicosia::stopScrollAnimations()
 {
 #if ENABLE(KINETIC_SCROLLING)
-    m_kineticAnimation->stop();
-    m_kineticAnimation->clearScrollHistory();
+    if (m_kineticAnimation) {
+        m_kineticAnimation->stop();
+        m_kineticAnimation->clearScrollHistory();
+    }
 #endif
 #if ENABLE(SMOOTH_SCROLLING)
-    m_smoothAnimation->stop();
+    if (m_smoothAnimation)
+        m_smoothAnimation->stop();
 #endif
 }
 

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h	2020-10-23 08:25:56 UTC (rev 268913)
@@ -50,10 +50,18 @@
 
     void repositionScrollingLayers() override;
 
+#if ENABLE(KINETIC_SCROLLING)
+    void ensureScrollAnimationKinetic();
+#endif
+#if ENABLE(SMOOTH_SCROLLING)
+    void ensureScrollAnimationSmooth();
+#endif
+
     WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&) override;
 
     void stopScrollAnimations() override;
 
+    bool m_scrollAnimatorEnabled { false };
 #if ENABLE(KINETIC_SCROLLING)
     std::unique_ptr<ScrollAnimationKinetic> m_kineticAnimation;
 #endif

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/PlatformWheelEvent.h (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/PlatformWheelEvent.h	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/PlatformWheelEvent.h	2020-10-23 08:25:56 UTC (rev 268913)
@@ -141,9 +141,12 @@
     explicit PlatformWheelEvent(GdkEventScroll*);
 #endif
 
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) || PLATFORM(GTK) || USE(LIBWPE)
     bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; }
     void setHasPreciseScrollingDeltas(bool hasPreciseScrollingDeltas) { m_hasPreciseScrollingDeltas = hasPreciseScrollingDeltas; }
+#endif
+
+#if PLATFORM(COCOA)
     unsigned scrollCount() const { return m_scrollCount; }
     float unacceleratedScrollingDeltaX() const { return m_unacceleratedScrollingDeltaX; }
     float unacceleratedScrollingDeltaY() const { return m_unacceleratedScrollingDeltaY; }
@@ -191,8 +194,10 @@
     PlatformWheelEventPhase m_phase { PlatformWheelEventPhaseNone };
     PlatformWheelEventPhase m_momentumPhase { PlatformWheelEventPhaseNone };
 #endif
+#if PLATFORM(COCOA) || PLATFORM(GTK) || USE(LIBWPE)
+    bool m_hasPreciseScrollingDeltas { false };
+#endif
 #if PLATFORM(COCOA)
-    bool m_hasPreciseScrollingDeltas { false };
     unsigned m_scrollCount { 0 };
     float m_unacceleratedScrollingDeltaX { 0 };
     float m_unacceleratedScrollingDeltaY { 0 };

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/ScrollAnimation.h (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/ScrollAnimation.h	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/ScrollAnimation.h	2020-10-23 08:25:56 UTC (rev 268913)
@@ -50,6 +50,7 @@
     virtual void updateVisibleLengths() { };
     virtual void setCurrentPosition(const FloatPoint&) { };
     virtual void serviceAnimation() { };
+    virtual bool isActive() const = 0;
 };
 
 } // namespace WebCore

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/ScrollAnimationKinetic.cpp (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/ScrollAnimationKinetic.cpp	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/ScrollAnimationKinetic.cpp	2020-10-23 08:25:56 UTC (rev 268913)
@@ -128,6 +128,11 @@
     m_verticalData = WTF::nullopt;
 }
 
+bool ScrollAnimationKinetic::isActive() const
+{
+    return m_animationTimer.isActive();
+}
+
 void ScrollAnimationKinetic::appendToScrollHistory(const PlatformWheelEvent& event)
 {
     m_scrollHistory.removeAllMatching([&event] (PlatformWheelEvent& otherEvent) -> bool {

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/ScrollAnimationKinetic.h (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/ScrollAnimationKinetic.h	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/ScrollAnimationKinetic.h	2020-10-23 08:25:56 UTC (rev 268913)
@@ -70,6 +70,7 @@
 
     void start(const FloatPoint& initialPosition, const FloatPoint& velocity, bool mayHScroll, bool mayVScroll);
     void stop() override;
+    bool isActive() const override;
 
 private:
     void animationTimerFired();

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/ScrollAnimationSmooth.cpp (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/ScrollAnimationSmooth.cpp	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/ScrollAnimationSmooth.cpp	2020-10-23 08:25:56 UTC (rev 268913)
@@ -85,7 +85,7 @@
         maxScrollPosition = extents.maximumScrollPosition.y();
     }
     bool needToScroll = updatePerAxisData(orientation == HorizontalScrollbar ? m_horizontalData : m_verticalData, granularity, step * multiplier, minScrollPosition, maxScrollPosition);
-    if (needToScroll && !animationTimerActive()) {
+    if (needToScroll && !isActive()) {
         m_startTime = orientation == HorizontalScrollbar ? m_horizontalData.startTime : m_verticalData.startTime;
         animationTimerFired();
     }
@@ -99,7 +99,7 @@
     bool needToScroll = updatePerAxisData(m_horizontalData, granularity, position.x() - m_horizontalData.currentPosition, extents.minimumScrollPosition.x(), extents.maximumScrollPosition.x(), smoothFactorForProgrammaticScroll);
     needToScroll |=
         updatePerAxisData(m_verticalData, granularity, position.y() - m_verticalData.currentPosition, extents.minimumScrollPosition.y(), extents.maximumScrollPosition.y(), smoothFactorForProgrammaticScroll);
-    if (needToScroll && !animationTimerActive()) {
+    if (needToScroll && !isActive()) {
         m_startTime = m_horizontalData.startTime;
         animationTimerFired();
     }
@@ -449,7 +449,7 @@
     m_animationTimer.startOneShot(delay);
 }
 
-bool ScrollAnimationSmooth::animationTimerActive() const
+bool ScrollAnimationSmooth::isActive() const
 {
     return m_animationTimer.isActive();
 }

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/ScrollAnimationSmooth.h (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/ScrollAnimationSmooth.h	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/ScrollAnimationSmooth.h	2020-10-23 08:25:56 UTC (rev 268913)
@@ -58,6 +58,7 @@
     void stop() override;
     void updateVisibleLengths() override;
     void setCurrentPosition(const FloatPoint&) override;
+    bool isActive() const override;
 
     struct PerAxisData {
         PerAxisData() = delete;
@@ -101,7 +102,6 @@
     void requestAnimationTimerFired();
     void startNextTimer(Seconds delay);
     void animationTimerFired();
-    bool animationTimerActive() const;
 
     ScrollExtentsCallback m_scrollExtentsFunction;
     NotifyPositionChangedCallback m_notifyPositionChangedFunction;

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp	2020-10-23 08:25:56 UTC (rev 268913)
@@ -73,8 +73,11 @@
 #if ENABLE(SMOOTH_SCROLLING)
 void ScrollAnimatorGeneric::ensureSmoothScrollingAnimation()
 {
-    if (m_smoothAnimation)
+    if (m_smoothAnimation) {
+        if (!m_smoothAnimation->isActive())
+            m_smoothAnimation->setCurrentPosition(m_currentPosition);
         return;
+    }
 
     m_smoothAnimation = makeUnique<ScrollAnimationSmooth>(
         [this]() -> ScrollExtents {

Modified: releases/WebKitGTK/webkit-2.30/Source/WebKit/ChangeLog (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebKit/ChangeLog	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebKit/ChangeLog	2020-10-23 08:25:56 UTC (rev 268913)
@@ -1,3 +1,31 @@
+2020-10-15  Chris Lord  <[email protected]>
+
+        [GTK][WPE] Add support for smooth scrolling animation with async scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=210382
+
+        Reviewed by Carlos Garcia Campos.
+
+        Add hasPreciseScrollingDeltas to GTK/WPE wheel events.
+
+        No new tests needed.
+
+        * Shared/WebEventConversion.cpp:
+        (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
+        * Shared/WebWheelEvent.cpp:
+        (WebKit::WebWheelEvent::WebWheelEvent):
+        (WebKit::WebWheelEvent::encode const):
+        (WebKit::WebWheelEvent::decode):
+        * Shared/WebWheelEvent.h:
+        * Shared/WebWheelEventCoalescer.cpp:
+        (WebKit::WebWheelEventCoalescer::canCoalesce):
+        (WebKit::WebWheelEventCoalescer::coalesce):
+        * Shared/gtk/NativeWebWheelEventGtk.cpp:
+        (WebKit::NativeWebWheelEvent::NativeWebWheelEvent):
+        * Shared/gtk/WebEventFactory.cpp:
+        (WebKit::WebEventFactory::createWebWheelEvent):
+        * Shared/libwpe/WebEventFactory.cpp:
+        (WebKit::WebEventFactory::createWebWheelEvent):
+
 2020-10-23  Michael Catanzaro  <[email protected]>
 
         [SOUP] Fix crash in WebSocketTask

Modified: releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/WebEvent.h (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/WebEvent.h	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/WebEvent.h	2020-10-23 08:25:56 UTC (rev 268913)
@@ -207,7 +207,7 @@
 #if PLATFORM(COCOA)
     WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, bool directionInvertedFromDevice, Phase, Phase momentumPhase, bool hasPreciseScrollingDeltas, uint32_t scrollCount, const WebCore::FloatSize& unacceleratedScrollingDelta, OptionSet<Modifier>, WallTime timestamp);
 #elif PLATFORM(GTK) || USE(LIBWPE)
-    WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Phase, Phase momentumPhase, Granularity, OptionSet<Modifier>, WallTime timestamp);
+    WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Phase, Phase momentumPhase, Granularity, bool hasPreciseScrollingDeltas, OptionSet<Modifier>, WallTime timestamp);
 #endif
 
     const WebCore::IntPoint position() const { return m_position; }
@@ -218,8 +218,10 @@
     bool directionInvertedFromDevice() const { return m_directionInvertedFromDevice; }
     Phase phase() const { return static_cast<Phase>(m_phase); }
     Phase momentumPhase() const { return static_cast<Phase>(m_momentumPhase); }
+#if PLATFORM(COCOA) || PLATFORM(GTK) || USE(LIBWPE)
+    bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; }
+#endif
 #if PLATFORM(COCOA)
-    bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; }
     uint32_t scrollCount() const { return m_scrollCount; }
     const WebCore::FloatSize& unacceleratedScrollingDelta() const { return m_unacceleratedScrollingDelta; }
 #endif
@@ -238,8 +240,10 @@
     bool m_directionInvertedFromDevice { false };
     uint32_t m_phase { Phase::PhaseNone };
     uint32_t m_momentumPhase { Phase::PhaseNone };
+#if PLATFORM(COCOA) || PLATFORM(GTK) || USE(LIBWPE)
+    bool m_hasPreciseScrollingDeltas { false };
+#endif
 #if PLATFORM(COCOA)
-    bool m_hasPreciseScrollingDeltas { false };
     uint32_t m_scrollCount { 0 };
     WebCore::FloatSize m_unacceleratedScrollingDelta;
 #endif

Modified: releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/WebEventConversion.cpp (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/WebEventConversion.cpp	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/WebEventConversion.cpp	2020-10-23 08:25:56 UTC (rev 268913)
@@ -161,8 +161,10 @@
         m_phase = static_cast<WebCore::PlatformWheelEventPhase>(webEvent.phase());
         m_momentumPhase = static_cast<WebCore::PlatformWheelEventPhase>(webEvent.momentumPhase());
 #endif
+#if PLATFORM(COCOA) || PLATFORM(GTK) || USE(LIBWPE)
+        m_hasPreciseScrollingDeltas = webEvent.hasPreciseScrollingDeltas();
+#endif
 #if PLATFORM(COCOA)
-        m_hasPreciseScrollingDeltas = webEvent.hasPreciseScrollingDeltas();
         m_scrollCount = webEvent.scrollCount();
         m_unacceleratedScrollingDeltaX = webEvent.unacceleratedScrollingDelta().width();
         m_unacceleratedScrollingDeltaY = webEvent.unacceleratedScrollingDelta().height();

Modified: releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/WebWheelEvent.cpp (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/WebWheelEvent.cpp	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/WebWheelEvent.cpp	2020-10-23 08:25:56 UTC (rev 268913)
@@ -66,7 +66,7 @@
     ASSERT(isWheelEventType(type));
 }
 #elif PLATFORM(GTK) || USE(LIBWPE)
-WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Phase phase, Phase momentumPhase, Granularity granularity, OptionSet<Modifier> modifiers, WallTime timestamp)
+WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Phase phase, Phase momentumPhase, Granularity granularity, bool hasPreciseScrollingDeltas, OptionSet<Modifier> modifiers, WallTime timestamp)
     : WebEvent(type, modifiers, timestamp)
     , m_position(position)
     , m_globalPosition(globalPosition)
@@ -76,6 +76,7 @@
     , m_directionInvertedFromDevice(false)
     , m_phase(phase)
     , m_momentumPhase(momentumPhase)
+    , m_hasPreciseScrollingDeltas(hasPreciseScrollingDeltas)
 {
     ASSERT(isWheelEventType(type));
 }
@@ -94,9 +95,9 @@
 #if PLATFORM(COCOA) || PLATFORM(GTK) || USE(LIBWPE)
     encoder << m_phase;
     encoder << m_momentumPhase;
+    encoder << m_hasPreciseScrollingDeltas;
 #endif
 #if PLATFORM(COCOA)
-    encoder << m_hasPreciseScrollingDeltas;
     encoder << m_scrollCount;
     encoder << m_unacceleratedScrollingDelta;
 #endif
@@ -123,10 +124,10 @@
         return false;
     if (!decoder.decode(t.m_momentumPhase))
         return false;
+    if (!decoder.decode(t.m_hasPreciseScrollingDeltas))
+        return false;
 #endif
 #if PLATFORM(COCOA)
-    if (!decoder.decode(t.m_hasPreciseScrollingDeltas))
-        return false;
     if (!decoder.decode(t.m_scrollCount))
         return false;
     if (!decoder.decode(t.m_unacceleratedScrollingDelta))

Modified: releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/gtk/NativeWebWheelEventGtk.cpp (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/gtk/NativeWebWheelEventGtk.cpp	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/gtk/NativeWebWheelEventGtk.cpp	2020-10-23 08:25:56 UTC (rev 268913)
@@ -50,12 +50,12 @@
 }
 
 NativeWebWheelEvent::NativeWebWheelEvent(const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, WebWheelEvent::Phase phase, WebWheelEvent::Phase momentumPhase)
-    : WebWheelEvent(WebEvent::Wheel, position, globalPosition, delta, wheelTicks, phase, momentumPhase, WebWheelEvent::ScrollByPixelWheelEvent, { }, WallTime::now())
+    : WebWheelEvent(WebEvent::Wheel, position, globalPosition, delta, wheelTicks, phase, momentumPhase, WebWheelEvent::ScrollByPixelWheelEvent, false, { }, WallTime::now())
 {
 }
 
 NativeWebWheelEvent::NativeWebWheelEvent(const NativeWebWheelEvent& event)
-    : WebWheelEvent(event.type(), event.position(), event.globalPosition(), event.delta(), event.wheelTicks(), event.phase(), event.momentumPhase(), event.granularity(), event.modifiers(), event.timestamp())
+    : WebWheelEvent(event.type(), event.position(), event.globalPosition(), event.delta(), event.wheelTicks(), event.phase(), event.momentumPhase(), event.granularity(), event.hasPreciseScrollingDeltas(), event.modifiers(), event.timestamp())
     , m_nativeEvent(event.nativeEvent() ? gdk_event_copy(event.nativeEvent()) : nullptr)
 {
 }

Modified: releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/gtk/WebEventFactory.cpp (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/gtk/WebEventFactory.cpp	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/gtk/WebEventFactory.cpp	2020-10-23 08:25:56 UTC (rev 268913)
@@ -288,6 +288,7 @@
         phase,
         momentumPhase,
         WebWheelEvent::ScrollByPixelWheelEvent,
+        false,
         modifiersForEvent(event),
         wallTimeForEvent(event));
 }

Modified: releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/libwpe/WebEventFactory.cpp (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/libwpe/WebEventFactory.cpp	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebKit/Shared/libwpe/WebEventFactory.cpp	2020-10-23 08:25:56 UTC (rev 268913)
@@ -164,6 +164,7 @@
 
     WebCore::FloatSize wheelTicks;
     WebCore::FloatSize delta;
+    bool hasPreciseScrollingDeltas = false;
 
 #if WPE_CHECK_VERSION(1, 5, 0)
     if (event->type & wpe_input_axis_event_type_mask_2d) {
@@ -177,6 +178,7 @@
         case wpe_input_axis_event_type_motion_smooth:
             wheelTicks = WebCore::FloatSize(event2D->x_axis / deviceScaleFactor, event2D->y_axis / deviceScaleFactor);
             delta = wheelTicks;
+            hasPreciseScrollingDeltas = true;
             break;
         default:
             return WebWheelEvent();
@@ -184,7 +186,7 @@
 
         return WebWheelEvent(WebEvent::Wheel, position, position,
             delta, wheelTicks, phase, momentumPhase,
-            WebWheelEvent::ScrollByPixelWheelEvent,
+            WebWheelEvent::ScrollByPixelWheelEvent, hasPreciseScrollingDeltas,
             OptionSet<WebEvent::Modifier> { }, wallTimeForEventTime(event->time));
     }
 #endif
@@ -210,6 +212,7 @@
     case Smooth:
         wheelTicks = WebCore::FloatSize(0, event->value / deviceScaleFactor);
         delta = wheelTicks;
+        hasPreciseScrollingDeltas = true;
         break;
     default:
         return WebWheelEvent();
@@ -217,7 +220,7 @@
 
     return WebWheelEvent(WebEvent::Wheel, position, position,
         delta, wheelTicks, phase, momentumPhase,
-        WebWheelEvent::ScrollByPixelWheelEvent,
+        WebWheelEvent::ScrollByPixelWheelEvent, hasPreciseScrollingDeltas,
         OptionSet<WebEvent::Modifier> { }, wallTimeForEventTime(event->time));
 }
 

Modified: releases/WebKitGTK/webkit-2.30/Source/WebKit/UIProcess/WebPageProxy.cpp (268912 => 268913)


--- releases/WebKitGTK/webkit-2.30/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-10-23 08:25:42 UTC (rev 268912)
+++ releases/WebKitGTK/webkit-2.30/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-10-23 08:25:56 UTC (rev 268913)
@@ -2611,6 +2611,8 @@
         return false;
     if (a.momentumPhase() != b.momentumPhase())
         return false;
+#endif
+#if PLATFORM(COCOA) || PLATFORM(GTK) || USE(LIBWPE)
     if (a.hasPreciseScrollingDeltas() != b.hasPreciseScrollingDeltas())
         return false;
 #endif
@@ -2629,6 +2631,8 @@
     FloatSize mergedUnacceleratedScrollingDelta = a.unacceleratedScrollingDelta() + b.unacceleratedScrollingDelta();
 
     return WebWheelEvent(WebEvent::Wheel, b.position(), b.globalPosition(), mergedDelta, mergedWheelTicks, b.granularity(), b.directionInvertedFromDevice(), b.phase(), b.momentumPhase(), b.hasPreciseScrollingDeltas(), b.scrollCount(), mergedUnacceleratedScrollingDelta, b.modifiers(), b.timestamp());
+#elif PLATFORM(GTK) || USE(LIBWPE)
+    return WebWheelEvent(WebEvent::Wheel, b.position(), b.globalPosition(), mergedDelta, mergedWheelTicks, b.phase(), b.momentumPhase(), b.granularity(), b.hasPreciseScrollingDeltas(), b.modifiers(), b.timestamp());
 #else
     return WebWheelEvent(WebEvent::Wheel, b.position(), b.globalPosition(), mergedDelta, mergedWheelTicks, b.granularity(), b.modifiers(), b.timestamp());
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to