Changeset 72653 in webkit


Ignore:
Timestamp:
Nov 24, 2010 2:24:02 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-11-24 Sheriff Bot <webkit.review.bot@gmail.com>

Unreviewed, rolling out r72650.
http://trac.webkit.org/changeset/72650
https://bugs.webkit.org/show_bug.cgi?id=50010

breaks focus in scenes focus item other than graphicswebiview
(Requested by tronical_ on #webkit).

  • Api/qgraphicswebview.cpp: (QGraphicsWebViewPrivate::QGraphicsWebViewPrivate): (QGraphicsWebView::QGraphicsWebView): (QGraphicsWebView::itemChange):
  • Api/qgraphicswebview.h:
  • tests/qgraphicswebview/tst_qgraphicswebview.cpp:
Location:
trunk/WebKit/qt
Files:
4 edited

Legend:

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

    r72650 r72653  
    5454        : q(parent)
    5555        , page(0)
    56         , resizesToContents(false)
    57         , currentScene(0) {}
     56        , resizesToContents(false) {}
    5857
    5958    virtual ~QGraphicsWebViewPrivate();
     
    7776    QWebPage* page;
    7877    bool resizesToContents;
    79     QGraphicsScene* currentScene;
    8078
    8179    QGraphicsItemOverlay* overlay() const
     
    255253    QObject::connect(this, SIGNAL(scaleChanged()), this, SLOT(_q_scaleChanged()));
    256254#endif
    257 
    258     if (scene()) {
    259         d->currentScene = scene();
    260         d->currentScene->installEventFilter(this);
    261     }
    262255}
    263256
     
    312305    page()->mainFrame()->render(painter, QWebFrame::AllLayers, option->exposedRect.toRect());
    313306#endif
    314 }
    315 
    316 /*! \reimp
    317 */
    318 bool QGraphicsWebView::eventFilter(QObject* object, QEvent* event)
    319 {
    320     if (object == d->currentScene
    321         && (event->type() == QEvent::FocusIn
    322             || event->type() == QEvent::FocusOut)) {
    323         QFocusEvent* focusEvent = static_cast<QFocusEvent*>(event);
    324         if (focusEvent->reason() == Qt::ActiveWindowFocusReason)
    325             d->page->event(event);
    326     }
    327     return false;
    328307}
    329308
     
    363342            QApplication::sendEvent(this, &event);
    364343            return value;
    365         }
    366     case ItemSceneHasChanged: {
    367             QGraphicsScene* newScene = qVariantValue<QGraphicsScene*>(value);
    368             if (d->currentScene)
    369                 d->currentScene->removeEventFilter(this);
    370             d->currentScene = newScene;
    371             if (d->currentScene)
    372                 d->currentScene->installEventFilter(this);
    373344        }
    374345    default:
  • trunk/WebKit/qt/Api/qgraphicswebview.h

    r72650 r72653  
    141141    virtual bool sceneEvent(QEvent*);
    142142
    143     virtual bool eventFilter(QObject*, QEvent*);
    144 
    145143private:
    146144    Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success))
  • trunk/WebKit/qt/ChangeLog

    r72650 r72653  
     12010-11-24  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r72650.
     4        http://trac.webkit.org/changeset/72650
     5        https://bugs.webkit.org/show_bug.cgi?id=50010
     6
     7        breaks focus in scenes focus item other than graphicswebiview
     8        (Requested by tronical_ on #webkit).
     9
     10        * Api/qgraphicswebview.cpp:
     11        (QGraphicsWebViewPrivate::QGraphicsWebViewPrivate):
     12        (QGraphicsWebView::QGraphicsWebView):
     13        (QGraphicsWebView::itemChange):
     14        * Api/qgraphicswebview.h:
     15        * tests/qgraphicswebview/tst_qgraphicswebview.cpp:
     16
    1172010-11-24  Jan Erik Hanssen  <jhanssen@sencha.com>
    218
  • trunk/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp

    r72650 r72653  
    3737    void crashOnSetScaleBeforeSetUrl();
    3838    void widgetsRenderingThroughCache();
    39     void receivesFocusInOnShow();
    4039};
    4140
     
    261260}
    262261
    263 class FocusPage : public QWebPage {
    264 public:
    265     FocusPage(QObject* parent = 0);
    266 
    267     bool gotFocus() const;
    268 
    269 protected:
    270     bool event(QEvent* e);
    271 
    272 private:
    273     bool m_focus;
    274 };
    275 
    276 FocusPage::FocusPage(QObject *parent)
    277     : QWebPage(parent), m_focus(false)
    278 {
    279 }
    280 
    281 bool FocusPage::event(QEvent *e)
    282 {
    283     if (e->type() == QEvent::FocusIn)
    284         m_focus = true;
    285     return QWebPage::event(e);
    286 }
    287 
    288 bool FocusPage::gotFocus() const
    289 {
    290     return m_focus;
    291 }
    292 
    293 void tst_QGraphicsWebView::receivesFocusInOnShow()
    294 {
    295     QGraphicsWebView webView;
    296     webView.setHtml("<body><input type=text autofocus=autofocus></input></body>");
    297     FocusPage page;
    298     webView.setPage(&page);
    299 
    300     for (int i = 0; i < 3; ++i) {
    301         QGraphicsView view;
    302         QGraphicsScene* scene = new QGraphicsScene(&view);
    303         view.setScene(scene);
    304         scene->addItem(&webView);
    305         view.setGeometry(QRect(0, 0, 500, 500));
    306 
    307         view.show();
    308         QTest::qWaitForWindowShown(&view);
    309 
    310         QVERIFY(page.gotFocus());
    311 
    312         scene->removeItem(&webView);
    313     }
    314 }
    315262
    316263
Note: See TracChangeset for help on using the changeset viewer.