diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2016-12-26 00:24:34 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-02-02 12:31:19 +0000 |
commit | b9e202b0f12f275d4aade98943df92bf67684f52 (patch) | |
tree | 4471f3da5f573679c3f42b0ad54c46bdd0a50910 /Tools | |
parent | 1c8f056531c65706b85c44c2db657ea891be868d (diff) |
Imported WebKit commit 12fbea815480c3b3fad139cd8dfb82e8c954bc9a
Change-Id: Iccbb1e8bd8b7f72322614224c203fc509a8dbb79
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Tools')
26 files changed, 186 insertions, 89 deletions
diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index b730df61c..e9c39f9b2 100755..100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -109,18 +109,18 @@ void NetworkAccessManager::sslErrorsEncountered(QNetworkReply* reply, const QLis #if !defined(QT_NO_PRINTER) && HAVE(QTPRINTSUPPORT) -class NullPrinter : public QPrinter { +class NullPrinter final : public QPrinter { public: class NullPaintEngine : public QPaintEngine { public: - virtual bool begin(QPaintDevice*) { return true; } - virtual bool end() { return true; } - virtual QPaintEngine::Type type() const { return QPaintEngine::User; } - virtual void drawPixmap(const QRectF& r, const QPixmap& pm, const QRectF& sr) { } - virtual void updateState(const QPaintEngineState& state) { } + bool begin(QPaintDevice*) final { return true; } + bool end() final { return true; } + QPaintEngine::Type type() const final { return QPaintEngine::User; } + void drawPixmap(const QRectF& r, const QPixmap& pm, const QRectF& sr) final { } + void updateState(const QPaintEngineState& state) final { } }; - virtual QPaintEngine* paintEngine() const { return const_cast<NullPaintEngine*>(&m_engine); } + QPaintEngine* paintEngine() const final { return const_cast<NullPaintEngine*>(&m_engine); } NullPaintEngine m_engine; }; @@ -155,6 +155,8 @@ WebPage::WebPage(QObject* parent, DumpRenderTree* drt) connect(this, SIGNAL(featurePermissionRequested(QWebFrame*, QWebPage::Feature)), this, SLOT(requestPermission(QWebFrame*, QWebPage::Feature))); connect(this, SIGNAL(featurePermissionRequestCanceled(QWebFrame*, QWebPage::Feature)), this, SLOT(cancelPermission(QWebFrame*, QWebPage::Feature))); + + connect(this, &QWebPage::fullScreenRequested, this, &WebPage::requestFullScreen); } WebPage::~WebPage() @@ -191,6 +193,7 @@ void WebPage::resetSettings() settings()->resetAttribute(QWebSettings::CSSRegionsEnabled); settings()->resetAttribute(QWebSettings::CSSGridLayoutEnabled); settings()->resetAttribute(QWebSettings::AcceleratedCompositingEnabled); + settings()->resetAttribute(QWebSettings::FullScreenSupportEnabled); m_drt->testRunner()->setCaretBrowsingEnabled(false); m_drt->testRunner()->setAuthorAndUserStylesEnabled(true); @@ -273,6 +276,11 @@ void WebPage::permissionSet(QWebPage::Feature feature) } } +void WebPage::requestFullScreen(QWebFullScreenRequest request) +{ + request.accept(); +} + // FIXME (119591): Make this match other platforms better. static QString urlSuitableForTestResult(const QString& url) { diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h index be1559d33..880f9ca83 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h @@ -67,7 +67,7 @@ class GCController; class WebPage; class NetworkAccessManager; -class DumpRenderTree : public QObject { +class DumpRenderTree final : public QObject { Q_OBJECT public: @@ -173,7 +173,7 @@ private: QString m_redirectErrorFileName; }; -class NetworkAccessManager : public QNetworkAccessManager { +class NetworkAccessManager final : public QNetworkAccessManager { Q_OBJECT public: NetworkAccessManager(QObject* parent); @@ -184,7 +184,7 @@ private Q_SLOTS: #endif }; -class WebPage : public QWebPage { +class WebPage final : public QWebPage { Q_OBJECT public: WebPage(QObject* parent, DumpRenderTree*); @@ -192,30 +192,31 @@ public: QWebInspector* webInspector(); void closeWebInspector(); - QWebPage *createWindow(QWebPage::WebWindowType); + QWebPage *createWindow(QWebPage::WebWindowType) final; - void javaScriptAlert(QWebFrame *frame, const QString& message); - void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID); - bool javaScriptConfirm(QWebFrame *frame, const QString& msg); - bool javaScriptPrompt(QWebFrame *frame, const QString& msg, const QString& defaultValue, QString* result); + void javaScriptAlert(QWebFrame*, const QString& message) final; + void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) final; + bool javaScriptConfirm(QWebFrame*, const QString& msg) final; + bool javaScriptPrompt(QWebFrame*, const QString& msg, const QString& defaultValue, QString* result) final; void resetSettings(); - virtual bool supportsExtension(QWebPage::Extension extension) const; - virtual bool extension(Extension extension, const ExtensionOption *option, ExtensionReturn *output); + bool supportsExtension(QWebPage::Extension) const final; + bool extension(Extension, const ExtensionOption*, ExtensionReturn*) final; - QObject* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&); + QObject* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&) final; void permissionSet(QWebPage::Feature feature); - virtual bool shouldInterruptJavaScript() { return false; } + bool shouldInterruptJavaScript() final { return false; } public Q_SLOTS: - void requestPermission(QWebFrame* frame, QWebPage::Feature feature); - void cancelPermission(QWebFrame* frame, QWebPage::Feature feature); + void requestPermission(QWebFrame*, QWebPage::Feature); + void cancelPermission(QWebFrame*, QWebPage::Feature); + void requestFullScreen(QWebFullScreenRequest); protected: - bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest& request, NavigationType type); + bool acceptNavigationRequest(QWebFrame*, const QNetworkRequest&, NavigationType) final; bool isTextOutputEnabled() { return m_drt->isTextOutputEnabled(); } private Q_SLOTS: @@ -227,7 +228,7 @@ private: DumpRenderTree *m_drt; }; -class WebViewGraphicsBased : public QGraphicsView { +class WebViewGraphicsBased final : public QGraphicsView { Q_OBJECT public: diff --git a/Tools/DumpRenderTree/qt/EventSenderQt.cpp b/Tools/DumpRenderTree/qt/EventSenderQt.cpp index 352f1de98..666a2475e 100644 --- a/Tools/DumpRenderTree/qt/EventSenderQt.cpp +++ b/Tools/DumpRenderTree/qt/EventSenderQt.cpp @@ -291,7 +291,7 @@ void EventSender::keyDown(const QString& string, const QStringList& modifiers, u code = string.unicode()->unicode(); //qDebug() << ">>>>>>>>> keyDown" << code << (char)code; // map special keycodes used by the tests to something that works for Qt/X11 - if (code == '\r') { + if (code == '\r' || code == '\n') { code = Qt::Key_Return; } else if (code == '\t') { code = Qt::Key_Tab; diff --git a/Tools/DumpRenderTree/qt/EventSenderQt.h b/Tools/DumpRenderTree/qt/EventSenderQt.h index 94fb1556f..087d475a7 100644 --- a/Tools/DumpRenderTree/qt/EventSenderQt.h +++ b/Tools/DumpRenderTree/qt/EventSenderQt.h @@ -50,11 +50,11 @@ #include <qwebframe.h> -class EventSender : public QObject { +class EventSender final : public QObject { Q_OBJECT public: EventSender(QWebPage* parent); - virtual bool eventFilter(QObject* watched, QEvent*); + bool eventFilter(QObject* watched, QEvent*) final; void resetClickCount() { m_clickCount = 0; } public Q_SLOTS: @@ -93,7 +93,7 @@ public Q_SLOTS: void beginDragWithFiles(const QStringList& files); protected: - void timerEvent(QTimerEvent*); + void timerEvent(QTimerEvent*) final; private: bool isGraphicsBased() const { return qobject_cast<WebViewGraphicsBased*>(m_page->view()); } diff --git a/Tools/DumpRenderTree/qt/TestRunnerQt.h b/Tools/DumpRenderTree/qt/TestRunnerQt.h index 8f2ef1f45..daf8dddba 100644 --- a/Tools/DumpRenderTree/qt/TestRunnerQt.h +++ b/Tools/DumpRenderTree/qt/TestRunnerQt.h @@ -51,7 +51,7 @@ class QWebFrame; class DumpRenderTreeSupportQt; class DumpRenderTree; -class TestRunnerQt : public QObject { +class TestRunnerQt final : public QObject { Q_OBJECT Q_PROPERTY(int webHistoryItemCount READ webHistoryItemCount) Q_PROPERTY(bool globalFlag READ globalFlag WRITE setGlobalFlag) @@ -72,7 +72,7 @@ public: void setShouldTimeout(bool flag) { m_shouldTimeout = flag; } protected: - void timerEvent(QTimerEvent*); + void timerEvent(QTimerEvent*) final; Q_SIGNALS: void done(); diff --git a/Tools/DumpRenderTree/qt/WorkQueueItemQt.h b/Tools/DumpRenderTree/qt/WorkQueueItemQt.h index f57abb0e2..22a6a1d66 100644 --- a/Tools/DumpRenderTree/qt/WorkQueueItemQt.h +++ b/Tools/DumpRenderTree/qt/WorkQueueItemQt.h @@ -34,7 +34,7 @@ #include <qwebframe.h> #include <qwebpage.h> -class LoadAlternateHTMLStringItem : public WorkQueueItem { +class LoadAlternateHTMLStringItem final : public WorkQueueItem { public: LoadAlternateHTMLStringItem(const JSRetainPtr<JSStringRef>& content, const JSRetainPtr<JSStringRef>& baseURL, const JSRetainPtr<JSStringRef>& failingURL) : m_content(content) @@ -44,7 +44,7 @@ public: } private: - virtual bool invoke() const; + bool invoke() const final; JSRetainPtr<JSStringRef> m_content; JSRetainPtr<JSStringRef> m_baseURL; diff --git a/Tools/DumpRenderTree/qt/testplugin.h b/Tools/DumpRenderTree/qt/testplugin.h index 3d8a28cf3..bda9f582c 100644 --- a/Tools/DumpRenderTree/qt/testplugin.h +++ b/Tools/DumpRenderTree/qt/testplugin.h @@ -28,18 +28,18 @@ #include <qwebpluginfactory.h> -class TestPlugin : public QWebPluginFactory +class TestPlugin final : public QWebPluginFactory { public: explicit TestPlugin(QObject *parent = 0); virtual ~TestPlugin(); - virtual QList<Plugin> plugins() const; + QList<Plugin> plugins() const final; - virtual QObject *create(const QString &mimeType, + QObject *create(const QString &mimeType, const QUrl &url, const QStringList &argumentNames, - const QStringList &argumentValues) const; + const QStringList &argumentValues) const final; }; diff --git a/Tools/QtTestBrowser/cookiejar.h b/Tools/QtTestBrowser/cookiejar.h index da62fb829..701cffc1f 100644 --- a/Tools/QtTestBrowser/cookiejar.h +++ b/Tools/QtTestBrowser/cookiejar.h @@ -33,14 +33,14 @@ #include <QNetworkCookieJar> #include <QTimer> -class TestBrowserCookieJar : public QNetworkCookieJar { +class TestBrowserCookieJar final : public QNetworkCookieJar { Q_OBJECT public: TestBrowserCookieJar(QObject* parent = 0); virtual ~TestBrowserCookieJar(); - virtual bool setCookiesFromUrl(const QList<QNetworkCookie>&, const QUrl&); + bool setCookiesFromUrl(const QList<QNetworkCookie>&, const QUrl&) final; void setDiskStorageEnabled(bool); diff --git a/Tools/QtTestBrowser/fpstimer.h b/Tools/QtTestBrowser/fpstimer.h index 256745aa8..833b3cc74 100644 --- a/Tools/QtTestBrowser/fpstimer.h +++ b/Tools/QtTestBrowser/fpstimer.h @@ -32,7 +32,7 @@ #include <QSet> #include <QTime> -class FpsTimer : public QObject { +class FpsTimer final : public QObject { Q_OBJECT public: @@ -44,7 +44,7 @@ public Q_SLOTS: void stop(); protected Q_SLOTS: - virtual void timerEvent(QTimerEvent*); + void timerEvent(QTimerEvent*) final; private: int m_timer; diff --git a/Tools/QtTestBrowser/launcherwindow.cpp b/Tools/QtTestBrowser/launcherwindow.cpp index 84a4c0873..537eccf64 100644 --- a/Tools/QtTestBrowser/launcherwindow.cpp +++ b/Tools/QtTestBrowser/launcherwindow.cpp @@ -381,6 +381,9 @@ void LauncherWindow::createChrome() toolsMenu->addSeparator(); toolsMenu->addAction("Load URLs from file", this, SLOT(loadURLListFromFile())); + toolsMenu->addSeparator(); + toolsMenu->addAction("Clear memory caches", this, SLOT(clearMemoryCaches())); + // GraphicsView sub menu. QAction* toggleAcceleratedCompositing = graphicsViewMenu->addAction("Toggle Accelerated Compositing", this, SLOT(toggleAcceleratedCompositing(bool))); toggleAcceleratedCompositing->setCheckable(true); @@ -1110,6 +1113,12 @@ void LauncherWindow::fileDownloadFinished() } #endif +void LauncherWindow::clearMemoryCaches() +{ + QWebSettings::clearMemoryCaches(); + qDebug() << "Memory caches were cleared"; +} + void LauncherWindow::updateFPS(int fps) { QString fpsStatusText = QString("Current FPS: %1").arg(fps); diff --git a/Tools/QtTestBrowser/launcherwindow.h b/Tools/QtTestBrowser/launcherwindow.h index 9fd41a445..d4a3b832d 100644 --- a/Tools/QtTestBrowser/launcherwindow.h +++ b/Tools/QtTestBrowser/launcherwindow.h @@ -91,7 +91,7 @@ public: bool startMaximized { false }; }; -class LauncherWindow : public MainWindow { +class LauncherWindow final : public MainWindow { Q_OBJECT public: @@ -100,7 +100,7 @@ public: void sendTouchEvent(); - bool eventFilter(QObject*, QEvent*); + bool eventFilter(QObject*, QEvent*) final; protected Q_SLOTS: void loadStarted(); @@ -170,6 +170,8 @@ protected Q_SLOTS: void fileDownloadFinished(); #endif + void clearMemoryCaches(); + public Q_SLOTS: LauncherWindow* newWindow(); LauncherWindow* cloneWindow(); diff --git a/Tools/QtTestBrowser/locationedit.h b/Tools/QtTestBrowser/locationedit.h index 5750cba36..43b30e38d 100644 --- a/Tools/QtTestBrowser/locationedit.h +++ b/Tools/QtTestBrowser/locationedit.h @@ -36,7 +36,7 @@ #include <QStyleOptionFrame> #include <QTimer> -class LocationEdit : public QLineEdit { +class LocationEdit final : public QLineEdit { Q_OBJECT public: @@ -51,8 +51,8 @@ private Q_SLOTS: void reset(); protected: - virtual void paintEvent(QPaintEvent*); - virtual void resizeEvent(QResizeEvent*); + void paintEvent(QPaintEvent*) final; + void resizeEvent(QResizeEvent*) final; private: void updateInternalGeometry(); diff --git a/Tools/QtTestBrowser/mainwindow.cpp b/Tools/QtTestBrowser/mainwindow.cpp index 68217696b..d342147ac 100644 --- a/Tools/QtTestBrowser/mainwindow.cpp +++ b/Tools/QtTestBrowser/mainwindow.cpp @@ -42,6 +42,7 @@ #ifndef QT_NO_FILEDIALOG #include <QFileDialog> #endif +#include <QMenuBar> MainWindow::MainWindow() : m_page(new WebPage(this)) @@ -118,6 +119,15 @@ void MainWindow::setPage(WebPage* page) buildUI(); } +void MainWindow::setToolBarsVisible(bool visible) +{ + if (menuBar()) + menuBar()->setVisible(visible); + + if (m_toolBar) + m_toolBar->setVisible(visible); +} + WebPage* MainWindow::page() const { return m_page; diff --git a/Tools/QtTestBrowser/mainwindow.h b/Tools/QtTestBrowser/mainwindow.h index 70b3e5e1c..6e978576e 100644 --- a/Tools/QtTestBrowser/mainwindow.h +++ b/Tools/QtTestBrowser/mainwindow.h @@ -55,6 +55,8 @@ public: WebPage* page() const; void setPage(WebPage*); + void setToolBarsVisible(bool); + protected Q_SLOTS: void setAddressUrl(const QString&); void setAddressUrl(const QUrl&); diff --git a/Tools/QtTestBrowser/webinspector.h b/Tools/QtTestBrowser/webinspector.h index c75bbdc2f..72a3a3b48 100644 --- a/Tools/QtTestBrowser/webinspector.h +++ b/Tools/QtTestBrowser/webinspector.h @@ -30,7 +30,7 @@ #include "qwebinspector.h" -class WebInspector : public QWebInspector { +class WebInspector final : public QWebInspector { Q_OBJECT public: @@ -40,12 +40,12 @@ Q_SIGNALS: void visibleChanged(bool nowVisible); protected: - void showEvent(QShowEvent* event) + void showEvent(QShowEvent* event) final { QWebInspector::showEvent(event); emit visibleChanged(true); } - void hideEvent(QHideEvent* event) + void hideEvent(QHideEvent* event) final { QWebInspector::hideEvent(event); emit visibleChanged(false); diff --git a/Tools/QtTestBrowser/webpage.cpp b/Tools/QtTestBrowser/webpage.cpp index 1a3ae3c82..a0efed1d8 100644 --- a/Tools/QtTestBrowser/webpage.cpp +++ b/Tools/QtTestBrowser/webpage.cpp @@ -33,6 +33,7 @@ #include "webpage.h" #include "launcherwindow.h" +#include "mainwindow.h" #include <QAction> #include <QApplication> @@ -47,13 +48,16 @@ #ifndef QT_NO_LINEEDIT #include <QLineEdit> #endif +#include <QMessageBox> #include <QProgressBar> +#include <QWindow> #include <QtNetwork/QNetworkReply> #include <QtNetwork/QNetworkRequest> #include <QtNetwork/QNetworkProxy> -WebPage::WebPage(QObject* parent) +WebPage::WebPage(MainWindow* parent) : QWebPage(parent) + , m_mainWindow(parent) , m_userAgent() , m_interruptingJavaScriptEnabled(false) { @@ -63,6 +67,7 @@ WebPage::WebPage(QObject* parent) this, SLOT(authenticationRequired(QNetworkReply*, QAuthenticator*))); connect(this, SIGNAL(featurePermissionRequested(QWebFrame*, QWebPage::Feature)), this, SLOT(requestPermission(QWebFrame*, QWebPage::Feature))); connect(this, SIGNAL(featurePermissionRequestCanceled(QWebFrame*, QWebPage::Feature)), this, SLOT(featurePermissionRequestCanceled(QWebFrame*, QWebPage::Feature))); + connect(this, &QWebPage::fullScreenRequested, this, &WebPage::requestFullScreen); } void WebPage::applyProxy() @@ -201,6 +206,23 @@ void WebPage::featurePermissionRequestCanceled(QWebFrame*, QWebPage::Feature) { } +void WebPage::requestFullScreen(QWebFullScreenRequest request) +{ + if (request.toggleOn()) { + if (QMessageBox::question(view(), "Enter Full Screen Mode", "Do you want to enter full screen mode?", QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel) == QMessageBox::Ok) { + request.accept(); + m_mainWindow->setToolBarsVisible(false); + m_mainWindow->showFullScreen(); + return; + } + } else { + request.accept(); + m_mainWindow->setToolBarsVisible(true); + m_mainWindow->showNormal(); + return; + } + request.reject(); +} QWebPage* WebPage::createWindow(QWebPage::WebWindowType type) { LauncherWindow* mw = new LauncherWindow; diff --git a/Tools/QtTestBrowser/webpage.h b/Tools/QtTestBrowser/webpage.h index 1a6ef2e38..0238354aa 100644 --- a/Tools/QtTestBrowser/webpage.h +++ b/Tools/QtTestBrowser/webpage.h @@ -36,11 +36,13 @@ #include <qwebframe.h> #include <qwebpage.h> +class MainWindow; + class WebPage : public QWebPage { Q_OBJECT public: - WebPage(QObject* parent = 0); + WebPage(MainWindow* parent); QWebPage* createWindow(QWebPage::WebWindowType) override; QObject* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&) override; @@ -62,9 +64,11 @@ public Q_SLOTS: void authenticationRequired(QNetworkReply*, QAuthenticator*); void requestPermission(QWebFrame*, QWebPage::Feature); void featurePermissionRequestCanceled(QWebFrame*, QWebPage::Feature); + void requestFullScreen(QWebFullScreenRequest); private: void applyProxy(); + MainWindow *m_mainWindow; QString m_userAgent; bool m_interruptingJavaScriptEnabled; }; diff --git a/Tools/QtTestBrowser/webview.h b/Tools/QtTestBrowser/webview.h index a45a972b7..de0b273de 100644 --- a/Tools/QtTestBrowser/webview.h +++ b/Tools/QtTestBrowser/webview.h @@ -45,31 +45,31 @@ QT_BEGIN_NAMESPACE class QStateMachine; QT_END_NAMESPACE -class WebViewTraditional : public QWebView { +class WebViewTraditional final : public QWebView { Q_OBJECT public: WebViewTraditional(QWidget* parent) : QWebView(parent) {} protected: - virtual void contextMenuEvent(QContextMenuEvent*); - virtual void mousePressEvent(QMouseEvent*); + void contextMenuEvent(QContextMenuEvent*) final; + void mousePressEvent(QMouseEvent*) final; }; -class GraphicsWebView : public QGraphicsWebView { +class GraphicsWebView final : public QGraphicsWebView { Q_OBJECT public: GraphicsWebView(QGraphicsItem* parent = 0) : QGraphicsWebView(parent) {}; protected: - virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent*); - virtual void mousePressEvent(QGraphicsSceneMouseEvent*); + void contextMenuEvent(QGraphicsSceneContextMenuEvent*) final; + void mousePressEvent(QGraphicsSceneMouseEvent*) final; }; -class WebViewGraphicsBased : public QGraphicsView { +class WebViewGraphicsBased final : public QGraphicsView { Q_OBJECT Q_PROPERTY(qreal yRotation READ yRotation WRITE setYRotation) @@ -83,8 +83,8 @@ public: void setFrameRateMeasurementEnabled(bool); bool frameRateMeasurementEnabled() const { return m_measureFps; } - virtual void resizeEvent(QResizeEvent*); - virtual void paintEvent(QPaintEvent*); + void resizeEvent(QResizeEvent*) final; + void paintEvent(QPaintEvent*) final; void setResizesToContents(bool); bool resizesToContents() const { return m_resizesToContents; } diff --git a/Tools/Scripts/webkitperl/FeatureList.pm b/Tools/Scripts/webkitperl/FeatureList.pm index 8301d9bc6..c3e03b3cc 100644 --- a/Tools/Scripts/webkitperl/FeatureList.pm +++ b/Tools/Scripts/webkitperl/FeatureList.pm @@ -269,7 +269,7 @@ my @features = ( define => "ENABLE_FTPDIR", default => !isQt(), value => \$ftpDirSupport }, { option => "fullscreen-api", desc => "Toggle Fullscreen API support", - define => "ENABLE_FULLSCREEN_API", default => (isAppleMacWebKit() || isEfl() || isGtk()), value => \$fullscreenAPISupport }, + define => "ENABLE_FULLSCREEN_API", default => (isAppleMacWebKit() || isEfl() || isGtk() || isQt()), value => \$fullscreenAPISupport }, { option => "gamepad", desc => "Toggle Gamepad support", define => "ENABLE_GAMEPAD", default => 0, value => \$gamepadSupport }, diff --git a/Tools/qmake/mkspecs/features/functions.prf b/Tools/qmake/mkspecs/features/functions.prf index daab9b8b5..2dcaa09ca 100644 --- a/Tools/qmake/mkspecs/features/functions.prf +++ b/Tools/qmake/mkspecs/features/functions.prf @@ -3,6 +3,11 @@ EOL = $$escape_expand(\\n) WEBKIT_SUBDIR = $$relative_path($$_PRO_FILE_PWD_, $$ROOT_WEBKIT_DIR) QTBASE_DIR = $$ROOT_WEBKIT_DIR/../qtbase +defineReplace(staticLibPath) { + lib_basename = $${QMAKE_PREFIX_STATICLIB}$${1}$$qtPlatformTargetSuffix() + return($$ROOT_BUILD_DIR/lib/$${lib_basename}.$$QMAKE_EXTENSION_STATICLIB) +} + defineTest(isQtMinimum) { !equals(QT_MAJOR_VERSION, $$1): return(false) count(ARGS, 1, greaterThan) { @@ -59,6 +64,12 @@ defineTest(isPlatformSupported) { } win32 { + CONFIG(debug, debug|release):!contains(QMAKE_HOST.arch, x86_64) { + # debug_and_release is built as release, see Tools/qmake/projects/run_cmake.pro + !debug_and_release { + skipBuild("QtWebKit requires a 64-bit toolchain for debug build") + } + } winrt { skipBuild("WinRT is not supported.") } diff --git a/Tools/qmake/projects/generate_cmake_toolchain_file.pro b/Tools/qmake/projects/generate_cmake_toolchain_file.pro index db26391b0..845372158 100644 --- a/Tools/qmake/projects/generate_cmake_toolchain_file.pro +++ b/Tools/qmake/projects/generate_cmake_toolchain_file.pro @@ -37,9 +37,6 @@ TOOLCHAIN_FILE_VARS += \ "CMAKE_C_COMPILER \"$$QMAKE_CC\"" \ "CMAKE_CXX_COMPILER \"$$QMAKE_CXX\"" -CONANBUILDINFO_PATH = $$ROOT_BUILD_DIR/conanbuildinfo.cmake -exists($$CONANBUILDINFO_PATH): TOOLCHAIN_FILE_VARS += "CONANBUILDINFO_PATH $$CONANBUILDINFO_PATH" - for (var, TOOLCHAIN_FILE_VARS): TOOLCHAIN_FILE_CONTENTS += "set($$var)" TOOLCHAIN_FILE = $$ROOT_BUILD_DIR/qmake_toolchain.cmake diff --git a/Tools/qmake/projects/qtjpeg/qtjpeg.pro b/Tools/qmake/projects/qtjpeg/qtjpeg.pro index 89d3e6113..a0c817a47 100644 --- a/Tools/qmake/projects/qtjpeg/qtjpeg.pro +++ b/Tools/qmake/projects/qtjpeg/qtjpeg.pro @@ -8,16 +8,7 @@ CONFIG += \ exceptions_off rtti_off warn_off \ installed -# Poor man's qt_helper_lib -TEMPLATE = lib -CONFIG += staticlib -CONFIG -= qt - -# In debug_and_release build we need only one copy of library, let it be release -debug_and_release { - CONFIG -= debug_and_release debug - CONFIG += release -} +load(qt_helper_lib) DESTDIR = $$ROOT_BUILD_DIR/lib diff --git a/Tools/qmake/projects/qtpng/qtpng.pro b/Tools/qmake/projects/qtpng/qtpng.pro index 88b6f9672..b6512f012 100644 --- a/Tools/qmake/projects/qtpng/qtpng.pro +++ b/Tools/qmake/projects/qtpng/qtpng.pro @@ -12,16 +12,7 @@ CONFIG += \ exceptions_off rtti_off warn_off \ installed -# Poor man's qt_helper_lib -TEMPLATE = lib -CONFIG += staticlib -CONFIG -= qt - -# In debug_and_release build we need only one copy of library, let it be release -debug_and_release { - CONFIG -= debug_and_release debug - CONFIG += release -} +load(qt_helper_lib) DESTDIR = $$ROOT_BUILD_DIR/lib PNGDIR = $$QTBASE_DIR/src/3rdparty/libpng diff --git a/Tools/qmake/projects/run_cmake.pro b/Tools/qmake/projects/run_cmake.pro index 55e4ccc17..14c248ced 100644 --- a/Tools/qmake/projects/run_cmake.pro +++ b/Tools/qmake/projects/run_cmake.pro @@ -4,6 +4,14 @@ ROOT_QT_BUILD_DIR = $$ROOT_BUILD_DIR/.. TEMPLATE = aux +win32:!contains(QMAKE_HOST.arch, x86_64) { + debug_and_release { + warning("Skipping debug build of QtWebKit because it requires a 64-bit toolchain") + CONFIG -= debug_and_release debug + CONFIG += release + } +} + CONFIG(debug, debug|release) { configuration = Debug } else { @@ -20,22 +28,25 @@ build_pass|!debug_and_release { CMAKE_TOOLCHAIN_FILE=$$toolchain_file \ CMAKE_PREFIX_PATH=\"$$[QT_INSTALL_PREFIX];$$ROOT_QT_BUILD_DIR/qtbase;$$ROOT_QT_BUILD_DIR/qtlocation;$$ROOT_QT_BUILD_DIR/qtsensors\" \ CMAKE_INSTALL_PREFIX=\"$$[QT_INSTALL_PREFIX]\" \ - ENABLE_TEST_SUPPORT=OFF \ USE_LIBHYPHEN=OFF + static: CMAKE_CONFIG += USE_THIN_ARCHIVES=OFF + + static_runtime: CMAKE_CONFIG += USE_STATIC_RUNTIME=ON + QT_FOR_CONFIG += gui-private !qtConfig(system-jpeg):exists($$QTBASE_DIR) { CMAKE_CONFIG += \ QT_BUNDLED_JPEG=1 \ JPEG_INCLUDE_DIR=$$QTBASE_DIR/src/3rdparty/libjpeg \ - JPEG_LIBRARIES=$$ROOT_BUILD_DIR/lib/$${QMAKE_PREFIX_STATICLIB}qtjpeg.$$QMAKE_EXTENSION_STATICLIB + JPEG_LIBRARIES=$$staticLibPath(qtjpeg) } !qtConfig(system-png):qtConfig(png):exists($$QTBASE_DIR) { CMAKE_CONFIG += \ QT_BUNDLED_PNG=1 \ PNG_INCLUDE_DIRS=$$QTBASE_DIR/src/3rdparty/libpng \ - PNG_LIBRARIES=$$ROOT_BUILD_DIR/lib/$${QMAKE_PREFIX_STATICLIB}qtpng.$$QMAKE_EXTENSION_STATICLIB + PNG_LIBRARIES=$$staticLibPath(qtpng) } !qtConfig(system-zlib):exists($$QTBASE_DIR) { @@ -44,6 +55,10 @@ build_pass|!debug_and_release { ZLIB_INCLUDE_DIRS=$$QTBASE_DIR/src/3rdparty/zlib } + exists($$ROOT_BUILD_DIR/conanbuildinfo.cmake):exists($$ROOT_BUILD_DIR/conanfile.txt) { + CMAKE_CONFIG += QT_CONAN_DIR=$$ROOT_BUILD_DIR + } + equals(QMAKE_HOST.os, Windows) { if(equals(MAKEFILE_GENERATOR, MSVC.NET)|equals(MAKEFILE_GENERATOR, MSBUILD)) { cmake_generator = "NMake Makefiles JOM" diff --git a/Tools/qt/convert-prl-libs-to-cmake.pl b/Tools/qt/convert-prl-libs-to-cmake.pl index b5b5289f8..1b304228c 100755 --- a/Tools/qt/convert-prl-libs-to-cmake.pl +++ b/Tools/qt/convert-prl-libs-to-cmake.pl @@ -27,12 +27,32 @@ use File::Basename; use File::Spec; +use Getopt::Long; +use Text::ParseWords; + +use v5.10; + use strict; use warnings; -my ($qt_lib, $component_name, $out_name) = @ARGV; +my $qt_lib; +my $component_name; +my $out_name; +my $compiler; + +processArgs(); + +sub processArgs { + GetOptions ( + "lib=s" => \$qt_lib, + "component=s" => \$component_name, + "out=s" => \$out_name, + "compiler=s" => \$compiler + ) +} -my ($qt_lib_base, $qt_lib_dir) = fileparse($qt_lib, qr{\..*}); +my $qt_lib_base = fileparse($qt_lib, qr{\..*}); +my $qt_lib_dir = dirname($qt_lib); my $prl_name = File::Spec->join($qt_lib_dir, "$qt_lib_base.prl"); my $qmake_prl_libs; @@ -53,7 +73,7 @@ unless($qmake_prl_libs) { exit; } -my $prl_libs = squash_prl_libs (split /\s+/, $qmake_prl_libs); +my $prl_libs = squash_prl_libs(shellwords($qmake_prl_libs)); my $template = <<'END_CMAKE'; get_target_property(_link_libs Qt5::${_component} INTERFACE_LINK_LIBRARIES) @@ -83,13 +103,26 @@ close $out; sub squash_prl_libs { my @libs = @_; my @result; - for (my $i = 0; $i < $#libs; ++$i) { + for (my $i = 0; $i < scalar(@libs); ++$i) { my $lib = $libs[$i]; if ($lib eq '-framework') { $lib = "$libs[$i] $libs[$i + 1]"; ++$i; } $lib =~ s"\$\$\[QT_INSTALL_LIBS\]"$qt_lib_dir"g; + + if (lc($compiler) eq 'msvc') { + # convert backslashes + $lib =~ s"\\"/"g; + + # MSVC doesn't support -L and -l arguments + if ($lib =~ /^-L(.*)$/) { + $lib = "-LIBPATH:$1" + } else { + $lib =~ s/^-l//; + } + } + push @result, $lib; } return join ';', @result; diff --git a/Tools/qt/manifest.txt b/Tools/qt/manifest.txt index 211fc29f4..624fe3ba1 100644 --- a/Tools/qt/manifest.txt +++ b/Tools/qt/manifest.txt @@ -71,6 +71,7 @@ file Source/WebCore/English.lproj/mediaControlsLocalizedStrings.js # Windows-specific code file Source/WTF/wtf/win/GDIObject.h file Source/WebCore/platform/graphics/win/LocalWindowsContext.h +file Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp file Source/WebCore/platform/graphics/win/TransformationMatrixWin.cpp file Source/WebCore/platform/win/BitmapInfo.cpp file Source/WebCore/platform/win/BitmapInfo.h |