E-book viewer: Fix very slow loading for HTML files with very many images on Linux. Fixes #1774884 [loading flow for some ebooks takes painfully long in linux](https://bugs.launchpad.net/calibre/+bug/1774884)

For some reason setting column break inside on the images was
causing a re-layout only on Linux.
This commit is contained in:
Kovid Goyal 2018-06-06 17:53:11 +05:30
parent 13f9a4b7c9
commit 1cbd6ccf9b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 2 deletions

Binary file not shown.

View File

@ -348,11 +348,16 @@ class PagedDisplay
# force a relayout if the render tree is dirty. # force a relayout if the render tree is dirty.
images = [] images = []
vimages = [] vimages = []
bounding_rects = []
img_tags = document.getElementsByTagName('img')
for img in img_tags
bounding_rects.push(img.getBoundingClientRect())
maxh = this.current_page_height maxh = this.current_page_height
for img in document.getElementsByTagName('img') for i in [0...img_tags.length]
img = img_tags[i]
previously_limited = calibre_utils.retrieve(img, 'width-limited', false) previously_limited = calibre_utils.retrieve(img, 'width-limited', false)
data = calibre_utils.retrieve(img, 'img-data', null) data = calibre_utils.retrieve(img, 'img-data', null)
br = img.getBoundingClientRect() br = bounding_rects[i]
if data == null if data == null
data = {'left':br.left, 'right':br.right, 'height':br.height, 'display': img.style.display} data = {'left':br.left, 'right':br.right, 'height':br.height, 'display': img.style.display}
calibre_utils.store(img, 'img-data', data) calibre_utils.store(img, 'img-data', data)