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) ...@@ -126,11 +126,10 @@ QString WebEngineScript::searchElementPosition(const QString &elementStr)
QString WebEngineScript::scrollPercentage(int percent) QString WebEngineScript::scrollPercentage(int percent)
{ {
const QString source = QString::fromLatin1("var current = document.body.scrollTop;" const QString source = QString::fromLatin1("var current = document.body.scrollTop;"
"var body = document.body;" "var docElement = document.documentElement;"
"html = document.documentElement;" "var height = docElement.clientHeight;"
"var height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );"
"var newPosition = current + height * %1 /100;" "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; //qDebug() << "QString WebEngineScript::scrollPercentage(int percent) " << source;
return source; return source;
......
Markdown is supported
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