diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2017-04-24 22:40:03 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-04-25 18:29:55 +0000 |
commit | 4bd713d56aa9bb86bc96ea9cb0c64cbf94bf43d4 (patch) | |
tree | 02bd448d49627f059df0d8036fbdb9d9ee883a50 /Source/WebCore/platform | |
parent | bd3f57b00bee3088971209a0ebc513eb1ef4ba14 (diff) | |
download | qtwebkit-4bd713d56aa9bb86bc96ea9cb0c64cbf94bf43d4.tar.gz |
Import WebKit commit 3040e0455efecd271f1aeef53cf287e75486a70d
Change-Id: I7df106cef8ce93ce33e49ad6fb0d202cd066d87c
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebCore/platform')
13 files changed, 111 insertions, 23 deletions
diff --git a/Source/WebCore/platform/PlatformTouchEvent.h b/Source/WebCore/platform/PlatformTouchEvent.h index 7af33d75d..21e306dd5 100644 --- a/Source/WebCore/platform/PlatformTouchEvent.h +++ b/Source/WebCore/platform/PlatformTouchEvent.h @@ -26,12 +26,6 @@ #if ENABLE(TOUCH_EVENTS) -#if PLATFORM(QT) -QT_BEGIN_NAMESPACE -class QTouchEvent; -QT_END_NAMESPACE -#endif - namespace WebCore { diff --git a/Source/WebCore/platform/ScrollView.cpp b/Source/WebCore/platform/ScrollView.cpp index c06450945..33792b6cc 100644 --- a/Source/WebCore/platform/ScrollView.cpp +++ b/Source/WebCore/platform/ScrollView.cpp @@ -574,8 +574,13 @@ void ScrollView::updateScrollbars(const ScrollPosition& desiredPosition) { LOG_WITH_STREAM(Scrolling, stream << "ScrollView::updateScrollbars " << desiredPosition); +#if PLATFORM(QT) + if (m_inUpdateScrollbars || prohibitsScrolling() || platformWidget()) + return; +#else if (m_inUpdateScrollbars || prohibitsScrolling() || platformWidget() || delegatesScrolling()) return; +#endif bool hasOverlayScrollbars = (!m_horizontalScrollbar || m_horizontalScrollbar->isOverlayScrollbar()) && (!m_verticalScrollbar || m_verticalScrollbar->isOverlayScrollbar()); diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp index 812980a28..b6eccf711 100644 --- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp +++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp @@ -26,7 +26,7 @@ #include "TextureMapperAnimation.h" #include <wtf/CurrentTime.h> -#if !USE(COORDINATED_GRAPHICS) +#if !USE(COORDINATED_GRAPHICS) || PLATFORM(QT) namespace WebCore { diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h index 74f6cea8b..121a54600 100644 --- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h +++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h @@ -20,7 +20,7 @@ #ifndef GraphicsLayerTextureMapper_h #define GraphicsLayerTextureMapper_h -#if !USE(COORDINATED_GRAPHICS) +#if !USE(COORDINATED_GRAPHICS) || PLATFORM(QT) #include "GraphicsLayer.h" #include "GraphicsLayerClient.h" diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp index 895d37f39..fc0dafab1 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp @@ -451,7 +451,7 @@ TextureMapperLayer::~TextureMapperLayer() } } -#if !USE(COORDINATED_GRAPHICS) +#if !USE(COORDINATED_GRAPHICS) || PLATFORM(QT) void TextureMapperLayer::setChildren(const Vector<GraphicsLayer*>& newChildren) { removeAllChildren(); diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h index 34c399af2..4fdb55263 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h @@ -76,7 +76,7 @@ public: TextureMapper* textureMapper() const { return rootLayer().m_textureMapper; } void setTextureMapper(TextureMapper* texmap) { m_textureMapper = texmap; } -#if !USE(COORDINATED_GRAPHICS) +#if !USE(COORDINATED_GRAPHICS) || PLATFORM(QT) void setChildren(const Vector<GraphicsLayer*>&); #endif void setChildren(const Vector<TextureMapperLayer*>&); diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp index 7de531692..67d9ceae5 100644 --- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp +++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp @@ -42,6 +42,7 @@ namespace WebCore { +#if !PLATFORM(QT) std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType) { if (!factory) @@ -49,6 +50,7 @@ std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* facto return factory->createGraphicsLayer(layerType, client); } +#endif static CoordinatedLayerID toCoordinatedLayerID(GraphicsLayer* layer) { diff --git a/Source/WebCore/platform/network/ResourceHandle.cpp b/Source/WebCore/platform/network/ResourceHandle.cpp index 44c007a66..4f1651294 100644 --- a/Source/WebCore/platform/network/ResourceHandle.cpp +++ b/Source/WebCore/platform/network/ResourceHandle.cpp @@ -153,7 +153,7 @@ void ResourceHandle::clearClient() d->m_client = nullptr; } -#if !PLATFORM(COCOA) && !USE(CFNETWORK) && !USE(SOUP) +#if !PLATFORM(COCOA) && !USE(CFNETWORK) && !USE(SOUP) && !PLATFORM(QT) // ResourceHandle never uses async client calls on these platforms yet. void ResourceHandle::continueWillSendRequest(const ResourceRequest&) { diff --git a/Source/WebCore/platform/network/qt/CookieJarQt.cpp b/Source/WebCore/platform/network/qt/CookieJarQt.cpp index 020727cc7..3b08c06cd 100644 --- a/Source/WebCore/platform/network/qt/CookieJarQt.cpp +++ b/Source/WebCore/platform/network/qt/CookieJarQt.cpp @@ -32,6 +32,7 @@ #include "Cookie.h" #include "URL.h" #include "NetworkingContext.h" +#include "NotImplemented.h" #include "PlatformCookieJar.h" #include "SQLiteStatement.h" #include "SQLiteTransaction.h" @@ -114,8 +115,7 @@ String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const bool cookiesEnabled(const NetworkStorageSession& session, const URL& /*firstParty*/, const URL& /*url*/) { - QNetworkCookieJar* jar = session.context() ? session.context()->networkAccessManager()->cookieJar() : SharedCookieJarQt::shared(); - return !!jar; + return true; } bool getRawCookies(const NetworkStorageSession& session, const URL& /*firstParty*/, const URL& /*url*/, Vector<Cookie>& rawCookies) @@ -138,12 +138,12 @@ void getHostnamesWithCookies(const NetworkStorageSession& session, HashSet<Strin jar->getHostnamesWithCookies(hostnames); } -void deleteCookiesForHostname(const NetworkStorageSession& session, const String& hostname) +void deleteCookiesForHostnames(const NetworkStorageSession& session, const Vector<String>& hostNames) { ASSERT_UNUSED(session, !session.context()); // Not yet implemented for cookie jars other than the shared one. SharedCookieJarQt* jar = SharedCookieJarQt::shared(); if (jar) - jar->deleteCookiesForHostname(hostname); + jar->deleteCookiesForHostnames(hostNames); } void deleteAllCookies(const NetworkStorageSession& session) @@ -154,6 +154,14 @@ void deleteAllCookies(const NetworkStorageSession& session) jar->deleteAllCookies(); } +void deleteAllCookiesModifiedSince(const NetworkStorageSession& session, std::chrono::system_clock::time_point time) +{ + ASSERT_UNUSED(session, !session.context()); // Not yet implemented for cookie jars other than the shared one. + SharedCookieJarQt* jar = SharedCookieJarQt::shared(); + if (jar) + jar->deleteAllCookiesModifiedSince(time); +} + SharedCookieJarQt* SharedCookieJarQt::shared() { return s_sharedCookieJarQt; @@ -203,6 +211,13 @@ bool SharedCookieJarQt::deleteCookie(const QNetworkCookie& cookie) return true; } +void SharedCookieJarQt::deleteCookiesForHostnames(const Vector<WTF::String>& hostNames) +{ + // QTFIXME: Implement as one statement or transaction + for (auto& hostname : hostNames) + deleteCookiesForHostname(hostname); +} + void SharedCookieJarQt::deleteCookiesForHostname(const String& hostname) { if (!m_database.isOpen()) @@ -245,6 +260,12 @@ void SharedCookieJarQt::deleteAllCookies() setAllCookies(QList<QNetworkCookie>()); } +void SharedCookieJarQt::deleteAllCookiesModifiedSince(std::chrono::system_clock::time_point) +{ + // QTFIXME + notImplemented(); +} + SharedCookieJarQt::SharedCookieJarQt(const String& cookieStorageDirectory) { if (!m_database.open(cookieStorageDirectory + ASCIILiteral("/cookies.db"))) { diff --git a/Source/WebCore/platform/network/qt/CookieJarQt.h b/Source/WebCore/platform/network/qt/CookieJarQt.h index 0f7b6abef..fb0e1a7c8 100644 --- a/Source/WebCore/platform/network/qt/CookieJarQt.h +++ b/Source/WebCore/platform/network/qt/CookieJarQt.h @@ -40,8 +40,9 @@ public: void getHostnamesWithCookies(HashSet<String>&); bool deleteCookie(const QNetworkCookie&) final; - void deleteCookiesForHostname(const String&); + void deleteCookiesForHostnames(const Vector<String>&); void deleteAllCookies(); + void deleteAllCookiesModifiedSince(std::chrono::system_clock::time_point); bool setCookiesFromUrl(const QList<QNetworkCookie>&, const QUrl&) final; void loadCookies(); @@ -49,6 +50,7 @@ private: SharedCookieJarQt(const String&); ~SharedCookieJarQt(); bool ensureDatabaseTable(); + void deleteCookiesForHostname(const String&); SQLiteDatabase m_database; }; diff --git a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index 951873190..cd096bfe7 100644 --- a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -563,6 +563,7 @@ void QNetworkReplyHandler::timerEvent(QTimerEvent* timerEvent) void QNetworkReplyHandler::sendResponseIfNeeded() { ASSERT(m_replyWrapper && m_replyWrapper->reply() && !wasAborted()); + ASSERT(!m_queue.deferSignals()); if (m_replyWrapper->reply()->error() && m_replyWrapper->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).isNull()) return; @@ -585,7 +586,11 @@ void QNetworkReplyHandler::sendResponseIfNeeded() m_replyWrapper->encoding()); if (url.isLocalFile()) { - client->didReceiveResponse(m_resourceHandle, response); + if (client->usesAsyncCallbacks()) { + setLoadingDeferred(true); + client->didReceiveResponseAsync(m_resourceHandle, response); + } else + client->didReceiveResponse(m_resourceHandle, response); return; } @@ -607,11 +612,41 @@ void QNetworkReplyHandler::sendResponseIfNeeded() return; } - client->didReceiveResponse(m_resourceHandle, response); + if (client->usesAsyncCallbacks()) { + setLoadingDeferred(true); + client->didReceiveResponseAsync(m_resourceHandle, response); + } else + client->didReceiveResponse(m_resourceHandle, response); +} + +void QNetworkReplyHandler::continueAfterWillSendRequest(const ResourceRequest& newRequest) +{ + if (wasAborted()) // Network error cancelled the request. + return; + + m_request = newRequest.toNetworkRequest(m_resourceHandle->getInternal()->m_context.get()); +} + +void QNetworkReplyHandler::continueWillSendRequest(const ResourceRequest& newRequest) +{ + ASSERT(!m_resourceHandle->client() || m_resourceHandle->client()->usesAsyncCallbacks()); + ASSERT(m_queue.deferSignals()); + setLoadingDeferred(false); + + continueAfterWillSendRequest(newRequest); +} + +void QNetworkReplyHandler::continueDidReceiveResponse() +{ + ASSERT(!m_resourceHandle->client() || m_resourceHandle->client()->usesAsyncCallbacks()); + ASSERT(m_queue.deferSignals()); + setLoadingDeferred(false); } void QNetworkReplyHandler::redirect(ResourceResponse& response, const QUrl& redirection) { + ASSERT(!m_queue.deferSignals()); + QUrl newUrl = m_replyWrapper->reply()->url().resolved(redirection); ResourceHandleClient* client = m_resourceHandle->client(); @@ -644,11 +679,13 @@ void QNetworkReplyHandler::redirect(ResourceResponse& response, const QUrl& redi if (!newRequest.url().protocolIs("https") && protocolIs(newRequest.httpReferrer(), "https") && m_resourceHandle->context()->shouldClearReferrerOnHTTPSToHTTPRedirect()) newRequest.clearHTTPReferrer(); - client->willSendRequest(m_resourceHandle, newRequest, response); - if (wasAborted()) // Network error cancelled the request. - return; - - m_request = newRequest.toNetworkRequest(m_resourceHandle->getInternal()->m_context.get()); + if (client->usesAsyncCallbacks()) { + setLoadingDeferred(true); + client->willSendRequestAsync(m_resourceHandle, newRequest, response); + } else { + client->willSendRequest(m_resourceHandle, newRequest, response); + continueAfterWillSendRequest(newRequest); + } } void QNetworkReplyHandler::forwardData() @@ -663,6 +700,15 @@ void QNetworkReplyHandler::forwardData() if (!client) return; + // We have to use didReceiveBuffer instead of didReceiveData + // See https://bugs.webkit.org/show_bug.cgi?id=118598 + // and https://bugs.webkit.org/show_bug.cgi?id=118448#c32 + // NetworkResourceLoader implements only didReceiveBuffer and sends it over IPC to WebProcess + + // See also https://codereview.qt-project.org/#/c/79565/ + // + // FIXME: We need API to get unflattened array of data segments to convert it to non-contiguous SharedBuffer + qint64 bytesAvailable = m_replyWrapper->reply()->bytesAvailable(); Vector<char> buffer(8128); // smaller than 8192 to fit within 8k including overhead. while (bytesAvailable > 0 && !m_queue.deferSignals()) { diff --git a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.h b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.h index 4619e4857..22bf18ed8 100644 --- a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.h +++ b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.h @@ -137,6 +137,9 @@ public: void forwardData(); void sendResponseIfNeeded(); + void continueWillSendRequest(const ResourceRequest&); + void continueDidReceiveResponse(); + static ResourceError errorForReply(QNetworkReply*); private Q_SLOTS: @@ -145,6 +148,7 @@ private Q_SLOTS: private: void start(); String httpMethod() const; + void continueAfterWillSendRequest(const ResourceRequest&); void redirect(ResourceResponse&, const QUrl&); bool wasAborted() const { return !m_resourceHandle; } QNetworkReply* sendNetworkRequest(QNetworkAccessManager*, const ResourceRequest&); diff --git a/Source/WebCore/platform/network/qt/ResourceHandleQt.cpp b/Source/WebCore/platform/network/qt/ResourceHandleQt.cpp index 64c5e47e8..b850e2327 100644 --- a/Source/WebCore/platform/network/qt/ResourceHandleQt.cpp +++ b/Source/WebCore/platform/network/qt/ResourceHandleQt.cpp @@ -135,6 +135,20 @@ void ResourceHandle::cancel() } } +void ResourceHandle::continueWillSendRequest(const ResourceRequest& request) +{ + ASSERT(!client() || client()->usesAsyncCallbacks()); + ASSERT(d->m_job); + d->m_job->continueWillSendRequest(request); +} + +void ResourceHandle::continueDidReceiveResponse() +{ + ASSERT(!client() || client()->usesAsyncCallbacks()); + ASSERT(d->m_job); + d->m_job->continueDidReceiveResponse(); +} + void ResourceHandle::platformLoadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials /*storedCredentials*/, ResourceError& error, ResourceResponse& response, Vector<char>& data) { WebCoreSynchronousLoader syncLoader(error, response, data); |