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/WebKit2/UIProcess/qt | |
parent | bd3f57b00bee3088971209a0ebc513eb1ef4ba14 (diff) |
Import WebKit commit 3040e0455efecd271f1aeef53cf287e75486a70d
Change-Id: I7df106cef8ce93ce33e49ad6fb0d202cd066d87c
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebKit2/UIProcess/qt')
29 files changed, 513 insertions, 129 deletions
diff --git a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp index 0dbaa651e..adac7bb80 100644 --- a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp +++ b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp @@ -41,7 +41,8 @@ namespace WebKit { static const int kScaleAnimationDurationMillis = 250; PageViewportControllerClientQt::PageViewportControllerClientQt(QQuickWebView* viewportItem, QQuickWebPage* pageItem) - : m_viewportItem(viewportItem) + : m_controller(nullptr) + , m_viewportItem(viewportItem) , m_pageItem(pageItem) , m_scaleChange(this) , m_scrollChange(this) diff --git a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h index 805fe7e40..f1b8afd15 100644 --- a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h +++ b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h @@ -54,7 +54,7 @@ public: void didChangeVisibleContents() final; void didChangeViewportAttributes() final; - virtual void setController(PageViewportController* controller) { m_controller = controller; } + void setController(PageViewportController* controller) { m_controller = controller; } // Additional methods currently only relevant in the QQuick context. void touchBegin(); diff --git a/Source/WebKit2/UIProcess/qt/QrcSchemeHandler.cpp b/Source/WebKit2/UIProcess/qt/QrcSchemeHandler.cpp new file mode 100644 index 000000000..9b07e3e32 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/QrcSchemeHandler.cpp @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2017 Konstantin Tokarev <annulen@yandex.ru> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "QrcSchemeHandler.h" + +#include <QCoreApplication> +#include <QFile> +#include <QFileInfo> +#include <QMimeDatabase> +#include <QNetworkReply> +#include <WebCore/ResourceError.h> +#include <WebCore/ResourceResponse.h> +#include <WebCore/SharedBuffer.h> + +using namespace WebCore; + +namespace WebKit { + +Ref<QrcSchemeHandler> QrcSchemeHandler::create() +{ + return adoptRef(*new QrcSchemeHandler()); +} + +static void sendResponse(WebURLSchemeHandlerTask& task, const QString& fileName, const QByteArray& fileData) +{ + QMimeDatabase mimeDb; + QMimeType mimeType = mimeDb.mimeTypeForFileNameAndData(fileName, fileData); + + WebCore::ResourceResponse response(task.request().url(), mimeType.name(), fileData.size(), String()); + auto result = task.didReceiveResponse(response); + ASSERT_UNUSED(result, result == WebURLSchemeHandlerTask::ExceptionType::None); +} + +static void sendError(WebURLSchemeHandlerTask& task) +{ + // QTFIXME: Move error templates to ErrorsQt + WebCore::ResourceError error("QtNetwork", QNetworkReply::ContentNotFoundError, task.request().url(), + QCoreApplication::translate("QWebFrame", "File does not exist")); + + auto result = task.didComplete(error); + ASSERT_UNUSED(result, result == WebURLSchemeHandlerTask::ExceptionType::None); +} + +void QrcSchemeHandler::platformStartTask(WebPageProxy& page, WebURLSchemeHandlerTask& task) +{ + QString fileName = ':' + QString(task.request().url().path()); + QByteArray fileData; + + { + QFile file(fileName); + QFileInfo fileInfo(file); + if (fileInfo.isDir() || !file.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) { + sendError(task); + return; + } + fileData = file.readAll(); + } + + sendResponse(task, fileName, fileData); + + // TODO: Wrap SharedBuffer around QByteArray when it's possible + auto result = task.didReceiveData(*SharedBuffer::create(fileData.data(), fileData.size())); + ASSERT_UNUSED(result, result == WebURLSchemeHandlerTask::ExceptionType::None); + + result = task.didComplete(WebCore::ResourceError()); + ASSERT_UNUSED(result, result == WebURLSchemeHandlerTask::ExceptionType::None); +} + +void QrcSchemeHandler::platformStopTask(WebPageProxy&, WebURLSchemeHandlerTask&) +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/QrcSchemeHandler.h b/Source/WebKit2/UIProcess/qt/QrcSchemeHandler.h new file mode 100644 index 000000000..2350c97b3 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/QrcSchemeHandler.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2017 Konstantin Tokarev <annulen@yandex.ru> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "WebURLSchemeHandler.h" + +namespace WebKit { + +class QrcSchemeHandler final : public WebURLSchemeHandler { +public: + static Ref<QrcSchemeHandler> create(); + +private: + QrcSchemeHandler() = default; + + void platformStartTask(WebPageProxy&, WebURLSchemeHandlerTask&) final; + void platformStopTask(WebPageProxy&, WebURLSchemeHandlerTask&) final; +}; + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp b/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp index 6d1949830..5043a170f 100644 --- a/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp +++ b/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp @@ -417,7 +417,7 @@ bool QtDialogRunner::createDialog(QQmlComponent* component, QObject* contextObje // This makes both "message" and "model.message" work for the dialog, // just like QtQuick's ListView delegates. contextObject->setParent(m_dialogContext.get()); - m_dialogContext->setContextProperty(QLatin1String("model"), contextObject); + m_dialogContext->setContextProperty(QStringLiteral("model"), contextObject); m_dialogContext->setContextObject(contextObject); QObject* object = component->beginCreate(m_dialogContext.get()); diff --git a/Source/WebKit2/UIProcess/qt/QtDownloadManager.cpp b/Source/WebKit2/UIProcess/qt/QtDownloadManager.cpp index 514a3e554..c5b7ef1da 100644 --- a/Source/WebKit2/UIProcess/qt/QtDownloadManager.cpp +++ b/Source/WebKit2/UIProcess/qt/QtDownloadManager.cpp @@ -39,16 +39,16 @@ static inline QtDownloadManager* toQtDownloadManager(const void* clientInfo) QtDownloadManager::QtDownloadManager(WKContextRef context) { - WKContextDownloadClient downloadClient; - memset(&downloadClient, 0, sizeof(WKContextDownloadClient)); - downloadClient.version = kWKContextDownloadClientCurrentVersion; - downloadClient.clientInfo = this; + WKContextDownloadClientV0 downloadClient; + memset(&downloadClient, 0, sizeof(WKContextDownloadClientV0)); + downloadClient.base.version = 0; + downloadClient.base.clientInfo = this; downloadClient.didReceiveResponse = didReceiveResponse; downloadClient.didReceiveData = didReceiveDataForDownload; downloadClient.didCreateDestination = didCreateDestination; downloadClient.didFinish = didFinishDownload; downloadClient.didFail = didFailDownload; - WKContextSetDownloadClient(context, &downloadClient); + WKContextSetDownloadClient(context, &downloadClient.base); } QtDownloadManager::~QtDownloadManager() diff --git a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp index d5afa7996..c4edb793e 100644 --- a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp @@ -88,7 +88,7 @@ void QtPageClient::pageDidRequestScroll(const IntPoint& pos) QQuickWebViewPrivate::get(m_webView)->pageDidRequestScroll(pos); } -void QtPageClient::processDidCrash() +void QtPageClient::processDidExit() { QQuickWebViewPrivate::get(m_webView)->processDidCrash(); } @@ -98,7 +98,7 @@ void QtPageClient::didRelaunchProcess() QQuickWebViewPrivate::get(m_webView)->didRelaunchProcess(); } -void QtPageClient::didChangeContentsSize(const IntSize& newSize) +void QtPageClient::didChangeContentSize(const IntSize& newSize) { PageViewportController* pvc = QQuickWebViewPrivate::get(m_webView)->viewportController(); if (pvc) @@ -199,12 +199,12 @@ FloatRect QtPageClient::convertToUserSpace(const FloatRect& rect) return rect; } -IntPoint QtPageClient::screenToWindow(const IntPoint& point) +IntPoint QtPageClient::screenToRootView(const IntPoint& point) { return point; } -IntRect QtPageClient::windowToScreen(const IntRect& rect) +IntRect QtPageClient::rootViewToScreen(const IntRect& rect) { return rect; } @@ -220,7 +220,7 @@ std::unique_ptr<WebContextMenuProxy> QtPageClient::createContextMenuProxy(WebPag } #if ENABLE(INPUT_TYPE_COLOR) -PassRefPtr<WebColorPicker> QtPageClient::createColorPicker(WebPageProxy* webPageProxy, const WebCore::Color& initialColor, const WebCore::IntRect& elementRect) +RefPtr<WebColorPicker> QtPageClient::createColorPicker(WebPageProxy* webPageProxy, const WebCore::Color& initialColor, const WebCore::IntRect& elementRect) { return WebColorPickerQt::create(webPageProxy, m_webView, initialColor, elementRect); } @@ -267,6 +267,43 @@ void QtPageClient::doneWithTouchEvent(const NativeWebTouchEvent& event, bool was } #endif +WebFullScreenManagerProxyClient& QtPageClient::fullScreenManagerProxyClient() +{ + return *this; +} + +// QTFIXME: #419 +void QtPageClient::closeFullScreenManager() +{ + notImplemented(); +} + +bool QtPageClient::isFullScreen() +{ + notImplemented(); + return false; +} + +void QtPageClient::enterFullScreen() +{ + notImplemented(); +} + +void QtPageClient::exitFullScreen() +{ + notImplemented(); +} + +void QtPageClient::beganEnterFullScreen(const IntRect& initialFrame, const IntRect& finalFrame) +{ + notImplemented(); +} + +void QtPageClient::beganExitFullScreen(const IntRect& initialFrame, const IntRect& finalFrame) +{ + notImplemented(); +} + void QtPageClient::displayView() { // FIXME: Implement. @@ -328,4 +365,84 @@ void QtPageClient::updateAcceleratedCompositingMode(const LayerTreeContext&) // FIXME: Implement. } +void QtPageClient::requestScroll(const FloatPoint& scrollPosition, const IntPoint& scrollOrigin, bool isProgrammaticScroll) +{ +} + +void QtPageClient::didCommitLoadForMainFrame(const WTF::String& mimeType, bool useCustomContentProvider) +{ +} + +void QtPageClient::willEnterAcceleratedCompositingMode() +{ +} + +void QtPageClient::didFinishLoadingDataForCustomContentProvider(const WTF::String& suggestedFilename, const IPC::DataReference&) +{ +} + +void QtPageClient::navigationGestureDidBegin() +{ +} + +void QtPageClient::navigationGestureWillEnd(bool willNavigate, WebKit::WebBackForwardListItem&) +{ +} + +void QtPageClient::navigationGestureDidEnd(bool willNavigate, WebKit::WebBackForwardListItem&) +{ +} + +void QtPageClient::navigationGestureDidEnd() +{ +} + +void QtPageClient::willRecordNavigationSnapshot(WebKit::WebBackForwardListItem&) +{ +} + +void QtPageClient::didRemoveNavigationGestureSnapshot() +{ +} + +void QtPageClient::didFirstVisuallyNonEmptyLayoutForMainFrame() +{ +} + +void QtPageClient::didFinishLoadForMainFrame() +{ +} + +void QtPageClient::didFailLoadForMainFrame() +{ +} + +void QtPageClient::didSameDocumentNavigationForMainFrame(WebKit::SameDocumentNavigationType) +{ +} + +void QtPageClient::didChangeBackgroundColor() +{ +} + +void QtPageClient::refView() +{ +} + +void QtPageClient::derefView() +{ +} + +#if ENABLE(VIDEO) && USE(GSTREAMER) +bool QtPageClient::decidePolicyForInstallMissingMediaPluginsPermissionRequest(WebKit::InstallMissingMediaPluginsPermissionRequest&) +{ + // QTFIXME + return false; +} +#endif + +void QtPageClient::didRestoreScrollPosition() +{ +} + } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/QtPageClient.h b/Source/WebKit2/UIProcess/qt/QtPageClient.h index a30b25dd3..3467ceaa9 100644 --- a/Source/WebKit2/UIProcess/qt/QtPageClient.h +++ b/Source/WebKit2/UIProcess/qt/QtPageClient.h @@ -22,6 +22,7 @@ #define QtPageClient_h #include "PageClient.h" +#include "WebFullScreenManagerProxy.h" class QQuickWebView; @@ -33,7 +34,11 @@ class QtWebPageEventHandler; class DefaultUndoController; class ShareableBitmap; -class QtPageClient final : public PageClient { +class QtPageClient final : public PageClient +#if ENABLE(FULLSCREEN_API) + , public WebFullScreenManagerProxyClient +#endif +{ public: QtPageClient(); ~QtPageClient(); @@ -47,13 +52,13 @@ public: bool isViewFocused() override; bool isViewVisible() override; void pageDidRequestScroll(const WebCore::IntPoint&) override; - void didChangeContentsSize(const WebCore::IntSize&) override; + void didChangeContentSize(const WebCore::IntSize&) override; void didChangeViewportProperties(const WebCore::ViewportAttributes&) override; - void processDidCrash() override; + void processDidExit() override; void didRelaunchProcess() override; std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy() override; void handleDownloadRequest(DownloadProxy*) override; - void handleApplicationSchemeRequest(PassRefPtr<QtRefCountedNetworkRequestData>) override; + void handleApplicationSchemeRequest(PassRefPtr<QtRefCountedNetworkRequestData>); // QTFIXME void handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) override; void handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors) override; void handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password) override; @@ -81,13 +86,13 @@ public: WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) override; WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) override; - WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) override; - WebCore::IntRect windowToScreen(const WebCore::IntRect&) override; + WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) override; + WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) override; void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) override { } RefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy&) override; std::unique_ptr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy&, const ContextMenuContextData&, const UserData&) override; #if ENABLE(INPUT_TYPE_COLOR) - virtual PassRefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&); + RefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&) override; #endif void pageTransitionViewportReady() override; void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) override; @@ -100,10 +105,46 @@ public: void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) override; #endif +#if ENABLE(FULLSCREEN_API) + WebFullScreenManagerProxyClient& fullScreenManagerProxyClient() final; + + // WebFullScreenManagerProxyClient + void closeFullScreenManager() final; + bool isFullScreen() final; + void enterFullScreen() final; + void exitFullScreen() final; + void beganEnterFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) final; + void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) final; +#endif + private: QQuickWebView* m_webView; QtWebPageEventHandler* m_eventHandler; DefaultUndoController* m_undoController; + + // PageClient interface +public: + void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll) override; + void didCommitLoadForMainFrame(const WTF::String& mimeType, bool useCustomContentProvider) override; + void willEnterAcceleratedCompositingMode() override; + void didFinishLoadingDataForCustomContentProvider(const WTF::String& suggestedFilename, const IPC::DataReference&) override; + void navigationGestureDidBegin() override; + void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&) override; + void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) override; + void navigationGestureDidEnd() override; + void willRecordNavigationSnapshot(WebBackForwardListItem&) override; + void didRemoveNavigationGestureSnapshot() override; + void didFirstVisuallyNonEmptyLayoutForMainFrame() override; + void didFinishLoadForMainFrame() override; + void didFailLoadForMainFrame() override; + void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) override; + void didChangeBackgroundColor() override; + void refView() override; + void derefView() override; +#if ENABLE(VIDEO) && USE(GSTREAMER) + bool decidePolicyForInstallMissingMediaPluginsPermissionRequest(InstallMissingMediaPluginsPermissionRequest&) override; +#endif + void didRestoreScrollPosition() override; }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/QtWebContext.cpp b/Source/WebKit2/UIProcess/qt/QtWebContext.cpp index 7d3ecc920..7030e13d9 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebContext.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebContext.cpp @@ -31,6 +31,7 @@ #include <WKAPICast.h> #include <WKArray.h> #include <WKContextPrivate.h> +#include <WKData.h> #include <WKPage.h> #include <WKString.h> #include <WKStringQt.h> @@ -50,7 +51,7 @@ static void initInspectorServer() #if ENABLE(INSPECTOR_SERVER) QString inspectorEnv = QString::fromUtf8(qgetenv("QTWEBKIT_INSPECTOR_SERVER")); if (!inspectorEnv.isEmpty()) { - QString bindAddress = QLatin1String("127.0.0.1"); + QString bindAddress = QStringLiteral("127.0.0.1"); QString portStr = inspectorEnv; int port = 0; @@ -69,7 +70,7 @@ static void initInspectorServer() bool success = WebInspectorServer::singleton().listen(bindAddress, port); if (success) { - QString inspectorServerUrl = QString::fromLatin1("http://%1:%2").arg(bindAddress).arg(port); + QString inspectorServerUrl = QStringLiteral("http://%1:%2").arg(bindAddress).arg(port); qWarning("Inspector server started successfully. Try pointing a WebKit browser to %s", qPrintable(inspectorServerUrl)); } else qWarning("Couldn't start the inspector server on bind address \"%s\" and port \"%d\". In case of invalid input, try something like: \"12345\" or \"192.168.2.14:12345\" (with the address of one of this host's interface).", qPrintable(bindAddress), port); @@ -90,7 +91,7 @@ static void globalInitialization() static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef messageBody, const void*) { if (!WKStringIsEqualToUTF8CString(messageName, "MessageFromNavigatorQtObject") -#ifdef HAVE_WEBCHANNEL +#if ENABLE(QT_WEBCHANNEL) && !WKStringIsEqualToUTF8CString(messageName, "MessageFromNavigatorQtWebChannelTransportObject") #endif ) @@ -104,26 +105,30 @@ static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messag WKArrayRef body = static_cast<WKArrayRef>(messageBody); ASSERT(WKArrayGetSize(body) == 2); ASSERT(WKGetTypeID(WKArrayGetItemAtIndex(body, 0)) == WKPageGetTypeID()); - ASSERT(WKGetTypeID(WKArrayGetItemAtIndex(body, 1)) == WKStringGetTypeID()); WKPageRef page = static_cast<WKPageRef>(WKArrayGetItemAtIndex(body, 0)); - WKStringRef str = static_cast<WKStringRef>(WKArrayGetItemAtIndex(body, 1)); - if (WKStringIsEqualToUTF8CString(messageName, "MessageFromNavigatorQtObject")) - QQuickWebViewPrivate::get(page)->didReceiveMessageFromNavigatorQtObject(str); -#ifdef HAVE_WEBCHANNEL - else if (WKStringIsEqualToUTF8CString(messageName, "MessageFromNavigatorQtWebChannelTransportObject")) - QQuickWebViewPrivate::get(page)->didReceiveMessageFromNavigatorQtWebChannelTransportObject(str); + if (WKStringIsEqualToUTF8CString(messageName, "MessageFromNavigatorQtObject")) { + ASSERT(WKGetTypeID(WKArrayGetItemAtIndex(body, 1)) == WKStringGetTypeID()); + WKStringRef data = static_cast<WKStringRef>(WKArrayGetItemAtIndex(body, 1)); + QQuickWebViewPrivate::get(page)->didReceiveMessageFromNavigatorQtObject(data); + } +#if ENABLE(QT_WEBCHANNEL) + else if (WKStringIsEqualToUTF8CString(messageName, "MessageFromNavigatorQtWebChannelTransportObject")) { + ASSERT(WKGetTypeID(WKArrayGetItemAtIndex(body, 1)) == WKDataGetTypeID()); + WKDataRef data = static_cast<WKDataRef>(WKArrayGetItemAtIndex(body, 1)); + QQuickWebViewPrivate::get(page)->didReceiveMessageFromNavigatorQtWebChannelTransportObject(data); + } #endif } static void initializeContextInjectedBundleClient(WKContextRef context) { - WKContextInjectedBundleClient injectedBundleClient; - memset(&injectedBundleClient, 0, sizeof(WKContextInjectedBundleClient)); - injectedBundleClient.version = kWKContextInjectedBundleClientCurrentVersion; + WKContextInjectedBundleClientV0 injectedBundleClient; + memset(&injectedBundleClient, 0, sizeof(WKContextInjectedBundleClientV0)); + injectedBundleClient.base.version = 0; injectedBundleClient.didReceiveMessageFromInjectedBundle = didReceiveMessageFromInjectedBundle; - WKContextSetInjectedBundleClient(context, &injectedBundleClient); + WKContextSetInjectedBundleClient(context, &injectedBundleClient.base); } QtWebContext::QtWebContext(WKContextRef context) @@ -155,10 +160,11 @@ QtWebContext* QtWebContext::defaultContext() WKContextSetCacheModel(wkContext.get(), kWKCacheModelDocumentBrowser); // Those paths have to be set before the first web process is spawned. - WKContextSetDatabaseDirectory(wkContext.get(), adoptWK(WKStringCreateWithQString(preparedStoragePath(DatabaseStorage))).get()); - WKContextSetLocalStorageDirectory(wkContext.get(), adoptWK(WKStringCreateWithQString(preparedStoragePath(LocalStorage))).get()); +// QTFIXME +// WKContextSetDatabaseDirectory(wkContext.get(), adoptWK(WKStringCreateWithQString(preparedStoragePath(DatabaseStorage))).get()); +// WKContextSetLocalStorageDirectory(wkContext.get(), adoptWK(WKStringCreateWithQString(preparedStoragePath(LocalStorage))).get()); WKContextSetCookieStorageDirectory(wkContext.get(), adoptWK(WKStringCreateWithQString(preparedStoragePath(CookieStorage))).get()); - WKContextSetDiskCacheDirectory(wkContext.get(), adoptWK(WKStringCreateWithQString(preparedStoragePath(DiskCacheStorage))).get()); +// WKContextSetDiskCacheDirectory(wkContext.get(), adoptWK(WKStringCreateWithQString(preparedStoragePath(DiskCacheStorage))).get()); s_defaultQtWebContext = QtWebContext::create(wkContext.get()); } @@ -177,6 +183,10 @@ QString QtWebContext::preparedStoragePath(StorageType type) { QString path; switch (type) { + case ApplicationCacheStorage: + path = defaultLocation(QStandardPaths::DataLocation) % QStringLiteral("Applications"); + QDir::root().mkpath(path); + break; case DatabaseStorage: path = defaultLocation(QStandardPaths::DataLocation) % QStringLiteral("Databases"); QDir::root().mkpath(path); @@ -190,7 +200,11 @@ QString QtWebContext::preparedStoragePath(StorageType type) QDir::root().mkpath(path); break; case DiskCacheStorage: +#if ENABLE(NETWORK_CACHE) + path = defaultLocation(QStandardPaths::CacheLocation) % QStringLiteral("WebKitCache"); +#else path = defaultLocation(QStandardPaths::CacheLocation) % QStringLiteral("DiskCache"); +#endif QDir::root().mkpath(path); break; case IconDatabaseStorage: diff --git a/Source/WebKit2/UIProcess/qt/QtWebContext.h b/Source/WebKit2/UIProcess/qt/QtWebContext.h index 4251f29e7..972e388a4 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebContext.h +++ b/Source/WebKit2/UIProcess/qt/QtWebContext.h @@ -36,11 +36,13 @@ public: ~QtWebContext(); enum StorageType { + ApplicationCacheStorage, DatabaseStorage, LocalStorage, CookieStorage, DiskCacheStorage, - IconDatabaseStorage + IconDatabaseStorage, + NetworkCacheStorage }; static QtWebContext* create(WKContextRef); diff --git a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp index f28fb4163..b641ab7f1 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp @@ -46,12 +46,12 @@ QtWebIconDatabaseClient::QtWebIconDatabaseClient(WKContextRef context) { m_iconDatabase = WKContextGetIconDatabase(context); - WKIconDatabaseClient iconDatabaseClient; - memset(&iconDatabaseClient, 0, sizeof(WKIconDatabaseClient)); - iconDatabaseClient.version = kWKIconDatabaseClientCurrentVersion; - iconDatabaseClient.clientInfo = this; + WKIconDatabaseClientV0 iconDatabaseClient; + memset(&iconDatabaseClient, 0, sizeof(WKIconDatabaseClientV0)); + iconDatabaseClient.base.version = 0; + iconDatabaseClient.base.clientInfo = this; iconDatabaseClient.didChangeIconForPageURL = didChangeIconForPageURL; - WKIconDatabaseSetIconDatabaseClient(m_iconDatabase, &iconDatabaseClient); + WKIconDatabaseSetIconDatabaseClient(m_iconDatabase, &iconDatabaseClient.base); // Triggers the startup of the icon database. WKRetainPtr<WKStringRef> path = adoptWK(WKStringCreateWithQString(QtWebContext::preparedStoragePath(QtWebContext::IconDatabaseStorage))); WKContextSetIconDatabasePath(context, path.get()); diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp index b56f475cc..d05649736 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp @@ -184,7 +184,7 @@ void QtWebPageEventHandler::handleHoverMoveEvent(QHoverEvent* ev) void QtWebPageEventHandler::handleDragEnterEvent(QDragEnterEvent* ev) { - m_webPageProxy->resetDragOperation(); + m_webPageProxy->resetCurrentDragInformation(); QTransform fromItemTransform = m_webPage->transformFromItem(); // FIXME: Should not use QCursor::pos() DragData dragData(ev->mimeData(), fromItemTransform.map(ev->pos()), QCursor::pos(), dropActionToDragOperation(ev->possibleActions())); @@ -199,7 +199,7 @@ void QtWebPageEventHandler::handleDragLeaveEvent(QDragLeaveEvent* ev) // FIXME: Should not use QCursor::pos() DragData dragData(0, IntPoint(), QCursor::pos(), DragOperationNone); m_webPageProxy->dragExited(dragData); - m_webPageProxy->resetDragOperation(); + m_webPageProxy->resetCurrentDragInformation(); ev->setAccepted(accepted); } @@ -212,8 +212,8 @@ void QtWebPageEventHandler::handleDragMoveEvent(QDragMoveEvent* ev) // FIXME: Should not use QCursor::pos() DragData dragData(ev->mimeData(), fromItemTransform.map(ev->pos()), QCursor::pos(), dropActionToDragOperation(ev->possibleActions())); m_webPageProxy->dragUpdated(dragData); - ev->setDropAction(dragOperationToDropAction(m_webPageProxy->dragSession().operation)); - if (m_webPageProxy->dragSession().operation != DragOperationNone) + ev->setDropAction(dragOperationToDropAction(m_webPageProxy->currentDragOperation())); + if (m_webPageProxy->currentDragOperation() != DragOperationNone) ev->accept(); ev->setAccepted(accepted); @@ -228,7 +228,7 @@ void QtWebPageEventHandler::handleDropEvent(QDropEvent* ev) SandboxExtension::Handle handle; SandboxExtension::HandleArray sandboxExtensionForUpload; m_webPageProxy->performDragOperation(dragData, String(), handle, sandboxExtensionForUpload); - ev->setDropAction(dragOperationToDropAction(m_webPageProxy->dragSession().operation)); + ev->setDropAction(dragOperationToDropAction(m_webPageProxy->currentDragOperation())); ev->accept(); ev->setAccepted(accepted); @@ -566,7 +566,9 @@ void QtWebPageEventHandler::handleInputEvent(const QInputEvent* event) // Early return since this was a touch-end event. return; - } else if (activeTouchPointCount == 1) { + } + + if (activeTouchPointCount == 1) { // If the pinch gesture recognizer was previously in active state the content might // be out of valid zoom boundaries, thus we need to finish the pinch gesture here. // This will resume the content to valid zoom levels before the pan gesture is started. @@ -642,4 +644,3 @@ void QtWebPageEventHandler::startDrag(const WebCore::DragData& dragData, PassRef } // namespace WebKit #include "moc_QtWebPageEventHandler.cpp" - diff --git a/Source/WebKit2/UIProcess/qt/QtWebPagePolicyClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebPagePolicyClient.cpp index 88a9436af..90e74fd9c 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPagePolicyClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPagePolicyClient.cpp @@ -35,13 +35,12 @@ namespace WebKit { QtWebPagePolicyClient::QtWebPagePolicyClient(WKPageRef pageRef, QQuickWebView* webView) : m_webView(webView) { - WKPagePolicyClient policyClient; - memset(&policyClient, 0, sizeof(WKPagePolicyClient)); - policyClient.version = kWKPagePolicyClientCurrentVersion; - policyClient.clientInfo = this; + WKPagePolicyClientV1 policyClient; + memset(&policyClient, 0, sizeof(WKPagePolicyClientV0)); + policyClient.base = { 1, this }; policyClient.decidePolicyForNavigationAction = decidePolicyForNavigationAction; policyClient.decidePolicyForResponse = decidePolicyForResponse; - WKPageSetPagePolicyClient(pageRef, &policyClient); + WKPageSetPagePolicyClient(pageRef, &policyClient.base); } void QtWebPagePolicyClient::decidePolicyForNavigationAction(const QUrl& url, Qt::MouseButton mouseButton, Qt::KeyboardModifiers keyboardModifiers, QQuickWebView::NavigationType navigationType, bool isMainFrame, WKFramePolicyListenerRef listener) @@ -121,7 +120,7 @@ static QQuickWebView::NavigationType toQuickWebViewNavigationType(WKFrameNavigat return QQuickWebView::OtherNavigation; } -void QtWebPagePolicyClient::decidePolicyForNavigationAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef, const void* clientInfo) +void QtWebPagePolicyClient::decidePolicyForNavigationAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKFrameRef originatingFrame, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef, const void* clientInfo) { WKRetainPtr<WKURLRef> frameURL(AdoptWK, WKFrameCopyURL(frame)); WKRetainPtr<WKURLRef> requestURL(AdoptWK, WKURLRequestCopyURL(request)); @@ -130,11 +129,10 @@ void QtWebPagePolicyClient::decidePolicyForNavigationAction(WKPageRef page, WKFr toQtWebPagePolicyClient(clientInfo)->decidePolicyForNavigationAction(qUrl, toQtMouseButton(mouseButton), toQtKeyboardModifiers(modifiers), toQuickWebViewNavigationType(navigationType), isMainFrame, listener); } -void QtWebPagePolicyClient::decidePolicyForResponse(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef, WKFramePolicyListenerRef listener, WKTypeRef, const void*) +void QtWebPagePolicyClient::decidePolicyForResponse(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef, bool canShowMIMEType, WKFramePolicyListenerRef listener, WKTypeRef, const void*) { String type = toImpl(response)->resourceResponse().mimeType(); - type.makeLower(); - bool canShowMIMEType = toImpl(frame)->canShowMIMEType(type); + type.convertToASCIILowercase(); // QTFIXME: See also FrameLoaderClientQt if (WKPageGetMainFrame(page) == frame) { if (canShowMIMEType) { diff --git a/Source/WebKit2/UIProcess/qt/QtWebPagePolicyClient.h b/Source/WebKit2/UIProcess/qt/QtWebPagePolicyClient.h index c9267508d..4e1d7f250 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPagePolicyClient.h +++ b/Source/WebKit2/UIProcess/qt/QtWebPagePolicyClient.h @@ -39,8 +39,8 @@ private: void decidePolicyForNavigationAction(const QUrl&, Qt::MouseButton, Qt::KeyboardModifiers, QQuickWebView::NavigationType, bool isMainFrame, WKFramePolicyListenerRef); // WKPagePolicyClient callbacks. - static void decidePolicyForNavigationAction(WKPageRef, WKFrameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef userData, const void* clientInfo); - static void decidePolicyForResponse(WKPageRef, WKFrameRef, WKURLResponseRef, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef userData, const void* clientInfo); + static void decidePolicyForNavigationAction(WKPageRef, WKFrameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKFrameRef, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef userData, const void* clientInfo); + static void decidePolicyForResponse(WKPageRef, WKFrameRef, WKURLResponseRef, WKURLRequestRef, bool, WKFramePolicyListenerRef, WKTypeRef userData, const void* clientInfo); QQuickWebView* m_webView; }; diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp index 67df10114..6630f6276 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp @@ -22,10 +22,9 @@ #include "QtWebPageSGNode.h" #include "CoordinatedGraphicsScene.h" +#include "WebPageProxy.h" #include <QtGui/QPolygonF> -#include <QtQuick/QQuickItem> -#include <QtQuick/QQuickWindow> #include <QtQuick/QSGSimpleRectNode> #include <WebCore/TransformationMatrix.h> @@ -88,7 +87,9 @@ public: bool mirrored = projection && (*projection)(0, 0) * (*projection)(1, 1) - (*projection)(0, 1) * (*projection)(1, 0) > 0; // FIXME: Support non-rectangular clippings. - coordinatedGraphicsScene()->paintToCurrentGLContext(renderMatrix, inheritedOpacity(), clipRect(), mirrored ? TextureMapper::PaintingMirrored : 0); + coordinatedGraphicsScene()->paintToCurrentGLContext(renderMatrix, inheritedOpacity(), clipRect(), + pageNode()->page().pageExtendedBackgroundColor(), pageNode()->page().drawsBackground(), FloatPoint(), + mirrored ? TextureMapper::PaintingMirrored : 0); } void releaseResources() @@ -163,8 +164,9 @@ private: RefPtr<CoordinatedGraphicsScene> m_scene; }; -QtWebPageSGNode::QtWebPageSGNode() - : m_contentsNode(0) +QtWebPageSGNode::QtWebPageSGNode(WebPageProxy& page) + : m_page(page) + , m_contentsNode(0) , m_backgroundNode(new QSGSimpleRectNode) , m_devicePixelRatio(1) { diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.h b/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.h index 830c6d64f..49c4c5000 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.h +++ b/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.h @@ -33,17 +33,20 @@ namespace WebKit { class ContentsSGNode; class CoordinatedGraphicsScene; +class WebPageProxy; class QtWebPageSGNode final : public QSGTransformNode { public: - QtWebPageSGNode(); + QtWebPageSGNode(WebPageProxy&); void setBackground(const QRectF&, const QColor&); void setScale(float); void setCoordinatedGraphicsScene(PassRefPtr<CoordinatedGraphicsScene>); qreal devicePixelRatio() const { return m_devicePixelRatio; } void setDevicePixelRatio(qreal devicePixelRatio) { m_devicePixelRatio = devicePixelRatio; } + const WebPageProxy& page() const { return m_page; } private: + Ref<WebPageProxy> m_page; ContentsSGNode* m_contentsNode; QSGSimpleRectNode* m_backgroundNode; qreal m_devicePixelRatio; diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp index 482076370..c58f20065 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp @@ -37,10 +37,10 @@ namespace WebKit { QtWebPageUIClient::QtWebPageUIClient(WKPageRef pageRef, QQuickWebView* webView) : m_webView(webView) { - WKPageUIClient uiClient; - memset(&uiClient, 0, sizeof(WKPageUIClient)); - uiClient.version = kWKPageUIClientCurrentVersion; - uiClient.clientInfo = this; + WKPageUIClientV1 uiClient; + memset(&uiClient, 0, sizeof(WKPageUIClientV1)); + uiClient.base.version = 1; + uiClient.base.clientInfo = this; uiClient.runJavaScriptAlert = runJavaScriptAlert; uiClient.runJavaScriptConfirm = runJavaScriptConfirm; uiClient.runJavaScriptPrompt = runJavaScriptPrompt; @@ -49,7 +49,7 @@ QtWebPageUIClient::QtWebPageUIClient(WKPageRef pageRef, QQuickWebView* webView) uiClient.exceededDatabaseQuota = exceededDatabaseQuota; uiClient.decidePolicyForGeolocationPermissionRequest = policyForGeolocationPermissionRequest; uiClient.decidePolicyForNotificationPermissionRequest = policyForNotificationPermissionRequest; - WKPageSetPageUIClient(pageRef, &uiClient); + WKPageSetPageUIClient(pageRef, &uiClient.base); } quint64 QtWebPageUIClient::exceededDatabaseQuota(const QString& databaseName, const QString& displayName, WKSecurityOriginRef securityOrigin, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage) diff --git a/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp b/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp index 7e343e179..4880ac119 100644 --- a/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp +++ b/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp @@ -80,12 +80,12 @@ void TextChecker::closeSpellDocumentWithTag(int64_t) notImplemented(); } -void TextChecker::checkSpellingOfString(int64_t, const UChar*, uint32_t, int32_t&, int32_t&) +void TextChecker::checkSpellingOfString(int64_t, StringView, int32_t&, int32_t&) { notImplemented(); } -void TextChecker::checkGrammarOfString(int64_t, const UChar*, uint32_t, Vector<WebCore::GrammarDetail>&, int32_t&, int32_t&) +void TextChecker::checkGrammarOfString(int64_t, StringView, Vector<WebCore::GrammarDetail>&, int32_t&, int32_t&) { notImplemented(); } diff --git a/Source/WebKit2/UIProcess/qt/WebColorPickerQt.cpp b/Source/WebKit2/UIProcess/qt/WebColorPickerQt.cpp index d23cff04a..031c32d9e 100644 --- a/Source/WebKit2/UIProcess/qt/WebColorPickerQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebColorPickerQt.cpp @@ -110,7 +110,7 @@ void WebColorPickerQt::createContext(QQmlComponent* component, QObject* contextO m_context.reset(new QQmlContext(baseContext)); contextObject->setParent(m_context.get()); - m_context->setContextProperty(QLatin1String("model"), contextObject); + m_context->setContextProperty(QStringLiteral("model"), contextObject); m_context->setContextObject(contextObject); } @@ -123,6 +123,12 @@ void WebColorPickerQt::setSelectedColor(const Color&) // And yes, the name sounds misleading but comes from WebCore. } +void WebColorPickerQt::showColorPicker(const Color&) +{ + // We use ENABLE(INPUT_TYPE_COLOR_POPOVER), so new color picker is created + // each time +} + void WebColorPickerQt::notifyColorSelected(const QColor& color) { if (!m_client) @@ -139,11 +145,6 @@ void WebColorPickerQt::endPicker() { m_colorChooser = nullptr; m_context = nullptr; - - if (!m_client) - return; - - m_client->didEndColorPicker(); } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebColorPickerQt.h b/Source/WebKit2/UIProcess/qt/WebColorPickerQt.h index 40181b6f0..0d57f7d3d 100644 --- a/Source/WebKit2/UIProcess/qt/WebColorPickerQt.h +++ b/Source/WebKit2/UIProcess/qt/WebColorPickerQt.h @@ -50,6 +50,7 @@ public: ~WebColorPickerQt(); void setSelectedColor(const WebCore::Color&) final; + void showColorPicker(const WebCore::Color&) final; public Q_SLOTS: void endPicker() final; diff --git a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp index 1ff57e9c9..b0eea135a 100644 --- a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp @@ -36,11 +36,7 @@ WebContextMenuProxyQt::WebContextMenuProxyQt(const ContextMenuContextData& conte { } -void WebContextMenuProxyQt::showContextMenu(const IntPoint&, const Vector<WebContextMenuItemData>&) -{ -} - -void WebContextMenuProxyQt::hideContextMenu() +void WebContextMenuProxyQt::show() { } diff --git a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h index a0cc82d0a..9a8645aa3 100644 --- a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h +++ b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h @@ -40,8 +40,7 @@ public: WebContextMenuProxyQt(const ContextMenuContextData&, const UserData&); private: - virtual void showContextMenu(const WebCore::IntPoint&, const Vector<WebContextMenuItemData>&); - virtual void hideContextMenu(); + void show() override; }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebGeolocationProviderQt.cpp b/Source/WebKit2/UIProcess/qt/WebGeolocationProviderQt.cpp index 7d05f043e..ca9cae747 100644 --- a/Source/WebKit2/UIProcess/qt/WebGeolocationProviderQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebGeolocationProviderQt.cpp @@ -46,16 +46,16 @@ WebGeolocationProviderQt* WebGeolocationProviderQt::create(WKGeolocationManagerR return new WebGeolocationProviderQt(manager); } -WKGeolocationProvider* WebGeolocationProviderQt::provider(const WebGeolocationProviderQt* location) +WKGeolocationProviderBase* WebGeolocationProviderQt::provider(const WebGeolocationProviderQt* location) { - static WKGeolocationProvider provider = { - 0, // This features the version. - location, // This points to the object implementer. + static WKGeolocationProviderV0 provider = { + { 0, // This features the version. + location }, // This points to the object implementer. locationStartUpdating, // The callbacks are next. locationStopUpdating }; - return &provider; + return &provider.base; } WebGeolocationProviderQt::WebGeolocationProviderQt(WKGeolocationManagerRef manager) diff --git a/Source/WebKit2/UIProcess/qt/WebGeolocationProviderQt.h b/Source/WebKit2/UIProcess/qt/WebGeolocationProviderQt.h index 9f1b13c87..035eff0cd 100644 --- a/Source/WebKit2/UIProcess/qt/WebGeolocationProviderQt.h +++ b/Source/WebKit2/UIProcess/qt/WebGeolocationProviderQt.h @@ -37,7 +37,7 @@ class WebGeolocationProviderQt final : public QObject { Q_OBJECT public: static WebGeolocationProviderQt* create(WKGeolocationManagerRef); - static WKGeolocationProvider* provider(const WebGeolocationProviderQt*); + static WKGeolocationProviderBase* provider(const WebGeolocationProviderQt*); virtual ~WebGeolocationProviderQt(); diff --git a/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp index 6a520c383..2de52d2c4 100644 --- a/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp @@ -26,8 +26,6 @@ #include "config.h" #include "WebInspectorProxy.h" -#if ENABLE(INSPECTOR) - #include <WebCore/NotImplemented.h> #include <wtf/text/WTFString.h> @@ -49,6 +47,11 @@ void WebInspectorProxy::platformDidClose() notImplemented(); } +void WebKit::WebInspectorProxy::platformInvalidate() +{ + notImplemented(); +} + void WebInspectorProxy::platformHide() { notImplemented(); @@ -107,7 +110,7 @@ void WebInspectorProxy::platformSetAttachedWindowWidth(unsigned) notImplemented(); } -void WebInspectorProxy::platformSetToolbarHeight(unsigned) +void WebKit::WebInspectorProxy::platformStartWindowDrag() { notImplemented(); } @@ -122,18 +125,22 @@ void WebInspectorProxy::platformAppend(const String&, const String&) notImplemented(); } -String WebInspectorProxy::inspectorPageURL() const +String WebInspectorProxy::inspectorPageURL() { notImplemented(); return String(); } -String WebInspectorProxy::inspectorBaseURL() const +String WebInspectorProxy::inspectorTestPageURL() { notImplemented(); return String(); } -} // namespace WebKit +String WebInspectorProxy::inspectorBaseURL() +{ + notImplemented(); + return String(); +} -#endif // ENABLE(INSPECTOR) +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp index 541cca01f..d3eeb5962 100644 --- a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp @@ -32,6 +32,7 @@ #include "WebKitVersion.h" #include "WebPageMessages.h" #include "WebProcessProxy.h" +#include "WebsiteDataStore.h" #include <WebCore/Editor.h> #include <WebCore/NotImplemented.h> @@ -45,45 +46,37 @@ using namespace WebCore; namespace WebKit { +void WebPageProxy::platformInitialize() +{ +} + String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent) { return UserAgentQt::standardUserAgent(applicationNameForUserAgent, WEBKIT_MAJOR_VERSION, WEBKIT_MINOR_VERSION); } -void WebPageProxy::saveRecentSearches(const String&, const Vector<String>&) +void WebPageProxy::saveRecentSearches(const String&, const Vector<WebCore::RecentSearch>&) { notImplemented(); } -void WebPageProxy::loadRecentSearches(const String&, Vector<String>&) +void WebPageProxy::loadRecentSearches(const String&, Vector<WebCore::RecentSearch>&) { notImplemented(); } -void WebPageProxy::registerApplicationScheme(const String& scheme) +void WebsiteDataStore::platformRemoveRecentSearches(std::chrono::system_clock::time_point oldestTimeToRemove) { - process().send(Messages::WebPage::RegisterApplicationScheme(scheme), m_pageID); + notImplemented(); } -void WebPageProxy::resolveApplicationSchemeRequest(QtNetworkRequestData request) +void WebPageProxy::editorStateChanged(const EditorState& editorState) { -#if HAVE(QTQUICK) - RefPtr<QtRefCountedNetworkRequestData> requestData = adoptRef(new QtRefCountedNetworkRequestData(request)); - m_applicationSchemeRequests.add(requestData); - static_cast<QtPageClient*>(m_pageClient)->handleApplicationSchemeRequest(requestData); -#endif -} + m_editorState = editorState; -void WebPageProxy::sendApplicationSchemeReply(const QQuickNetworkReply* reply) -{ -#if HAVE(QTQUICK) - RefPtr<QtRefCountedNetworkRequestData> requestData = reply->networkRequestData(); - if (m_applicationSchemeRequests.contains(requestData)) { - RefPtr<QtRefCountedNetworkReplyData> replyData = reply->networkReplyData(); - process().send(Messages::WebPage::ApplicationSchemeReply(replyData->data()), pageID()); - m_applicationSchemeRequests.remove(requestData); - } -#endif + if (editorState.shouldIgnoreCompositionSelectionChange) + return; + m_pageClient.updateTextInputState(); } void WebPageProxy::authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) @@ -111,6 +104,11 @@ void WebPageProxy::windowedPluginGeometryDidChange(const WebCore::IntRect& frame { notImplemented(); } + +void WebPageProxy::windowedPluginVisibilityDidChange(bool isVisible, uint64_t windowID) +{ + notImplemented(); +} #endif void WebPageProxy::changeSelectedIndex(int32_t selectedIndex) diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp index e1d556e08..249de62ec 100644 --- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp @@ -342,7 +342,7 @@ void WebPopupMenuProxyQt::createContext(QQmlComponent* component, QObject* conte m_context.reset(new QQmlContext(baseContext)); contextObject->setParent(m_context.get()); - m_context->setContextProperty(QLatin1String("model"), contextObject); + m_context->setContextProperty(QStringLiteral("model"), contextObject); m_context->setContextObject(contextObject); } diff --git a/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp b/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp index 35dc7ebb9..6072394cb 100644 --- a/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp @@ -25,7 +25,10 @@ #include "config.h" #include "WebPreferences.h" + +#include "WebPreferencesKeys.h" #include <QFont> +#include <WebCore/NotImplemented.h> namespace WebKit { @@ -62,22 +65,51 @@ void WebPreferences::platformInitializeStore() void WebPreferences::platformUpdateStringValueForKey(const String&, const String&) { + notImplemented(); } void WebPreferences::platformUpdateBoolValueForKey(const String&, bool) { + notImplemented(); } void WebPreferences::platformUpdateUInt32ValueForKey(const String&, uint32_t) { + notImplemented(); } void WebPreferences::platformUpdateDoubleValueForKey(const String&, double) { + notImplemented(); } void WebPreferences::platformUpdateFloatValueForKey(const String&, float) { + notImplemented(); +} + +bool WebPreferences::platformGetStringUserValueForKey(const String&, String&) +{ + notImplemented(); + return false; +} + +bool WebPreferences::platformGetBoolUserValueForKey(const String&, bool&) +{ + notImplemented(); + return false; +} + +bool WebPreferences::platformGetUInt32UserValueForKey(const String&, uint32_t&) +{ + notImplemented(); + return false; +} + +bool WebPreferences::platformGetDoubleUserValueForKey(const String&, double&) +{ + notImplemented(); + return false; } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebProcessPoolQt.cpp b/Source/WebKit2/UIProcess/qt/WebProcessPoolQt.cpp index 11ef5e380..e2662a7d7 100644 --- a/Source/WebKit2/UIProcess/qt/WebProcessPoolQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebProcessPoolQt.cpp @@ -27,10 +27,14 @@ #include "config.h" #include "WebProcessPool.h" +#include "NetworkProcessCreationParameters.h" +#include "QtWebContext.h" #include "WKSharedAPICast.h" +#include "WebCookieManagerProxy.h" #include "WebProcessCreationParameters.h" #include <QProcess> #include <WebCore/ApplicationCacheStorage.h> +#include <WebCore/Language.h> #if ENABLE(GEOLOCATION) #include "WebGeolocationManagerProxy.h" @@ -41,12 +45,14 @@ namespace WebKit { String WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory() { - const String cacheDirectory = WebCore::cacheStorage().cacheDirectory(); +// QTFIXME +// const String cacheDirectory = WebCore::cacheStorage().cacheDirectory(); - if (cacheDirectory.isEmpty()) - return diskCacheDirectory(); +// if (cacheDirectory.isEmpty()) +// return diskCacheDirectory(); - return cacheDirectory; +// return cacheDirectory; + return API::WebsiteDataStore::defaultApplicationCacheDirectory(); } void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters& parameters) @@ -62,15 +68,41 @@ void WebProcessPool::platformInvalidateContext() { } +void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationParameters& parameters) +{ + // QTFIXME + parameters.cookiePersistentStoragePath = QtWebContext::preparedStoragePath(QtWebContext::CookieStorage); + parameters.languages = WebCore::userPreferredLanguages(); +} String WebProcessPool::platformDefaultIconDatabasePath() const { - return String(); + return WebKit::QtWebContext::preparedStoragePath(WebKit::QtWebContext::IconDatabaseStorage); +} + +String WebProcessPool::legacyPlatformDefaultLocalStorageDirectory() +{ + return WebKit::QtWebContext::preparedStoragePath(WebKit::QtWebContext::LocalStorage); +} + +String WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory() +{ + return WebKit::QtWebContext::preparedStoragePath(WebKit::QtWebContext::DatabaseStorage); +} + +String WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory() +{ + return WebKit::QtWebContext::preparedStoragePath(WebKit::QtWebContext::DatabaseStorage); +} + +String WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory() +{ + return String(); // QTFIXME: Add MediaKeys path } -String WebProcessPool::platformDefaultLocalStorageDirectory() const +String WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory() { - return String(); + return WebKit::QtWebContext::preparedStoragePath(WebKit::QtWebContext::DiskCacheStorage); } } // namespace WebKit |