Changeset 72653 in webkit
- Timestamp:
- Nov 24, 2010 2:24:02 AM (13 years ago)
- Location:
- trunk/WebKit/qt
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/qt/Api/qgraphicswebview.cpp
r72650 r72653 54 54 : q(parent) 55 55 , page(0) 56 , resizesToContents(false) 57 , currentScene(0) {} 56 , resizesToContents(false) {} 58 57 59 58 virtual ~QGraphicsWebViewPrivate(); … … 77 76 QWebPage* page; 78 77 bool resizesToContents; 79 QGraphicsScene* currentScene;80 78 81 79 QGraphicsItemOverlay* overlay() const … … 255 253 QObject::connect(this, SIGNAL(scaleChanged()), this, SLOT(_q_scaleChanged())); 256 254 #endif 257 258 if (scene()) {259 d->currentScene = scene();260 d->currentScene->installEventFilter(this);261 }262 255 } 263 256 … … 312 305 page()->mainFrame()->render(painter, QWebFrame::AllLayers, option->exposedRect.toRect()); 313 306 #endif 314 }315 316 /*! \reimp317 */318 bool QGraphicsWebView::eventFilter(QObject* object, QEvent* event)319 {320 if (object == d->currentScene321 && (event->type() == QEvent::FocusIn322 || 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;328 307 } 329 308 … … 363 342 QApplication::sendEvent(this, &event); 364 343 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);373 344 } 374 345 default: -
trunk/WebKit/qt/Api/qgraphicswebview.h
r72650 r72653 141 141 virtual bool sceneEvent(QEvent*); 142 142 143 virtual bool eventFilter(QObject*, QEvent*);144 145 143 private: 146 144 Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success)) -
trunk/WebKit/qt/ChangeLog
r72650 r72653 1 2010-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 1 17 2010-11-24 Jan Erik Hanssen <jhanssen@sencha.com> 2 18 -
trunk/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
r72650 r72653 37 37 void crashOnSetScaleBeforeSetUrl(); 38 38 void widgetsRenderingThroughCache(); 39 void receivesFocusInOnShow();40 39 }; 41 40 … … 261 260 } 262 261 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() const289 {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 }315 262 316 263
Note: See TracChangeset
for help on using the changeset viewer.