From 323d5fc9e710cc40cef5a0ab5281238df4313722 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 3 Oct 2016 06:59:35 +0200 Subject: [PATCH] Also fix scroll.to_perc with position:absolute --- qutebrowser/javascript/scroll.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/qutebrowser/javascript/scroll.js b/qutebrowser/javascript/scroll.js index 699a59599..aad6917ca 100644 --- a/qutebrowser/javascript/scroll.js +++ b/qutebrowser/javascript/scroll.js @@ -26,13 +26,25 @@ window._qutebrowser.scroll = (function() { var elem = document.documentElement; var x_px = window.scrollX; var y_px = window.scrollY; + var width = Math.max( + document.body.scrollWidth, + document.body.offsetWidth, + elem.scrollWidth, + elem.offsetWidth + ); + var height = Math.max( + document.body.scrollHeight, + document.body.offsetHeight, + elem.scrollHeight, + elem.offsetHeight + ); if (x !== undefined) { - x_px = (elem.scrollWidth - window.innerWidth) / 100 * x; + x_px = (width - window.innerWidth) / 100 * x; } if (y !== undefined) { - y_px = (elem.scrollHeight - window.innerHeight) / 100 * y; + y_px = (height - window.innerHeight) / 100 * y; } /*