Bug 1781209 - Swipe navigation does not work when kinetic scroll is disabled. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D154239
This commit is contained in:
Razvan Cojocaru 2022-08-16 20:54:43 +00:00
Родитель 9a46716bc2
Коммит 88058d9bfe
2 изменённых файлов: 16 добавлений и 10 удалений

Просмотреть файл

@ -549,7 +549,12 @@
value: true
mirror: always
# Mode to use when receiving kinetic scroll input.
- name: apz.gtk.pangesture.enabled
type: RelaxedAtomicBool
value: true
mirror: always
# Mode to use when receiving pan gesture input.
#
# * 0: Auto mode (uses the default behavior, subject to change).
# * 1: Page mode: Uses gtk deltas as a percentage of the page size to scroll. This mode matches:
@ -560,17 +565,17 @@
#
# https://webkit-search.igalia.com/webkit/rev/215039ef09d6bfd6e088175bfe30788d95b9705d/Source/WebKit/Shared/gtk/WebEventFactory.cpp#265-296
# (multiplied then by pixelsPerLineStep which in GNOME-web is 40).
- name: apz.gtk.kinetic_scroll.delta_mode
- name: apz.gtk.pangesture.delta_mode
type: uint32_t
value: 0
mirror: always
- name: apz.gtk.kinetic_scroll.page_delta_mode_multiplier
- name: apz.gtk.pangesture.page_delta_mode_multiplier
type: float
value: 1.0f
mirror: always
- name: apz.gtk.kinetic_scroll.pixel_delta_mode_multiplier
- name: apz.gtk.pangesture.pixel_delta_mode_multiplier
type: float
value: 40.0f
mirror: always

Просмотреть файл

@ -4727,7 +4727,7 @@ void nsWindow::OnScrollEvent(GdkEventScroll* aEvent) {
GdkInputSource source = gdk_device_get_source(device);
if (source == GDK_SOURCE_TOUCHSCREEN || source == GDK_SOURCE_TOUCHPAD ||
mCurrentSynthesizedTouchpadPan.mTouchpadGesturePhase.isSome()) {
if (StaticPrefs::apz_gtk_kinetic_scroll_enabled() &&
if (StaticPrefs::apz_gtk_pangesture_enabled() &&
gtk_check_version(3, 20, 0) == nullptr) {
static auto sGdkEventIsScrollStopEvent =
(gboolean(*)(const GdkEvent*))dlsym(
@ -4773,14 +4773,14 @@ void nsWindow::OnScrollEvent(GdkEventScroll* aEvent) {
mCurrentSynthesizedTouchpadPan.mTouchpadGesturePhase.reset();
const bool isPageMode =
StaticPrefs::apz_gtk_kinetic_scroll_delta_mode() != 2;
StaticPrefs::apz_gtk_pangesture_delta_mode() != 2;
const double multiplier =
isPageMode
? StaticPrefs::
apz_gtk_kinetic_scroll_page_delta_mode_multiplier()
? StaticPrefs::apz_gtk_pangesture_page_delta_mode_multiplier()
: StaticPrefs::
apz_gtk_kinetic_scroll_pixel_delta_mode_multiplier() *
apz_gtk_pangesture_pixel_delta_mode_multiplier() *
FractionalScaleFactor();
ScreenPoint deltas(float(aEvent->delta_x * multiplier),
float(aEvent->delta_y * multiplier));
@ -4791,7 +4791,8 @@ void nsWindow::OnScrollEvent(GdkEventScroll* aEvent) {
KeymapWrapper::ComputeKeyModifiers(aEvent->state));
panEvent.mDeltaType = isPageMode ? PanGestureInput::PANDELTA_PAGE
: PanGestureInput::PANDELTA_PIXEL;
panEvent.mSimulateMomentum = true;
panEvent.mSimulateMomentum =
StaticPrefs::apz_gtk_kinetic_scroll_enabled();
panEvent
.mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection =