diff -r c3379bf35654 -r d3548bec88d1 UI/Previewers/PreviewerHTML.py --- a/UI/Previewers/PreviewerHTML.py Mon Jul 10 18:48:33 2017 +0200 +++ b/UI/Previewers/PreviewerHTML.py Mon Jul 10 19:12:12 2017 +0200 @@ -246,22 +246,24 @@ frame.scrollBarMaximum(Qt.Vertical) == pos.y() else: from PyQt5.QtCore import QPoint - # TODO: replace this by QWebEnginePage.scrollPosition() - pos = self.__execJavaScript( - "(function() {" - "var res = {" - " x: 0," - " y: 0," - "};" - "res.x = window.scrollX;" - "res.y = window.scrollY;" - "return res;" - "})()" - ) - if pos is not None: - pos = QPoint(pos["x"], pos["y"]) - else: - pos = QPoint(0, 0) + try: + pos = self.previewView.scrollPosition() + except AttributeError: + pos = self.__execJavaScript( + "(function() {" + "var res = {" + " x: 0," + " y: 0," + "};" + "res.x = window.scrollX;" + "res.y = window.scrollY;" + "return res;" + "})()" + ) + if pos is not None: + pos = QPoint(pos["x"], pos["y"]) + else: + pos = QPoint(0, 0) self.__scrollBarPositions[self.__previewedPath] = pos self.__hScrollBarAtEnd[self.__previewedPath] = False self.__vScrollBarAtEnd[self.__previewedPath] = False