mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
E-book viewer: Use the Qt API to set document padding during next page operation, instead of javascript. Fixes #5343 (Preview EPUB "crashes" when PgDwn is used)
This commit is contained in:
parent
8a759d7738
commit
a47273f7b8
@ -394,13 +394,14 @@ class Document(QWebPage):
|
||||
return self.mainFrame().contentsSize().width() # offsetWidth gives inaccurate results
|
||||
|
||||
def set_bottom_padding(self, amount):
|
||||
padding = '%dpx'%amount
|
||||
try:
|
||||
old_padding = unicode(self.javascript('$("body").css("padding-bottom")').toString())
|
||||
except:
|
||||
old_padding = ''
|
||||
body = self.mainFrame().documentElement().findFirst('body')
|
||||
if body.isNull():
|
||||
return
|
||||
old_padding = unicode(body.styleProperty('padding-bottom',
|
||||
body.ComputedStyle)).strip()
|
||||
padding = u'%dpx'%amount
|
||||
if old_padding != padding:
|
||||
self.javascript('$("body").css("padding-bottom", "%s")' % padding)
|
||||
body.setStyleProperty('padding-bottom', padding + ' !important')
|
||||
|
||||
|
||||
class EntityDeclarationProcessor(object):
|
||||
|
Loading…
x
Reference in New Issue
Block a user