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:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72653 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4ee21ffa
......@@ -53,8 +53,7 @@ public:
QGraphicsWebViewPrivate(QGraphicsWebView* parent)
: q(parent)
, page(0)
, resizesToContents(false)
, currentScene(0) {}
, resizesToContents(false) {}
virtual ~QGraphicsWebViewPrivate();
......@@ -76,7 +75,6 @@ public:
QGraphicsWebView* q;
QWebPage* page;
bool resizesToContents;
QGraphicsScene* currentScene;
QGraphicsItemOverlay* overlay() const
{
......@@ -254,11 +252,6 @@ QGraphicsWebView::QGraphicsWebView(QGraphicsItem* parent)
#if ENABLE(TILED_BACKING_STORE)
QObject::connect(this, SIGNAL(scaleChanged()), this, SLOT(_q_scaleChanged()));
#endif
if (scene()) {
d->currentScene = scene();
d->currentScene->installEventFilter(this);
}
}
/*!
......@@ -313,20 +306,6 @@ void QGraphicsWebView::paint(QPainter* painter, const QStyleOptionGraphicsItem*
#endif
}
/*! \reimp
*/
bool QGraphicsWebView::eventFilter(QObject* object, QEvent* event)
{
if (object == d->currentScene
&& (event->type() == QEvent::FocusIn
|| event->type() == QEvent::FocusOut)) {
QFocusEvent* focusEvent = static_cast<QFocusEvent*>(event);
if (focusEvent->reason() == Qt::ActiveWindowFocusReason)
d->page->event(event);
}
return false;
}
/*! \reimp
*/
bool QGraphicsWebView::sceneEvent(QEvent* event)
......@@ -363,14 +342,6 @@ QVariant QGraphicsWebView::itemChange(GraphicsItemChange change, const QVariant&
QApplication::sendEvent(this, &event);
return value;
}
case ItemSceneHasChanged: {
QGraphicsScene* newScene = qVariantValue<QGraphicsScene*>(value);
if (d->currentScene)
d->currentScene->removeEventFilter(this);
d->currentScene = newScene;
if (d->currentScene)
d->currentScene->installEventFilter(this);
}
default:
break;
}
......
......@@ -140,8 +140,6 @@ protected:
virtual bool sceneEvent(QEvent*);
virtual bool eventFilter(QObject*, QEvent*);
private:
Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success))
#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN))
......
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:
2010-11-24 Jan Erik Hanssen <jhanssen@sencha.com>
Reviewed by Kenneth Rohde Christiansen.
......
......@@ -36,7 +36,6 @@ private slots:
void focusInputTypes();
void crashOnSetScaleBeforeSetUrl();
void widgetsRenderingThroughCache();
void receivesFocusInOnShow();
};
void tst_QGraphicsWebView::qgraphicswebview()
......@@ -260,58 +259,6 @@ void tst_QGraphicsWebView::focusInputTypes()
delete view;
}
class FocusPage : public QWebPage {
public:
FocusPage(QObject* parent = 0);
bool gotFocus() const;
protected:
bool event(QEvent* e);
private:
bool m_focus;
};
FocusPage::FocusPage(QObject *parent)
: QWebPage(parent), m_focus(false)
{
}
bool FocusPage::event(QEvent *e)
{
if (e->type() == QEvent::FocusIn)
m_focus = true;
return QWebPage::event(e);
}
bool FocusPage::gotFocus() const
{
return m_focus;
}
void tst_QGraphicsWebView::receivesFocusInOnShow()
{
QGraphicsWebView webView;
webView.setHtml("<body><input type=text autofocus=autofocus></input></body>");
FocusPage page;
webView.setPage(&page);
for (int i = 0; i < 3; ++i) {
QGraphicsView view;
QGraphicsScene* scene = new QGraphicsScene(&view);
view.setScene(scene);
scene->addItem(&webView);
view.setGeometry(QRect(0, 0, 500, 500));
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(page.gotFocus());
scene->removeItem(&webView);
}
}
QTEST_MAIN(tst_QGraphicsWebView)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment