Changeset 238675 in webkit


Ignore:
Timestamp:
Nov 29, 2018 10:36:29 AM (5 years ago)
Author:
don.olmstead@sony.com
Message:

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.

Location:
trunk/Source/WebCore
Files:
1 added
2 deleted
7 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r238673 r238675  
     12018-11-29  Don Olmstead  <don.olmstead@sony.com>
     2
     3        Make generic ScrollAnimator
     4        https://bugs.webkit.org/show_bug.cgi?id=192128
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        No new tests. No change in behavior.
     9
     10        Moves ScrollAnimatorGtk into ScrollAnimatorGeneric where it can be used
     11        by other implementations. Fixed some compilation issues around using
     12        this as a default implementation.
     13
     14        Removing ScrollAnimatorSmooth since it is dead code and doesn't even
     15        compile at this time.
     16
     17        Fixing a compilation issue within LowPowerModeNotifierGLib
     18        implementation that appeared due to unified sources changes.
     19
     20        * PlatformGTK.cmake:
     21        * SourcesGTK.txt:
     22        * platform/LowPowerModeNotifier.h:
     23        * platform/PlatformWheelEvent.h:
     24        (WebCore::PlatformWheelEvent::swipeVelocity const):
     25        * platform/ScrollAnimatorSmooth.cpp: Removed.
     26        * platform/ScrollAnimatorSmooth.h: Removed.
     27        * platform/generic/ScrollAnimatorGeneric.cpp: Renamed from Source/WebCore/platform/gtk/ScrollAnimatorGtk.cpp.
     28        (WebCore::ScrollAnimator::create):
     29        (WebCore::ScrollAnimatorGeneric::ScrollAnimatorGeneric):
     30        (WebCore::ScrollAnimatorGeneric::ensureSmoothScrollingAnimation):
     31        (WebCore::ScrollAnimatorGeneric::scroll):
     32        (WebCore::ScrollAnimatorGeneric::scrollToOffsetWithoutAnimation):
     33        (WebCore::ScrollAnimatorGeneric::computeVelocity):
     34        (WebCore::ScrollAnimatorGeneric::handleWheelEvent):
     35        (WebCore::ScrollAnimatorGeneric::willEndLiveResize):
     36        (WebCore::ScrollAnimatorGeneric::updatePosition):
     37        (WebCore::ScrollAnimatorGeneric::didAddVerticalScrollbar):
     38        (WebCore::ScrollAnimatorGeneric::didAddHorizontalScrollbar):
     39        (WebCore::ScrollAnimatorGeneric::willRemoveVerticalScrollbar):
     40        (WebCore::ScrollAnimatorGeneric::willRemoveHorizontalScrollbar):
     41        (WebCore::ScrollAnimatorGeneric::updateOverlayScrollbarsOpacity):
     42        (WebCore::ScrollAnimatorGeneric::overlayScrollbarAnimationTimerFired):
     43        (WebCore::ScrollAnimatorGeneric::showOverlayScrollbars):
     44        (WebCore::ScrollAnimatorGeneric::hideOverlayScrollbars):
     45        (WebCore::ScrollAnimatorGeneric::mouseEnteredContentArea):
     46        (WebCore::ScrollAnimatorGeneric::mouseExitedContentArea):
     47        (WebCore::ScrollAnimatorGeneric::mouseMovedInContentArea):
     48        (WebCore::ScrollAnimatorGeneric::contentAreaDidShow):
     49        (WebCore::ScrollAnimatorGeneric::contentAreaDidHide):
     50        (WebCore::ScrollAnimatorGeneric::notifyContentAreaScrolled):
     51        (WebCore::ScrollAnimatorGeneric::lockOverlayScrollbarStateToHidden):
     52        * platform/generic/ScrollAnimatorGeneric.h: Renamed from Source/WebCore/platform/gtk/ScrollAnimatorGtk.h.
     53        * platform/glib/LowPowerModeNotifierGLib.cpp:
     54        * platform/gtk/PlatformWheelEventGtk.cpp:
     55        (WebCore::PlatformWheelEvent::swipeVelocity const): Deleted.
     56
    1572018-11-28  Dean Jackson  <dino@apple.com>
    258
  • trunk/Source/WebCore/PlatformGTK.cmake

    r237566 r238675  
    2121    "${WEBCORE_DIR}/editing/atk"
    2222    "${WEBCORE_DIR}/page/gtk"
     23    "${WEBCORE_DIR}/platform/generic"
    2324    "${WEBCORE_DIR}/platform/geoclue"
    2425    "${WEBCORE_DIR}/platform/gtk"
  • trunk/Source/WebCore/SourcesGTK.txt

    r235521 r238675  
    6060platform/UserAgentQuirks.cpp
    6161
     62platform/generic/ScrollAnimatorGeneric.cpp
     63
    6264platform/geoclue/GeolocationProviderGeoclue.cpp
    6365
     
    9092platform/gtk/LocalizedStringsGtk.cpp
    9193platform/gtk/PasteboardGtk.cpp
    92 platform/gtk/ScrollAnimatorGtk.cpp
    9394platform/gtk/SelectionData.cpp
    9495
  • trunk/Source/WebCore/platform/LowPowerModeNotifier.h

    r237266 r238675  
    3535#if USE(GLIB)
    3636#include <wtf/glib/GRefPtr.h>
    37 typedef _GDBusProxy GDBusProxy;
     37typedef struct _GDBusProxy GDBusProxy;
    3838#endif
    3939
  • trunk/Source/WebCore/platform/PlatformWheelEvent.h

    r232590 r238675  
    127127#if PLATFORM(GTK)
    128128    explicit PlatformWheelEvent(GdkEventScroll*);
    129     FloatPoint swipeVelocity() const;
    130129#endif
    131130
     
    152151    bool isEndOfNonMomentumScroll() const;
    153152    bool isTransitioningToMomentumScroll() const;
     153    FloatPoint swipeVelocity() const;
    154154#endif
    155155
     
    210210}
    211211
    212 #endif
    213 
    214 #if PLATFORM(COCOA) || PLATFORM(GTK)
    215 
    216212inline bool PlatformWheelEvent::isEndOfNonMomentumScroll() const
    217213{
     
    223219    return m_phase == PlatformWheelEventPhaseNone && m_momentumPhase == PlatformWheelEventPhaseBegan;
    224220}
    225 #endif
     221
     222inline FloatPoint PlatformWheelEvent::swipeVelocity() const
     223{
     224    // The swiping velocity is stored in the deltas of the event declaring it.
     225    return isTransitioningToMomentumScroll() ? FloatPoint(m_wheelTicksX, m_wheelTicksY) : FloatPoint();
     226}
     227
     228#endif // ENABLE(ASYNC_SCROLLING)
    226229
    227230} // namespace WebCore
  • trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp

    r238674 r238675  
    3030
    3131#include "config.h"
    32 #include "ScrollAnimatorGtk.h"
     32#include "ScrollAnimatorGeneric.h"
    3333
    3434#include "ScrollAnimationKinetic.h"
     
    4545std::unique_ptr<ScrollAnimator> ScrollAnimator::create(ScrollableArea& scrollableArea)
    4646{
    47     return std::make_unique<ScrollAnimatorGtk>(scrollableArea);
    48 }
    49 
    50 ScrollAnimatorGtk::ScrollAnimatorGtk(ScrollableArea& scrollableArea)
     47    return std::make_unique<ScrollAnimatorGeneric>(scrollableArea);
     48}
     49
     50ScrollAnimatorGeneric::ScrollAnimatorGeneric(ScrollableArea& scrollableArea)
    5151    : ScrollAnimator(scrollableArea)
    52     , m_overlayScrollbarAnimationTimer(*this, &ScrollAnimatorGtk::overlayScrollbarAnimationTimerFired)
     52    , m_overlayScrollbarAnimationTimer(*this, &ScrollAnimatorGeneric::overlayScrollbarAnimationTimerFired)
    5353{
    5454    m_kineticAnimation = std::make_unique<ScrollAnimationKinetic>(m_scrollableArea, [this](FloatPoint&& position) {
     
    6666}
    6767
    68 ScrollAnimatorGtk::~ScrollAnimatorGtk() = default;
    69 
    70 #if ENABLE(SMOOTH_SCROLLING)
    71 void ScrollAnimatorGtk::ensureSmoothScrollingAnimation()
     68ScrollAnimatorGeneric::~ScrollAnimatorGeneric() = default;
     69
     70#if ENABLE(SMOOTH_SCROLLING)
     71void ScrollAnimatorGeneric::ensureSmoothScrollingAnimation()
    7272{
    7373    if (m_smoothAnimation)
     
    8181
    8282#if ENABLE(SMOOTH_SCROLLING)
    83 bool ScrollAnimatorGtk::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier)
     83bool ScrollAnimatorGeneric::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier)
    8484{
    8585    if (!m_scrollableArea.scrollAnimatorEnabled())
     
    9191#endif
    9292
    93 void ScrollAnimatorGtk::scrollToOffsetWithoutAnimation(const FloatPoint& offset, ScrollClamping)
     93void ScrollAnimatorGeneric::scrollToOffsetWithoutAnimation(const FloatPoint& offset, ScrollClamping)
    9494{
    9595    FloatPoint position = ScrollableArea::scrollPositionFromOffset(offset, toFloatSize(m_scrollableArea.scrollOrigin()));
     
    105105}
    106106
    107 FloatPoint ScrollAnimatorGtk::computeVelocity()
     107FloatPoint ScrollAnimatorGeneric::computeVelocity()
    108108{
    109109    if (m_scrollHistory.isEmpty())
     
    125125}
    126126
    127 bool ScrollAnimatorGtk::handleWheelEvent(const PlatformWheelEvent& event)
     127bool ScrollAnimatorGeneric::handleWheelEvent(const PlatformWheelEvent& event)
    128128{
    129129    m_kineticAnimation->stop();
     
    133133    });
    134134
     135#if ENABLE(ASYNC_SCROLLING)
    135136    if (event.isEndOfNonMomentumScroll()) {
    136137        // We don't need to add the event to the history as its delta will be (0, 0).
     
    143144        return true;
    144145    }
     146#endif
    145147
    146148    m_scrollHistory.append(event);
     
    149151}
    150152
    151 void ScrollAnimatorGtk::willEndLiveResize()
     153void ScrollAnimatorGeneric::willEndLiveResize()
    152154{
    153155    m_kineticAnimation->updateVisibleLengths();
     
    159161}
    160162
    161 void ScrollAnimatorGtk::updatePosition(FloatPoint&& position)
     163void ScrollAnimatorGeneric::updatePosition(FloatPoint&& position)
    162164{
    163165    FloatSize delta = position - m_currentPosition;
     
    166168}
    167169
    168 void ScrollAnimatorGtk::didAddVerticalScrollbar(Scrollbar* scrollbar)
     170void ScrollAnimatorGeneric::didAddVerticalScrollbar(Scrollbar* scrollbar)
    169171{
    170172    m_kineticAnimation->updateVisibleLengths();
     
    183185}
    184186
    185 void ScrollAnimatorGtk::didAddHorizontalScrollbar(Scrollbar* scrollbar)
     187void ScrollAnimatorGeneric::didAddHorizontalScrollbar(Scrollbar* scrollbar)
    186188{
    187189    m_kineticAnimation->updateVisibleLengths();
     
    200202}
    201203
    202 void ScrollAnimatorGtk::willRemoveVerticalScrollbar(Scrollbar* scrollbar)
     204void ScrollAnimatorGeneric::willRemoveVerticalScrollbar(Scrollbar* scrollbar)
    203205{
    204206    if (m_verticalOverlayScrollbar != scrollbar)
     
    209211}
    210212
    211 void ScrollAnimatorGtk::willRemoveHorizontalScrollbar(Scrollbar* scrollbar)
     213void ScrollAnimatorGeneric::willRemoveHorizontalScrollbar(Scrollbar* scrollbar)
    212214{
    213215    if (m_horizontalOverlayScrollbar != scrollbar)
     
    218220}
    219221
    220 void ScrollAnimatorGtk::updateOverlayScrollbarsOpacity()
     222void ScrollAnimatorGeneric::updateOverlayScrollbarsOpacity()
    221223{
    222224    if (m_verticalOverlayScrollbar && m_overlayScrollbarAnimationCurrent != m_verticalOverlayScrollbar->opacity()) {
     
    239241}
    240242
    241 void ScrollAnimatorGtk::overlayScrollbarAnimationTimerFired()
     243void ScrollAnimatorGeneric::overlayScrollbarAnimationTimerFired()
    242244{
    243245    if (!m_horizontalOverlayScrollbar && !m_verticalOverlayScrollbar)
     
    266268}
    267269
    268 void ScrollAnimatorGtk::showOverlayScrollbars()
     270void ScrollAnimatorGeneric::showOverlayScrollbars()
    269271{
    270272    if (m_overlayScrollbarsLocked)
     
    288290}
    289291
    290 void ScrollAnimatorGtk::hideOverlayScrollbars()
     292void ScrollAnimatorGeneric::hideOverlayScrollbars()
    291293{
    292294    if (m_overlayScrollbarAnimationTimer.isActive() && !m_overlayScrollbarAnimationTarget)
     
    306308}
    307309
    308 void ScrollAnimatorGtk::mouseEnteredContentArea()
     310void ScrollAnimatorGeneric::mouseEnteredContentArea()
    309311{
    310312    showOverlayScrollbars();
    311313}
    312314
    313 void ScrollAnimatorGtk::mouseExitedContentArea()
     315void ScrollAnimatorGeneric::mouseExitedContentArea()
    314316{
    315317    hideOverlayScrollbars();
    316318}
    317319
    318 void ScrollAnimatorGtk::mouseMovedInContentArea()
     320void ScrollAnimatorGeneric::mouseMovedInContentArea()
    319321{
    320322    showOverlayScrollbars();
    321323}
    322324
    323 void ScrollAnimatorGtk::contentAreaDidShow()
     325void ScrollAnimatorGeneric::contentAreaDidShow()
    324326{
    325327    showOverlayScrollbars();
    326328}
    327329
    328 void ScrollAnimatorGtk::contentAreaDidHide()
     330void ScrollAnimatorGeneric::contentAreaDidHide()
    329331{
    330332    if (m_overlayScrollbarsLocked)
     
    337339}
    338340
    339 void ScrollAnimatorGtk::notifyContentAreaScrolled(const FloatSize&)
     341void ScrollAnimatorGeneric::notifyContentAreaScrolled(const FloatSize&)
    340342{
    341343    showOverlayScrollbars();
    342344}
    343345
    344 void ScrollAnimatorGtk::lockOverlayScrollbarStateToHidden(bool shouldLockState)
     346void ScrollAnimatorGeneric::lockOverlayScrollbarStateToHidden(bool shouldLockState)
    345347{
    346348    if (m_overlayScrollbarsLocked == shouldLockState)
  • trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.h

    r238674 r238675  
    2929 */
    3030
    31 #ifndef ScrollAnimatorGtk_h
    32 #define ScrollAnimatorGtk_h
     31#pragma once
    3332
    3433#include "ScrollAnimator.h"
     
    3938class ScrollAnimation;
    4039
    41 class ScrollAnimatorGtk final : public ScrollAnimator {
     40class ScrollAnimatorGeneric final : public ScrollAnimator {
    4241public:
    43     explicit ScrollAnimatorGtk(ScrollableArea&);
    44     virtual ~ScrollAnimatorGtk();
     42    explicit ScrollAnimatorGeneric(ScrollableArea&);
     43    virtual ~ScrollAnimatorGeneric();
    4544
    4645private:
     
    9493
    9594} // namespace WebCore
    96 
    97 #endif // ScrollAnimatorGtk_h
  • trunk/Source/WebCore/platform/glib/LowPowerModeNotifierGLib.cpp

    r228888 r238675  
    2323#include <cstring>
    2424#include <gio/gio.h>
     25#include <wtf/glib/GUniquePtr.h>
    2526
    2627namespace WebCore {
  • trunk/Source/WebCore/platform/gtk/PlatformWheelEventGtk.cpp

    r235560 r238675  
    112112}
    113113
    114 FloatPoint PlatformWheelEvent::swipeVelocity() const
    115 {
    116     // The swiping velocity is stored in the deltas of the event declaring it.
    117     return isTransitioningToMomentumScroll() ? FloatPoint(m_wheelTicksX, m_wheelTicksY) : FloatPoint();
    118 }
    119 
    120 }
     114} // namespace WebCore
Note: See TracChangeset for help on using the changeset viewer.