[Webkit-unassigned] [Bug 28865] New: [Qt] Make cursor set cleaner in QtWebKit Api: eliminate SetCursorEvent hack.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Aug 31 20:40:46 PDT 2009
https://bugs.webkit.org/show_bug.cgi?id=28865
Summary: [Qt] Make cursor set cleaner in QtWebKit Api:
eliminate SetCursorEvent hack.
Product: WebKit
Version: 528+ (Nightly build)
Platform: PC
OS/Version: All
Status: NEW
Severity: Normal
Priority: P2
Component: WebKit Qt
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: tonikitoo at gmail.com
CC: tonikitoo at gmail.com, hausmann at webkit.org,
ariya.hidayat at trolltech.com,
kenneth.christiansen at openbossa.org
[Background]
Instead of the default architecture flow commonly used when embedding through
by QtWebKit API (QWebView -> QWebPage -> QWebFrame), one has the following:
CustomWidget -> QWebPage -> QWebFrame (e.g. DUI's QFxWebView [1] or plasma's
WebView [2])
[1]
http://qt.gitorious.org/+qt-kinetic-developers/qt/kinetic/blobs/kinetic-declarativeui-gv/src/declarative/fx/qfxwebview.h
[2]
http://api.kde.org/4.x-api/kdelibs-apidocs/plasma/html/classPlasma_1_1WebView.html
[Bug description]
currently it is very hacky the way cursors are set to the QApplication. The
flow is +- :
1) an outer embedding widget (for example qwebview or any other custom web
widget) receives mouse events (like the 'mousemove' event)
2) mousemove event is sent to qwebpage (see QWebPage::event and then to
QWebPagePrivate::mouseMoveEvent) and then to WebCore.
3) When there is a cursor change, WidgetQt::setCursor method is called (see
quotation below).
#include "qwebframe_p.h" // <-- that includes qwebpage_p.h
(...)
void Widget::setCursor(const Cursor& cursor)
{
#ifndef QT_NO_CURSOR
QWidget* widget = root()->hostWindow()->platformWindow();
(...)
QCoreApplication::postEvent(widget, new SetCursorEvent(cursor.impl()));
#endif
(...)
}
4) 3_ sends an custom event back to QWebView and from within QWebView::event()
method, we have:
void QWebView::event() {
(...)
#ifndef QT_NO_CURSOR
} else if (e->type() ==
static_cast<QEvent::Type>(WebCore::SetCursorEvent::EventType)) {
d->setCursor(static_cast<WebCore::SetCursorEvent*>(e)->cursor());
#if QT_VERSION >= 0x040400
(...)
whereas a static_cast to a not exposed class happens. pontentially wrong
things:
* in WidgetQt::setCursor method we have
...
QWidget* widget = root()->hostWindow()->platformWindow();
if (!widget)
return;
...
here, it is mandatory that platformWindow() returns a QWidget, which can be
problematic for non-QWidget subclasses (e.g. QGraphicsWidget subclass objects).
...
QCoreApplication::postEvent(widget, new SetCursorEvent(cursor.impl()));
...
SetCursorEvent is defined in a private header, so this class wont be available
together with other API headers. In QWebView it is not a problem, since it
includes this private header, but it can be a problem on other situations,
including DUI and plasma's qgraphicswidget approaches.
this API needs some better implementation, imho
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list