From ac2d44e4dc95b09879675b7dfef025a720895b91 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 20 Oct 2019 10:46:44 +0530 Subject: [PATCH] Clean up fs_images --- src/pyj/fs_images.pyj | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/pyj/fs_images.pyj b/src/pyj/fs_images.pyj index c0268f474e..19c4d7ae96 100644 --- a/src/pyj/fs_images.pyj +++ b/src/pyj/fs_images.pyj @@ -3,6 +3,16 @@ 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(): # Full screen images using SVG no longer render correctly # webengine. This is because it sets the width to the @@ -27,7 +37,7 @@ def fix_fullscreen_svg_images(): names.push(name) if name is 'svg': svg = node - if names == ['div', 'svg', 'image'] or names == ['svg', 'image']: - if svg.getAttribute('width') is '100%' and svg.getAttribute('height') is '100%': - svg.setAttribute('width', '100vw') - svg.setAttribute('height', '100vh') + + if is_svg_fs_markup(names, svg): + svg.setAttribute('width', '100vw') + svg.setAttribute('height', '100vh')