diff options
author | Florian Bruhin <me@the-compiler.org> | 2023-12-04 16:44:56 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2023-12-04 16:44:56 +0100 |
commit | 21c7699eaced839b4645dabfbef05a7ff7f2de36 (patch) | |
tree | 6810fc96efdba1408620c28b764006d1b4619023 | |
parent | 0ffb04cfc0f641da773ab6084c209b97328d4cbb (diff) | |
download | qutebrowser-21c7699eaced839b4645dabfbef05a7ff7f2de36.tar.gz qutebrowser-21c7699eaced839b4645dabfbef05a7ff7f2de36.zip |
Add content.javascript.legacy_touch_events setting
Closes #7814
-rw-r--r-- | doc/changelog.asciidoc | 2 | ||||
-rw-r--r-- | doc/help/settings.asciidoc | 22 | ||||
-rw-r--r-- | qutebrowser/config/configdata.yml | 23 | ||||
-rw-r--r-- | qutebrowser/config/qtargs.py | 5 | ||||
-rw-r--r-- | tests/unit/config/test_qtargs.py | 1 |
5 files changed, 53 insertions, 0 deletions
diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index 36c18d65c..e3fe5784f 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -31,6 +31,8 @@ Added - New `smart-simple` value for `colors.webpage.darkmode.policy.images`, which on QtWebEngine 6.6+ uses a simpler classification algorithm to decide whether to invert images. +- New `content.javascript.legacy_touch_events` setting, with those now being + disabled by default, following a Chromium change. Changed ~~~~~~~ diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index b6f61ab03..9ef0a014d 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -171,6 +171,7 @@ |<<content.javascript.can_open_tabs_automatically,content.javascript.can_open_tabs_automatically>>|Allow JavaScript to open new tabs without user interaction. |<<content.javascript.clipboard,content.javascript.clipboard>>|Allow JavaScript to read from or write to the clipboard. |<<content.javascript.enabled,content.javascript.enabled>>|Enable JavaScript. +|<<content.javascript.legacy_touch_events,content.javascript.legacy_touch_events>>|Enables the legacy touch event feature. |<<content.javascript.log,content.javascript.log>>|Log levels to use for JavaScript console logging messages. |<<content.javascript.log_message.excludes,content.javascript.log_message.excludes>>|Javascript messages to *not* show in the UI, despite a corresponding `content.javascript.log_message.levels` setting. |<<content.javascript.log_message.levels,content.javascript.log_message.levels>>|Javascript message sources/levels to show in the qutebrowser UI. @@ -2365,6 +2366,27 @@ Type: <<types,Bool>> Default: +pass:[true]+ +[[content.javascript.legacy_touch_events]] +=== content.javascript.legacy_touch_events +Enables the legacy touch event feature. +This affects JS APIs such as: +- ontouch* members on window, document, Element - document.createTouch, document.createTouchList - document.createEvent("TouchEvent") +Newer Chromium versions have those disabled by default: https://bugs.chromium.org/p/chromium/issues/detail?id=392584 https://groups.google.com/a/chromium.org/g/blink-dev/c/KV6kqDJpYiE + +This setting requires a restart. + +This setting is only available with the QtWebEngine backend. + +Type: <<types,String>> + +Valid values: + + * +always+: Legacy touch events are always enabled. This might cause some websites to assume a mobile device. + * +auto+: Legacy touch events are only enabled if a touch screen was detected on startup. + * +never+: Legacy touch events are always disabled. + +Default: +pass:[never]+ + [[content.javascript.log]] === content.javascript.log Log levels to use for JavaScript console logging messages. diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index cddac7353..ff45b355d 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -1031,6 +1031,29 @@ content.javascript.prompt: type: Bool desc: Show javascript prompts. +content.javascript.legacy_touch_events: + type: + name: String + valid_values: + - always: Legacy touch events are always enabled. This might cause some websites to assume a mobile device. + - auto: Legacy touch events are only enabled if a touch screen was detected on startup. + - never: Legacy touch events are always disabled. + default: never + backend: QtWebEngine + restart: true + desc: >- + Enables the legacy touch event feature. + + This affects JS APIs such as: + + - ontouch* members on window, document, Element + - document.createTouch, document.createTouchList + - document.createEvent("TouchEvent") + + Newer Chromium versions have those disabled by default: + https://bugs.chromium.org/p/chromium/issues/detail?id=392584 + https://groups.google.com/a/chromium.org/g/blink-dev/c/KV6kqDJpYiE + content.local_content_can_access_remote_urls: default: false type: Bool diff --git a/qutebrowser/config/qtargs.py b/qutebrowser/config/qtargs.py index 06e260de9..3a648524e 100644 --- a/qutebrowser/config/qtargs.py +++ b/qutebrowser/config/qtargs.py @@ -309,6 +309,11 @@ _WEBENGINE_SETTINGS: Dict[str, Dict[Any, Optional[_SettingValueType]]] = { '--force-webrtc-ip-handling-policy=' 'disable_non_proxied_udp', }, + 'content.javascript.legacy_touch_events': { + 'always': '--touch-events=enabled', + 'auto': '--touch-events=auto', + 'never': '--touch-events=disabled', + }, 'qt.chromium.process_model': { 'process-per-site-instance': None, 'process-per-site': '--process-per-site', diff --git a/tests/unit/config/test_qtargs.py b/tests/unit/config/test_qtargs.py index 2414d4ba9..d8980bb53 100644 --- a/tests/unit/config/test_qtargs.py +++ b/tests/unit/config/test_qtargs.py @@ -77,6 +77,7 @@ class TestQtArgs: ]) def test_qt_args(self, monkeypatch, config_stub, args, expected, parser): """Test commandline with no Qt arguments given.""" + expected.append("--touch-events=disabled") # passed unconditionally parsed = parser.parse_args(args) assert qtargs.qt_args(parsed) == expected |