[webkit-qt] API for uniform scrolling

Kevin.Simons at nokia.com Kevin.Simons at nokia.com
Fri Aug 6 01:06:13 PDT 2010

Hi all,

In several examples of trying to implement kinetic scrolling on top of
QtWebKit that I've seen, the code has needed to do some inelegant stuff like
the following to handle overflow:scroll/auto elements:

// some mouse down handling...
QWebFrame frame = view->page()->frameAt(point);
// later some mouse move handling...
If(!qtwebkit_webframe_scrollOverflow(frame, ...))

Where qtwebkit_webframe_scrollOverflow needs to each and every time do an
elementForPoint() to find the element, etc.

What if instead we added (presumably to QWebPage or to the QGraphicsWebView
itself) a uniform API that external scrolling implementations could use:

QWebScrollController* scrollControllerForPoint(const Qpoint&);

The QWebScrollController itself would basically provide the position, scroll
range and visible size of the "thing" being scrolled, would allow the the
position to be set, and would emit signals when range/position change. It
would then internally handle whether it's scrolling a frame or an element
with overflow:scroll/auto (and would keep a pointer to it around so that it
doesn't need to figure it out for every move event).

Thoughts? Is there a better way to do it today that I'm missing?


More information about the webkit-qt mailing list