diff --git a/qutebrowser/browser/webengine/webenginesettings.py b/qutebrowser/browser/webengine/webenginesettings.py index 7d8d14dc6..93f1b4494 100644 --- a/qutebrowser/browser/webengine/webenginesettings.py +++ b/qutebrowser/browser/webengine/webenginesettings.py @@ -76,35 +76,35 @@ class WebEngineSettings(websettings.AbstractSettings): _ATTRIBUTES = { 'content.xss_auditing': - QWebEngineSettings.XSSAuditingEnabled, + [QWebEngineSettings.XSSAuditingEnabled], 'content.images': - QWebEngineSettings.AutoLoadImages, + [QWebEngineSettings.AutoLoadImages], 'content.javascript.enabled': - QWebEngineSettings.JavascriptEnabled, + [QWebEngineSettings.JavascriptEnabled], 'content.javascript.can_open_tabs_automatically': - QWebEngineSettings.JavascriptCanOpenWindows, + [QWebEngineSettings.JavascriptCanOpenWindows], 'content.javascript.can_access_clipboard': - QWebEngineSettings.JavascriptCanAccessClipboard, + [QWebEngineSettings.JavascriptCanAccessClipboard], 'content.plugins': - QWebEngineSettings.PluginsEnabled, + [QWebEngineSettings.PluginsEnabled], 'content.hyperlink_auditing': - QWebEngineSettings.HyperlinkAuditingEnabled, + [QWebEngineSettings.HyperlinkAuditingEnabled], 'content.local_content_can_access_remote_urls': - QWebEngineSettings.LocalContentCanAccessRemoteUrls, + [QWebEngineSettings.LocalContentCanAccessRemoteUrls], 'content.local_content_can_access_file_urls': - QWebEngineSettings.LocalContentCanAccessFileUrls, + [QWebEngineSettings.LocalContentCanAccessFileUrls], 'content.webgl': - QWebEngineSettings.WebGLEnabled, + [QWebEngineSettings.WebGLEnabled], 'content.local_storage': - QWebEngineSettings.LocalStorageEnabled, + [QWebEngineSettings.LocalStorageEnabled], 'input.spatial_navigation': - QWebEngineSettings.SpatialNavigationEnabled, + [QWebEngineSettings.SpatialNavigationEnabled], 'input.links_included_in_focus_chain': - QWebEngineSettings.LinksIncludedInFocusChain, + [QWebEngineSettings.LinksIncludedInFocusChain], 'scrolling.smooth': - QWebEngineSettings.ScrollAnimatorEnabled, + [QWebEngineSettings.ScrollAnimatorEnabled], # Missing QtWebEngine attributes: # - ScreenCaptureEnabled @@ -162,14 +162,7 @@ class WebEngineSettings(websettings.AbstractSettings): except AttributeError: continue - self._ATTRIBUTES[name] = value - - def set_attribute(self, name, value): - attribute = self._ATTRIBUTES[name] - if value is configutils.UNSET: - self._settings.resetAttribute(attribute) - else: - self._settings.setAttribute(attribute, value) + self._ATTRIBUTES[name] = [value] def _init_stylesheet(profile): diff --git a/qutebrowser/browser/webkit/webkitsettings.py b/qutebrowser/browser/webkit/webkitsettings.py index 6ba15f62a..d8cbfbb2e 100644 --- a/qutebrowser/browser/webkit/webkitsettings.py +++ b/qutebrowser/browser/webkit/webkitsettings.py @@ -121,13 +121,6 @@ class WebKitSettings(websettings.AbstractSettings): QWebSettings.FantasyFont: QFont.Fantasy, } - def set_attribute(self, name, value): - for attribute in self._ATTRIBUTES[name]: - if value is configutils.UNSET: - self._settings.resetAttribute(attribute) - else: - self._settings.setAttribute(attribute, value) - def _set_user_stylesheet(settings): """Set the generated user-stylesheet.""" diff --git a/qutebrowser/config/websettings.py b/qutebrowser/config/websettings.py index 86f70ab69..20b59c90c 100644 --- a/qutebrowser/config/websettings.py +++ b/qutebrowser/config/websettings.py @@ -45,7 +45,11 @@ class AbstractSettings: If the value is configutils.UNSET, the value is reset instead. """ - raise NotImplementedError + for attribute in self._ATTRIBUTES[name]: + if value is configutils.UNSET: + self._settings.resetAttribute(attribute) + else: + self._settings.setAttribute(attribute, value) def test_attribute(self, name): """Get the value for the given attribute."""