Changeset 49846 in webkit


Ignore:
Timestamp:
Oct 20, 2009 2:54:29 AM (14 years ago)
Author:
tonikitoo@webkit.org
Message:

[Qt] Infinite loop (leading to crash) when setting cursor in QGraphicsWebView
https://bugs.webkit.org/show_bug.cgi?id=30549

Patch by Antonio Gomes <tonikitoo@webkit.org> on 2009-10-19
Reviewed by Ariya Hidayat.

Patch reimplements QGraphicsItem's itemChange method, and make
CursorChange event to be emitted after cursor has already been
set.

QWidget::setCursor send the event just after it sets the cursor,
then patch makes both behaviors compatible.

  • Api/qgraphicswebview.cpp:

(QGraphicsWebView::itemChange):

  • Api/qgraphicswebview.h:
Location:
trunk/WebKit/qt
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/qt/Api/qgraphicswebview.cpp

    r49782 r49846  
    243243    // Re-implemented in order to allows fixing event-related bugs in patch releases.
    244244    return QGraphicsWidget::sceneEvent(event);
     245}
     246
     247/*! \reimp
     248*/
     249QVariant QGraphicsWebView::itemChange(GraphicsItemChange change, const QVariant& value)
     250{
     251    switch (change) {
     252    // Differently from QWebView, it is interesting to QGraphicsWebView to handle
     253    // post mouse cursor change notifications. Reason: 'ItemCursorChange' is sent
     254    // as the first action in QGraphicsItem::setCursor implementation, and at that
     255    // item widget's cursor has not been effectively changed yet.
     256    // After cursor is properly set (at 'ItemCursorHasChanged' emission time), we
     257    // fire 'CursorChange'.
     258    case ItemCursorChange:
     259        return value;
     260    case ItemCursorHasChanged:
     261        QEvent event(QEvent::CursorChange);
     262        QApplication::sendEvent(this, &event);
     263        return value;
     264    }
     265
     266    return QGraphicsWidget::itemChange(change, value);
    245267}
    246268
  • trunk/WebKit/qt/Api/qgraphicswebview.h

    r49245 r49846  
    8686    virtual void updateGeometry();
    8787    virtual void paint(QPainter*, const QStyleOptionGraphicsItem* options, QWidget* widget = 0);
     88    virtual QVariant itemChange(GraphicsItemChange change, const QVariant& value);
    8889    virtual bool event(QEvent*);
    8990
  • trunk/WebKit/qt/ChangeLog

    r49812 r49846  
     12009-10-19  Antonio Gomes  <tonikitoo@webkit.org>
     2
     3        Reviewed by Ariya Hidayat.
     4
     5        [Qt] Infinite loop (leading to crash) when setting cursor in QGraphicsWebView
     6        https://bugs.webkit.org/show_bug.cgi?id=30549
     7
     8        Patch reimplements QGraphicsItem's itemChange method, and make
     9        CursorChange event to be emitted after cursor has already been
     10        set.
     11
     12        QWidget::setCursor send the event just after it sets the cursor,
     13        then patch makes both behaviors compatible.
     14
     15        * Api/qgraphicswebview.cpp:
     16        (QGraphicsWebView::itemChange):
     17        * Api/qgraphicswebview.h:
     18
    1192009-10-19  Nate Chapin  <japhet@chromium.org>
    220
Note: See TracChangeset for help on using the changeset viewer.