Add support for general -> print-element-backgrounds with WebEngine

This commit is contained in:
Florian Bruhin 2017-02-06 21:08:32 +01:00
parent a40db1735e
commit df245dae48
4 changed files with 16 additions and 4 deletions

View File

@ -29,6 +29,7 @@ Added
- Support for the `storage -> cache-size` option with QtWebEngine
- Support for the `colors -> webpage.bg` option with QtWebEngine
- Support for the HTML5 fullscreen API (e.g. youtube videos) with QtWebEngine
- Support for the `general -> print-element-backgrounds` option with QtWebEngine on Qt >= 5.8
Changed
~~~~~~~

View File

@ -185,7 +185,6 @@ def shutdown():
# - AutoLoadIconsForPage (5.7)
# - TouchIconsEnabled (5.7)
# - FocusOnNavigationEnabled (5.8)
# - PrintElementBackgrounds (5.8)
# - AllowRunningInsecureContent (5.8)
#
# Missing QtWebEngine fonts:
@ -288,3 +287,10 @@ try:
except AttributeError:
# Added in Qt 5.7
pass
try:
MAPPINGS['general']['print-element-backgrounds'] = Attribute(
QWebEngineSettings.PrintElementBackgrounds)
except AttributeError:
# Added in Qt 5.8
pass

View File

@ -200,9 +200,12 @@ def data(readonly=False):
('print-element-backgrounds',
SettingValue(typ.Bool(), 'true',
backends=[usertypes.Backend.QtWebKit]),
backends=(None if qtutils.version_check('5.8')
else [usertypes.Backend.QtWebKit])),
"Whether the background color and images are also drawn when the "
"page is printed."),
"page is printed.\n"
"This setting only works with Qt 5.8 or newer when using the "
"QtWebEngine backend."),
('xss-auditing',
SettingValue(typ.Bool(), 'false'),

View File

@ -365,6 +365,8 @@ def generate_commands(filename):
def _generate_setting_section(f, sectname, sect):
"""Generate documentation for a single section."""
version_dependent_options = [('network', 'proxy'),
('general', 'print-element-backgrounds')]
for optname, option in sect.items():
f.write("\n")
f.write('[[{}-{}]]'.format(sectname, optname) + "\n")
@ -391,7 +393,7 @@ def _generate_setting_section(f, sectname, sect):
f.write("Default: empty\n")
if (option.backends is None or
(sectname, optname) == ('network', 'proxy')):
(sectname, optname) in version_dependent_options):
pass
elif option.backends == [usertypes.Backend.QtWebKit]:
f.write("\nThis setting is only available with the QtWebKit "