mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 13:05:04 +02:00
Workaround bug in Qt WebKit that causes innerHeight to sometimes erroneously return 0
This commit is contained in:
parent
bb4062a84a
commit
89639ac509
2 changed files with 8 additions and 4 deletions
|
|
@ -20,7 +20,7 @@
|
|||
description: >
|
||||
Now calibre will automatically check for updated versions of the recipes used to
|
||||
download the builting news sources. As a result, there is no need to upgrade calibre
|
||||
just for recipe fixes. Note that you stil have to upgrade to get access to new
|
||||
just for recipe fixes. Note that you still have to upgrade to get access to new
|
||||
news sources.
|
||||
type: major
|
||||
|
||||
|
|
|
|||
|
|
@ -344,7 +344,10 @@ def hscroll_fraction(self):
|
|||
|
||||
@property
|
||||
def height(self):
|
||||
return self.javascript('document.body.offsetHeight', 'int') # contentsSize gives inaccurate results
|
||||
ans = self.javascript('document.body.offsetHeight', 'int') # contentsSize gives inaccurate results
|
||||
if ans == 0:
|
||||
ans = self.mainFrame().contentsSize().height()
|
||||
return ans
|
||||
|
||||
@property
|
||||
def width(self):
|
||||
|
|
@ -489,6 +492,7 @@ def load_path(self, path, pos=0.0):
|
|||
self.manager.load_started()
|
||||
self.loading_url = QUrl.fromLocalFile(path)
|
||||
#self.setContent(QByteArray(html.encode(path.encoding)), mt, QUrl.fromLocalFile(path))
|
||||
#open('/tmp/t.html', 'wb').write(html.encode(path.encoding))
|
||||
self.setHtml(html, self.loading_url)
|
||||
self.turn_off_internal_scrollbars()
|
||||
|
||||
|
|
@ -585,8 +589,8 @@ def next_page(self):
|
|||
else:
|
||||
self.document.set_bottom_padding(0)
|
||||
opos = self.document.ypos
|
||||
lower_limit = opos + delta_y
|
||||
max_y = self.document.height - window_height
|
||||
lower_limit = opos + delta_y # Max value of top y co-ord after scrolling
|
||||
max_y = self.document.height - window_height # The maximum possible top y co-ord
|
||||
if max_y < lower_limit:
|
||||
self.document.set_bottom_padding(lower_limit - max_y)
|
||||
max_y = self.document.height - window_height
|
||||
|
|
|
|||
Loading…
Reference in a new issue