From cc648d9ccf96a48f43d8fafa363bb175967e5e97 Mon Sep 17 00:00:00 2001 From: "vestbo@webkit.org" Date: Tue, 27 Sep 2011 15:11:11 +0000 Subject: [PATCH] [Qt] Fix build against Qt5 after refactor of widgets out of QtGUi QWidget and friends now live in the QtWidgets library. We update includes in implementation files and private headers to us the non-module-prefixed path, and leave the lookup for the include path. For public headers we have to ifdef the includes as the user might now have the modules we need in his QT config. Finally, QSGCanvas is no longer a QWidget but a QWindow, so we have to update our code and use windowHandle() for setting the parent relationships. https://bugs.webkit.org/show_bug.cgi?id=68687 Reviewed by Andreas Kling. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96108 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- ChangeLog | 20 +++++++++++ Source/WebCore/ChangeLog | 21 ++++++++++++ Source/WebCore/WebCore.pri | 5 ++- .../platform/graphics/qt/GraphicsLayerQt.cpp | 12 +++---- Source/WebKit.pro | 7 ++++ Source/WebKit/qt/Api/qgraphicswebview.cpp | 15 ++++---- Source/WebKit/qt/Api/qgraphicswebview.h | 7 +++- Source/WebKit/qt/Api/qwebframe.h | 4 +++ Source/WebKit/qt/Api/qwebhistory.h | 6 +++- Source/WebKit/qt/Api/qwebpage.h | 4 +++ Source/WebKit/qt/Api/qwebsettings.h | 4 +++ Source/WebKit/qt/Api/qwebview.h | 5 +++ Source/WebKit/qt/ChangeLog | 34 ++++++++++++++++++ Source/WebKit/qt/QtWebKit.pro | 1 + Source/WebKit/qt/WebCoreSupport/PageClientQt.h | 12 +++---- Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp | 4 +-- Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h | 2 +- .../WebKit/qt/declarative/qdeclarativewebview.cpp | 4 +-- .../WebKit/qt/declarative/qdeclarativewebview_p.h | 3 +- .../WebKit/qt/docs/webkitsnippets/webpage/main.cpp | 5 +-- .../platformplugin/WebNotificationPresenter.h | 8 ++++- Source/WebKit2/ChangeLog | 24 +++++++++++++ .../WebKit2/UIProcess/API/qt/qdesktopwebview.cpp | 39 +++++++++++++-------- Source/WebKit2/UIProcess/API/qt/qdesktopwebview.h | 4 +-- Source/WebKit2/UIProcess/API/qt/tests/tests.pro | 3 +- Source/WebKit2/UIProcess/qt/ViewInterface.h | 2 +- .../UIProcess/qt/WebPopupMenuProxyQtDesktop.cpp | 8 +++-- Tools/ChangeLog | 40 ++++++++++++++++++++++ Tools/DumpRenderTree/qt/DumpRenderTree.pro | 12 +++++-- Tools/DumpRenderTree/qt/ImageDiff.pro | 1 + Tools/MiniBrowser/qt/BrowserView.cpp | 2 +- Tools/MiniBrowser/qt/BrowserView.h | 3 +- Tools/MiniBrowser/qt/BrowserWindow.cpp | 37 +++++++++++++++++--- Tools/MiniBrowser/qt/BrowserWindow.h | 21 +++++++++++- Tools/MiniBrowser/qt/MiniBrowser.pro | 1 + Tools/MiniBrowser/qt/MiniBrowserApplication.h | 12 ++++++- Tools/MiniBrowser/qt/main.cpp | 1 - Tools/QtTestBrowser/QtTestBrowser.pro | 10 +++++- Tools/QtTestBrowser/launcherwindow.cpp | 18 ++++++++++ Tools/QtTestBrowser/launcherwindow.h | 1 - Tools/QtTestBrowser/locationedit.h | 7 +++- Tools/QtTestBrowser/main.cpp | 3 +- Tools/QtTestBrowser/mainwindow.cpp | 8 +++++ Tools/QtTestBrowser/mainwindow.h | 5 ++- Tools/QtTestBrowser/webinspector.h | 1 - Tools/QtTestBrowser/webpage.cpp | 11 +++++- Tools/QtTestBrowser/webview.cpp | 16 ++++++++- Tools/WebKitTestRunner/PlatformWebView.h | 10 +++--- Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp | 36 +++++-------------- 49 files changed, 414 insertions(+), 105 deletions(-) diff --git a/ChangeLog b/ChangeLog index 99b252f..b29fb3d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2011-09-23 Tor Arne Vestbø + + [Qt] Fix build against Qt5 after refactor of widgets out of QtGUi + + QWidget and friends now live in the QtWidgets library. We update + includes in implementation files and private headers to us the + non-module-prefixed path, and leave the lookup for the include + path. For public headers we have to ifdef the includes as the + user might now have the modules we need in his QT config. + + Finally, QSGCanvas is no longer a QWidget but a QWindow, so we + have to update our code and use windowHandle() for setting the + parent relationships. + + https://bugs.webkit.org/show_bug.cgi?id=68687 + + Reviewed by Andreas Kling. + + * Source/WebKit.pro: + 2011-09-27 Carlos Garcia Campos [GTK] Reorganize header files diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 2296683..7f477d7 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,24 @@ +2011-09-23 Tor Arne Vestbø + + [Qt] Fix build against Qt5 after refactor of widgets out of QtGUi + + QWidget and friends now live in the QtWidgets library. We update + includes in implementation files and private headers to us the + non-module-prefixed path, and leave the lookup for the include + path. For public headers we have to ifdef the includes as the + user might now have the modules we need in his QT config. + + Finally, QSGCanvas is no longer a QWidget but a QWindow, so we + have to update our code and use windowHandle() for setting the + parent relationships. + + https://bugs.webkit.org/show_bug.cgi?id=68687 + + Reviewed by Andreas Kling. + + * WebCore.pri: + * platform/graphics/qt/GraphicsLayerQt.cpp: + 2011-09-27 Pavel Feldman Web Inspector: split DOM.attributesUpdated into attributeModified and attributeRemoved. diff --git a/Source/WebCore/WebCore.pri b/Source/WebCore/WebCore.pri index ff978ee..869fead 100644 --- a/Source/WebCore/WebCore.pri +++ b/Source/WebCore/WebCore.pri @@ -332,7 +332,10 @@ unix:!mac:*-g++*:QMAKE_CXXFLAGS += -ffunction-sections -fdata-sections unix:!mac:*-g++*:QMAKE_LFLAGS += -Wl,--gc-sections linux*-g++*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF -unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork +unix|win32-g++* { + QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork + greaterThan(QT_MAJOR_VERSION, 4): QMAKE_PKGCONFIG_REQUIRES += QtWidgets +} unix:!mac:!symbian:CONFIG += link_pkgconfig # Disable C++0x mode in WebCore for those who enabled it in their Qt's mkspec diff --git a/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp index 6765799..3609d85 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp @@ -29,6 +29,12 @@ #include "RefCounted.h" #include "TranslateTransformOperation.h" #include "UnitBezier.h" +#include +#include +#include +#include +#include +#include #include #include #include @@ -36,15 +42,9 @@ #include #include #include -#include -#include -#include -#include -#include #include #include #include -#include #if ENABLE(TILED_BACKING_STORE) #include "TiledBackingStore.h" diff --git a/Source/WebKit.pro b/Source/WebKit.pro index 741d476..169a4ee 100644 --- a/Source/WebKit.pro +++ b/Source/WebKit.pro @@ -17,6 +17,13 @@ webkit2 { exists($$PWD/WebKit2/WebKit2.pro): SUBDIRS += WebKit2/WebKit2.pro } +greaterThan(QT_MAJOR_VERSION, 4) { + isEmpty(QT.widgets.name)|isEmpty(QT.printsupport.name) { + message("Building WebKit against Qt 5.0 requires the QtWidgets and QtPrintSupport modules.") + error("Aborting build.") + } +} + SUBDIRS += WebCore SUBDIRS += WebKit/qt/QtWebKit.pro diff --git a/Source/WebKit/qt/Api/qgraphicswebview.cpp b/Source/WebKit/qt/Api/qgraphicswebview.cpp index 2bd237f..e078ddc 100644 --- a/Source/WebKit/qt/Api/qgraphicswebview.cpp +++ b/Source/WebKit/qt/Api/qgraphicswebview.cpp @@ -34,17 +34,18 @@ #include "GraphicsContext.h" #include "IntRect.h" #include "TiledBackingStore.h" +#include +#include +#include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include #include -#include -#include -#include + #if defined(Q_WS_X11) #include #endif diff --git a/Source/WebKit/qt/Api/qgraphicswebview.h b/Source/WebKit/qt/Api/qgraphicswebview.h index ceb0ad8..29e7ffd 100644 --- a/Source/WebKit/qt/Api/qgraphicswebview.h +++ b/Source/WebKit/qt/Api/qgraphicswebview.h @@ -23,9 +23,14 @@ #include "qwebkitglobal.h" #include "qwebpage.h" #include -#include +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#include +#include +#else #include #include +#endif +#include #include #include diff --git a/Source/WebKit/qt/Api/qwebframe.h b/Source/WebKit/qt/Api/qwebframe.h index 262fe7d..35fce4b 100644 --- a/Source/WebKit/qt/Api/qwebframe.h +++ b/Source/WebKit/qt/Api/qwebframe.h @@ -24,7 +24,11 @@ #include #include #include +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#include +#else #include +#endif #include #include #include "qwebkitglobal.h" diff --git a/Source/WebKit/qt/Api/qwebhistory.h b/Source/WebKit/qt/Api/qwebhistory.h index 3456784..0d59041 100644 --- a/Source/WebKit/qt/Api/qwebhistory.h +++ b/Source/WebKit/qt/Api/qwebhistory.h @@ -22,9 +22,13 @@ #include #include -#include #include #include +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#include +#else +#include +#endif #include "qwebkitglobal.h" diff --git a/Source/WebKit/qt/Api/qwebpage.h b/Source/WebKit/qt/Api/qwebpage.h index 21083d8..fd2fd4b 100644 --- a/Source/WebKit/qt/Api/qwebpage.h +++ b/Source/WebKit/qt/Api/qwebpage.h @@ -26,7 +26,11 @@ #include #include +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#include +#else #include +#endif QT_BEGIN_NAMESPACE class QNetworkProxy; diff --git a/Source/WebKit/qt/Api/qwebsettings.h b/Source/WebKit/qt/Api/qwebsettings.h index 18787d5..40f7f73 100644 --- a/Source/WebKit/qt/Api/qwebsettings.h +++ b/Source/WebKit/qt/Api/qwebsettings.h @@ -24,7 +24,11 @@ #include #include +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#include +#else #include +#endif #include namespace WebCore { diff --git a/Source/WebKit/qt/Api/qwebview.h b/Source/WebKit/qt/Api/qwebview.h index 70ee1fa..07e30d3 100644 --- a/Source/WebKit/qt/Api/qwebview.h +++ b/Source/WebKit/qt/Api/qwebview.h @@ -23,8 +23,13 @@ #include "qwebkitglobal.h" #include "qwebpage.h" +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#include +#include +#else #include #include +#endif #include #include #include diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index 7d9a7a1..c158ae8 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,37 @@ +2011-09-23 Tor Arne Vestbø + + [Qt] Fix build against Qt5 after refactor of widgets out of QtGUi + + QWidget and friends now live in the QtWidgets library. We update + includes in implementation files and private headers to us the + non-module-prefixed path, and leave the lookup for the include + path. For public headers we have to ifdef the includes as the + user might now have the modules we need in his QT config. + + Finally, QSGCanvas is no longer a QWidget but a QWindow, so we + have to update our code and use windowHandle() for setting the + parent relationships. + + https://bugs.webkit.org/show_bug.cgi?id=68687 + + Reviewed by Andreas Kling. + + * Api/qgraphicswebview.cpp: + * Api/qgraphicswebview.h: + * Api/qwebframe.h: + * Api/qwebhistory.h: + * Api/qwebpage.h: + * Api/qwebsettings.h: + * Api/qwebview.h: + * QtWebKit.pro: + * WebCoreSupport/PageClientQt.h: + * WebCoreSupport/QtWebComboBox.cpp: + * WebCoreSupport/QtWebComboBox.h: + * declarative/qdeclarativewebview.cpp: + * declarative/qdeclarativewebview_p.h: + * docs/webkitsnippets/webpage/main.cpp: + * examples/platformplugin/WebNotificationPresenter.h: + 2011-09-24 Adam Barth Always enable ENABLE(OFFLINE_WEB_APPLICATIONS) diff --git a/Source/WebKit/qt/QtWebKit.pro b/Source/WebKit/qt/QtWebKit.pro index 060ad9f..010a599 100644 --- a/Source/WebKit/qt/QtWebKit.pro +++ b/Source/WebKit/qt/QtWebKit.pro @@ -41,6 +41,7 @@ webkit2:prependWebKit2Lib(../../WebKit2) # the generated includes are containing the dependencies. # It used to be in WebCore.pro but now that this is the main pro file it has to be here. QT += network +greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../.. diff --git a/Source/WebKit/qt/WebCoreSupport/PageClientQt.h b/Source/WebKit/qt/WebCoreSupport/PageClientQt.h index d0f717f..c7b1439 100644 --- a/Source/WebKit/qt/WebCoreSupport/PageClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/PageClientQt.h @@ -31,13 +31,13 @@ #include "qwebframe_p.h" #include "qwebpage.h" #include "qwebpage_p.h" +#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include #include diff --git a/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp b/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp index b6347fc..8a06d64 100644 --- a/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp @@ -24,8 +24,8 @@ #ifndef QT_NO_COMBOBOX -#include -#include +#include +#include #include namespace WebCore { diff --git a/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h b/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h index 6cc5f21..bca2e5f 100644 --- a/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h +++ b/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h @@ -23,7 +23,7 @@ #include "Platform.h" -#include +#include #ifndef QT_NO_COMBOBOX diff --git a/Source/WebKit/qt/declarative/qdeclarativewebview.cpp b/Source/WebKit/qt/declarative/qdeclarativewebview.cpp index 22ee579..4bf6e15 100644 --- a/Source/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/Source/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -20,14 +20,14 @@ #include "qdeclarativewebview_p.h" +#include +#include #include #include #include #include #include #include -#include -#include #include #include #include diff --git a/Source/WebKit/qt/declarative/qdeclarativewebview_p.h b/Source/WebKit/qt/declarative/qdeclarativewebview_p.h index 9fcd3ef..83463db 100644 --- a/Source/WebKit/qt/declarative/qdeclarativewebview_p.h +++ b/Source/WebKit/qt/declarative/qdeclarativewebview_p.h @@ -26,11 +26,12 @@ #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) #include +#include #else #include +#include #endif -#include #include #include "qgraphicswebview.h" #include "qwebpage.h" diff --git a/Source/WebKit/qt/docs/webkitsnippets/webpage/main.cpp b/Source/WebKit/qt/docs/webkitsnippets/webpage/main.cpp index 393b16a..491935a 100644 --- a/Source/WebKit/qt/docs/webkitsnippets/webpage/main.cpp +++ b/Source/WebKit/qt/docs/webkitsnippets/webpage/main.cpp @@ -17,9 +17,10 @@ Boston, MA 02110-1301, USA. */ -#include -#include +#include +#include #include +#include //! [0] class Thumbnailer : public QObject diff --git a/Source/WebKit/qt/examples/platformplugin/WebNotificationPresenter.h b/Source/WebKit/qt/examples/platformplugin/WebNotificationPresenter.h index f46e5cb..4b1bb98 100644 --- a/Source/WebKit/qt/examples/platformplugin/WebNotificationPresenter.h +++ b/Source/WebKit/qt/examples/platformplugin/WebNotificationPresenter.h @@ -22,7 +22,13 @@ #define WebNotificationPresenter_h #include "qwebkitplatformplugin.h" -#include + +#include +#include +#include +#include +#include +#include class WebNotificationWidget : public QWidget { diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 6d76463..1f5e7fa 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,27 @@ +2011-09-23 Tor Arne Vestbø + + [Qt] Fix build against Qt5 after refactor of widgets out of QtGUi + + QWidget and friends now live in the QtWidgets library. We update + includes in implementation files and private headers to us the + non-module-prefixed path, and leave the lookup for the include + path. For public headers we have to ifdef the includes as the + user might now have the modules we need in his QT config. + + Finally, QSGCanvas is no longer a QWidget but a QWindow, so we + have to update our code and use windowHandle() for setting the + parent relationships. + + https://bugs.webkit.org/show_bug.cgi?id=68687 + + Reviewed by Andreas Kling. + + * UIProcess/API/qt/qdesktopwebview.cpp: + * UIProcess/API/qt/qdesktopwebview.h: + * UIProcess/API/qt/tests/tests.pro: + * UIProcess/qt/ViewInterface.h: + * UIProcess/qt/WebPopupMenuProxyQtDesktop.cpp: + 2011-09-26 Caio Marcelo de Oliveira Filho [Qt][WK2] Add support for hover API in Qt WebKit2 diff --git a/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.cpp index 380214c..27ed106 100644 --- a/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.cpp @@ -23,6 +23,8 @@ #include "qdesktopwebview_p.h" #include "qweberror.h" +#include +#include #include #include #include @@ -31,9 +33,8 @@ #include #include #include -#include +#include #include -#include #include #include #include @@ -81,16 +82,16 @@ bool QDesktopWebViewPrivate::isVisible() void QDesktopWebViewPrivate::startDrag(Qt::DropActions supportedDropActions, const QImage& dragImage, QMimeData* data, QPoint* clientPosition, QPoint* globalPosition, Qt::DropAction* dropAction) { - QWidget* widget = q->canvas(); - if (!widget) + QWindow* window = q->canvas(); + if (!window) return; - QDrag* drag = new QDrag(widget); + QDrag* drag = new QDrag(window); drag->setPixmap(QPixmap::fromImage(dragImage)); drag->setMimeData(data); *dropAction = drag->exec(supportedDropActions); *globalPosition = QCursor::pos(); - *clientPosition = widget->mapFromGlobal(*globalPosition); + *clientPosition = window->mapFromGlobal(*globalPosition); } void QDesktopWebViewPrivate::didReceiveViewportArguments(const WebCore::ViewportArguments&) @@ -116,7 +117,6 @@ void QDesktopWebViewPrivate::didChangeTitle(const QString& newTitle) void QDesktopWebViewPrivate::didChangeToolTip(const QString& newToolTip) { // FIXME: Add a proper implementation when Qt 5 supports tooltip. - q->canvas()->setToolTip(newToolTip); } void QDesktopWebViewPrivate::didChangeStatusText(const QString& newMessage) @@ -127,7 +127,6 @@ void QDesktopWebViewPrivate::didChangeStatusText(const QString& newMessage) void QDesktopWebViewPrivate::didChangeCursor(const QCursor& newCursor) { // FIXME: add proper cursor handling when Qt 5 supports it. - q->canvas()->setCursor(newCursor); } void QDesktopWebViewPrivate::loadDidBegin() @@ -164,15 +163,18 @@ void QDesktopWebViewPrivate::showContextMenu(QSharedPointer menu) if (menu->isEmpty()) return; - QWidget* widget = q->canvas(); - if (!widget) + QWindow* window = q->canvas(); + if (!window) return; activeMenu = menu; - menu->setParent(widget, menu->windowFlags()); + activeMenu->window()->winId(); // Ensure that the menu has a window + Q_ASSERT(activeMenu->window()->windowHandle()); + activeMenu->window()->windowHandle()->setTransientParent(window); + QPoint menuPositionInScene = q->mapToScene(menu->pos()).toPoint(); - menu->exec(widget->mapToGlobal(menuPositionInScene)); + menu->exec(window->mapToGlobal(menuPositionInScene)); // The last function to get out of exec() clear the local copy. if (activeMenu == menu) activeMenu.clear(); @@ -403,8 +405,17 @@ void QDesktopWebViewPrivate::chooseFiles(WKOpenPanelResultListenerRef listenerRe if (!selectedFileNames.isEmpty()) selectedFileName = selectedFileNames.at(0); - QWidget* widget = q->canvas(); - fileDialog = new QFileDialog(widget, QString(), selectedFileName); + Q_ASSERT(!fileDialog); + + QWindow* window = q->canvas(); + if (!window) + return; + + fileDialog = new QFileDialog(0, QString(), selectedFileName); + fileDialog->window()->winId(); // Ensure that the dialog has a window + Q_ASSERT(fileDialog->window()->windowHandle()); + fileDialog->window()->windowHandle()->setTransientParent(window); + fileDialog->open(this, SLOT(onOpenPanelFilesSelected())); connect(fileDialog, SIGNAL(finished(int)), this, SLOT(onOpenPanelFinished(int))); diff --git a/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.h b/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.h index c1fb59f..2a854a0 100644 --- a/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.h +++ b/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.h @@ -44,7 +44,7 @@ class QWheelEvent; QT_END_NAMESPACE namespace WTR { - class WebView; + class PlatformWebView; } class QWEBKIT_EXPORT QDesktopWebView : public QSGPaintedItem { @@ -120,7 +120,7 @@ private: void init(); - friend class WTR::WebView; + friend class WTR::PlatformWebView; friend class QDesktopWebViewPrivate; QDesktopWebViewPrivate *d; }; diff --git a/Source/WebKit2/UIProcess/API/qt/tests/tests.pro b/Source/WebKit2/UIProcess/API/qt/tests/tests.pro index f229705..04c1d92 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/tests.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/tests.pro @@ -1,2 +1,3 @@ TEMPLATE = subdirs -SUBDIRS = qtouchwebview qdesktopwebview commonviewtests qmltests +SUBDIRS = qtouchwebview qdesktopwebview commonviewtests +lessThan(QT_MAJOR_VERSION, 5): SUBDIRS += qmltests diff --git a/Source/WebKit2/UIProcess/qt/ViewInterface.h b/Source/WebKit2/UIProcess/qt/ViewInterface.h index 47e6919..161d481 100644 --- a/Source/WebKit2/UIProcess/qt/ViewInterface.h +++ b/Source/WebKit2/UIProcess/qt/ViewInterface.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include class QWebError; diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQtDesktop.cpp b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQtDesktop.cpp index dc0f206..a1b5bdd 100644 --- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQtDesktop.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQtDesktop.cpp @@ -30,7 +30,7 @@ #include "WebPopupItem.h" #include #include -#include +#include using namespace WebCore; @@ -44,7 +44,11 @@ WebPopupMenuProxyQtDesktop::WebPopupMenuProxyQtDesktop(WebPopupMenuProxy::Client , m_selectedIndex(-1) { QtWebComboBox* comboBox = m_comboBox.data(); - comboBox->setParent(m_webViewItem->canvas()); + + comboBox->window()->winId(); // Ensure that the combobox has a window + Q_ASSERT(comboBox->window()->windowHandle()); + comboBox->window()->windowHandle()->setTransientParent(m_webViewItem->canvas()); + connect(comboBox, SIGNAL(activated(int)), SLOT(setSelectedIndex(int))); connect(comboBox, SIGNAL(didHide()), SLOT(onPopupMenuHidden()), Qt::QueuedConnection); } diff --git a/Tools/ChangeLog b/Tools/ChangeLog index 5dcc810..165ade6 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,43 @@ +2011-09-23 Tor Arne Vestbø + + [Qt] Fix build against Qt5 after refactor of widgets out of QtGUi + + QWidget and friends now live in the QtWidgets library. We update + includes in implementation files and private headers to us the + non-module-prefixed path, and leave the lookup for the include + path. For public headers we have to ifdef the includes as the + user might now have the modules we need in his QT config. + + Finally, QSGCanvas is no longer a QWidget but a QWindow, so we + have to update our code and use windowHandle() for setting the + parent relationships. + + https://bugs.webkit.org/show_bug.cgi?id=68687 + + Reviewed by Andreas Kling. + + * DumpRenderTree/qt/DumpRenderTree.pro: + * DumpRenderTree/qt/ImageDiff.pro: + * MiniBrowser/qt/BrowserView.cpp: + * MiniBrowser/qt/BrowserView.h: + * MiniBrowser/qt/BrowserWindow.cpp: + * MiniBrowser/qt/BrowserWindow.h: + * MiniBrowser/qt/MiniBrowser.pro: + * MiniBrowser/qt/MiniBrowserApplication.h: + * MiniBrowser/qt/main.cpp: + * QtTestBrowser/QtTestBrowser.pro: + * QtTestBrowser/launcherwindow.cpp: + * QtTestBrowser/launcherwindow.h: + * QtTestBrowser/locationedit.h: + * QtTestBrowser/main.cpp: + * QtTestBrowser/mainwindow.cpp: + * QtTestBrowser/mainwindow.h: + * QtTestBrowser/webinspector.h: + * QtTestBrowser/webpage.cpp: + * QtTestBrowser/webview.cpp: + * WebKitTestRunner/PlatformWebView.h: + * WebKitTestRunner/qt/PlatformWebViewQt.cpp: + 2011-09-26 Caio Marcelo de Oliveira Filho [Qt][WK2] Add support for hover API in Qt WebKit2 diff --git a/Tools/DumpRenderTree/qt/DumpRenderTree.pro b/Tools/DumpRenderTree/qt/DumpRenderTree.pro index e81086a..6eabf76 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTree.pro +++ b/Tools/DumpRenderTree/qt/DumpRenderTree.pro @@ -1,6 +1,13 @@ TARGET = DumpRenderTree CONFIG -= app_bundle -!isEqual(QT_ARCH,sh4): CONFIG += uitools +!isEqual(QT_ARCH,sh4) { + greaterThan(QT_MAJOR_VERSION, 4):isEmpty(QT.uitools.name) { + message("QtUiTools library not found. QWidget plugin loading will be disabled") + DEFINES += QT_NO_UITOOLS + } else { + CONFIG += uitools + } +} BASEDIR = $$PWD/../ isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../.. @@ -20,6 +27,7 @@ unix:!mac:!symbian:!embedded { QT = core gui network testlib macx: QT += xml +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport HEADERS = $$BASEDIR/WorkQueue.h \ DumpRenderTreeQt.h \ @@ -54,4 +62,4 @@ wince*: { DEFINES += USE_SYSTEM_MALLOC=1 DEFINES -= QT_ASCII_CAST_WARNINGS -RESOURCES = DumpRenderTree.qrc \ No newline at end of file +RESOURCES = DumpRenderTree.qrc diff --git a/Tools/DumpRenderTree/qt/ImageDiff.pro b/Tools/DumpRenderTree/qt/ImageDiff.pro index b3d5181..92ade71 100644 --- a/Tools/DumpRenderTree/qt/ImageDiff.pro +++ b/Tools/DumpRenderTree/qt/ImageDiff.pro @@ -7,6 +7,7 @@ INCLUDEPATH += ../../../Source/JavaScriptCore DESTDIR = $$OUTPUT_DIR/bin QT = core gui +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets SOURCES = ImageDiff.cpp diff --git a/Tools/MiniBrowser/qt/BrowserView.cpp b/Tools/MiniBrowser/qt/BrowserView.cpp index 9313ec8..41cefc7 100644 --- a/Tools/MiniBrowser/qt/BrowserView.cpp +++ b/Tools/MiniBrowser/qt/BrowserView.cpp @@ -36,7 +36,7 @@ #include #include -BrowserView::BrowserView(bool useTouchWebView, QWidget* parent) +BrowserView::BrowserView(bool useTouchWebView, QWindow* parent) : QSGCanvas(parent) , m_item(0) { diff --git a/Tools/MiniBrowser/qt/BrowserView.h b/Tools/MiniBrowser/qt/BrowserView.h index d8dd062..5029da4 100644 --- a/Tools/MiniBrowser/qt/BrowserView.h +++ b/Tools/MiniBrowser/qt/BrowserView.h @@ -29,6 +29,7 @@ #ifndef BrowserView_h #define BrowserView_h +#include #include #include @@ -40,7 +41,7 @@ class BrowserView : public QSGCanvas { Q_OBJECT public: - BrowserView(bool useTouchWebView, QWidget* parent = 0); + BrowserView(bool useTouchWebView, QWindow* parent = 0); virtual ~BrowserView(); void load(const QString&); diff --git a/Tools/MiniBrowser/qt/BrowserWindow.cpp b/Tools/MiniBrowser/qt/BrowserWindow.cpp index bf506a7..f2f45ac 100644 --- a/Tools/MiniBrowser/qt/BrowserWindow.cpp +++ b/Tools/MiniBrowser/qt/BrowserWindow.cpp @@ -42,6 +42,36 @@ static QWKPage* newPageFunction(QWKPage* page) } #endif +WindowWrapper::WindowWrapper(QWindow* window, QWidget* widget) + : QWidget(widget) + , m_window(window) +{ + // Throttle resize events a bit + m_resizeTimer.setInterval(16); + m_resizeTimer.setSingleShot(true); + connect(&m_resizeTimer, SIGNAL(timeout()), this, SLOT(doResize())); + m_window->setWindowFlags(Qt::FramelessWindowHint); +} + +void WindowWrapper::showEvent(QShowEvent* event) +{ + QWidget::showEvent(event); + m_window->setParent(window()->windowHandle()); + m_window->show(); +} + +void WindowWrapper::resizeEvent(QResizeEvent* event) +{ + QWidget::resizeEvent(event); + if (!m_resizeTimer.isActive()) + m_resizeTimer.start(); +} + +void WindowWrapper::doResize() +{ + m_window->setGeometry(QRect(mapTo(window(), QPoint(0, 0)), size())); +} + BrowserWindow::BrowserWindow(WindowOptions* options) : m_urlLoader(0) , m_browser(0) @@ -69,8 +99,8 @@ BrowserWindow::BrowserWindow(WindowOptions* options) connect(desktopWebView, SIGNAL(linkHovered(QUrl, QString)), this, SLOT(onLinkHovered(QUrl, QString))); } - this->setCentralWidget(m_browser); - m_browser->setFocus(Qt::OtherFocusReason); + setCentralWidget(new WindowWrapper(m_browser, this)); + centralWidget()->setFocus(Qt::OtherFocusReason); QMenu* fileMenu = menuBar()->addMenu("&File"); fileMenu->addAction("New Window", this, SLOT(newWindow()), QKeySequence::New); @@ -187,7 +217,7 @@ void BrowserWindow::onLoadProgressChanged(int progress) void BrowserWindow::urlChanged(const QUrl& url) { m_addressBar->setText(url.toString()); - m_browser->setFocus(); + m_browser->requestActivateWindow(); m_browser->view()->setFocus(true); } @@ -320,5 +350,4 @@ BrowserWindow::~BrowserWindow() { delete m_urlLoader; delete m_addressBar; - delete m_browser; } diff --git a/Tools/MiniBrowser/qt/BrowserWindow.h b/Tools/MiniBrowser/qt/BrowserWindow.h index d69f513..2a85a00 100644 --- a/Tools/MiniBrowser/qt/BrowserWindow.h +++ b/Tools/MiniBrowser/qt/BrowserWindow.h @@ -33,10 +33,29 @@ #include "MiniBrowserApplication.h" #include -#include +#include class UrlLoader; +class WindowWrapper : public QWidget +{ + Q_OBJECT + +public: + WindowWrapper(QWindow* window, QWidget* widget = 0); + +protected: + void showEvent(QShowEvent* event); + void resizeEvent(QResizeEvent* event); + +private slots: + void doResize(); + +private: + QWindow* m_window; + QTimer m_resizeTimer; +}; + class BrowserWindow : public QMainWindow { Q_OBJECT diff --git a/Tools/MiniBrowser/qt/MiniBrowser.pro b/Tools/MiniBrowser/qt/MiniBrowser.pro index 3981511..c942162 100644 --- a/Tools/MiniBrowser/qt/MiniBrowser.pro +++ b/Tools/MiniBrowser/qt/MiniBrowser.pro @@ -32,6 +32,7 @@ DESTDIR = $$OUTPUT_DIR/bin QT += network declarative macx:QT+=xml +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets linux-* { # From Creator's src/rpath.pri: diff --git a/Tools/MiniBrowser/qt/MiniBrowserApplication.h b/Tools/MiniBrowser/qt/MiniBrowserApplication.h index 5697748..1fddc38 100644 --- a/Tools/MiniBrowser/qt/MiniBrowserApplication.h +++ b/Tools/MiniBrowser/qt/MiniBrowserApplication.h @@ -29,10 +29,20 @@ #ifndef MiniBrowserApplication_h #define MiniBrowserApplication_h +#include +#include #include +#include +#include +#include +#include +#include +#include +#include #include +#include #include -#include +#include struct WindowOptions { WindowOptions() diff --git a/Tools/MiniBrowser/qt/main.cpp b/Tools/MiniBrowser/qt/main.cpp index 2d578d8..e90c4f7 100644 --- a/Tools/MiniBrowser/qt/main.cpp +++ b/Tools/MiniBrowser/qt/main.cpp @@ -32,7 +32,6 @@ #include "UrlLoader.h" #include #include -#include int main(int argc, char** argv) { diff --git a/Tools/QtTestBrowser/QtTestBrowser.pro b/Tools/QtTestBrowser/QtTestBrowser.pro index 68cc8f9..5b8d6a2c 100644 --- a/Tools/QtTestBrowser/QtTestBrowser.pro +++ b/Tools/QtTestBrowser/QtTestBrowser.pro @@ -24,7 +24,14 @@ HEADERS += \ fpstimer.h \ cookiejar.h -!isEqual(QT_ARCH,sh4): CONFIG += uitools +!isEqual(QT_ARCH,sh4) { + greaterThan(QT_MAJOR_VERSION, 4):isEmpty(QT.uitools.name) { + message("QtUiTools library not found. QWidget plugin loading will be disabled") + DEFINES += QT_NO_UITOOLS + } else { + CONFIG += uitools + } +} isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../.. include(../../Source/WebKit.pri) @@ -35,6 +42,7 @@ DESTDIR = $$OUTPUT_DIR/bin QT += network macx:QT+=xml +greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport unix:!mac:!symbian:!embedded { CONFIG += link_pkgconfig diff --git a/Tools/QtTestBrowser/launcherwindow.cpp b/Tools/QtTestBrowser/launcherwindow.cpp index 86f15fe..e1ddc5a 100644 --- a/Tools/QtTestBrowser/launcherwindow.cpp +++ b/Tools/QtTestBrowser/launcherwindow.cpp @@ -36,7 +36,25 @@ #include "cookiejar.h" #include "urlloader.h" +#include +#include +#include #include +#include +#include +#include +#ifndef QT_NO_LINEEDIT +#include +#endif +#ifndef QT_NO_SHORTCUT +#include +#endif +#include +#include +#include +#include +#include +#include #if !defined(QT_NO_FILEDIALOG) && !defined(QT_NO_MESSAGEBOX) #include diff --git a/Tools/QtTestBrowser/launcherwindow.h b/Tools/QtTestBrowser/launcherwindow.h index 9a36fdf..a3255f9 100644 --- a/Tools/QtTestBrowser/launcherwindow.h +++ b/Tools/QtTestBrowser/launcherwindow.h @@ -33,7 +33,6 @@ #ifndef launcherwindow_h #define launcherwindow_h -#include #include #if defined(QT_CONFIGURED_WITH_OPENGL) diff --git a/Tools/QtTestBrowser/locationedit.h b/Tools/QtTestBrowser/locationedit.h index e8afe70..abdd9b8 100644 --- a/Tools/QtTestBrowser/locationedit.h +++ b/Tools/QtTestBrowser/locationedit.h @@ -31,7 +31,12 @@ #include #ifndef QT_NO_INPUTDIALOG -#include +#include +#include +#include +#include +#include +#include class LocationEdit : public QLineEdit { Q_OBJECT diff --git a/Tools/QtTestBrowser/main.cpp b/Tools/QtTestBrowser/main.cpp index fb42799..a9f7d13 100644 --- a/Tools/QtTestBrowser/main.cpp +++ b/Tools/QtTestBrowser/main.cpp @@ -35,13 +35,12 @@ WindowOptions windowOptions; - +#include #include #include #include #include - #if defined(Q_WS_X11) #include #endif diff --git a/Tools/QtTestBrowser/mainwindow.cpp b/Tools/QtTestBrowser/mainwindow.cpp index dcd350d..bc65fbe 100644 --- a/Tools/QtTestBrowser/mainwindow.cpp +++ b/Tools/QtTestBrowser/mainwindow.cpp @@ -35,6 +35,14 @@ #include "locationedit.h" #include "utils.h" +#include +#ifndef QT_NO_INPUTDIALOG +#include +#endif +#ifndef QT_NO_FILEDIALOG +#include +#endif + MainWindow::MainWindow() : m_page(new WebPage(this)) , m_toolBar(0) diff --git a/Tools/QtTestBrowser/mainwindow.h b/Tools/QtTestBrowser/mainwindow.h index f8baebc..a6a1bd2 100644 --- a/Tools/QtTestBrowser/mainwindow.h +++ b/Tools/QtTestBrowser/mainwindow.h @@ -33,9 +33,12 @@ #ifndef mainwindow_h #define mainwindow_h -#include #include "webpage.h" +#include +#include +#include + class LocationEdit; class MainWindow : public QMainWindow { diff --git a/Tools/QtTestBrowser/webinspector.h b/Tools/QtTestBrowser/webinspector.h index 5cc7f8a..c24ecbf 100644 --- a/Tools/QtTestBrowser/webinspector.h +++ b/Tools/QtTestBrowser/webinspector.h @@ -28,7 +28,6 @@ #ifndef webinspector_h #define webinspector_h -#include #include "qwebinspector.h" class WebInspector : public QWebInspector { diff --git a/Tools/QtTestBrowser/webpage.cpp b/Tools/QtTestBrowser/webpage.cpp index 9088ce2..d255d06 100644 --- a/Tools/QtTestBrowser/webpage.cpp +++ b/Tools/QtTestBrowser/webpage.cpp @@ -34,9 +34,18 @@ #include "launcherwindow.h" +#include +#include #include +#ifndef QT_NO_DESKTOPSERVICES #include -#include +#endif +#include +#include +#include +#ifndef QT_NO_LINEEDIT +#include +#endif #include #include #include diff --git a/Tools/QtTestBrowser/webview.cpp b/Tools/QtTestBrowser/webview.cpp index 8e33620..3ea98f9 100644 --- a/Tools/QtTestBrowser/webview.cpp +++ b/Tools/QtTestBrowser/webview.cpp @@ -32,8 +32,22 @@ #include "webview.h" -#include +#include #include +#include +#include +#include +#include +#include + +#ifndef QT_NO_ANIMATION +#include +#include +#include +#include +#include +#include +#endif WebViewGraphicsBased::WebViewGraphicsBased(QWidget* parent) : QGraphicsView(parent) diff --git a/Tools/WebKitTestRunner/PlatformWebView.h b/Tools/WebKitTestRunner/PlatformWebView.h index 6f412c5..5284e87 100644 --- a/Tools/WebKitTestRunner/PlatformWebView.h +++ b/Tools/WebKitTestRunner/PlatformWebView.h @@ -27,12 +27,10 @@ #define PlatformWebView_h #if defined(BUILDING_QT__) -namespace WTR { -class WebView; -} -typedef WTR::WebView* PlatformWKView; -class QMainWindow; -typedef QMainWindow* PlatformWindow; +class QDesktopWebView; +typedef QDesktopWebView* PlatformWKView; +class QSGCanvas; +typedef QSGCanvas* PlatformWindow; #elif defined(__APPLE__) && __APPLE__ #if __OBJC__ @class WKView; diff --git a/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp b/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp index 81ae9d2..f1e0b69 100644 --- a/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp +++ b/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp @@ -28,42 +28,22 @@ #include "PlatformWebView.h" #include "qdesktopwebview.h" + +#include #include -#include namespace WTR { -class WebView : public QSGCanvas { -public: - WebView(WKContextRef, WKPageGroupRef); - - QDesktopWebView* wkView() const { return m_item; } - WKPageRef pageRef() const { return m_item->pageRef(); } - - virtual ~WebView() { delete m_item; } - -private: - QDesktopWebView* m_item; -}; - -WebView::WebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef) - : m_item(new QDesktopWebView(contextRef, pageGroupRef, rootItem())) -{ - m_item->setWidth(800); - m_item->setHeight(600); -} - PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef) - : m_view(new WebView(contextRef, pageGroupRef)) - , m_window(new QMainWindow()) + : m_view(new QDesktopWebView(contextRef, pageGroupRef)) + , m_window(new QSGCanvas) { - m_view->setParent(m_window); - m_window->setCentralWidget(m_view); + m_view->setParent(m_window->rootItem()); m_window->setGeometry(0, 0, 800, 600); QFocusEvent ev(QEvent::WindowActivate); QApplication::sendEvent(m_view, &ev); - m_view->wkView()->setFocus(Qt::OtherFocusReason); + m_view->setFocus(Qt::OtherFocusReason); } PlatformWebView::~PlatformWebView() @@ -104,12 +84,12 @@ void PlatformWebView::setWindowFrame(WKRect wkRect) bool PlatformWebView::sendEvent(QEvent* event) { - return QCoreApplication::sendEvent(m_view->wkView(), event); + return QCoreApplication::sendEvent(m_view, event); } void PlatformWebView::postEvent(QEvent* event) { - QCoreApplication::postEvent(m_view->wkView(), event); + QCoreApplication::postEvent(m_view, event); } } // namespace WTR -- 2.7.4