mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: Fix bug that could cause the bottom of chapters to get cut-off if the topmost element had a large top margin. Fixes #8791 (Viewer cutting of chapter ends)
This commit is contained in:
parent
ad8d2f8889
commit
dc84821cec
@ -440,16 +440,17 @@ class Document(QWebPage): # {{{
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def height(self):
|
def height(self):
|
||||||
j = self.javascript('document.body.offsetHeight', 'int')
|
# Note that document.body.offsetHeight does not include top and bottom
|
||||||
|
# margins on body and in some cases does not include the top margin on
|
||||||
|
# the first element inside body either. See ticket #8791 for an example
|
||||||
|
# of the latter.
|
||||||
q = self.mainFrame().contentsSize().height()
|
q = self.mainFrame().contentsSize().height()
|
||||||
if q == j:
|
if q < 0:
|
||||||
return j
|
# Don't know if this is still needed, but it can't hurt
|
||||||
if min(j, q) <= 0:
|
j = self.javascript('document.body.offsetHeight', 'int')
|
||||||
return max(j, q)
|
if j >= 0:
|
||||||
window_height = self.window_height
|
q = j
|
||||||
if j == window_height:
|
return q
|
||||||
return j if q < 1.2*j else q
|
|
||||||
return j
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def width(self):
|
def width(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user