Commit 8134f3fb authored by David Faure's avatar David Faure
Browse files

fix PageUp/PageDown: clientHeight works, one of the other heights was the full document height.

parent 84b568e1
......@@ -126,11 +126,10 @@ QString WebEngineScript::searchElementPosition(const QString &elementStr)
QString WebEngineScript::scrollPercentage(int percent)
const QString source = QString::fromLatin1("var current = document.body.scrollTop;"
"var body = document.body;"
"html = document.documentElement;"
"var height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );"
"var docElement = document.documentElement;"
"var height = docElement.clientHeight;"
"var newPosition = current + height * %1 /100;"
"window.scrollTo(window.scrollX, newPosition); [window.scrollX, window.scrollY];").arg(percent);
"window.scrollTo(window.scrollX, newPosition);").arg(percent);
//qDebug() << "QString WebEngineScript::scrollPercentage(int percent) " << source;
return source;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment