Skip to content
Snippets Groups Projects
Commit ef0e6ea3 authored by Hiroyuki Ikezoe's avatar Hiroyuki Ikezoe
Browse files

Bug 1751124 - Disable SwipeTracker on Windows. r=tnikkel

parent d3ecc48a
No related branches found
No related tags found
No related merge requests found
......@@ -12764,6 +12764,15 @@
mirror: always
#endif
# Whether to disable SwipeTracker (e.g. swipe-to-nav).
- name: widget.disable-swipe-tracker
type: bool
#ifdef XP_WIN
value: true
#else
value: false
#endif
mirror: always
#---------------------------------------------------------------------------
# Prefs starting with "xul."
......
......@@ -9,6 +9,7 @@
#include "InputData.h"
#include "mozilla/FlushType.h"
#include "mozilla/PresShell.h"
#include "mozilla/StaticPrefs_widget.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/dom/SimpleGestureEventBinding.h"
......@@ -216,6 +217,10 @@ bool SwipeTracker::SendSwipeEvent(EventMessage aMsg, uint32_t aDirection,
// static
bool SwipeTracker::CanTriggerSwipe(const PanGestureInput& aPanInput) {
if (StaticPrefs::widget_disable_swipe_tracker()) {
return false;
}
if (aPanInput.mType != PanGestureInput::PANGESTURE_START) {
return false;
}
......
......@@ -127,6 +127,7 @@ add_task(async () => {
set: [
["browser.gesture.swipe.left", "Browser:BackOrBackDuplicate"],
["browser.gesture.swipe.eight", "Browser:ForwardOrForwardDuplicate"],
["widget.disable-swipe-tracker", false],
],
});
......@@ -201,9 +202,25 @@ add_task(async () => {
// Now try to navigate backward again but with preventDefault-ed event
// handler.
wheelEventCount = 0;
tab.linkedBrowser.addEventListener("wheel", event => {
let wheelEventListener = event => {
event.preventDefault();
};
tab.linkedBrowser.addEventListener("wheel", wheelEventListener);
await panLeftToRight(tab.linkedBrowser, 100, 100);
is(wheelEventCount, 3, "Received all wheel events");
await waitForWhile();
// Make sure any navigation didn't happen.
is(tab.linkedBrowser.currentURI.spec, secondPage);
// Now drop the event handler and disable the swipe tracker and try to swipe
// again.
wheelEventCount = 0;
tab.linkedBrowser.removeEventListener("wheel", wheelEventListener);
await SpecialPowers.pushPrefEnv({
set: [["widget.disable-swipe-tracker", true]],
});
await panLeftToRight(tab.linkedBrowser, 100, 100);
is(wheelEventCount, 3, "Received all wheel events");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment