E-book viewer: Fix displaying multiple pages per screen not working in calibre 2.x with some books, due to a change in Qt 5. Fixes #1372066 [Private bug](https://bugs.launchpad.net/calibre/+bug/1372066)

This commit is contained in:
Kovid Goyal 2014-09-21 21:02:13 +05:30
parent 1053533932
commit 9b2ebcfdc5
2 changed files with 11 additions and 3 deletions

Binary file not shown.

View File

@ -152,9 +152,9 @@ class PagedDisplay
fgcolor = body_style.getPropertyValue('color')
bs.setProperty('-webkit-column-gap', (2*sm)+'px')
bs.setProperty('-webkit-column-width', col_width+'px')
bs.setProperty('-webkit-column-rule-color', fgcolor)
bs.setProperty('-webkit-column-gap', 2*sm + 'px')
bs.setProperty('-webkit-column-width', col_width + 'px')
bs.setProperty('-webkit-column-rule', '0px inset blue')
# Without this, webkit bleeds the margin of the first block(s) of body
# above the columns, which causes them to effectively be added to the
@ -231,6 +231,14 @@ class PagedDisplay
if is_single_page
this.is_full_screen_layout = true
ncols = document.body.scrollWidth / this.page_width
if ncols != Math.floor(ncols) and not this.is_full_screen_layout
# In Qt 5 WebKit will sometimes adjust the individual column widths for
# better text layout. This is allowed as per the CSS spec, so the
# only way to ensure fixed column widths is to make sure the body
# width is an exact multiple of the column widths
bs.setProperty('width', Math.floor(ncols) * this.page_width - 2 * sm)
this.in_paged_mode = true
this.current_margin_side = sm
# log('Time to layout:', new Date().getTime() - start_time)