diff options
author | toofar <toofar@spalge.com> | 2023-09-25 18:59:03 +1300 |
---|---|---|
committer | toofar <toofar@spalge.com> | 2023-09-25 18:59:03 +1300 |
commit | 4927534a6898fb3d6bea7f7c2b4ee0b42650a0c1 (patch) | |
tree | afbe05c8d392de6d083794118ab8f74948d591ac | |
parent | 9a50f2875b361bdf9cd718e550270036ff6048a7 (diff) | |
download | qutebrowser-4927534a6898fb3d6bea7f7c2b4ee0b42650a0c1.tar.gz qutebrowser-4927534a6898fb3d6bea7f7c2b4ee0b42650a0c1.zip |
Reduce args passed to `_qtwebengine_settings_args`
I added all three args to this function in an effort to allow for generic
feature detection, because other places further up in the code where using all
these variables for that. But I didn't look at how the stuff I
was passing in could be used. I can see `special_flags` has essentially already
been consumed. `namespace` is used for all kinds of stuff, there could
theoretically be a pretty simple mapping between the CLI arg and a setting
webengine setting but the only examples of that so for are the special flags
ones and debug flags, which are already generic in their own way. So if we've
gone this long without it we probably don't need it.
-rw-r--r-- | qutebrowser/config/qtargs.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/qutebrowser/config/qtargs.py b/qutebrowser/config/qtargs.py index 4bcadea84..934953d0a 100644 --- a/qutebrowser/config/qtargs.py +++ b/qutebrowser/config/qtargs.py @@ -273,7 +273,7 @@ def _qtwebengine_args( if disabled_features: yield _DISABLE_FEATURES + ','.join(disabled_features) - yield from _qtwebengine_settings_args(versions, namespace, special_flags) + yield from _qtwebengine_settings_args(versions) _SettingValueType = Union[ @@ -281,8 +281,6 @@ _SettingValueType = Union[ Callable[ [ version.WebEngineVersions, - argparse.Namespace, - Sequence[str], ], str, ], @@ -338,7 +336,7 @@ _WEBENGINE_SETTINGS: Dict[str, Dict[Any, Optional[_SettingValueType]]] = { 'qt.workarounds.disable_accelerated_2d_canvas': { 'always': '--disable-accelerated-2d-canvas', 'never': None, - 'auto': lambda versions, namespace, special_flags: 'always' + 'auto': lambda versions: 'always' if machinery.IS_QT6 and versions.chromium_major and versions.chromium_major < 111 @@ -347,15 +345,11 @@ _WEBENGINE_SETTINGS: Dict[str, Dict[Any, Optional[_SettingValueType]]] = { } -def _qtwebengine_settings_args( - versions: version.WebEngineVersions, - namespace: argparse.Namespace, - special_flags: Sequence[str], -) -> Iterator[str]: +def _qtwebengine_settings_args(versions: version.WebEngineVersions) -> Iterator[str]: for setting, args in sorted(_WEBENGINE_SETTINGS.items()): arg = args[config.instance.get(setting)] if callable(arg): - new_value = arg(versions, namespace, special_flags) + new_value = arg(versions) assert ( new_value in args ), f"qt.settings feature detection returned an unrecognized value: {new_value} for {setting}" |