Changeset 96105 in webkit
- Timestamp:
- Sep 27, 2011 7:09:00 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r96101 r96105 1 2011-09-26 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> 2 3 [Qt][WK2] Add support for hover API in Qt WebKit2 4 https://bugs.webkit.org/show_bug.cgi?id=68369 5 6 Reviewed by Andreas Kling. 7 8 Based on the patch from Igor Oliveira in the same bug. 9 10 Expose a linkHovered() signal in QDesktopWebView, that passes the QUrl and the 11 QString corresponding to the link title. I left textContent out because was 12 unsure of its use case. 13 14 In QDesktopWebView we store the last URL and title emitted to make sure we send 15 the signal only if either value changes. Tests were added to the QML element to 16 check: if values are correctly emitted and if we don't emit more signals than 17 necessary. 18 19 * UIProcess/API/qt/qdesktopwebview.cpp: 20 (QDesktopWebViewPrivate::didMouseMoveOverElement): 21 * UIProcess/API/qt/qdesktopwebview.h: 22 * UIProcess/API/qt/qdesktopwebview_p.h: 23 * UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_linkHovered.qml: Added. 24 * UIProcess/API/qt/tests/qmltests/common/test2.html: 25 * UIProcess/API/qt/tests/qmltests/qmltests.pro: 26 * UIProcess/qt/ClientImpl.cpp: 27 (qt_wk_mouseDidMoveOverElement): 28 * UIProcess/qt/ClientImpl.h: 29 * UIProcess/qt/QtWebPageProxy.cpp: 30 (QtWebPageProxy::init): 31 * UIProcess/qt/TouchViewInterface.h: 32 (WebKit::TouchViewInterface::didMouseMoveOverElement): 33 * UIProcess/qt/ViewInterface.h: 34 1 35 2011-09-27 Alexis Menard <alexis.menard@openbossa.org> 2 36 -
trunk/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.cpp
r95901 r96105 432 432 } 433 433 434 void QDesktopWebViewPrivate::didMouseMoveOverElement(const QUrl& linkURL, const QString& linkTitle) 435 { 436 if (linkURL == lastHoveredURL && linkTitle == lastHoveredTitle) 437 return; 438 lastHoveredURL = linkURL; 439 lastHoveredTitle = linkTitle; 440 emit q->linkHovered(lastHoveredURL, lastHoveredTitle); 441 } 442 434 443 static PolicyInterface::PolicyAction toPolicyAction(QDesktopWebView::NavigationPolicy policy) 435 444 { -
trunk/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.h
r96101 r96105 89 89 void loadProgressChanged(int progress); 90 90 void urlChanged(const QUrl& url); 91 void linkHovered(const QUrl& url, const QString& title); 91 92 92 93 protected: -
trunk/Source/WebKit2/UIProcess/API/qt/qdesktopwebview_p.h
r95901 r96105 85 85 virtual void chooseFiles(WKOpenPanelResultListenerRef, const QStringList& selectedFileNames, ViewInterface::FileChooserType); 86 86 87 virtual void didMouseMoveOverElement(const QUrl&, const QString&); 88 87 89 // PolicyInterface. 88 90 virtual PolicyInterface::PolicyAction navigationPolicyForURL(const QUrl&, Qt::MouseButton, Qt::KeyboardModifiers); … … 92 94 QFileDialog* fileDialog; 93 95 WKOpenPanelResultListenerRef openPanelResultListener; 96 97 QUrl lastHoveredURL; 98 QString lastHoveredTitle; 94 99 }; 95 100 -
trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test2.html
r93427 r96105 2 2 <head><title>Test page with huge link area</title></head> 3 3 <body> 4 <a href="test1.html"><img width=200 height=200></a>4 <a title="A title" href="test1.html"><img width=200 height=200></a> 5 5 </body> 6 6 </html> -
trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro
r95773 r96105 14 14 DesktopWebView/tst_loadProgress.qml \ 15 15 DesktopWebView/tst_loadProgressSignal.qml \ 16 DesktopWebView/tst_linkHovered.qml \ 16 17 TouchWebView/tst_properties.qml \ 17 18 TouchWebView/tst_load.qml \ -
trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp
r95901 r96105 33 33 #include <WKFrame.h> 34 34 #include <WKFramePolicyListener.h> 35 #include <WKHitTestResult.h> 35 36 #include <WKOpenPanelParameters.h> 36 37 #include <WKOpenPanelResultListener.h> … … 162 163 ViewInterface::FileChooserType allowMultipleFiles = WKOpenPanelParametersGetAllowsMultipleFiles(parameters) ? ViewInterface::MultipleFilesSelection : ViewInterface::SingleFileSelection; 163 164 toViewInterface(clientInfo)->chooseFiles(listener, selectedFileNames, allowMultipleFiles); 165 } 166 167 void qt_wk_mouseDidMoveOverElement(WKPageRef page, WKHitTestResultRef hitTestResult, WKEventModifiers modifiers, WKTypeRef userData, const void* clientInfo) 168 { 169 const QUrl absoluteLinkUrl = WKURLCopyQUrl(WKHitTestResultCopyAbsoluteLinkURL(hitTestResult)); 170 const QString linkTitle = WKStringCopyQString(WKHitTestResultCopyLinkTitle(hitTestResult)); 171 toViewInterface(clientInfo)->didMouseMoveOverElement(absoluteLinkUrl, linkTitle); 164 172 } 165 173 -
trunk/Source/WebKit2/UIProcess/qt/ClientImpl.h
r95901 r96105 42 42 void qt_wk_setStatusText(WKPageRef page, WKStringRef text, const void *clientInfo); 43 43 void qt_wk_runOpenPanel(WKPageRef, WKFrameRef, WKOpenPanelParametersRef, WKOpenPanelResultListenerRef, const void* clientInfo); 44 void qt_wk_mouseDidMoveOverElement(WKPageRef, WKHitTestResultRef, WKEventModifiers, WKTypeRef, const void* clientInfo); 44 45 45 46 // Policy client. -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp
r95901 r96105 144 144 uiClient.setStatusText = qt_wk_setStatusText; 145 145 uiClient.runOpenPanel = qt_wk_runOpenPanel; 146 uiClient.mouseDidMoveOverElement = qt_wk_mouseDidMoveOverElement; 146 147 WKPageSetPageUIClient(toAPI(m_webPageProxy.get()), &uiClient); 147 148 -
trunk/Source/WebKit2/UIProcess/qt/TouchViewInterface.h
r95901 r96105 80 80 virtual void chooseFiles(WKOpenPanelResultListenerRef, const QStringList&, FileChooserType) { } 81 81 82 virtual void didMouseMoveOverElement(const QUrl&, const QString&) { } 83 82 84 private: 83 85 QTouchWebView* const m_viewportView; -
trunk/Source/WebKit2/UIProcess/qt/ViewInterface.h
r95901 r96105 89 89 90 90 virtual void chooseFiles(WKOpenPanelResultListenerRef, const QStringList& selectedFileNames, FileChooserType) = 0; 91 92 virtual void didMouseMoveOverElement(const QUrl&, const QString&) = 0; 91 93 }; 92 94 -
trunk/Tools/ChangeLog
r96074 r96105 1 2011-09-26 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> 2 3 [Qt][WK2] Add support for hover API in Qt WebKit2 4 https://bugs.webkit.org/show_bug.cgi?id=68369 5 6 Reviewed by Andreas Kling. 7 8 Change the statusbar to show the link URL when hovering links in 9 MiniBrowser using QDesktopWebView. 10 11 * MiniBrowser/qt/BrowserWindow.cpp: 12 (BrowserWindow::BrowserWindow): 13 (BrowserWindow::onLinkHovered): 14 * MiniBrowser/qt/BrowserWindow.h: 15 1 16 2011-09-26 Dimitri Glazkov <dglazkov@chromium.org> 2 17 -
trunk/Tools/MiniBrowser/qt/BrowserWindow.cpp
r92276 r96105 65 65 connect(webView(), SIGNAL(urlChanged(QUrl)), this, SLOT(printURL(QUrl))); 66 66 67 if (QDesktopWebView* const desktopWebView = m_browser->desktopWebView()) 67 if (QDesktopWebView* const desktopWebView = m_browser->desktopWebView()) { 68 68 connect(desktopWebView, SIGNAL(statusBarMessageChanged(QString)), statusBar(), SLOT(showMessage(QString))); 69 connect(desktopWebView, SIGNAL(linkHovered(QUrl, QString)), this, SLOT(onLinkHovered(QUrl, QString))); 70 } 69 71 70 72 this->setCentralWidget(m_browser); … … 288 290 } 289 291 292 void BrowserWindow::onLinkHovered(const QUrl& url, const QString&) 293 { 294 statusBar()->showMessage(url.toString()); 295 } 296 290 297 void BrowserWindow::updateUserAgentList() 291 298 { -
trunk/Tools/MiniBrowser/qt/BrowserWindow.h
r92276 r96105 70 70 71 71 void printURL(const QUrl&); 72 void onLinkHovered(const QUrl&, const QString&); 72 73 73 74 private:
Note: See TracChangeset
for help on using the changeset viewer.