mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Viewer: Fix vertical margin at the top of the first page incorrect in a certain rare circumstance (first child of body being an empty paragraph). Fixes #1082640 (ebook-viewer: top line of the text is cut off when using two-paged mode)
This commit is contained in:
parent
6e02f9a4a0
commit
d29b097216
Binary file not shown.
@ -116,6 +116,18 @@ class PagedDisplay
|
||||
# above the columns, which causes them to effectively be added to the
|
||||
# page margins (the margin collapse algorithm)
|
||||
bs.setProperty('-webkit-margin-collapse', 'separate')
|
||||
# Remove any webkit specified default margin from the first child of body
|
||||
# Otherwise, you could end up with an effective negative margin, I dont
|
||||
# understand exactly why, but see:
|
||||
# https://bugs.launchpad.net/calibre/+bug/1082640 for an example
|
||||
c = document.body.firstChild
|
||||
count = 0
|
||||
while c?.nodeType != 1 and count < 20
|
||||
c = c?.nextSibling
|
||||
count += 1
|
||||
if c?.nodeType == 1
|
||||
c.style.setProperty('-webkit-margin-before', '0')
|
||||
|
||||
|
||||
bs.setProperty('overflow', 'visible')
|
||||
bs.setProperty('height', (window.innerHeight - this.margin_top - this.margin_bottom) + 'px')
|
||||
|
Loading…
x
Reference in New Issue
Block a user