mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Clean up fs_images
This commit is contained in:
parent
579049affd
commit
ac2d44e4dc
@ -3,6 +3,16 @@
|
|||||||
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
|
||||||
@ -27,7 +37,7 @@ def fix_fullscreen_svg_images():
|
|||||||
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') is '100%':
|
if is_svg_fs_markup(names, svg):
|
||||||
svg.setAttribute('width', '100vw')
|
svg.setAttribute('width', '100vw')
|
||||||
svg.setAttribute('height', '100vh')
|
svg.setAttribute('height', '100vh')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user