RESOLVED INVALID 31351
[Qt] Remove the resetCursor code in qwebview and qgraphicswebview
https://bugs.webkit.org/show_bug.cgi?id=31351
Summary [Qt] Remove the resetCursor code in qwebview and qgraphicswebview
Antonio Gomes
Reported 2009-11-11 05:45:38 PST
Both qwebview and qgraphicswebview ::event() methods have the same code: (...) #ifndef QT_NO_CURSOR #if QT_VERSION >= 0x040400 if (event->type() == QEvent::CursorChange) { // An unsetCursor will set the cursor to Qt::ArrowCursor. // Thus this cursor change might be a QWidget::unsetCursor() // If this is not the case and it came from WebCore, the // QWebPageClient already has set its cursor internally // to Qt::ArrowCursor, so updating the cursor is always // right, as it falls back to the last cursor set by // WebCore. // FIXME: Add a QEvent::CursorUnset or similar to Qt. if (cursor().shape() == Qt::ArrowCursor) d->resetCursor(); } #endif #endif (...) it is pointless, since cursor implementation has changed w/ qwebpageclient, and make calls to "unsetCursor" to fail. I would propose to remove these code, and unsetCursor starts to work. Not sure if it'd go to 4.6 though.
Attachments
patch 0.1 (4.11 KB, patch)
2009-11-11 05:51 PST, Antonio Gomes
no flags
Antonio Gomes
Comment 1 2009-11-11 05:51:02 PST
Created attachment 42957 [details] patch 0.1 patch removes this unsetCursor call from both ::event methods in qwebview and qgraphicswebview. bug 30557 has auto tests for it.
Antonio Gomes
Comment 2 2009-11-11 06:18:05 PST
follows a more detailed explanation about why the code is wrong. suppose: 0) one is in a qwebview context. 1) mouse moves hover a link and goes to Qt::PointingHandCursor shape. 2) unsetCursor is called. e.g "view.unsetCursor();". 3) cursor changes internally in qwidget::unsetCursor (i.e. it goes to Qt::ArrowCursor shape) , a "CursorChange" event is fired and qwebview::event method fetch the event. 4) since cursor is already in Qt::ArrowCursor shape, it goes in the "IF" statement below: (...) if (event->type() == QEvent::CursorChange) { if (cursor().shape() == Qt::ArrowCursor) d->resetCursor(); } (...) QWebPageClient::resetCursor in its turn will call setCursor(m_lastCursor) and set cursor back to Qt::PointingHandCursor shape. In the end, the initial unsetCursor call is useless (see _2_) since cursor ends up in the same shape, not as Qt::ArrowCursor.
Antonio Gomes
Comment 3 2009-11-11 06:21:02 PST
furthermore, for qgraphicswebview the problem described in comment #2 would not happen just because qgraphicsitem's unsetCursor does not fire a CursorChange event as qwidget's do, and then qgraphicswebview ::event wont be triggered. so the problem is hidden, imho
Antonio Gomes
Comment 4 2009-11-11 06:48:34 PST
after discussing w/ kenneth on IRC about the desired behavior, then it turns that is is not what this bug proposes, then it is INVALID. I will file another bug to track the real problem.
Note You need to log in before you can comment on or make changes to this bug.