Changeset 72202 in webkit
- Timestamp:
- Nov 17, 2010 5:50:16 AM (13 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r72193 r72202 1 2010-11-17 Benjamin Poulain <benjamin.poulain@nokia.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 [Qt] [WK2] The focus switching does not seems to work with QGraphicsWKView 6 https://bugs.webkit.org/show_bug.cgi?id=49545 7 8 Implement focus switching with Tab. This is now done asynchronously, 9 waiting for webkit to call takeFocus() and switching the widget. 10 11 Since the focus can change between the Tab press and the callback, 12 QGraphicsWKView::focusNextPrevChildCallback() make sure the view still has 13 focus before passing it to the next widget. 14 15 * UIProcess/API/qt/qgraphicswkview.cpp: 16 (QGraphicsWKView::QGraphicsWKView): 17 (QGraphicsWKView::focusNextPrevChildCallback): 18 (QGraphicsWKView::focusNextPrevChild): 19 * UIProcess/API/qt/qgraphicswkview.h: 20 * UIProcess/API/qt/qwkpage.cpp: 21 (QWKPagePrivate::takeFocus): 22 * UIProcess/API/qt/qwkpage.h: 23 * UIProcess/API/qt/qwkpage_p.h: 24 1 25 2010-11-17 Andreas Kling <kling@webkit.org> 2 26 -
trunk/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp
r72016 r72202 89 89 connect(d->page, SIGNAL(urlChanged(const QUrl&)), this, SIGNAL(urlChanged(const QUrl&))); 90 90 connect(d->page, SIGNAL(cursorChanged(const QCursor&)), this, SLOT(updateCursor(const QCursor&))); 91 connect(d->page, SIGNAL(focusNextPrevChild(bool)), this, SLOT(focusNextPrevChildCallback(bool))); 91 92 } 92 93 … … 167 168 { 168 169 setCursor(cursor); 170 } 171 172 class FriendlyWidget : public QWidget 173 { 174 public: 175 bool focusNextPrevChild(bool next); 176 }; 177 178 void QGraphicsWKView::focusNextPrevChildCallback(bool next) 179 { 180 if (hasFocus()) { 181 // find the view which has the focus: 182 QList<QGraphicsView*> views = scene()->views(); 183 const int viewCount = views.count(); 184 QGraphicsView* focusedView = 0; 185 for (int i = 0; i < viewCount; ++i) { 186 if (views[i]->hasFocus()) { 187 focusedView = views[i]; 188 break; 189 } 190 } 191 192 if (focusedView) { 193 QWidget* window = focusedView->window(); 194 FriendlyWidget* friendlyWindow = static_cast<FriendlyWidget*>(window); 195 friendlyWindow->focusNextPrevChild(next); 196 } 197 } 198 } 199 200 /*! \reimp 201 */ 202 bool QGraphicsWKView::focusNextPrevChild(bool next) 203 { 204 QKeyEvent ev(QEvent::KeyPress, Qt::Key_Tab, Qt::KeyboardModifiers(next ? Qt::NoModifier : Qt::ShiftModifier)); 205 page()->d->keyPressEvent(&ev); 206 return true; 169 207 } 170 208 -
trunk/WebKit2/UIProcess/API/qt/qgraphicswkview.h
r72016 r72202 82 82 83 83 Q_SLOT void updateCursor(const QCursor&); 84 Q_SLOT void focusNextPrevChildCallback(bool next); 84 85 86 virtual bool focusNextPrevChild(bool next); 85 87 virtual void focusInEvent(QFocusEvent*); 86 88 virtual void focusOutEvent(QFocusEvent*); -
trunk/WebKit2/UIProcess/API/qt/qwkpage.cpp
r72100 r72202 97 97 viewportArguments = args; 98 98 emit q->viewportChangeRequested(); 99 } 100 101 void QWKPagePrivate::takeFocus(bool direction) 102 { 103 emit q->focusNextPrevChild(direction); 99 104 } 100 105 -
trunk/WebKit2/UIProcess/API/qt/qwkpage.h
r72100 r72202 119 119 Q_SIGNAL void windowCloseRequested(); 120 120 Q_SIGNAL void zoomableAreaFound(const QRect&); 121 Q_SIGNAL void focusNextPrevChild(bool); 121 122 122 123 protected: -
trunk/WebKit2/UIProcess/API/qt/qwkpage_p.h
r72100 r72202 56 56 virtual void setCursor(const WebCore::Cursor&); 57 57 virtual void setViewportArguments(const WebCore::ViewportArguments&); 58 virtual void takeFocus(bool direction) { }58 virtual void takeFocus(bool direction); 59 59 virtual void toolTipChanged(const WTF::String&, const WTF::String&); 60 60 virtual void registerEditCommand(PassRefPtr<WebKit::WebEditCommandProxy>, WebKit::WebPageProxy::UndoOrRedo);
Note: See TracChangeset
for help on using the changeset viewer.