Make scrolling work with multiple frames

This commit is contained in:
Florian Bruhin 2014-04-22 14:17:17 +02:00
parent 26124920cd
commit ebd3ab778f

View File

@ -64,7 +64,7 @@ class CurCommandDispatcher(QObject):
perc = int(count) perc = int(count)
else: else:
perc = float(perc) perc = float(perc)
frame = self._tabs.currentWidget().page_.mainFrame() frame = self._tabs.currentWidget().page_.currentFrame()
m = frame.scrollBarMaximum(orientation) m = frame.scrollBarMaximum(orientation)
if m == 0: if m == 0:
return return
@ -234,7 +234,7 @@ class CurCommandDispatcher(QObject):
""" """
dx = int(count) * float(dx) dx = int(count) * float(dx)
dy = int(count) * float(dy) dy = int(count) * float(dy)
self._tabs.currentWidget().page_.mainFrame().scroll(dx, dy) self._tabs.currentWidget().page_.currentFrame().scroll(dx, dy)
@cmdutils.register(instance='mainwindow.tabs.cur', name='scroll_perc_x', @cmdutils.register(instance='mainwindow.tabs.cur', name='scroll_perc_x',
hide=True) hide=True)
@ -271,11 +271,10 @@ class CurCommandDispatcher(QObject):
my: How many pages to scroll down. my: How many pages to scroll down.
count: multiplier count: multiplier
""" """
# FIXME this might not work with HTML frames frame = self._tabs.currentWidget().page_.currentFrame()
page = self._tabs.currentWidget().page_ size = frame.geometry()
size = page.viewportSize() frame.scroll(int(count) * float(mx) * size.width(),
page.mainFrame().scroll(int(count) * float(mx) * size.width(), int(count) * float(my) * size.height())
int(count) * float(my) * size.height())
@cmdutils.register(instance='mainwindow.tabs.cur') @cmdutils.register(instance='mainwindow.tabs.cur')
def yank(self, sel=False): def yank(self, sel=False):