From e749331979132baebcf0a42227577d8feb9296fc Mon Sep 17 00:00:00 2001 From: Adenilson Cavalcanti Da Silva Date: Tue, 6 Oct 2009 18:31:47 +0000 Subject: [PATCH] Using the viewport/content size ratio to inform the geometry. It ensures that at least the page will scroll correctly (i.e. advancing just 1 page down) in webpages that are too long (e.g. kdeplanet). svn path=/trunk/KDE/kdelibs/; revision=1032052 --- widgets/webview.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/widgets/webview.cpp b/widgets/webview.cpp index 400417f6d..6128db88f 100644 --- a/widgets/webview.cpp +++ b/widgets/webview.cpp @@ -200,7 +200,16 @@ void WebView::setVerticalScrollValue(qreal value) QRectF WebView::viewport() const { - return QRectF(d->page->mainFrame()->geometry()); + QRectF result; + if (!d->page) { + return result; + } + + result.setWidth(d->page->mainFrame()->contentsSize().width()); + result.setHeight(d->page->mainFrame()->contentsSize().height()); + result.setHeight(d->page->mainFrame()->geometry().height()/result.height()); + result.setWidth(d->page->mainFrame()->geometry().width()/result.width()); + return result; }