diff options
Diffstat (limited to 'Source/WebCore/platform')
23 files changed, 192 insertions, 113 deletions
diff --git a/Source/WebCore/platform/Cursor.cpp b/Source/WebCore/platform/Cursor.cpp index 60a619acd..722181bc1 100644 --- a/Source/WebCore/platform/Cursor.cpp +++ b/Source/WebCore/platform/Cursor.cpp @@ -154,7 +154,9 @@ Cursor::Cursor(Image* image, const IntPoint& hotSpot) #if ENABLE(MOUSE_CURSOR_SCALE) , m_imageScaleFactor(1) #endif - , m_platformCursor(0) +#if !PLATFORM(QT) + , m_platformCursor(nullptr) +#endif { } @@ -164,7 +166,9 @@ Cursor::Cursor(Image* image, const IntPoint& hotSpot, float scale) , m_image(image) , m_hotSpot(determineHotSpot(image, hotSpot)) , m_imageScaleFactor(scale) +#if !PLATFORM(QT) , m_platformCursor(0) +#endif { } #endif @@ -174,11 +178,19 @@ Cursor::Cursor(Type type) #if ENABLE(MOUSE_CURSOR_SCALE) , m_imageScaleFactor(1) #endif - , m_platformCursor(0) +#if !PLATFORM(QT) + , m_platformCursor(nullptr) +#endif { } -#if !PLATFORM(COCOA) +#if PLATFORM(QT) +PlatformCursor Cursor::platformCursor() const +{ + ensurePlatformCursor(); + return m_platformCursor ? &m_platformCursor.value() : nullptr; +} +#elif !PLATFORM(COCOA) PlatformCursor Cursor::platformCursor() const { diff --git a/Source/WebCore/platform/Cursor.h b/Source/WebCore/platform/Cursor.h index d06ad7d47..a81783e5f 100644 --- a/Source/WebCore/platform/Cursor.h +++ b/Source/WebCore/platform/Cursor.h @@ -42,6 +42,7 @@ typedef HICON HCURSOR; #include "GRefPtrGtk.h" #elif PLATFORM(QT) #include <QCursor> +#include <wtf/Optional.h> #endif #if USE(APPKIT) @@ -140,7 +141,9 @@ namespace WebCore { #if ENABLE(MOUSE_CURSOR_SCALE) , m_imageScaleFactor(1) #endif - , m_platformCursor(0) +#if !PLATFORM(QT) + , m_platformCursor(nullptr) +#endif #endif // !PLATFORM(IOS) { } @@ -181,7 +184,9 @@ namespace WebCore { float m_imageScaleFactor; #endif -#if !USE(APPKIT) +#if PLATFORM(QT) + mutable Optional<QCursor> m_platformCursor; +#elif !USE(APPKIT) mutable PlatformCursor m_platformCursor; #else mutable RetainPtr<NSCursor> m_platformCursor; diff --git a/Source/WebCore/platform/FileSystem.h b/Source/WebCore/platform/FileSystem.h index 2c46e4da0..4ee276da4 100644 --- a/Source/WebCore/platform/FileSystem.h +++ b/Source/WebCore/platform/FileSystem.h @@ -49,7 +49,7 @@ #endif #endif -#if USE(CF) || (PLATFORM(QT) && defined(Q_OS_MAC)) +#if USE(CF) || (PLATFORM(QT) && defined(Q_OS_MACOS)) typedef struct __CFBundle* CFBundleRef; typedef const struct __CFData* CFDataRef; #endif @@ -75,7 +75,7 @@ typedef HMODULE PlatformModule; #elif PLATFORM(EFL) typedef Eina_Module* PlatformModule; #elif PLATFORM(QT) -#if defined(Q_OS_MAC) +#if defined(Q_OS_MACOS) typedef CFBundleRef PlatformModule; #elif !defined(QT_NO_LIBRARY) typedef QLibrary* PlatformModule; diff --git a/Source/WebCore/platform/HashTools.h b/Source/WebCore/platform/HashTools.h index 3badbdee1..a943eb49a 100644 --- a/Source/WebCore/platform/HashTools.h +++ b/Source/WebCore/platform/HashTools.h @@ -37,9 +37,9 @@ struct Value { int id; }; -const NamedColor* findColor(register const char* str, register unsigned int len); -const Property* findProperty(register const char* str, register unsigned int len); -const Value* findValue(register const char* str, register unsigned int len); +const NamedColor* findColor(const char* str, unsigned len); +const Property* findProperty(const char* str, unsigned len); +const Value* findValue(const char* str, unsigned len); } // namespace WebCore diff --git a/Source/WebCore/platform/Length.h b/Source/WebCore/platform/Length.h index 75ccf775e..b5697ce13 100644 --- a/Source/WebCore/platform/Length.h +++ b/Source/WebCore/platform/Length.h @@ -170,12 +170,12 @@ inline Length::Length(const Length& other) if (other.isCalculated()) other.ref(); - memcpy(this, &other, sizeof(Length)); + memcpy(static_cast<void*>(this), static_cast<void*>(const_cast<Length*>(&other)), sizeof(Length)); } inline Length::Length(Length&& other) { - memcpy(this, &other, sizeof(Length)); + memcpy(static_cast<void*>(this), static_cast<void*>(&other), sizeof(Length)); other.m_type = Auto; } @@ -189,7 +189,7 @@ inline Length& Length::operator=(const Length& other) if (isCalculated()) deref(); - memcpy(this, &other, sizeof(Length)); + memcpy(static_cast<void*>(this), static_cast<void*>(const_cast<Length*>(&other)), sizeof(Length)); return *this; } @@ -201,7 +201,7 @@ inline Length& Length::operator=(Length&& other) if (isCalculated()) deref(); - memcpy(this, &other, sizeof(Length)); + memcpy(static_cast<void*>(this), static_cast<void*>(&other), sizeof(Length)); other.m_type = Auto; return *this; } diff --git a/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp b/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp index 908d881f1..2c8571ace 100644 --- a/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp +++ b/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp @@ -41,7 +41,7 @@ std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffe const QByteArray fontData(buffer.data(), buffer.size()); // Pixel size doesn't matter at this point, it is set in FontCustomPlatformData::fontPlatformData. - QRawFont rawFont(fontData, /*pixelSize = */0, QFont::PreferDefaultHinting); + QRawFont rawFont(fontData, /*pixelSize = */0, QFont::PreferVerticalHinting); if (!rawFont.isValid()) return 0; 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/graphics/qt/GradientQt.cpp b/Source/WebCore/platform/graphics/qt/GradientQt.cpp index 3412cfadd..2c3dec5ba 100644 --- a/Source/WebCore/platform/graphics/qt/GradientQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GradientQt.cpp @@ -66,6 +66,10 @@ QGradient* Gradient::platformGradient() qreal lastStop(0.0); const qreal lastStopDiff = 0.0000001; while (stopIterator != m_stops.end()) { + // Drop gradient stops after 1.0 to avoid overwriting color at 1.0 + if (lastStop >= 1) + break; + stopColor.setRgbF(stopIterator->red, stopIterator->green, stopIterator->blue, stopIterator->alpha); if (qFuzzyCompare(lastStop, qreal(stopIterator->stop))) lastStop = stopIterator->stop + lastStopDiff; @@ -78,6 +82,8 @@ QGradient* Gradient::platformGradient() lastStop += innerRadius / outerRadius; } + // Clamp stop position to 1.0, otherwise QGradient will ignore it + // https://bugs.webkit.org/show_bug.cgi?id=41484 qreal stopPosition = qMin(lastStop, qreal(1.0f)); if (m_radial && reversed) diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index 1e041050e..6bf343087 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -151,6 +151,11 @@ static inline QPainter::CompositionMode toQtCompositionMode(BlendMode op) return QPainter::CompositionMode_Difference; case BlendModeExclusion: return QPainter::CompositionMode_Exclusion; + case BlendModePlusLighter: + return QPainter::CompositionMode_Plus; + case BlendModePlusDarker: + // there is no exact match, but this is the closest + return QPainter::CompositionMode_Darken; case BlendModeHue: case BlendModeSaturation: case BlendModeColor: diff --git a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp index 9091fdc72..cef4750ed 100644 --- a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp +++ b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp @@ -80,7 +80,7 @@ MediaPlayer::SupportsType MediaPlayerPrivateQt::supportsType(const MediaEngineSu if (parameters.isMediaStream || parameters.isMediaSource) return MediaPlayer::IsNotSupported; - if (!parameters.type.startsWith("audio/") && !parameters.type.startsWith("video/")) + if (!parameters.type.startsWithIgnoringASCIICase("audio/") && !parameters.type.startsWithIgnoringASCIICase("video/")) return MediaPlayer::IsNotSupported; // Parse and trim codecs. diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp index 98f2ec964..a56a47a3e 100644 --- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp +++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp @@ -193,15 +193,6 @@ void MediaPlayerPrivateMediaFoundation::cancelLoad() notImplemented(); } -void MediaPlayerPrivateMediaFoundation::prepareToPlay() -{ - // We call startSession() to start buffering video data. - // When we have received enough data, we pause, so that we don't actually start the playback. - ASSERT(m_paused); - ASSERT(!m_preparingToPlay); - m_preparingToPlay = startSession(); -} - void MediaPlayerPrivateMediaFoundation::play() { m_paused = !startSession(); @@ -937,7 +928,11 @@ void MediaPlayerPrivateMediaFoundation::onTopologySet() } // It is expected that we start buffering data from the network now. - prepareToPlay(); + // We call startSession() to start buffering video data. + // When we have received enough data, we pause, so that we don't actually start the playback. + ASSERT(m_paused); + ASSERT(!m_preparingToPlay); + m_preparingToPlay = startSession(); } void MediaPlayerPrivateMediaFoundation::onBufferingStarted() @@ -2920,6 +2915,7 @@ HRESULT MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSample(IMFS D3DSURFACE_DESC desc; if (SUCCEEDED(surface->GetDesc(&desc))) format = desc.Format; + m_memSurface.clear(); hr = m_device->CreateOffscreenPlainSurface(width, height, format, D3DPOOL_SYSTEMMEM, &m_memSurface, nullptr); m_width = width; m_height = height; diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h index 0fe07fa13..d945c20d0 100644 --- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h +++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h @@ -60,8 +60,6 @@ public: void load(const String& url) override; void cancelLoad() override; - void prepareToPlay() override; - void play() override; void pause() override; diff --git a/Source/WebCore/platform/image-decoders/ImageDecoder.cpp b/Source/WebCore/platform/image-decoders/ImageDecoder.cpp index 46366823f..0273dd3c2 100644 --- a/Source/WebCore/platform/image-decoders/ImageDecoder.cpp +++ b/Source/WebCore/platform/image-decoders/ImageDecoder.cpp @@ -28,7 +28,9 @@ #if PLATFORM(QT) #include "ImageDecoderQt.h" #endif +#if !PLATFORM(QT) || USE(LIBJPEG) #include "JPEGImageDecoder.h" +#endif #include "PNGImageDecoder.h" #include "SharedBuffer.h" #if USE(WEBP) @@ -115,8 +117,10 @@ ImageDecoder* ImageDecoder::create(const SharedBuffer& data, ImageSource::AlphaO if (matchesICOSignature(contents) || matchesCURSignature(contents)) return new ICOImageDecoder(alphaOption, gammaAndColorProfileOption); +#if !PLATFORM(QT) || USE(LIBJPEG) if (matchesJPEGSignature(contents)) return new JPEGImageDecoder(alphaOption, gammaAndColorProfileOption); +#endif #if USE(WEBP) if (matchesWebPSignature(contents)) diff --git a/Source/WebCore/platform/network/NetworkingContext.h b/Source/WebCore/platform/network/NetworkingContext.h index 3de432e42..582bca647 100644 --- a/Source/WebCore/platform/network/NetworkingContext.h +++ b/Source/WebCore/platform/network/NetworkingContext.h @@ -28,10 +28,6 @@ #include <wtf/SchedulePair.h> #endif -#if PLATFORM(QT) -#include <qglobal.h> -#endif - #if PLATFORM(COCOA) OBJC_CLASS NSOperationQueue; #endif diff --git a/Source/WebCore/platform/network/qt/CookieJarQt.cpp b/Source/WebCore/platform/network/qt/CookieJarQt.cpp index d1cf87fdd..0e05e677b 100644 --- a/Source/WebCore/platform/network/qt/CookieJarQt.cpp +++ b/Source/WebCore/platform/network/qt/CookieJarQt.cpp @@ -123,7 +123,7 @@ String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const bool cookiesEnabled(const NetworkStorageSession& session, const URL& /*firstParty*/, const URL& /*url*/) { - return true; + return session.context() ? session.context()->networkAccessManager()->cookieJar() : SharedCookieJarQt::shared(); } bool getRawCookies(const NetworkStorageSession& session, const URL& /*firstParty*/, const URL& /*url*/, Vector<Cookie>& rawCookies) diff --git a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index 1b60c5131..792459558 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) && QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + +#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) && QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + static const int gMaxRedirections = 10; namespace WebCore { @@ -488,12 +511,15 @@ QNetworkReply* QNetworkReplyHandler::release() static bool shouldIgnoreHttpError(QNetworkReply* reply, bool receivedData) { + int httpStatusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + // Don't ignore error if we haven't received HTTP status code + if (httpStatusCode == 0) + return false; + // An HEAD XmlHTTPRequest shouldn't be marked as failure for HTTP errors. if (reply->operation() == QNetworkAccessManager::HeadOperation) return true; - int httpStatusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); - if (httpStatusCode == 401 || httpStatusCode == 407) return true; @@ -585,19 +611,10 @@ void QNetworkReplyHandler::sendResponseIfNeeded() m_replyWrapper->reply()->header(QNetworkRequest::ContentLengthHeader).toLongLong(), m_replyWrapper->encoding()); - if (url.isLocalFile()) { - if (client->usesAsyncCallbacks()) { - setLoadingDeferred(true); - client->didReceiveResponseAsync(m_resourceHandle, response); - } else - client->didReceiveResponse(m_resourceHandle, response); - return; - } - - // The status code is equal to 0 for protocols not in the HTTP family. - int statusCode = m_replyWrapper->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (url.protocolIsInHTTPFamily()) { + // The status code is equal to 0 for protocols not in the HTTP family. + int statusCode = m_replyWrapper->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); response.setHTTPStatusCode(statusCode); response.setHTTPStatusText(m_replyWrapper->reply()->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray().constData()); @@ -606,6 +623,7 @@ void QNetworkReplyHandler::sendResponseIfNeeded() response.setHTTPHeaderField(String(pair.first.constData(), pair.first.size()), String(pair.second.constData(), pair.second.size())); } + // Note: Qt sets RedirectionTargetAttribute only for 3xx responses, so Location header in 201 responce won't affect this code QUrl redirection = m_replyWrapper->reply()->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl(); if (redirection.isValid()) { redirect(response, redirection); @@ -648,8 +666,10 @@ void QNetworkReplyHandler::redirect(ResourceResponse& response, const QUrl& redi ASSERT(!m_queue.deferSignals()); QUrl currentUrl = m_replyWrapper->reply()->url(); + + // RFC7231 section 7.1.2 QUrl newUrl = currentUrl.resolved(redirection); - if (currentUrl.hasFragment()) + if (!newUrl.hasFragment() && currentUrl.hasFragment()) newUrl.setFragment(currentUrl.fragment()); ResourceHandleClient* client = m_resourceHandle->client(); @@ -777,6 +797,18 @@ QNetworkReply* QNetworkReplyHandler::sendNetworkRequest(QNetworkAccessManager* m if (!manager) return 0; +#if USE(HTTP2) && QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + 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 c54a8115b..310738449 100644 --- a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp +++ b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp @@ -27,17 +27,12 @@ #include <QNetworkRequest> #include <QUrl> -// HTTP/2 is implemented since Qt 5.8, but QTBUG-64359 makes it unusable in browser -#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 4) -#define USE_HTTP2 1 -#endif - -// HTTP2AllowedAttribute enforces HTTP/2 instead of negotiating, see QTBUG-61397 -#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) -#define HTTP2_IS_BUGGY_WITHOUT_HTTPS 1 -#else -#define HTTP2_IS_BUGGY_WITHOUT_HTTPS 0 +#if USE(HTTP2) +#include <QSslSocket> +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) +#include <QHttp2Configuration> #endif +#endif // USE(HTTP2) namespace WebCore { @@ -66,6 +61,25 @@ 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")); +} + +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) +static QHttp2Configuration createHttp2Configuration() +{ + QHttp2Configuration params; + params.setServerPushEnabled(true); + return params; +} +#endif + +#endif + QNetworkRequest ResourceRequest::toNetworkRequest(NetworkingContext *context) const { QNetworkRequest request; @@ -74,15 +88,16 @@ QNetworkRequest ResourceRequest::toNetworkRequest(NetworkingContext *context) co request.setOriginatingObject(context ? context->originatingObject() : 0); #if USE(HTTP2) -#if HTTP2_IS_BUGGY_WITHOUT_HTTPS - if (originalUrl.protocolIs("https")) + static const bool NegotiateHttp2ForHttps = alpnIsSupported(); + if (originalUrl.protocolIs("https") && NegotiateHttp2ForHttps) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + static const auto params = createHttp2Configuration(); + request.setHttp2Configuration(params); #endif - { request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true); } #endif // USE(HTTP2) - const HTTPHeaderMap &headers = httpHeaderFields(); for (HTTPHeaderMap::const_iterator it = headers.begin(), end = headers.end(); it != end; ++it) { diff --git a/Source/WebCore/platform/qt/CursorQt.cpp b/Source/WebCore/platform/qt/CursorQt.cpp index ffec6715a..6f27b671c 100644 --- a/Source/WebCore/platform/qt/CursorQt.cpp +++ b/Source/WebCore/platform/qt/CursorQt.cpp @@ -49,17 +49,12 @@ Cursor::Cursor(const Cursor& other) , m_image(other.m_image) , m_hotSpot(other.m_hotSpot) #ifndef QT_NO_CURSOR - , m_platformCursor(other.m_platformCursor ? new QCursor(*other.m_platformCursor) : 0) + , m_platformCursor(other.m_platformCursor) #endif { } -Cursor::~Cursor() -{ -#ifndef QT_NO_CURSOR - delete m_platformCursor; -#endif -} +Cursor::~Cursor() = default; Cursor& Cursor::operator=(const Cursor& other) { @@ -67,18 +62,18 @@ Cursor& Cursor::operator=(const Cursor& other) m_image = other.m_image; m_hotSpot = other.m_hotSpot; #ifndef QT_NO_CURSOR - m_platformCursor = other.m_platformCursor ? new QCursor(*other.m_platformCursor) : 0; + m_platformCursor = other.m_platformCursor; #endif return *this; } #ifndef QT_NO_CURSOR -static QCursor* createCustomCursor(Image* image, const IntPoint& hotSpot) +static Optional<QCursor> createCustomCursor(Image* image, const IntPoint& hotSpot) { if (!image->nativeImageForCurrentFrame()) - return 0; + return Nullopt; IntPoint effectiveHotSpot = determineHotSpot(image, hotSpot); - return new QCursor(*(image->nativeImageForCurrentFrame()), effectiveHotSpot.x(), effectiveHotSpot.y()); + return QCursor(*(image->nativeImageForCurrentFrame()), effectiveHotSpot.x(), effectiveHotSpot.y()); } #endif @@ -90,117 +85,117 @@ void Cursor::ensurePlatformCursor() const switch (m_type) { case Pointer: - m_platformCursor = new QCursor(Qt::ArrowCursor); + m_platformCursor = QCursor(Qt::ArrowCursor); break; case Cross: - m_platformCursor = new QCursor(Qt::CrossCursor); + m_platformCursor = QCursor(Qt::CrossCursor); break; case Hand: - m_platformCursor = new QCursor(Qt::PointingHandCursor); + m_platformCursor = QCursor(Qt::PointingHandCursor); break; case IBeam: - m_platformCursor = new QCursor(Qt::IBeamCursor); + m_platformCursor = QCursor(Qt::IBeamCursor); break; case Wait: - m_platformCursor = new QCursor(Qt::WaitCursor); + m_platformCursor = QCursor(Qt::WaitCursor); break; case Help: - m_platformCursor = new QCursor(Qt::WhatsThisCursor); + m_platformCursor = QCursor(Qt::WhatsThisCursor); break; case EastResize: case EastPanning: - m_platformCursor = new QCursor(Qt::SizeHorCursor); + m_platformCursor = QCursor(Qt::SizeHorCursor); break; case NorthResize: case NorthPanning: - m_platformCursor = new QCursor(Qt::SizeVerCursor); + m_platformCursor = QCursor(Qt::SizeVerCursor); break; case NorthEastResize: case NorthEastPanning: - m_platformCursor = new QCursor(Qt::SizeBDiagCursor); + m_platformCursor = QCursor(Qt::SizeBDiagCursor); break; case NorthWestResize: case NorthWestPanning: - m_platformCursor = new QCursor(Qt::SizeFDiagCursor); + m_platformCursor = QCursor(Qt::SizeFDiagCursor); break; case SouthResize: case SouthPanning: - m_platformCursor = new QCursor(Qt::SizeVerCursor); + m_platformCursor = QCursor(Qt::SizeVerCursor); break; case SouthEastResize: case SouthEastPanning: - m_platformCursor = new QCursor(Qt::SizeFDiagCursor); + m_platformCursor = QCursor(Qt::SizeFDiagCursor); break; case SouthWestResize: case SouthWestPanning: - m_platformCursor = new QCursor(Qt::SizeBDiagCursor); + m_platformCursor = QCursor(Qt::SizeBDiagCursor); break; case WestResize: case WestPanning: - m_platformCursor = new QCursor(Qt::SizeHorCursor); + m_platformCursor = QCursor(Qt::SizeHorCursor); break; case NorthSouthResize: - m_platformCursor = new QCursor(Qt::SizeVerCursor); + m_platformCursor = QCursor(Qt::SizeVerCursor); break; case EastWestResize: - m_platformCursor = new QCursor(Qt::SizeHorCursor); + m_platformCursor = QCursor(Qt::SizeHorCursor); break; case NorthEastSouthWestResize: - m_platformCursor = new QCursor(Qt::SizeBDiagCursor); + m_platformCursor = QCursor(Qt::SizeBDiagCursor); break; case NorthWestSouthEastResize: - m_platformCursor = new QCursor(Qt::SizeFDiagCursor); + m_platformCursor = QCursor(Qt::SizeFDiagCursor); break; case ColumnResize: - m_platformCursor = new QCursor(Qt::SplitHCursor); + m_platformCursor = QCursor(Qt::SplitHCursor); break; case RowResize: - m_platformCursor = new QCursor(Qt::SplitVCursor); + m_platformCursor = QCursor(Qt::SplitVCursor); break; case MiddlePanning: case Move: - m_platformCursor = new QCursor(Qt::SizeAllCursor); + m_platformCursor = QCursor(Qt::SizeAllCursor); break; case None: - m_platformCursor = new QCursor(Qt::BlankCursor); + m_platformCursor = QCursor(Qt::BlankCursor); break; case NoDrop: case NotAllowed: - m_platformCursor = new QCursor(Qt::ForbiddenCursor); + m_platformCursor = QCursor(Qt::ForbiddenCursor); break; case Grab: case Grabbing: notImplemented(); - m_platformCursor = new QCursor(Qt::ArrowCursor); + m_platformCursor = QCursor(Qt::ArrowCursor); break; case VerticalText: - m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/verticalTextCursor.png")), 7, 7); + m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/verticalTextCursor.png")), 7, 7); break; case Cell: - m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/cellCursor.png")), 7, 7); + m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/cellCursor.png")), 7, 7); break; case ContextMenu: - m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/contextMenuCursor.png")), 3, 2); + m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/contextMenuCursor.png")), 3, 2); break; case Alias: - m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/aliasCursor.png")), 11, 3); + m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/aliasCursor.png")), 11, 3); break; case Progress: - m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/progressCursor.png")), 3, 2); + m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/progressCursor.png")), 3, 2); break; case Copy: - m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/copyCursor.png")), 3, 2); + m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/copyCursor.png")), 3, 2); break; case ZoomIn: - m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/zoomInCursor.png")), 7, 7); + m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/zoomInCursor.png")), 7, 7); break; case ZoomOut: - m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/zoomOutCursor.png")), 7, 7); + m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/zoomOutCursor.png")), 7, 7); break; case Custom: m_platformCursor = createCustomCursor(m_image.get(), m_hotSpot); if (!m_platformCursor) - m_platformCursor = new QCursor(Qt::ArrowCursor); + m_platformCursor = QCursor(Qt::ArrowCursor); break; default: ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/platform/qt/FileSystemQt.cpp b/Source/WebCore/platform/qt/FileSystemQt.cpp index 167ff8354..7f62d0e1f 100644 --- a/Source/WebCore/platform/qt/FileSystemQt.cpp +++ b/Source/WebCore/platform/qt/FileSystemQt.cpp @@ -257,7 +257,7 @@ int writeToFile(PlatformFileHandle handle, const char* data, int length) bool unloadModule(PlatformModule module) { -#if defined(Q_OS_MAC) +#if defined(Q_OS_MACOS) CFRelease(module); return true; diff --git a/Source/WebCore/platform/qt/PasteboardQt.cpp b/Source/WebCore/platform/qt/PasteboardQt.cpp index 2bc766782..2b4a2220c 100644 --- a/Source/WebCore/platform/qt/PasteboardQt.cpp +++ b/Source/WebCore/platform/qt/PasteboardQt.cpp @@ -131,7 +131,7 @@ void Pasteboard::writeSelection(Range& selectedRange, bool canSmartCopyOrDelete, m_writableData->setText(text); QString markup = createMarkup(selectedRange, 0, AnnotateForInterchange, false, ResolveNonLocalURLs); -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS markup.prepend(QLatin1String("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></head><body>")); markup.append(QLatin1String("</body></html>")); m_writableData->setData(QLatin1String("text/html"), markup.toUtf8()); diff --git a/Source/WebCore/platform/qt/RenderThemeQStyle.cpp b/Source/WebCore/platform/qt/RenderThemeQStyle.cpp index 706570399..8c6bbba03 100644 --- a/Source/WebCore/platform/qt/RenderThemeQStyle.cpp +++ b/Source/WebCore/platform/qt/RenderThemeQStyle.cpp @@ -130,7 +130,7 @@ RenderThemeQStyle::RenderThemeQStyle(Page* page) { int buttonPixelSize = 0; m_qStyle->getButtonMetrics(&m_buttonFontFamily, &buttonPixelSize); -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS m_buttonFontPixelSize = buttonPixelSize; #endif } @@ -288,7 +288,7 @@ void RenderThemeQStyle::adjustButtonStyle(StyleResolver& styleResolver, RenderSt // Ditch the border. style.resetBorder(); -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS if (style.appearance() == PushButtonPart) { // The Mac ports ignore the specified height for <input type="button"> elements // unless a border and/or background CSS property is also specified. @@ -299,7 +299,7 @@ void RenderThemeQStyle::adjustButtonStyle(StyleResolver& styleResolver, RenderSt FontCascadeDescription fontDescription = style.fontDescription(); fontDescription.setIsAbsoluteSize(true); -#ifdef Q_OS_MAC // Use fixed font size and family on Mac (like Safari does) +#ifdef Q_OS_MACOS // Use fixed font size and family on Mac (like Safari does) fontDescription.setSpecifiedSize(m_buttonFontPixelSize); fontDescription.setComputedSize(m_buttonFontPixelSize); #else @@ -601,7 +601,7 @@ ControlPart RenderThemeQStyle::initializeCommonQStyleOptions(QStyleFacadeOption option.state &= ~(QStyleFacade::State_HasFocus | QStyleFacade::State_MouseOver); option.state |= QStyleFacade::State_Enabled; -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS // to render controls in correct positions we also should set the State_Active flag option.state |= QStyleFacade::State_Active; #endif diff --git a/Source/WebCore/platform/qt/RenderThemeQStyle.h b/Source/WebCore/platform/qt/RenderThemeQStyle.h index 665eee005..463404b7d 100644 --- a/Source/WebCore/platform/qt/RenderThemeQStyle.h +++ b/Source/WebCore/platform/qt/RenderThemeQStyle.h @@ -110,7 +110,7 @@ private: QRect indicatorRect(QStyleFacade::ButtonType part, const QRect& originalRect) const; -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS int m_buttonFontPixelSize; #endif |