mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-07 09:01:38 -04:00
Port fix for 1667357 to the new viewer code
This commit is contained in:
parent
90d587905d
commit
8867ca68fc
@ -126,6 +126,13 @@ def layout(is_single_page):
|
|||||||
# cover, if so we treat it specially.
|
# cover, if so we treat it specially.
|
||||||
single_screen = (document.body.scrollHeight < window.innerHeight + 75)
|
single_screen = (document.body.scrollHeight < window.innerHeight + 75)
|
||||||
first_layout = True
|
first_layout = True
|
||||||
|
has_svg = document.getElementsByTagName('svg').length > 0
|
||||||
|
imgs = document.getElementsByTagName('img')
|
||||||
|
only_img = imgs.length is 1 and document.getElementsByTagName('div').length < 3 and document.getElementsByTagName('p').length < 2
|
||||||
|
if only_img and window.getComputedStyle(imgs[0]).zIndex < 0:
|
||||||
|
# Needed for some stupidly coded fixed layout EPUB comics, see for
|
||||||
|
# instance: https://bugs.launchpad.net/calibre/+bug/1667357
|
||||||
|
imgs[0].style.zIndex = '0'
|
||||||
if not single_screen and cps > 1:
|
if not single_screen and cps > 1:
|
||||||
num = cps - 1
|
num = cps - 1
|
||||||
elems = document.querySelectorAll('body > *')
|
elems = document.querySelectorAll('body > *')
|
||||||
@ -182,8 +189,6 @@ def layout(is_single_page):
|
|||||||
# width 100% are wider than body and lead to a blank page after the
|
# width 100% are wider than body and lead to a blank page after the
|
||||||
# current page (when cols_per_screen == 1). Similarly img elements
|
# current page (when cols_per_screen == 1). Similarly img elements
|
||||||
# with height=100% overflow the first column
|
# with height=100% overflow the first column
|
||||||
has_svg = document.getElementsByTagName('svg').length > 0
|
|
||||||
only_img = document.getElementsByTagName('img').length is 1 and document.getElementsByTagName('div').length < 3 and document.getElementsByTagName('p').length < 2
|
|
||||||
is_full_screen_layout = (only_img or has_svg) and single_screen and (document.body.scrollWidth < 2*ww + 10)
|
is_full_screen_layout = (only_img or has_svg) and single_screen and (document.body.scrollWidth < 2*ww + 10)
|
||||||
if is_single_page:
|
if is_single_page:
|
||||||
is_full_screen_layout = True
|
is_full_screen_layout = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user