diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2019-08-14 12:56:41 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2019-08-15 21:56:14 +0300 |
commit | 0b3aa2c8d05a54a0837cb5a49fd03aa4a34957f0 (patch) | |
tree | a412e9dd52bba7c601847f056c1bd194c93b3153 | |
parent | 6bdfdd20faa222d902cfd244590bfab8776ee34a (diff) |
Import QtWebKit commit 423e60d5ea622069917a51229a090eae955072dc
Change-Id: I05f8e1d4bcd815cc1c3ccda241aa94e608a8221e
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
-rw-r--r-- | Source/WebCore/PlatformQt.cmake | 1 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp | 4 | ||||
-rw-r--r-- | Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp | 35 | ||||
-rw-r--r-- | Source/WebCore/platform/network/qt/ResourceRequest.h | 13 | ||||
-rw-r--r-- | Source/WebCore/platform/network/qt/ResourceRequestQt.cpp | 23 | ||||
-rw-r--r-- | Source/cmake/OptionsQt.cmake | 3 | ||||
-rwxr-xr-x | Tools/Scripts/build-webkit | 8 | ||||
-rwxr-xr-x | Tools/Scripts/webkitdirs.pm | 7 | ||||
-rwxr-xr-x | Tools/qt/make-snapshot.pl | 2 |
9 files changed, 77 insertions, 19 deletions
diff --git a/Source/WebCore/PlatformQt.cmake b/Source/WebCore/PlatformQt.cmake index cd2e79d5d..99c625dc3 100644 --- a/Source/WebCore/PlatformQt.cmake +++ b/Source/WebCore/PlatformQt.cmake @@ -283,6 +283,7 @@ list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES ${Qt5Gui_INCLUDE_DIRS} ${Qt5Gui_PRIVATE_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} + ${Qt5Network_PRIVATE_INCLUDE_DIRS} ${Qt5Sensors_INCLUDE_DIRS} ${SQLITE_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS} diff --git a/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp b/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp index 2ed4a98c3..8727bccab 100644 --- a/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp +++ b/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp @@ -105,7 +105,9 @@ FontPlatformData::FontPlatformData(const FontDescription& description, const Ato font.setLetterSpacing(QFont::AbsoluteSpacing, letterSpacing); if (!FontCascade::shouldUseSmoothing()) - font.setStyleStrategy(QFont::NoAntialias); + font.setStyleStrategy(static_cast<QFont::StyleStrategy>(QFont::NoAntialias | QFont::ForceOutline)); + else + font.setStyleStrategy(QFont::ForceOutline); m_data->bold = font.bold(); // WebKit allows font size zero but QFont does not. We will return diff --git a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index 48432d974..0da45fbc7 100644 --- a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -41,6 +41,29 @@ #include <QCoreApplication> +#if USE(HTTP2) + +#include <private/http2protocol_p.h> +#include <cstdlib> + +// Redefine private bits which are not currenly exported from QtNetwork + +QT_BEGIN_NAMESPACE + +namespace Http2 { +const char *http2ParametersPropertyName = "QT_HTTP2_PARAMETERS_PROPERTY"; + +ProtocolParameters::ProtocolParameters() +{ + settingsFrameData[Settings::INITIAL_WINDOW_SIZE_ID] = qtDefaultStreamReceiveWindowSize; + settingsFrameData[Settings::ENABLE_PUSH_ID] = 0; +} +} + +QT_END_NAMESPACE + +#endif // USE(HTTP2) + static const int gMaxRedirections = 10; namespace WebCore { @@ -774,6 +797,18 @@ QNetworkReply* QNetworkReplyHandler::sendNetworkRequest(QNetworkAccessManager* m if (!manager) return 0; +#if USE(HTTP2) + static const bool alpnIsSupported = ResourceRequest::alpnIsSupported(); + if (alpnIsSupported && !manager->property(Http2::http2ParametersPropertyName).isValid()) { + Http2::ProtocolParameters params; + // QTBUG-77308 + params.maxSessionReceiveWindowSize = Http2::maxSessionReceiveWindowSize / 2; + // Enable HTTP/2 push + params.settingsFrameData[Http2::Settings::ENABLE_PUSH_ID] = 1; + manager->setProperty(Http2::http2ParametersPropertyName, QVariant::fromValue(params)); + } +#endif + const QUrl url = m_request.url(); // Post requests on files and data don't really make sense, but for diff --git a/Source/WebCore/platform/network/qt/ResourceRequest.h b/Source/WebCore/platform/network/qt/ResourceRequest.h index e74d9024c..1154d56a0 100644 --- a/Source/WebCore/platform/network/qt/ResourceRequest.h +++ b/Source/WebCore/platform/network/qt/ResourceRequest.h @@ -29,6 +29,13 @@ #include "ResourceRequestBase.h" +// HTTP/2 is implemented since Qt 5.8, but various QtNetwork bugs make it unusable in browser with Qt < 5.10.1 +// We also don't enable HTTP/2 for unencrypted connections because of possible compatibility issues; it can be +// enabled manually by user application via custom QNAM subclass +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 1) +#define USE_HTTP2 1 +#endif + QT_BEGIN_NAMESPACE class QNetworkRequest; QT_END_NAMESPACE @@ -63,6 +70,12 @@ class NetworkingContext; QNetworkRequest toNetworkRequest(NetworkingContext* = 0) const; +#if USE(HTTP2) + // Don't enable HTTP/2 when ALPN support status is unknown + static bool alpnIsSupported(); +#endif + + private: friend class ResourceRequestBase; diff --git a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp index 694e2a764..2cf2e7750 100644 --- a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp +++ b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp @@ -27,20 +27,8 @@ #include <QNetworkRequest> #include <QUrl> -// HTTP/2 is implemented since Qt 5.8, but various QtNetwork bugs make it unusable in browser with Qt < 5.10.1 -// We also don't enable HTTP/2 for unencrypted connections because of possible compatibility issues; it can be -// enabled manually by user application via custom QNAM subclass -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 1) +#if USE(HTTP2) #include <QSslSocket> -#define USE_HTTP2 1 - -// Don't enable HTTP/2 when ALPN support status is unknown -// Before QTBUG-65903 is implemented there is no better way than to check OpenSSL version -static bool alpnIsSupported() -{ - return QSslSocket::sslLibraryVersionNumber() > 0x10002000L && - QSslSocket::sslLibraryVersionString().startsWith(QLatin1String("OpenSSL")); -} #endif namespace WebCore { @@ -70,6 +58,15 @@ static inline QByteArray stringToByteArray(const String& string) return QString(string).toLatin1(); } +#if USE(HTTP2) +bool ResourceRequest::alpnIsSupported() +{ + // Before QTBUG-65903 is implemented there is no better way than to check OpenSSL version + return QSslSocket::sslLibraryVersionNumber() > 0x10002000L && + QSslSocket::sslLibraryVersionString().startsWith(QLatin1String("OpenSSL")); +} +#endif + QNetworkRequest ResourceRequest::toNetworkRequest(NetworkingContext *context) const { QNetworkRequest request; diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index 31f89ea82..b190f2151 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -611,6 +611,9 @@ endif () find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS ${QT_REQUIRED_COMPONENTS}) CHECK_QT5_PRIVATE_INCLUDE_DIRS(Gui private/qhexstring_p.h) +if (Qt5_VERSION VERSION_GREATER 5.10.1) + CHECK_QT5_PRIVATE_INCLUDE_DIRS(Network private/http2protocol_p.h) +endif () if (ENABLE_WEBKIT2) CHECK_QT5_PRIVATE_INCLUDE_DIRS(Quick private/qsgrendernode_p.h) endif () diff --git a/Tools/Scripts/build-webkit b/Tools/Scripts/build-webkit index b8a4bd1e2..fbaee1c0d 100755 --- a/Tools/Scripts/build-webkit +++ b/Tools/Scripts/build-webkit @@ -240,10 +240,6 @@ if (isInspectorFrontend()) { } if (isCMakeBuild() && (!isAnyWindows() || isQt())) { - if ($shouldInstall) { - $makeArgs .= ($makeArgs ? " " : "") . "install"; - } - # Visual Studio generator doesn't support -j switch if (canUseNinja() || !isAnyWindows()) { # By default we build using all of the available CPUs. @@ -258,6 +254,10 @@ if (isCMakeBuild() && (!isAnyWindows() || isQt())) { removeCMakeCache(@featureArgs); buildCMakeProjectOrExit($clean, $prefixPath, $makeArgs, (cmakeBasedPortArguments(), @featureArgs), $cmakeArgs); + + if ($shouldInstall) { + installCMakeProjectOrExit(); + } } my $baseProductDir = baseProductDir(); diff --git a/Tools/Scripts/webkitdirs.pm b/Tools/Scripts/webkitdirs.pm index 84b18c7b6..afe4af015 100755 --- a/Tools/Scripts/webkitdirs.pm +++ b/Tools/Scripts/webkitdirs.pm @@ -2145,6 +2145,13 @@ sub buildCMakeProjectOrExit($$$@) return 0; } +sub installCMakeProjectOrExit +{ + my $returnCode = exitStatus(system(qw(cmake -P cmake_install.cmake))); + exit($returnCode) if $returnCode; + return 0; +} + sub cmakeBasedPortArguments() { return (); diff --git a/Tools/qt/make-snapshot.pl b/Tools/qt/make-snapshot.pl index 2c2af1a9f..8b189059c 100755 --- a/Tools/qt/make-snapshot.pl +++ b/Tools/qt/make-snapshot.pl @@ -53,7 +53,7 @@ my @commands = ( "tar -xf $src_repo/snapshot.tar --strip-components=1", "git add -A", "rm $src_repo/snapshot.tar", - "git commit -m 'Import WebKit commit $commit'" + "git commit -m 'Import QtWebKit commit $commit'" ); my $cmd = join " && ", @commands; |