parent
c5b7ed350e
commit
3bf89bcea4
@ -109,6 +109,7 @@
|
|||||||
|<<completion.use_best_match,completion.use_best_match>>|Execute the best-matching command on a partial match.
|
|<<completion.use_best_match,completion.use_best_match>>|Execute the best-matching command on a partial match.
|
||||||
|<<completion.web_history_max_items,completion.web_history_max_items>>|Number of URLs to show in the web history.
|
|<<completion.web_history_max_items,completion.web_history_max_items>>|Number of URLs to show in the web history.
|
||||||
|<<confirm_quit,confirm_quit>>|Require a confirmation before quitting the application.
|
|<<confirm_quit,confirm_quit>>|Require a confirmation before quitting the application.
|
||||||
|
|<<content.autoplay,content.autoplay>>|Automatically start playing `<video>` elements.
|
||||||
|<<content.cache.appcache,content.cache.appcache>>|Enable support for the HTML 5 web application cache feature.
|
|<<content.cache.appcache,content.cache.appcache>>|Enable support for the HTML 5 web application cache feature.
|
||||||
|<<content.cache.maximum_pages,content.cache.maximum_pages>>|Maximum number of pages to hold in the global memory page cache.
|
|<<content.cache.maximum_pages,content.cache.maximum_pages>>|Maximum number of pages to hold in the global memory page cache.
|
||||||
|<<content.cache.size,content.cache.size>>|Size (in bytes) of the HTTP network cache. Null to use the default value.
|
|<<content.cache.size,content.cache.size>>|Size (in bytes) of the HTTP network cache. Null to use the default value.
|
||||||
@ -1467,6 +1468,19 @@ Default:
|
|||||||
|
|
||||||
- +pass:[never]+
|
- +pass:[never]+
|
||||||
|
|
||||||
|
[[content.autoplay]]
|
||||||
|
=== content.autoplay
|
||||||
|
Automatically start playing `<video>` elements.
|
||||||
|
Note this option needs a restart with QtWebEngine on Qt < 5.11.
|
||||||
|
|
||||||
|
Type: <<types,Bool>>
|
||||||
|
|
||||||
|
Default: +pass:[true]+
|
||||||
|
|
||||||
|
On QtWebEngine, this setting requires Qt 5.10 or newer.
|
||||||
|
|
||||||
|
On QtWebKit, this setting is unavailable.
|
||||||
|
|
||||||
[[content.cache.appcache]]
|
[[content.cache.appcache]]
|
||||||
=== content.cache.appcache
|
=== content.cache.appcache
|
||||||
Enable support for the HTML 5 web application cache feature.
|
Enable support for the HTML 5 web application cache feature.
|
||||||
|
@ -156,15 +156,19 @@ class WebEngineSettings(websettings.AbstractSettings):
|
|||||||
# Attributes which don't exist in all Qt versions.
|
# Attributes which don't exist in all Qt versions.
|
||||||
new_attributes = {
|
new_attributes = {
|
||||||
# Qt 5.8
|
# Qt 5.8
|
||||||
'content.print_element_backgrounds': 'PrintElementBackgrounds',
|
'content.print_element_backgrounds':
|
||||||
|
('PrintElementBackgrounds', None),
|
||||||
|
# Qt 5.11
|
||||||
|
'content.autoplay':
|
||||||
|
('PlaybackRequiresUserGesture', lambda val: not val),
|
||||||
}
|
}
|
||||||
for name, attribute in new_attributes.items():
|
for name, (attribute, converter) in new_attributes.items():
|
||||||
try:
|
try:
|
||||||
value = getattr(QWebEngineSettings, attribute)
|
value = getattr(QWebEngineSettings, attribute)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self._ATTRIBUTES[name] = Attr(value)
|
self._ATTRIBUTES[name] = Attr(value, converter=converter)
|
||||||
|
|
||||||
|
|
||||||
class ProfileSetter:
|
class ProfileSetter:
|
||||||
|
@ -149,6 +149,7 @@ def _parse_yaml_backends_dict(name, node):
|
|||||||
False: False,
|
False: False,
|
||||||
'Qt 5.8': qtutils.version_check('5.8'),
|
'Qt 5.8': qtutils.version_check('5.8'),
|
||||||
'Qt 5.9': qtutils.version_check('5.9'),
|
'Qt 5.9': qtutils.version_check('5.9'),
|
||||||
|
'Qt 5.10': qtutils.version_check('5.10'),
|
||||||
'Qt 5.11': qtutils.version_check('5.11'),
|
'Qt 5.11': qtutils.version_check('5.11'),
|
||||||
}
|
}
|
||||||
for key in sorted(node.keys()):
|
for key in sorted(node.keys()):
|
||||||
|
@ -214,6 +214,17 @@ auto_save.session:
|
|||||||
|
|
||||||
## content
|
## content
|
||||||
|
|
||||||
|
content.autoplay:
|
||||||
|
default: true
|
||||||
|
type: Bool
|
||||||
|
backend:
|
||||||
|
QtWebEngine: Qt 5.10
|
||||||
|
QtWebKit: false
|
||||||
|
desc: >-
|
||||||
|
Automatically start playing `<video>` elements.
|
||||||
|
|
||||||
|
Note this option needs a restart with QtWebEngine on Qt < 5.11.
|
||||||
|
|
||||||
content.cache.size:
|
content.cache.size:
|
||||||
default: null
|
default: null
|
||||||
type:
|
type:
|
||||||
|
@ -172,7 +172,13 @@ def qt_args(namespace):
|
|||||||
# https://codereview.qt-project.org/#/c/217932/
|
# https://codereview.qt-project.org/#/c/217932/
|
||||||
# Needed for Qt < 5.9.5 and < 5.10.1
|
# Needed for Qt < 5.9.5 and < 5.10.1
|
||||||
argv.append('--disable-shared-workers')
|
argv.append('--disable-shared-workers')
|
||||||
|
|
||||||
if config.val.qt.force_software_rendering == 'chromium':
|
if config.val.qt.force_software_rendering == 'chromium':
|
||||||
argv.append('--disable-gpu')
|
argv.append('--disable-gpu')
|
||||||
|
|
||||||
|
if not qtutils.version_check('5.11'):
|
||||||
|
# On Qt 5.11, we can control this via QWebEngineSettings
|
||||||
|
if not config.val.content.autoplay:
|
||||||
|
argv.append('--autoplay-policy=user-gesture-required')
|
||||||
|
|
||||||
return argv
|
return argv
|
||||||
|
@ -359,7 +359,7 @@ class TestQtArgs:
|
|||||||
def patch_version_check(self, monkeypatch):
|
def patch_version_check(self, monkeypatch):
|
||||||
"""Make sure no --disable-shared-workers argument gets added."""
|
"""Make sure no --disable-shared-workers argument gets added."""
|
||||||
monkeypatch.setattr(configinit.qtutils, 'version_check',
|
monkeypatch.setattr(configinit.qtutils, 'version_check',
|
||||||
lambda version, compiled: True)
|
lambda version, compiled=False: True)
|
||||||
|
|
||||||
@pytest.mark.parametrize('args, expected', [
|
@pytest.mark.parametrize('args, expected', [
|
||||||
# No Qt arguments
|
# No Qt arguments
|
||||||
@ -403,7 +403,7 @@ class TestQtArgs:
|
|||||||
def test_shared_workers(self, config_stub, monkeypatch, parser,
|
def test_shared_workers(self, config_stub, monkeypatch, parser,
|
||||||
backend, expected):
|
backend, expected):
|
||||||
monkeypatch.setattr(configinit.qtutils, 'version_check',
|
monkeypatch.setattr(configinit.qtutils, 'version_check',
|
||||||
lambda version, compiled: False)
|
lambda version, compiled=False: False)
|
||||||
monkeypatch.setattr(configinit.objects, 'backend', backend)
|
monkeypatch.setattr(configinit.objects, 'backend', backend)
|
||||||
parsed = parser.parse_args([])
|
parsed = parser.parse_args([])
|
||||||
assert configinit.qt_args(parsed) == [sys.argv[0]] + expected
|
assert configinit.qt_args(parsed) == [sys.argv[0]] + expected
|
||||||
@ -416,6 +416,23 @@ class TestQtArgs:
|
|||||||
expected = [sys.argv[0], '--disable-gpu']
|
expected = [sys.argv[0], '--disable-gpu']
|
||||||
assert configinit.qt_args(parsed) == expected
|
assert configinit.qt_args(parsed) == expected
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('backend, new_version, autoplay, added', [
|
||||||
|
(usertypes.Backend.QtWebEngine, True, False, False), # new
|
||||||
|
(usertypes.Backend.QtWebKit, False, False, False), # QtWebKit
|
||||||
|
(usertypes.Backend.QtWebEngine, False, True, False), # enabled
|
||||||
|
(usertypes.Backend.QtWebEngine, False, False, True),
|
||||||
|
])
|
||||||
|
def test_autoplay(self, config_stub, monkeypatch, parser,
|
||||||
|
backend, new_version, autoplay, added):
|
||||||
|
config_stub.val.content.autoplay = autoplay
|
||||||
|
monkeypatch.setattr(configinit.qtutils, 'version_check',
|
||||||
|
lambda version, compiled=False: new_version)
|
||||||
|
monkeypatch.setattr(configinit.objects, 'backend', backend)
|
||||||
|
|
||||||
|
parsed = parser.parse_args([])
|
||||||
|
args = configinit.qt_args(parsed)
|
||||||
|
assert ('--autoplay-policy=user-gesture-required' in args) == added
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('arg, confval, used', [
|
@pytest.mark.parametrize('arg, confval, used', [
|
||||||
# overridden by commandline arg
|
# overridden by commandline arg
|
||||||
|
Loading…
Reference in New Issue
Block a user