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

Changeset 269151 in webkit


Ignore:
Timestamp:
Oct 29, 2020, 9:53:19 AM (6 years ago)
Author:
Chris Lord
Message:

[WPE] Add axis-locking to kinetic scrolling
https://bugs.webkit.org/show_bug.cgi?id=209729

Reviewed by Adrian Perez de Castro.

Add axis-locking to scroll gestures on WPE, and new WPE-specific
settings to control the process.

  • UIProcess/API/wpe/ScrollGestureController.cpp:

(WebKit::ScrollGestureController::handleEvent):

  • UIProcess/API/wpe/ScrollGestureController.h:
Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r269150 r269151  
     12020-10-29  Chris Lord  <clord@igalia.com>
     2
     3        [WPE] Add axis-locking to kinetic scrolling
     4        https://bugs.webkit.org/show_bug.cgi?id=209729
     5
     6        Reviewed by Adrian Perez de Castro.
     7
     8        Add axis-locking to scroll gestures on WPE, and new WPE-specific
     9        settings to control the process.
     10
     11        * UIProcess/API/wpe/ScrollGestureController.cpp:
     12        (WebKit::ScrollGestureController::handleEvent):
     13        * UIProcess/API/wpe/ScrollGestureController.h:
     14
    1152020-10-29  Youenn Fablet  <youenn@apple.com>
    216
  • trunk/Source/WebKit/UIProcess/API/wpe/ScrollGestureController.cpp

    r259112 r269151  
    2727#include "ScrollGestureController.h"
    2828
     29#include "WebKitSettings.h"
    2930#include <WebCore/Scrollbar.h>
    3031
    3132namespace WebKit {
     33
     34// FIXME: These ought to be either configurable or derived from system
     35//        properties, such as screen size and pixel density.
     36static constexpr uint32_t scrollCaptureThreshold { 200 };
     37static constexpr uint32_t axisLockMovementThreshold { 8 };
     38static constexpr uint32_t axisLockActivationThreshold { 15 };
     39static constexpr uint32_t axisLockReleaseThreshold { 30 };
    3240
    3341bool ScrollGestureController::handleEvent(const struct wpe_input_touch_event_raw* touchPoint)
     
    4048        m_offset.x = touchPoint->x;
    4149        m_offset.y = touchPoint->y;
     50        m_xAxisLockBroken = false;
     51        m_yAxisLockBroken = false;
    4252        return false;
    4353    case wpe_input_touch_event_type_motion:
     
    5060            m_handling = std::abs(deltaX) >= pixelsPerLineStep
    5161                || std::abs(deltaY) >= pixelsPerLineStep
    52                 || deltaTime >= 200;
     62                || deltaTime >= scrollCaptureThreshold;
    5363        }
    5464        if (m_handling) {
     
    5969                0, 0, 0,
    6070            };
    61             m_axisEvent.x_axis = -(m_offset.x - touchPoint->x);
    62             m_axisEvent.y_axis = -(m_offset.y - touchPoint->y);
     71
     72            auto xOffset = std::abs(touchPoint->x - m_start.x);
     73            auto yOffset = std::abs(touchPoint->y - m_start.y);
     74
     75            if (xOffset >= axisLockReleaseThreshold)
     76                m_xAxisLockBroken = true;
     77            if (yOffset >= axisLockReleaseThreshold)
     78                m_yAxisLockBroken = true;
     79
     80            if (xOffset >= axisLockMovementThreshold && yOffset >= axisLockMovementThreshold && xOffset < axisLockActivationThreshold && yOffset < axisLockActivationThreshold) {
     81                m_xAxisLockBroken = true;
     82                m_yAxisLockBroken = true;
     83            }
     84
     85            m_axisEvent.x_axis = (m_xAxisLockBroken || yOffset < axisLockActivationThreshold) ?  -(m_offset.x - touchPoint->x) : 0;
     86            m_axisEvent.y_axis = (m_yAxisLockBroken || xOffset < axisLockActivationThreshold) ?  -(m_offset.y - touchPoint->y) : 0;
    6387#else
    6488            m_axisEvent = {
  • trunk/Source/WebKit/UIProcess/API/wpe/ScrollGestureController.h

    r267916 r269151  
    6969#endif
    7070    WebWheelEvent::Phase m_phase { WebWheelEvent::Phase::PhaseNone };
     71
     72    bool m_xAxisLockBroken { false };
     73    bool m_yAxisLockBroken { false };
    7174};
    7275
Note: See TracChangeset for help on using the changeset viewer.