E-book viewer: Fix next page skipping the bottom of chapters when the content is wider than the window. Fixes #8153 (Viewer in 0.7.36 cutting off end of chapters.)

This commit is contained in:
Kovid Goyal 2011-01-06 20:41:38 -07:00
parent 6a40732711
commit 32c1ef8ef6

View File

@ -449,7 +449,7 @@ class Document(QWebPage): # {{{
return self.mainFrame().contentsSize().width() # offsetWidth gives inaccurate results
def set_bottom_padding(self, amount):
s = QSize(-1, -1) if amount == 0 else QSize(self.width,
s = QSize(-1, -1) if amount == 0 else QSize(self.viewportSize().width(),
self.height+amount)
self.setPreferredContentsSize(s)
@ -820,6 +820,7 @@ class DocumentView(QWebView): # {{{
self.flipper.initialize(self.current_page_image())
self.manager.next_document()
return
#oheight = self.document.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:
@ -835,6 +836,7 @@ class DocumentView(QWebView): # {{{
if epf:
self.flipper.initialize(self.current_page_image())
#print 'Document height:', self.document.height
#print 'Height change:', (self.document.height - oheight)
max_y = self.document.height - window_height
lower_limit = min(max_y, lower_limit)
#print 'Scroll to:', lower_limit
@ -842,6 +844,7 @@ class DocumentView(QWebView): # {{{
self.document.scroll_to(self.document.xpos, lower_limit)
actually_scrolled = self.document.ypos - opos
#print 'After scroll pos:', self.document.ypos
#print 'Scrolled by:', self.document.ypos - opos
self.find_next_blank_line(window_height - actually_scrolled)
#print 'After blank line pos:', self.document.ypos
if epf: