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
This commit is contained in:
parent
3d33d3f28f
commit
e749331979
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user