⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 269143 in webkit


Ignore:
Timestamp:
Oct 29, 2020, 4:23:45 AM (6 years ago)
Author:
Chris Lord
Message:

[GTK] Smooth scrolling should not apply to continuous scrolling with sync scrolling
https://bugs.webkit.org/show_bug.cgi?id=218133

Reviewed by Adrian Perez de Castro.

Source/WebCore:

Respect PlatformWheelEvent.hasPreciseScrollingDeltas in the base
ScrollAnimator class, and make sure the flag is set correctly for
GdkEvent.

  • SourcesGTK.txt:
  • platform/PlatformWheelEvent.h:

(WebCore::PlatformWheelEvent::setHasPreciseScrollingDeltas):

  • platform/ScrollAnimator.cpp:

(WebCore::ScrollAnimator::scroll):
(WebCore::ScrollAnimator::scrollWithoutAnimation):
(WebCore::ScrollAnimator::handleWheelEvent):

  • platform/ScrollAnimator.h:
  • platform/gtk/GtkVersioning.h:

(gdk_event_get_source_device):

  • platform/gtk/PlatformWheelEventGtk.cpp: Removed.

Source/WebKit:

Set hasPreciseScrollDeltas appropriately on scroll events created from GdkEvent.

  • Shared/gtk/WebEventFactory.cpp:

(WebKit::WebEventFactory::createWebWheelEvent):

Location:
trunk/Source
Files:
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r269141 r269143  
     12020-10-29  Chris Lord  <clord@igalia.com>
     2
     3        [GTK] Smooth scrolling should not apply to continuous scrolling with sync scrolling
     4        https://bugs.webkit.org/show_bug.cgi?id=218133
     5
     6        Reviewed by Adrian Perez de Castro.
     7
     8        Respect PlatformWheelEvent.hasPreciseScrollingDeltas in the base
     9        ScrollAnimator class, and make sure the flag is set correctly for
     10        GdkEvent.
     11
     12        * SourcesGTK.txt:
     13        * platform/PlatformWheelEvent.h:
     14        (WebCore::PlatformWheelEvent::setHasPreciseScrollingDeltas):
     15        * platform/ScrollAnimator.cpp:
     16        (WebCore::ScrollAnimator::scroll):
     17        (WebCore::ScrollAnimator::scrollWithoutAnimation):
     18        (WebCore::ScrollAnimator::handleWheelEvent):
     19        * platform/ScrollAnimator.h:
     20        * platform/gtk/GtkVersioning.h:
     21        (gdk_event_get_source_device):
     22        * platform/gtk/PlatformWheelEventGtk.cpp: Removed.
     23
    1242020-10-29  Cathie Chen  <cathiechen@igalia.com>
    225
  • trunk/Source/WebCore/SourcesGTK.txt

    r266055 r269143  
    113113platform/gtk/PlatformKeyboardEventGtk.cpp
    114114platform/gtk/PlatformScreenGtk.cpp
    115 platform/gtk/PlatformWheelEventGtk.cpp
    116115platform/gtk/RenderThemeGadget.cpp
    117116platform/gtk/RenderThemeScrollbar.cpp
  • trunk/Source/WebCore/platform/PlatformWheelEvent.h

    r268522 r269143  
    3131#include <wtf/WindowsExtras.h>
    3232
    33 #if PLATFORM(GTK)
    34 typedef struct _GdkEventScroll GdkEventScroll;
    35 #endif
    36 
    3733namespace WTF {
    3834class TextStream;
     
    138134    const FloatSize& scrollingVelocity() const { return m_scrollingVelocity; }
    139135
    140 #if PLATFORM(GTK)
    141     explicit PlatformWheelEvent(GdkEventScroll*);
    142 #endif
    143 
    144 #if PLATFORM(COCOA) || PLATFORM(GTK) || USE(LIBWPE)
    145136    bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; }
    146137    void setHasPreciseScrollingDeltas(bool hasPreciseScrollingDeltas) { m_hasPreciseScrollingDeltas = hasPreciseScrollingDeltas; }
    147 #endif
    148138
    149139#if PLATFORM(COCOA)
     
    197187    PlatformWheelEventPhase m_momentumPhase { PlatformWheelEventPhaseNone };
    198188#endif
    199 #if PLATFORM(COCOA) || PLATFORM(GTK) || USE(LIBWPE)
    200189    bool m_hasPreciseScrollingDeltas { false };
    201 #endif
    202190#if PLATFORM(COCOA)
    203191    unsigned m_scrollCount { 0 };
  • trunk/Source/WebCore/platform/ScrollAnimator.cpp

    r268031 r269143  
    8181}
    8282
    83 bool ScrollAnimator::scroll(ScrollbarOrientation orientation, ScrollGranularity, float step, float multiplier)
     83bool ScrollAnimator::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier)
     84{
     85    return scrollWithoutAnimation(orientation, granularity, step, multiplier);
     86}
     87
     88bool ScrollAnimator::scrollWithoutAnimation(ScrollbarOrientation orientation, ScrollGranularity, float step, float multiplier)
    8489{
    8590    FloatPoint currentPosition = this->currentPosition();
     
    177182                    deltaY = -deltaY;
    178183            }
    179             scroll(VerticalScrollbar, granularity, verticalScrollbar->pixelStep(), -deltaY);
     184            if (e.hasPreciseScrollingDeltas())
     185                scrollWithoutAnimation(VerticalScrollbar, granularity, verticalScrollbar->pixelStep(), -deltaY);
     186            else
     187                scroll(VerticalScrollbar, granularity, verticalScrollbar->pixelStep(), -deltaY);
    180188        }
    181189
     
    187195                    deltaX = -deltaX;
    188196            }
    189             scroll(HorizontalScrollbar, granularity, horizontalScrollbar->pixelStep(), -deltaX);
     197            if (e.hasPreciseScrollingDeltas())
     198                scrollWithoutAnimation(HorizontalScrollbar, granularity, horizontalScrollbar->pixelStep(), -deltaX);
     199            else
     200                scroll(HorizontalScrollbar, granularity, horizontalScrollbar->pixelStep(), -deltaX);
    190201        }
    191202    }
  • trunk/Source/WebCore/platform/ScrollAnimator.h

    r268031 r269143  
    7373    // The base class implementation always scrolls immediately, never animates.
    7474    virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier);
     75    bool scrollWithoutAnimation(ScrollbarOrientation, ScrollGranularity, float step, float multiplier);
    7576
    7677    void scrollToOffset(const FloatPoint&);
  • trunk/Source/WebCore/platform/gtk/GtkVersioning.h

    r263843 r269143  
    8181}
    8282
     83static inline GdkDevice*
     84gdk_event_get_source_device(const GdkEvent* event)
     85{
     86    return gdk_event_get_device(event);
     87}
     88
    8389static inline void
    8490gtk_widget_size_allocate(GtkWidget* widget, GtkAllocation* allocation)
  • trunk/Source/WebKit/ChangeLog

    r269129 r269143  
     12020-10-29  Chris Lord  <clord@igalia.com>
     2
     3        [GTK] Smooth scrolling should not apply to continuous scrolling with sync scrolling
     4        https://bugs.webkit.org/show_bug.cgi?id=218133
     5
     6        Reviewed by Adrian Perez de Castro.
     7
     8        Set hasPreciseScrollDeltas appropriately on scroll events created from GdkEvent.
     9
     10        * Shared/gtk/WebEventFactory.cpp:
     11        (WebKit::WebEventFactory::createWebWheelEvent):
     12
    1132020-10-28  John Wilander  <wilander@apple.com>
    214
  • trunk/Source/WebKit/Shared/gtk/WebEventFactory.cpp

    r268522 r269143  
    281281    FloatSize delta(wheelTicks.width() * step, wheelTicks.height() * step);
    282282
     283    bool hasPreciseScrollingDeltas = false;
     284    GdkScrollDirection direction;
     285    if (!gdk_event_get_scroll_direction(event, &direction)) {
     286        double deltaX, deltaY;
     287        if (gdk_event_get_scroll_deltas(event, &deltaX, &deltaY)) {
     288            if (auto* device = gdk_event_get_source_device(event))
     289                hasPreciseScrollingDeltas = gdk_device_get_source(device) != GDK_SOURCE_MOUSE;
     290        }
     291    }
     292
    283293    return WebWheelEvent(WebEvent::Wheel,
    284294        position,
     
    289299        momentumPhase,
    290300        WebWheelEvent::ScrollByPixelWheelEvent,
    291         false,
     301        hasPreciseScrollingDeltas,
    292302        modifiersForEvent(event),
    293303        wallTimeForEvent(event));
Note: See TracChangeset for help on using the changeset viewer.