Make generic ScrollAnimator
authordon.olmstead@sony.com <don.olmstead@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Nov 2018 18:36:29 +0000 (18:36 +0000)
committerdon.olmstead@sony.com <don.olmstead@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Nov 2018 18:36:29 +0000 (18:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192128

Reviewed by Michael Catanzaro.

No new tests. No change in behavior.

Moves ScrollAnimatorGtk into ScrollAnimatorGeneric where it can be used
by other implementations. Fixed some compilation issues around using
this as a default implementation.

Removing ScrollAnimatorSmooth since it is dead code and doesn't even
compile at this time.

Fixing a compilation issue within LowPowerModeNotifierGLib
implementation that appeared due to unified sources changes.

* PlatformGTK.cmake:
* SourcesGTK.txt:
* platform/LowPowerModeNotifier.h:
* platform/PlatformWheelEvent.h:
(WebCore::PlatformWheelEvent::swipeVelocity const):
* platform/ScrollAnimatorSmooth.cpp: Removed.
* platform/ScrollAnimatorSmooth.h: Removed.
* platform/generic/ScrollAnimatorGeneric.cpp: Renamed from Source/WebCore/platform/gtk/ScrollAnimatorGtk.cpp.
(WebCore::ScrollAnimator::create):
(WebCore::ScrollAnimatorGeneric::ScrollAnimatorGeneric):
(WebCore::ScrollAnimatorGeneric::ensureSmoothScrollingAnimation):
(WebCore::ScrollAnimatorGeneric::scroll):
(WebCore::ScrollAnimatorGeneric::scrollToOffsetWithoutAnimation):
(WebCore::ScrollAnimatorGeneric::computeVelocity):
(WebCore::ScrollAnimatorGeneric::handleWheelEvent):
(WebCore::ScrollAnimatorGeneric::willEndLiveResize):
(WebCore::ScrollAnimatorGeneric::updatePosition):
(WebCore::ScrollAnimatorGeneric::didAddVerticalScrollbar):
(WebCore::ScrollAnimatorGeneric::didAddHorizontalScrollbar):
(WebCore::ScrollAnimatorGeneric::willRemoveVerticalScrollbar):
(WebCore::ScrollAnimatorGeneric::willRemoveHorizontalScrollbar):
(WebCore::ScrollAnimatorGeneric::updateOverlayScrollbarsOpacity):
(WebCore::ScrollAnimatorGeneric::overlayScrollbarAnimationTimerFired):
(WebCore::ScrollAnimatorGeneric::showOverlayScrollbars):
(WebCore::ScrollAnimatorGeneric::hideOverlayScrollbars):
(WebCore::ScrollAnimatorGeneric::mouseEnteredContentArea):
(WebCore::ScrollAnimatorGeneric::mouseExitedContentArea):
(WebCore::ScrollAnimatorGeneric::mouseMovedInContentArea):
(WebCore::ScrollAnimatorGeneric::contentAreaDidShow):
(WebCore::ScrollAnimatorGeneric::contentAreaDidHide):
(WebCore::ScrollAnimatorGeneric::notifyContentAreaScrolled):
(WebCore::ScrollAnimatorGeneric::lockOverlayScrollbarStateToHidden):
* platform/generic/ScrollAnimatorGeneric.h: Renamed from Source/WebCore/platform/gtk/ScrollAnimatorGtk.h.
* platform/glib/LowPowerModeNotifierGLib.cpp:
* platform/gtk/PlatformWheelEventGtk.cpp:
(WebCore::PlatformWheelEvent::swipeVelocity const): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238675 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/PlatformGTK.cmake
Source/WebCore/SourcesGTK.txt
Source/WebCore/platform/LowPowerModeNotifier.h
Source/WebCore/platform/PlatformWheelEvent.h
Source/WebCore/platform/ScrollAnimatorSmooth.cpp [deleted file]
Source/WebCore/platform/ScrollAnimatorSmooth.h [deleted file]
Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp [moved from Source/WebCore/platform/gtk/ScrollAnimatorGtk.cpp with 85% similarity]
Source/WebCore/platform/generic/ScrollAnimatorGeneric.h [moved from Source/WebCore/platform/gtk/ScrollAnimatorGtk.h with 93% similarity]
Source/WebCore/platform/glib/LowPowerModeNotifierGLib.cpp
Source/WebCore/platform/gtk/PlatformWheelEventGtk.cpp

index 526aa70..4e5b161 100644 (file)
@@ -1,3 +1,59 @@
+2018-11-29  Don Olmstead  <don.olmstead@sony.com>
+
+        Make generic ScrollAnimator
+        https://bugs.webkit.org/show_bug.cgi?id=192128
+
+        Reviewed by Michael Catanzaro.
+
+        No new tests. No change in behavior.
+
+        Moves ScrollAnimatorGtk into ScrollAnimatorGeneric where it can be used
+        by other implementations. Fixed some compilation issues around using
+        this as a default implementation.
+
+        Removing ScrollAnimatorSmooth since it is dead code and doesn't even
+        compile at this time.
+
+        Fixing a compilation issue within LowPowerModeNotifierGLib
+        implementation that appeared due to unified sources changes.
+
+        * PlatformGTK.cmake:
+        * SourcesGTK.txt:
+        * platform/LowPowerModeNotifier.h:
+        * platform/PlatformWheelEvent.h:
+        (WebCore::PlatformWheelEvent::swipeVelocity const):
+        * platform/ScrollAnimatorSmooth.cpp: Removed.
+        * platform/ScrollAnimatorSmooth.h: Removed.
+        * platform/generic/ScrollAnimatorGeneric.cpp: Renamed from Source/WebCore/platform/gtk/ScrollAnimatorGtk.cpp.
+        (WebCore::ScrollAnimator::create):
+        (WebCore::ScrollAnimatorGeneric::ScrollAnimatorGeneric):
+        (WebCore::ScrollAnimatorGeneric::ensureSmoothScrollingAnimation):
+        (WebCore::ScrollAnimatorGeneric::scroll):
+        (WebCore::ScrollAnimatorGeneric::scrollToOffsetWithoutAnimation):
+        (WebCore::ScrollAnimatorGeneric::computeVelocity):
+        (WebCore::ScrollAnimatorGeneric::handleWheelEvent):
+        (WebCore::ScrollAnimatorGeneric::willEndLiveResize):
+        (WebCore::ScrollAnimatorGeneric::updatePosition):
+        (WebCore::ScrollAnimatorGeneric::didAddVerticalScrollbar):
+        (WebCore::ScrollAnimatorGeneric::didAddHorizontalScrollbar):
+        (WebCore::ScrollAnimatorGeneric::willRemoveVerticalScrollbar):
+        (WebCore::ScrollAnimatorGeneric::willRemoveHorizontalScrollbar):
+        (WebCore::ScrollAnimatorGeneric::updateOverlayScrollbarsOpacity):
+        (WebCore::ScrollAnimatorGeneric::overlayScrollbarAnimationTimerFired):
+        (WebCore::ScrollAnimatorGeneric::showOverlayScrollbars):
+        (WebCore::ScrollAnimatorGeneric::hideOverlayScrollbars):
+        (WebCore::ScrollAnimatorGeneric::mouseEnteredContentArea):
+        (WebCore::ScrollAnimatorGeneric::mouseExitedContentArea):
+        (WebCore::ScrollAnimatorGeneric::mouseMovedInContentArea):
+        (WebCore::ScrollAnimatorGeneric::contentAreaDidShow):
+        (WebCore::ScrollAnimatorGeneric::contentAreaDidHide):
+        (WebCore::ScrollAnimatorGeneric::notifyContentAreaScrolled):
+        (WebCore::ScrollAnimatorGeneric::lockOverlayScrollbarStateToHidden):
+        * platform/generic/ScrollAnimatorGeneric.h: Renamed from Source/WebCore/platform/gtk/ScrollAnimatorGtk.h.
+        * platform/glib/LowPowerModeNotifierGLib.cpp:
+        * platform/gtk/PlatformWheelEventGtk.cpp:
+        (WebCore::PlatformWheelEvent::swipeVelocity const): Deleted.
+
 2018-11-28  Dean Jackson  <dino@apple.com>
 
         [ES Modules] Allow .mjs content when loaded from file://
index c41caa5..e0dd9cd 100644 (file)
@@ -20,6 +20,7 @@ list(APPEND WebCore_INCLUDE_DIRECTORIES
     "${WEBCORE_DIR}/accessibility/atk"
     "${WEBCORE_DIR}/editing/atk"
     "${WEBCORE_DIR}/page/gtk"
+    "${WEBCORE_DIR}/platform/generic"
     "${WEBCORE_DIR}/platform/geoclue"
     "${WEBCORE_DIR}/platform/gtk"
     "${WEBCORE_DIR}/platform/graphics/egl"
index e616f27..5e2356d 100644 (file)
@@ -59,6 +59,8 @@ platform/ScrollAnimationKinetic.cpp
 platform/ScrollAnimationSmooth.cpp
 platform/UserAgentQuirks.cpp
 
+platform/generic/ScrollAnimatorGeneric.cpp
+
 platform/geoclue/GeolocationProviderGeoclue.cpp
 
 platform/graphics/GLContext.cpp @no-unify
@@ -89,7 +91,6 @@ platform/graphics/x11/XUniqueResource.cpp @no-unify
 platform/gtk/DragDataGtk.cpp
 platform/gtk/LocalizedStringsGtk.cpp
 platform/gtk/PasteboardGtk.cpp
-platform/gtk/ScrollAnimatorGtk.cpp
 platform/gtk/SelectionData.cpp
 
 platform/text/Hyphenation.cpp
index de103c2..6b4b447 100644 (file)
@@ -34,7 +34,7 @@ OBJC_CLASS WebLowPowerModeObserver;
 
 #if USE(GLIB)
 #include <wtf/glib/GRefPtr.h>
-typedef _GDBusProxy GDBusProxy;
+typedef struct _GDBusProxy GDBusProxy;
 #endif
 
 namespace WebCore {
index 9003225..21e9709 100644 (file)
@@ -126,7 +126,6 @@ public:
 
 #if PLATFORM(GTK)
     explicit PlatformWheelEvent(GdkEventScroll*);
-    FloatPoint swipeVelocity() const;
 #endif
 
 #if PLATFORM(COCOA)
@@ -151,6 +150,7 @@ public:
     PlatformWheelEventPhase momentumPhase() const { return m_momentumPhase; }
     bool isEndOfNonMomentumScroll() const;
     bool isTransitioningToMomentumScroll() const;
+    FloatPoint swipeVelocity() const;
 #endif
 
 #if PLATFORM(WIN)
@@ -209,10 +209,6 @@ inline bool PlatformWheelEvent::isEndOfMomentumScroll() const
     return m_phase == PlatformWheelEventPhaseNone && m_momentumPhase == PlatformWheelEventPhaseEnded;
 }
 
-#endif
-
-#if PLATFORM(COCOA) || PLATFORM(GTK)
-
 inline bool PlatformWheelEvent::isEndOfNonMomentumScroll() const
 {
     return m_phase == PlatformWheelEventPhaseEnded && m_momentumPhase == PlatformWheelEventPhaseNone;
@@ -222,6 +218,13 @@ inline bool PlatformWheelEvent::isTransitioningToMomentumScroll() const
 {
     return m_phase == PlatformWheelEventPhaseNone && m_momentumPhase == PlatformWheelEventPhaseBegan;
 }
-#endif
+
+inline FloatPoint PlatformWheelEvent::swipeVelocity() const
+{
+    // The swiping velocity is stored in the deltas of the event declaring it.
+    return isTransitioningToMomentumScroll() ? FloatPoint(m_wheelTicksX, m_wheelTicksY) : FloatPoint();
+}
+
+#endif // ENABLE(ASYNC_SCROLLING)
 
 } // namespace WebCore
diff --git a/Source/WebCore/platform/ScrollAnimatorSmooth.cpp b/Source/WebCore/platform/ScrollAnimatorSmooth.cpp
deleted file mode 100644 (file)
index defc3f1..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2011, Google Inc. All rights reserved.
- * Copyright (C) 2015 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ScrollAnimatorSmooth.h"
-
-#if ENABLE(SMOOTH_SCROLLING)
-
-#include "ScrollAnimationSmooth.h"
-#include "ScrollableArea.h"
-
-namespace WebCore {
-
-std::unique_ptr<ScrollAnimator> ScrollAnimator::create(ScrollableArea& scrollableArea)
-{
-    if (scrollableArea.scrollAnimatorEnabled())
-        return std::make_unique<ScrollAnimatorSmooth>(scrollableArea);
-    return std::make_unique<ScrollAnimator>(scrollableArea);
-}
-
-ScrollAnimatorSmooth::ScrollAnimatorSmooth(ScrollableArea& scrollableArea)
-    : ScrollAnimator(scrollableArea)
-    , m_animation(std::make_unique<ScrollAnimationSmooth>(scrollableArea, m_currentPosition, [this](FloatPoint&& position) {
-        FloatSize delta = position - m_currentPosition;
-        m_currentPosition = WTFMove(position);
-        notifyPositionChanged(delta);
-    }))
-{
-}
-
-ScrollAnimatorSmooth::~ScrollAnimatorSmooth() = default;
-
-bool ScrollAnimatorSmooth::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier)
-{
-    if (!m_scrollableArea.scrollAnimatorEnabled())
-        return ScrollAnimator::scroll(orientation, granularity, step, multiplier);
-
-    return m_animation->scroll(orientation, granularity, step, multiplier);
-}
-
-void ScrollAnimatorSmooth::scrollToOffsetWithoutAnimation(const FloatPoint& offset)
-{
-    FloatPoint position = ScrollableArea::scrollPositionFromOffset(offset, toFloatSize(m_scrollableArea.scrollOrigin()));
-    m_animation->setCurrentPosition(position);
-
-    FloatSize delta = position - m_currentPosition;
-    m_currentPosition = position;
-    notifyPositionChanged(delta);
-}
-
-#if !USE(REQUEST_ANIMATION_FRAME_TIMER)
-void ScrollAnimatorSmooth::cancelAnimations()
-{
-    m_animation->stop();
-}
-
-void ScrollAnimatorSmooth::serviceScrollAnimations()
-{
-    m_animation->serviceAnimation();
-}
-#endif
-
-void ScrollAnimatorSmooth::willEndLiveResize()
-{
-    m_animation->updateVisibleLengths();
-}
-
-void ScrollAnimatorSmooth::didAddVerticalScrollbar(Scrollbar*)
-{
-    m_animation->updateVisibleLengths();
-}
-
-void ScrollAnimatorSmooth::didAddHorizontalScrollbar(Scrollbar*)
-{
-    m_animation->updateVisibleLengths();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(SMOOTH_SCROLLING)
diff --git a/Source/WebCore/platform/ScrollAnimatorSmooth.h b/Source/WebCore/platform/ScrollAnimatorSmooth.h
deleted file mode 100644 (file)
index 4c6ac03..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2011, Google Inc. All rights reserved.
- * Copyright (C) 2015 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ScrollAnimatorSmooth_h
-#define ScrollAnimatorSmooth_h
-
-#include "ScrollAnimator.h"
-
-#if ENABLE(SMOOTH_SCROLLING)
-
-namespace WebCore {
-
-class ScrollAnimation;
-
-class ScrollAnimatorSmooth final : public ScrollAnimator {
-public:
-    explicit ScrollAnimatorSmooth(ScrollableArea&);
-    virtual ~ScrollAnimatorSmooth();
-
-    bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier) override;
-    void scrollToOffsetWithoutAnimation(const FloatPoint&) override;
-
-#if !USE(REQUEST_ANIMATION_FRAME_TIMER)
-    void cancelAnimations() override;
-    void serviceScrollAnimations() override;
-#endif
-
-    void willEndLiveResize() override;
-    void didAddVerticalScrollbar(Scrollbar*) override;
-    void didAddHorizontalScrollbar(Scrollbar*) override;
-
-private:
-
-    std::unique_ptr<ScrollAnimation> m_animation;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(SMOOTH_SCROLLING)
-
-#endif // ScrollAnimatorSmooth_h
@@ -29,7 +29,7 @@
  */
 
 #include "config.h"
-#include "ScrollAnimatorGtk.h"
+#include "ScrollAnimatorGeneric.h"
 
 #include "ScrollAnimationKinetic.h"
 #include "ScrollAnimationSmooth.h"
@@ -44,12 +44,12 @@ static const Seconds scrollCaptureThreshold { 150_ms };
 
 std::unique_ptr<ScrollAnimator> ScrollAnimator::create(ScrollableArea& scrollableArea)
 {
-    return std::make_unique<ScrollAnimatorGtk>(scrollableArea);
+    return std::make_unique<ScrollAnimatorGeneric>(scrollableArea);
 }
 
-ScrollAnimatorGtk::ScrollAnimatorGtk(ScrollableArea& scrollableArea)
+ScrollAnimatorGeneric::ScrollAnimatorGeneric(ScrollableArea& scrollableArea)
     : ScrollAnimator(scrollableArea)
-    , m_overlayScrollbarAnimationTimer(*this, &ScrollAnimatorGtk::overlayScrollbarAnimationTimerFired)
+    , m_overlayScrollbarAnimationTimer(*this, &ScrollAnimatorGeneric::overlayScrollbarAnimationTimerFired)
 {
     m_kineticAnimation = std::make_unique<ScrollAnimationKinetic>(m_scrollableArea, [this](FloatPoint&& position) {
 #if ENABLE(SMOOTH_SCROLLING)
@@ -65,10 +65,10 @@ ScrollAnimatorGtk::ScrollAnimatorGtk(ScrollableArea& scrollableArea)
 #endif
 }
 
-ScrollAnimatorGtk::~ScrollAnimatorGtk() = default;
+ScrollAnimatorGeneric::~ScrollAnimatorGeneric() = default;
 
 #if ENABLE(SMOOTH_SCROLLING)
-void ScrollAnimatorGtk::ensureSmoothScrollingAnimation()
+void ScrollAnimatorGeneric::ensureSmoothScrollingAnimation()
 {
     if (m_smoothAnimation)
         return;
@@ -80,7 +80,7 @@ void ScrollAnimatorGtk::ensureSmoothScrollingAnimation()
 #endif
 
 #if ENABLE(SMOOTH_SCROLLING)
-bool ScrollAnimatorGtk::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier)
+bool ScrollAnimatorGeneric::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier)
 {
     if (!m_scrollableArea.scrollAnimatorEnabled())
         return ScrollAnimator::scroll(orientation, granularity, step, multiplier);
@@ -90,7 +90,7 @@ bool ScrollAnimatorGtk::scroll(ScrollbarOrientation orientation, ScrollGranulari
 }
 #endif
 
-void ScrollAnimatorGtk::scrollToOffsetWithoutAnimation(const FloatPoint& offset, ScrollClamping)
+void ScrollAnimatorGeneric::scrollToOffsetWithoutAnimation(const FloatPoint& offset, ScrollClamping)
 {
     FloatPoint position = ScrollableArea::scrollPositionFromOffset(offset, toFloatSize(m_scrollableArea.scrollOrigin()));
     m_kineticAnimation->stop();
@@ -104,7 +104,7 @@ void ScrollAnimatorGtk::scrollToOffsetWithoutAnimation(const FloatPoint& offset,
     updatePosition(WTFMove(position));
 }
 
-FloatPoint ScrollAnimatorGtk::computeVelocity()
+FloatPoint ScrollAnimatorGeneric::computeVelocity()
 {
     if (m_scrollHistory.isEmpty())
         return { };
@@ -124,7 +124,7 @@ FloatPoint ScrollAnimatorGtk::computeVelocity()
     return FloatPoint(accumDelta.x() * -1 / (last - first).value(), accumDelta.y() * -1 / (last - first).value());
 }
 
-bool ScrollAnimatorGtk::handleWheelEvent(const PlatformWheelEvent& event)
+bool ScrollAnimatorGeneric::handleWheelEvent(const PlatformWheelEvent& event)
 {
     m_kineticAnimation->stop();
 
@@ -132,6 +132,7 @@ bool ScrollAnimatorGtk::handleWheelEvent(const PlatformWheelEvent& event)
         return (event.timestamp() - otherEvent.timestamp()) > scrollCaptureThreshold;
     });
 
+#if ENABLE(ASYNC_SCROLLING)
     if (event.isEndOfNonMomentumScroll()) {
         // We don't need to add the event to the history as its delta will be (0, 0).
         static_cast<ScrollAnimationKinetic*>(m_kineticAnimation.get())->start(m_currentPosition, computeVelocity(), m_scrollableArea.horizontalScrollbar(), m_scrollableArea.verticalScrollbar());
@@ -142,13 +143,14 @@ bool ScrollAnimatorGtk::handleWheelEvent(const PlatformWheelEvent& event)
         static_cast<ScrollAnimationKinetic*>(m_kineticAnimation.get())->start(m_currentPosition, event.swipeVelocity(), m_scrollableArea.horizontalScrollbar(), m_scrollableArea.verticalScrollbar());
         return true;
     }
+#endif
 
     m_scrollHistory.append(event);
 
     return ScrollAnimator::handleWheelEvent(event);
 }
 
-void ScrollAnimatorGtk::willEndLiveResize()
+void ScrollAnimatorGeneric::willEndLiveResize()
 {
     m_kineticAnimation->updateVisibleLengths();
 
@@ -158,14 +160,14 @@ void ScrollAnimatorGtk::willEndLiveResize()
 #endif
 }
 
-void ScrollAnimatorGtk::updatePosition(FloatPoint&& position)
+void ScrollAnimatorGeneric::updatePosition(FloatPoint&& position)
 {
     FloatSize delta = position - m_currentPosition;
     m_currentPosition = WTFMove(position);
     notifyPositionChanged(delta);
 }
 
-void ScrollAnimatorGtk::didAddVerticalScrollbar(Scrollbar* scrollbar)
+void ScrollAnimatorGeneric::didAddVerticalScrollbar(Scrollbar* scrollbar)
 {
     m_kineticAnimation->updateVisibleLengths();
 
@@ -182,7 +184,7 @@ void ScrollAnimatorGtk::didAddVerticalScrollbar(Scrollbar* scrollbar)
     hideOverlayScrollbars();
 }
 
-void ScrollAnimatorGtk::didAddHorizontalScrollbar(Scrollbar* scrollbar)
+void ScrollAnimatorGeneric::didAddHorizontalScrollbar(Scrollbar* scrollbar)
 {
     m_kineticAnimation->updateVisibleLengths();
 
@@ -199,7 +201,7 @@ void ScrollAnimatorGtk::didAddHorizontalScrollbar(Scrollbar* scrollbar)
     hideOverlayScrollbars();
 }
 
-void ScrollAnimatorGtk::willRemoveVerticalScrollbar(Scrollbar* scrollbar)
+void ScrollAnimatorGeneric::willRemoveVerticalScrollbar(Scrollbar* scrollbar)
 {
     if (m_verticalOverlayScrollbar != scrollbar)
         return;
@@ -208,7 +210,7 @@ void ScrollAnimatorGtk::willRemoveVerticalScrollbar(Scrollbar* scrollbar)
         m_overlayScrollbarAnimationCurrent = 0;
 }
 
-void ScrollAnimatorGtk::willRemoveHorizontalScrollbar(Scrollbar* scrollbar)
+void ScrollAnimatorGeneric::willRemoveHorizontalScrollbar(Scrollbar* scrollbar)
 {
     if (m_horizontalOverlayScrollbar != scrollbar)
         return;
@@ -217,7 +219,7 @@ void ScrollAnimatorGtk::willRemoveHorizontalScrollbar(Scrollbar* scrollbar)
         m_overlayScrollbarAnimationCurrent = 0;
 }
 
-void ScrollAnimatorGtk::updateOverlayScrollbarsOpacity()
+void ScrollAnimatorGeneric::updateOverlayScrollbarsOpacity()
 {
     if (m_verticalOverlayScrollbar && m_overlayScrollbarAnimationCurrent != m_verticalOverlayScrollbar->opacity()) {
         m_verticalOverlayScrollbar->setOpacity(m_overlayScrollbarAnimationCurrent);
@@ -238,7 +240,7 @@ static inline double easeOutCubic(double t)
     return p * p * p + 1;
 }
 
-void ScrollAnimatorGtk::overlayScrollbarAnimationTimerFired()
+void ScrollAnimatorGeneric::overlayScrollbarAnimationTimerFired()
 {
     if (!m_horizontalOverlayScrollbar && !m_verticalOverlayScrollbar)
         return;
@@ -265,7 +267,7 @@ void ScrollAnimatorGtk::overlayScrollbarAnimationTimerFired()
         hideOverlayScrollbars();
 }
 
-void ScrollAnimatorGtk::showOverlayScrollbars()
+void ScrollAnimatorGeneric::showOverlayScrollbars()
 {
     if (m_overlayScrollbarsLocked)
         return;
@@ -287,7 +289,7 @@ void ScrollAnimatorGtk::showOverlayScrollbars()
         hideOverlayScrollbars();
 }
 
-void ScrollAnimatorGtk::hideOverlayScrollbars()
+void ScrollAnimatorGeneric::hideOverlayScrollbars()
 {
     if (m_overlayScrollbarAnimationTimer.isActive() && !m_overlayScrollbarAnimationTarget)
         return;
@@ -305,27 +307,27 @@ void ScrollAnimatorGtk::hideOverlayScrollbars()
     m_overlayScrollbarAnimationTimer.startOneShot(overflowScrollbarsAnimationHideDelay);
 }
 
-void ScrollAnimatorGtk::mouseEnteredContentArea()
+void ScrollAnimatorGeneric::mouseEnteredContentArea()
 {
     showOverlayScrollbars();
 }
 
-void ScrollAnimatorGtk::mouseExitedContentArea()
+void ScrollAnimatorGeneric::mouseExitedContentArea()
 {
     hideOverlayScrollbars();
 }
 
-void ScrollAnimatorGtk::mouseMovedInContentArea()
+void ScrollAnimatorGeneric::mouseMovedInContentArea()
 {
     showOverlayScrollbars();
 }
 
-void ScrollAnimatorGtk::contentAreaDidShow()
+void ScrollAnimatorGeneric::contentAreaDidShow()
 {
     showOverlayScrollbars();
 }
 
-void ScrollAnimatorGtk::contentAreaDidHide()
+void ScrollAnimatorGeneric::contentAreaDidHide()
 {
     if (m_overlayScrollbarsLocked)
         return;
@@ -336,12 +338,12 @@ void ScrollAnimatorGtk::contentAreaDidHide()
     }
 }
 
-void ScrollAnimatorGtk::notifyContentAreaScrolled(const FloatSize&)
+void ScrollAnimatorGeneric::notifyContentAreaScrolled(const FloatSize&)
 {
     showOverlayScrollbars();
 }
 
-void ScrollAnimatorGtk::lockOverlayScrollbarStateToHidden(bool shouldLockState)
+void ScrollAnimatorGeneric::lockOverlayScrollbarStateToHidden(bool shouldLockState)
 {
     if (m_overlayScrollbarsLocked == shouldLockState)
         return;
@@ -28,8 +28,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef ScrollAnimatorGtk_h
-#define ScrollAnimatorGtk_h
+#pragma once
 
 #include "ScrollAnimator.h"
 #include "Timer.h"
@@ -38,10 +37,10 @@ namespace WebCore {
 
 class ScrollAnimation;
 
-class ScrollAnimatorGtk final : public ScrollAnimator {
+class ScrollAnimatorGeneric final : public ScrollAnimator {
 public:
-    explicit ScrollAnimatorGtk(ScrollableArea&);
-    virtual ~ScrollAnimatorGtk();
+    explicit ScrollAnimatorGeneric(ScrollableArea&);
+    virtual ~ScrollAnimatorGeneric();
 
 private:
 #if ENABLE(SMOOTH_SCROLLING)
@@ -93,5 +92,3 @@ private:
 };
 
 } // namespace WebCore
-
-#endif // ScrollAnimatorGtk_h
index caa8567..6387f1f 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <cstring>
 #include <gio/gio.h>
+#include <wtf/glib/GUniquePtr.h>
 
 namespace WebCore {
 
index a3b4774..311a6b4 100644 (file)
@@ -111,10 +111,4 @@ PlatformWheelEvent::PlatformWheelEvent(GdkEventScroll* event)
     m_deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep());
 }
 
-FloatPoint PlatformWheelEvent::swipeVelocity() const
-{
-    // The swiping velocity is stored in the deltas of the event declaring it.
-    return isTransitioningToMomentumScroll() ? FloatPoint(m_wheelTicksX, m_wheelTicksY) : FloatPoint();
-}
-
-}
+} // namespace WebCore