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
|
return self.mainFrame().contentsSize().width() # offsetWidth gives inaccurate results
|
||||||
|
|
||||||
def set_bottom_padding(self, amount):
|
def set_bottom_padding(self, amount):
|
||||||
padding = '%dpx'%amount
|
body = self.mainFrame().documentElement().findFirst('body')
|
||||||
try:
|
if body.isNull():
|
||||||
old_padding = unicode(self.javascript('$("body").css("padding-bottom")').toString())
|
return
|
||||||
except:
|
old_padding = unicode(body.styleProperty('padding-bottom',
|
||||||
old_padding = ''
|
body.ComputedStyle)).strip()
|
||||||
|
padding = u'%dpx'%amount
|
||||||
if old_padding != padding:
|
if old_padding != padding:
|
||||||
self.javascript('$("body").css("padding-bottom", "%s")' % padding)
|
body.setStyleProperty('padding-bottom', padding + ' !important')
|
||||||
|
|
||||||
|
|
||||||
class EntityDeclarationProcessor(object):
|
class EntityDeclarationProcessor(object):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user