"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/pyj/fs_images.pyj" between
calibre-4.2.0.tar.xz and calibre-4.3.0.tar.xz

About: calibre is an e-book library management application (syncing, converting, viewing,\PKG_DESCR_TTnbsp;...).

fs_images.pyj  (calibre-4.2.0.tar.xz):fs_images.pyj  (calibre-4.3.0.tar.xz)
# vim:fileencoding=utf-8 # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net> # License: GPL v3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals from __python__ import bound_methods, hash_literals
def is_svg_fs_markup(names, svg):
if svg is not None:
if names.length is 2 or names.length is 3:
if names[-1] is 'image' and names[-2] is 'svg':
if names.length is 2 or names[0] is 'div':
if svg.width is '100%' and svg.height is '100%':
return True
return False
def fix_fullscreen_svg_images(): def fix_fullscreen_svg_images():
# Full screen images using SVG no longer render correctly # Full screen images using SVG no longer render correctly
# webengine. This is because it sets the width to the # webengine. This is because it sets the width to the
# viewport width and simply adjusts the height accordingly # viewport width and simply adjusts the height accordingly
# So we replace 100% with 100vw and 100vh to get the desired # So we replace 100% with 100vw and 100vh to get the desired
# rendering # rendering
child_names = v'[]' child_names = v'[]'
for node in document.body.childNodes: for node in document.body.childNodes:
if node.tagName: if node.tagName:
name = node.tagName.toLowerCase() name = node.tagName.toLowerCase()
if name is not 'style' and name is not 'script': if name is not 'style' and name is not 'script':
child_names.push(name) child_names.push(name)
if child_names.length > 1: if child_names.length > 1:
break break
if child_names.length is 1 and child_names[0] is 'div': if child_names.length is 1 and (child_names[0] is 'div' or child_names[0] is
names = [] 'svg'):
names = v'[]'
svg = None svg = None
for node in document.body.querySelectorAll('*'): for node in document.body.querySelectorAll('*'):
if node.tagName: if node.tagName:
name = node.tagName.toLowerCase() name = node.tagName.toLowerCase()
if name is not 'style' and name is not 'script': if name is not 'style' and name is not 'script':
names.push(name) names.push(name)
if name is 'svg': if name is 'svg':
svg = node svg = node
if names == ['div', 'svg', 'image'] or names == ['svg', 'image']:
if svg.getAttribute('width') is '100%' and svg.getAttribute('height' if is_svg_fs_markup(names, svg):
) is '100%': svg.setAttribute('width', '100vw')
svg.setAttribute('width', '100vw') svg.setAttribute('height', '100vh')
svg.setAttribute('height', '100vh')
 End of changes. 3 change blocks. 
2 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)