From 9daf1655d7e4eaaa6ed5f44055a4b4fd399fd25c Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Wed, 28 Sep 2016 16:39:37 +0300 Subject: Imported WebKit commit eb954cdcf58f9b915b2fcb6f8e4cb3a60650a4f3 Change-Id: I8dda875c38075d43b76fe3a21acb0ffa102bb82d Reviewed-by: Konstantin Tokarev --- .../NetworkProcess/Downloads/qt/DownloadQt.cpp | 82 +++++++ .../Downloads/qt/QtFileDownloader.cpp | 249 ++++++++++++++++++++ .../NetworkProcess/Downloads/qt/QtFileDownloader.h | 78 +++++++ .../NetworkProcess/NetworkResourceLoader.cpp | 4 +- Source/WebKit2/Platform/IPC/Connection.h | 2 - .../WebKit2/Platform/IPC/unix/ConnectionUnix.cpp | 76 +++--- Source/WebKit2/Platform/SharedMemory.h | 3 +- Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp | 36 ++- Source/WebKit2/PlatformQt.cmake | 260 +++++++++++++++++++++ Source/WebKit2/Shared/API/c/qt/WKImageQt.h | 4 +- Source/WebKit2/Shared/Downloads/qt/DownloadQt.cpp | 102 -------- .../Shared/Downloads/qt/QtFileDownloader.cpp | 249 -------------------- .../WebKit2/Shared/Downloads/qt/QtFileDownloader.h | 80 ------- Source/WebKit2/Shared/LayerTreeContext.h | 4 - Source/WebKit2/Shared/qt/ArgumentCodersQt.cpp | 2 +- Source/WebKit2/Shared/qt/ArgumentCodersQt.h | 2 +- Source/WebKit2/Shared/qt/LayerTreeContextQt.cpp | 63 ----- .../WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp | 2 +- Source/WebKit2/Shared/qt/NativeWebMouseEventQt.cpp | 2 +- Source/WebKit2/Shared/qt/NativeWebTouchEventQt.cpp | 2 +- Source/WebKit2/Shared/qt/NativeWebWheelEventQt.cpp | 2 +- Source/WebKit2/Shared/qt/PlatformCertificateInfo.h | 4 +- Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp | 8 +- Source/WebKit2/Shared/qt/QtNetworkReplyData.h | 6 +- Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp | 5 +- Source/WebKit2/Shared/qt/QtNetworkRequestData.h | 6 +- .../WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp | 15 +- Source/WebKit2/Shared/qt/WebEventFactory.h | 59 +++++ Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp | 11 +- Source/WebKit2/Shared/qt/WebEventFactoryQt.h | 59 ----- Source/WebKit2/Shared/qt/WebURLRequestQt.cpp | 42 ---- Source/WebKit2/Shared/qt/WebURLResponseQt.cpp | 42 ---- .../WebKit2/UIProcess/API/C/qt/WKIconDatabaseQt.h | 4 +- Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.h | 2 +- Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.h | 4 +- .../UIProcess/API/qt/qquicknetworkreply.cpp | 4 +- .../UIProcess/API/qt/qquicknetworkreply_p.h | 3 +- .../UIProcess/API/qt/qquicknetworkrequest.cpp | 1 - .../UIProcess/API/qt/qquicknetworkrequest_p.h | 3 +- .../UIProcess/API/qt/qquickurlschemedelegate_p.h | 2 - Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp | 6 +- Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp | 55 +++-- .../WebKit2/UIProcess/API/qt/qquickwebview_p_p.h | 16 +- .../UIProcess/API/qt/qtwebsecurityorigin.cpp | 6 +- .../UIProcess/API/qt/qtwebsecurityorigin_p.h | 1 - .../API/qt/qwebchannelwebkittransport.cpp | 9 +- .../API/qt/qwebchannelwebkittransport_p.h | 10 +- .../WebKit2/UIProcess/API/qt/qwebdownloaditem.cpp | 1 - Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h | 2 +- .../WebKit2/UIProcess/API/qt/qwebloadrequest.cpp | 1 - .../UIProcess/API/qt/qwebnavigationhistory.cpp | 17 +- .../UIProcess/API/qt/qwebnavigationhistory_p_p.h | 9 +- .../UIProcess/API/qt/qwebnavigationrequest.cpp | 1 - .../UIProcess/API/qt/qwebpermissionrequest.cpp | 6 +- .../UIProcess/API/qt/qwebpermissionrequest_p.h | 6 +- .../WebKit2/UIProcess/API/qt/qwebpreferences.cpp | 2 +- .../WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp | 4 +- .../WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h | 4 +- .../UIProcess/InspectorServer/WebSocketServer.h | 2 +- .../InspectorServer/qt/WebInspectorServerQt.cpp | 9 +- .../InspectorServer/qt/WebSocketServerQt.cpp | 9 +- .../UIProcess/Launcher/qt/ProcessLauncherQt.cpp | 11 +- .../WebKit2/UIProcess/Plugins/PluginInfoStore.cpp | 2 +- .../UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp | 12 +- .../Plugins/unix/PluginProcessProxyUnix.cpp | 5 +- .../UIProcess/Storage/LocalStorageDatabase.cpp | 5 +- Source/WebKit2/UIProcess/WebPageProxy.cpp | 5 +- Source/WebKit2/UIProcess/WebPageProxy.h | 7 +- Source/WebKit2/UIProcess/qt/BackingStoreQt.cpp | 2 +- .../qt/PageViewportControllerClientQt.cpp | 4 +- Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp | 11 +- Source/WebKit2/UIProcess/qt/QtDialogRunner.h | 7 +- Source/WebKit2/UIProcess/qt/QtPageClient.cpp | 11 +- Source/WebKit2/UIProcess/qt/QtPageClient.h | 101 ++++---- .../UIProcess/qt/QtPinchGestureRecognizer.cpp | 1 - Source/WebKit2/UIProcess/qt/QtWebContext.cpp | 3 +- Source/WebKit2/UIProcess/qt/QtWebError.cpp | 2 + Source/WebKit2/UIProcess/qt/QtWebError.h | 2 +- .../UIProcess/qt/QtWebIconDatabaseClient.cpp | 1 - .../WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp | 16 +- .../WebKit2/UIProcess/qt/QtWebPageEventHandler.h | 2 +- .../WebKit2/UIProcess/qt/QtWebPagePolicyClient.cpp | 1 - Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp | 9 +- Source/WebKit2/UIProcess/qt/QtWebPageSGNode.h | 7 +- Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp | 5 +- Source/WebKit2/UIProcess/qt/QtWebPageUIClient.h | 2 +- Source/WebKit2/UIProcess/qt/WebColorPickerQt.cpp | 12 +- Source/WebKit2/UIProcess/qt/WebColorPickerQt.h | 5 +- .../WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp | 11 +- .../WebKit2/UIProcess/qt/WebContextMenuProxyQt.h | 4 +- Source/WebKit2/UIProcess/qt/WebContextQt.cpp | 90 ------- .../UIProcess/qt/WebGeolocationProviderQt.h | 6 +- Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp | 16 +- .../WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp | 10 +- Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h | 11 +- Source/WebKit2/UIProcess/qt/WebProcessPoolQt.cpp | 76 ++++++ Source/WebKit2/UIProcess/qt/WebProcessProxyQt.cpp | 35 --- .../InjectedBundle/qt/InjectedBundleQt.cpp | 4 - .../Plugins/Netscape/unix/NetscapePluginUnix.cpp | 13 +- .../WebProcess/WebCoreSupport/WebEditorClient.cpp | 2 +- .../WebCoreSupport/WebFrameLoaderClient.cpp | 4 +- .../WebCoreSupport/qt/WebDragClientQt.cpp | 10 +- .../WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp | 35 ++- .../qt/WebFrameNetworkingContext.cpp | 2 +- .../WebCoreSupport/qt/WebFrameNetworkingContext.h | 12 +- .../WebProcess/WebPage/TapHighlightController.cpp | 12 +- .../WebProcess/WebPage/TapHighlightController.h | 11 +- Source/WebKit2/WebProcess/WebPage/WebPage.cpp | 10 +- Source/WebKit2/WebProcess/WebPage/WebPage.h | 1 + .../WebProcess/WebPage/qt/WebInspectorQt.cpp | 49 ---- .../WebProcess/WebPage/qt/WebInspectorUIQt.cpp | 48 ++++ Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp | 4 +- Source/WebKit2/WebProcess/qt/QtBuiltinBundle.cpp | 5 +- Source/WebKit2/WebProcess/qt/QtBuiltinBundle.h | 3 +- .../WebKit2/WebProcess/qt/QtNetworkAccessManager.h | 2 +- Source/WebKit2/WebProcess/qt/QtNetworkReply.cpp | 3 +- Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp | 19 +- Source/WebKit2/WebProcess/qt/WebProcessQt.cpp | 16 +- 118 files changed, 1262 insertions(+), 1273 deletions(-) create mode 100644 Source/WebKit2/NetworkProcess/Downloads/qt/DownloadQt.cpp create mode 100644 Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.cpp create mode 100644 Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.h create mode 100644 Source/WebKit2/PlatformQt.cmake delete mode 100644 Source/WebKit2/Shared/Downloads/qt/DownloadQt.cpp delete mode 100644 Source/WebKit2/Shared/Downloads/qt/QtFileDownloader.cpp delete mode 100644 Source/WebKit2/Shared/Downloads/qt/QtFileDownloader.h delete mode 100644 Source/WebKit2/Shared/qt/LayerTreeContextQt.cpp create mode 100644 Source/WebKit2/Shared/qt/WebEventFactory.h delete mode 100644 Source/WebKit2/Shared/qt/WebEventFactoryQt.h delete mode 100644 Source/WebKit2/Shared/qt/WebURLRequestQt.cpp delete mode 100644 Source/WebKit2/Shared/qt/WebURLResponseQt.cpp delete mode 100644 Source/WebKit2/UIProcess/qt/WebContextQt.cpp create mode 100644 Source/WebKit2/UIProcess/qt/WebProcessPoolQt.cpp delete mode 100644 Source/WebKit2/UIProcess/qt/WebProcessProxyQt.cpp delete mode 100644 Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp create mode 100644 Source/WebKit2/WebProcess/WebPage/qt/WebInspectorUIQt.cpp (limited to 'Source/WebKit2') diff --git a/Source/WebKit2/NetworkProcess/Downloads/qt/DownloadQt.cpp b/Source/WebKit2/NetworkProcess/Downloads/qt/DownloadQt.cpp new file mode 100644 index 000000000..9747f5210 --- /dev/null +++ b/Source/WebKit2/NetworkProcess/Downloads/qt/DownloadQt.cpp @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 "Download.h" + +#include "QtFileDownloader.h" +#include "WebProcess.h" +#include +#include +#include +#include +#include + +using namespace WebCore; + +namespace WebKit { + +void Download::start() +{ + QNetworkAccessManager* manager = WebProcess::singleton().networkAccessManager(); + ASSERT(manager); + ASSERT(!m_qtDownloader); + + m_qtDownloader = new QtFileDownloader(this, manager->get(m_request.toNetworkRequest())); + m_qtDownloader->init(); +} + +void Download::startWithHandle(ResourceHandle* handle, const ResourceResponse& resp) +{ + ASSERT(!m_qtDownloader); + m_qtDownloader = new QtFileDownloader(this, handle->getInternal()->m_job->release()); + m_qtDownloader->init(); +} + +void Download::cancel() +{ + ASSERT(m_qtDownloader); + m_qtDownloader->cancel(); +} + +void Download::platformInvalidate() +{ + ASSERT(m_qtDownloader); + m_qtDownloader->deleteLater(); + m_qtDownloader = 0; +} + +void Download::startTransfer(const String& destination) +{ + m_qtDownloader->startTransfer(destination); +} + +void Download::platformDidFinish() +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.cpp b/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.cpp new file mode 100644 index 000000000..0ec67704c --- /dev/null +++ b/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.cpp @@ -0,0 +1,249 @@ +/* + * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ +#include "config.h" +#include "QtFileDownloader.h" + +#include "DataReference.h" +#include "Download.h" +#include "HTTPParsers.h" +#include "MIMETypeRegistry.h" +#include +#include +#include +#include +#include +#include +#include + +using namespace WebCore; +using namespace WTF; + +namespace WebKit { + +QtFileDownloader::QtFileDownloader(Download* download, QNetworkReply* reply) + : m_download(download) + , m_reply(reply) + , m_error(QNetworkReply::NoError) + , m_headersRead(false) +{ +} + +QtFileDownloader::~QtFileDownloader() +{ + if (!m_destinationFile) + return; + + abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorAborted); +} + +void QtFileDownloader::init() +{ + connect(m_reply.get(), SIGNAL(readyRead()), SLOT(onReadyRead())); + connect(m_reply.get(), SIGNAL(finished()), SLOT(onFinished())); + connect(m_reply.get(), SIGNAL(error(QNetworkReply::NetworkError)), SLOT(onError(QNetworkReply::NetworkError))); +} + +QString QtFileDownloader::determineFilename() +{ + ASSERT(!m_destinationFile); + + QString filenameCandidate = filenameFromHTTPContentDisposition(QString::fromLatin1(m_reply->rawHeader("Content-Disposition"))); + if (filenameCandidate.isEmpty()) { + URL kurl = m_reply->url(); + filenameCandidate = decodeURLEscapeSequences(kurl.lastPathComponent()); + } + + if (filenameCandidate.isEmpty()) { + abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorCannotDetermineFilename); + return QString(); + } + + // Make sure that we remove possible "../.." parts in the given file name. + QFileInfo filenameFilter(filenameCandidate); + QString filename = filenameFilter.fileName(); + + if (filename.isEmpty()) { + abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorCannotDetermineFilename); + return QString(); + } + + return filename; +} + +void QtFileDownloader::startTransfer(const QString& decidedFilePath) +{ + ASSERT(!m_destinationFile); + + // Error might have occured during destination query. + if (m_error != QNetworkReply::NoError) { + abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorNetworkFailure); + return; + } + + if (decidedFilePath.isEmpty()) { + abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorCancelled); + return; + } + + auto downloadFile = std::make_unique(decidedFilePath); + + if (!downloadFile->open(QIODevice::WriteOnly | QIODevice::Truncate)) { + abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorCannotOpenFile); + return; + } + + // Assigning to m_destinationFile flags that either error or + // finished shall be called in the end. + m_destinationFile = WTFMove(downloadFile); + + m_download->didCreateDestination(m_destinationFile->fileName()); + + // We might have gotten readyRead already even before this function + // was called. + if (m_reply->bytesAvailable()) + onReadyRead(); + + // We might have gotten finished already even before this + // function was called. + if (m_reply->isFinished()) + onFinished(); +} + +void QtFileDownloader::abortDownloadWritingAndEmitError(QtFileDownloader::DownloadError errorCode) +{ + m_reply->abort(); + + // On network failures it's QNetworkReplyHandler::errorForReply who will handle errors. + if (errorCode == QtFileDownloader::DownloadErrorNetworkFailure) { + m_download->didFail(QNetworkReplyHandler::errorForReply(m_reply.get()), IPC::DataReference(0, 0)); + return; + } + + QString translatedErrorMessage; + switch (errorCode) { + case QtFileDownloader::DownloadErrorAborted: + translatedErrorMessage = QCoreApplication::translate("QtFileDownloader", "Download aborted"); + break; + case QtFileDownloader::DownloadErrorCannotWriteToFile: + translatedErrorMessage = QCoreApplication::translate("QtFileDownloader", "Cannot write to file"); + break; + case QtFileDownloader::DownloadErrorCannotOpenFile: + translatedErrorMessage = QCoreApplication::translate("QtFileDownloader", "Cannot open file for writing"); + break; + case QtFileDownloader::DownloadErrorDestinationAlreadyExists: + translatedErrorMessage = QCoreApplication::translate("QtFileDownloader", "Destination already exists"); + break; + case QtFileDownloader::DownloadErrorCancelled: + translatedErrorMessage = QCoreApplication::translate("QtFileDownloader", "Download cancelled by caller"); + break; + case QtFileDownloader::DownloadErrorCannotDetermineFilename: + translatedErrorMessage = QCoreApplication::translate("QtFileDownloader", "Cannot determine filename"); + break; + default: + ASSERT_NOT_REACHED(); + } + + ResourceError downloadError("Download", errorCode, m_reply->url(), translatedErrorMessage); + + m_download->didFail(downloadError, IPC::DataReference(0, 0)); +} + +void QtFileDownloader::handleDownloadResponse() +{ + // By API contract, QNetworkReply::metaDataChanged cannot really be trusted. + // Thus we need to call this upon receiving first data. + String contentType = m_reply->header(QNetworkRequest::ContentTypeHeader).toString(); + String encoding = extractCharsetFromMediaType(contentType); + String mimeType = extractMIMETypeFromMediaType(contentType); + String filename = determineFilename(); + + // If filename is empty it means determineFilename aborted and emitted an error. + if (filename.isEmpty()) + return; + + // Let's try to guess from the extension. + if (mimeType.isEmpty()) + mimeType = MIMETypeRegistry::getMIMETypeForPath(m_reply->url().path()); + + ResourceResponse response(m_reply->url(), mimeType, m_reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), encoding, filename); + m_download->didReceiveResponse(response); +} + +void QtFileDownloader::onReadyRead() +{ + if (m_destinationFile) { + QByteArray content = m_reply->readAll(); + if (content.size() <= 0) + return; + + qint64 bytesWritten = m_destinationFile->write(content); + + if (bytesWritten == -1) { + abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorCannotWriteToFile); + return; + } + + // There might a corner case to be fixed here if bytesWritten != content.size() + // does not actually represent an error. + ASSERT(bytesWritten == content.size()); + + m_download->didReceiveData(bytesWritten); + } else if (!m_headersRead) { + handleDownloadResponse(); + m_headersRead = true; + } +} + +void QtFileDownloader::onFinished() +{ + // If it's finished and we haven't even read the headers, it means we never got to onReadyRead and that we are + // probably dealing with the download of a local file or of a small file that was started with a handle. + if (!m_headersRead) { + handleDownloadResponse(); + m_headersRead = true; + return; + } + + if (!m_destinationFile) + return; + + m_destinationFile = nullptr; + + if (m_error == QNetworkReply::NoError) + m_download->didFinish(); + else if (m_error == QNetworkReply::OperationCanceledError) + abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorCancelled); + else + abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorNetworkFailure); +} + +void QtFileDownloader::onError(QNetworkReply::NetworkError code) +{ + m_error = code; +} + +void QtFileDownloader::cancel() +{ + m_reply->abort(); + // QtFileDownloader::onFinished() will be called and will raise a DownloadErrorCancelled. +} + +} // namespace WebKit +#include "moc_QtFileDownloader.cpp" diff --git a/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.h b/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.h new file mode 100644 index 000000000..2b096760c --- /dev/null +++ b/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef QtFileDownloader_h +#define QtFileDownloader_h + +#include +#include + +QT_BEGIN_NAMESPACE +class QFile; +class QNetworkAccessManager; +class QNetworkRequest; +QT_END_NAMESPACE + +namespace WebCore { +class ResourceError; +} + +namespace WebKit { +class Download; + +class QtFileDownloader : public QObject { + Q_OBJECT +public: + QtFileDownloader(Download*, QNetworkReply*); + virtual ~QtFileDownloader(); + void cancel(); + void init(); + void startTransfer(const QString& destination); + + enum DownloadError { + DownloadErrorAborted = 0, + DownloadErrorCannotWriteToFile, + DownloadErrorCannotOpenFile, + DownloadErrorDestinationAlreadyExists, + DownloadErrorCancelled, + DownloadErrorCannotDetermineFilename, + DownloadErrorNetworkFailure + }; + +private Q_SLOTS: + void onReadyRead(); + void onFinished(); + void onError(QNetworkReply::NetworkError); + +private: + void abortDownloadWritingAndEmitError(QtFileDownloader::DownloadError); + QString determineFilename(); + void handleDownloadResponse(); + + Download* m_download; + std::unique_ptr m_reply; + std::unique_ptr m_destinationFile; + QNetworkReply::NetworkError m_error; + bool m_headersRead; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp b/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp index b45e4d2bd..cef04f346 100644 --- a/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp +++ b/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp @@ -377,8 +377,8 @@ void NetworkResourceLoader::didFailLoading(const ResourceError& error) if (isSynchronous()) { m_synchronousLoadData->error = error; sendReplyToSynchronousRequest(*m_synchronousLoadData, nullptr); - } else - send(Messages::WebResourceLoader::DidFailResourceLoad(error)); + } else if (auto* connection = messageSenderConnection()) + connection->send(Messages::WebResourceLoader::DidFailResourceLoad(error), messageSenderDestinationID(), 0); cleanup(); } diff --git a/Source/WebKit2/Platform/IPC/Connection.h b/Source/WebKit2/Platform/IPC/Connection.h index f339067af..14cc8851d 100644 --- a/Source/WebKit2/Platform/IPC/Connection.h +++ b/Source/WebKit2/Platform/IPC/Connection.h @@ -341,9 +341,7 @@ private: bool processMessage(); Vector m_readBuffer; - size_t m_readBufferSize; Vector m_fileDescriptors; - size_t m_fileDescriptorsSize; int m_socketDescriptor; #if PLATFORM(GTK) GSocketMonitor m_socketMonitor; diff --git a/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp b/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp index c39086113..71f2e252f 100644 --- a/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp +++ b/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp @@ -135,10 +135,8 @@ private: void Connection::platformInitialize(Identifier identifier) { m_socketDescriptor = identifier; - m_readBuffer.resize(messageMaxSize); - m_readBufferSize = 0; - m_fileDescriptors.resize(attachmentMaxAmount); - m_fileDescriptorsSize = 0; + m_readBuffer.reserveInitialCapacity(messageMaxSize); + m_fileDescriptors.reserveInitialCapacity(attachmentMaxAmount); #if PLATFORM(QT) m_socketNotifier = 0; @@ -193,7 +191,7 @@ private: bool Connection::processMessage() { - if (m_readBufferSize < sizeof(MessageInfo)) + if (m_readBuffer.size() < sizeof(MessageInfo)) return false; uint8_t* messageData = m_readBuffer.data(); @@ -202,7 +200,7 @@ bool Connection::processMessage() messageData += sizeof(messageInfo); size_t messageLength = sizeof(MessageInfo) + messageInfo.attachmentCount() * sizeof(AttachmentInfo) + (messageInfo.isMessageBodyIsOutOfLine() ? 0 : messageInfo.bodySize()); - if (m_readBufferSize < messageLength) + if (m_readBuffer.size() < messageLength) return false; size_t attachmentFileDescriptorCount = 0; @@ -283,25 +281,25 @@ bool Connection::processMessage() processIncomingMessage(WTFMove(decoder)); - if (m_readBufferSize > messageLength) { - memmove(m_readBuffer.data(), m_readBuffer.data() + messageLength, m_readBufferSize - messageLength); - m_readBufferSize -= messageLength; + if (m_readBuffer.size() > messageLength) { + memmove(m_readBuffer.data(), m_readBuffer.data() + messageLength, m_readBuffer.size() - messageLength); + m_readBuffer.shrink(m_readBuffer.size() - messageLength); } else - m_readBufferSize = 0; + m_readBuffer.shrink(0); if (attachmentFileDescriptorCount) { - if (m_fileDescriptorsSize > attachmentFileDescriptorCount) { - memmove(m_fileDescriptors.data(), m_fileDescriptors.data() + attachmentFileDescriptorCount, (m_fileDescriptorsSize - attachmentFileDescriptorCount) * sizeof(int)); - m_fileDescriptorsSize -= attachmentFileDescriptorCount; + if (m_fileDescriptors.size() > attachmentFileDescriptorCount) { + memmove(m_fileDescriptors.data(), m_fileDescriptors.data() + attachmentFileDescriptorCount, (m_fileDescriptors.size() - attachmentFileDescriptorCount) * sizeof(int)); + m_fileDescriptors.shrink(m_fileDescriptors.size() - attachmentFileDescriptorCount); } else - m_fileDescriptorsSize = 0; + m_fileDescriptors.shrink(0); } return true; } -static ssize_t readBytesFromSocket(int socketDescriptor, uint8_t* buffer, int count, int* fileDescriptors, size_t* fileDescriptorsCount) +static ssize_t readBytesFromSocket(int socketDescriptor, Vector& buffer, Vector& fileDescriptors) { struct msghdr message; memset(&message, 0, sizeof(message)); @@ -314,8 +312,10 @@ static ssize_t readBytesFromSocket(int socketDescriptor, uint8_t* buffer, int co memset(attachmentDescriptorBuffer.get(), 0, sizeof(char) * message.msg_controllen); message.msg_control = attachmentDescriptorBuffer.get(); - iov[0].iov_base = buffer; - iov[0].iov_len = count; + size_t previousBufferSize = buffer.size(); + buffer.grow(buffer.capacity()); + iov[0].iov_base = buffer.data() + previousBufferSize; + iov[0].iov_len = buffer.size() - previousBufferSize; message.msg_iov = iov; message.msg_iovlen = 1; @@ -327,33 +327,29 @@ static ssize_t readBytesFromSocket(int socketDescriptor, uint8_t* buffer, int co if (errno == EINTR) continue; + buffer.shrink(previousBufferSize); return -1; } - bool found = false; struct cmsghdr* controlMessage; for (controlMessage = CMSG_FIRSTHDR(&message); controlMessage; controlMessage = CMSG_NXTHDR(&message, controlMessage)) { if (controlMessage->cmsg_level == SOL_SOCKET && controlMessage->cmsg_type == SCM_RIGHTS) { - *fileDescriptorsCount = (controlMessage->cmsg_len - CMSG_LEN(0)) / sizeof(int); - memcpy(fileDescriptors, CMSG_DATA(controlMessage), sizeof(int) * *fileDescriptorsCount); - - for (size_t i = 0; i < *fileDescriptorsCount; ++i) { - while (fcntl(fileDescriptors[i], F_SETFD, FD_CLOEXEC) == -1) { - if (errno != EINTR) { - ASSERT_NOT_REACHED(); - break; - } + size_t previousFileDescriptorsSize = fileDescriptors.size(); + size_t fileDescriptorsCount = (controlMessage->cmsg_len - CMSG_LEN(0)) / sizeof(int); + fileDescriptors.grow(fileDescriptors.size() + fileDescriptorsCount); + memcpy(fileDescriptors.data() + previousFileDescriptorsSize, CMSG_DATA(controlMessage), sizeof(int) * fileDescriptorsCount); + + for (size_t i = 0; i < fileDescriptorsCount; ++i) { + if (!setCloseOnExec(fileDescriptors[previousFileDescriptorsSize + i])) { + ASSERT_NOT_REACHED(); + break; } } - - found = true; break; } } - if (!found) - *fileDescriptorsCount = 0; - + buffer.shrink(previousBufferSize + bytesRead); return bytesRead; } @@ -367,10 +363,7 @@ void Connection::readyReadHandler() #endif while (true) { - size_t fileDescriptorsCount = 0; - size_t bytesToRead = m_readBuffer.size() - m_readBufferSize; - ssize_t bytesRead = readBytesFromSocket(m_socketDescriptor, m_readBuffer.data() + m_readBufferSize, bytesToRead, - m_fileDescriptors.data() + m_fileDescriptorsSize, &fileDescriptorsCount); + ssize_t bytesRead = readBytesFromSocket(m_socketDescriptor, m_readBuffer, m_fileDescriptors); if (bytesRead < 0) { // EINTR was already handled by readBytesFromSocket. @@ -384,9 +377,6 @@ void Connection::readyReadHandler() return; } - m_readBufferSize += bytesRead; - m_fileDescriptorsSize += fileDescriptorsCount; - if (!bytesRead) { connectionDidClose(); return; @@ -586,14 +576,14 @@ Connection::SocketPair Connection::createPlatformConnection(unsigned options) if (options & SetCloexecOnServer) { // Don't expose the child socket to the parent process. - while (fcntl(sockets[1], F_SETFD, FD_CLOEXEC) == -1) - RELEASE_ASSERT(errno != EINTR); + if (!setCloseOnExec(sockets[1])) + RELEASE_ASSERT_NOT_REACHED(); } if (options & SetCloexecOnClient) { // Don't expose the parent socket to potential future children. - while (fcntl(sockets[0], F_SETFD, FD_CLOEXEC) == -1) - RELEASE_ASSERT(errno != EINTR); + if (!setCloseOnExec(sockets[0])) + RELEASE_ASSERT_NOT_REACHED(); } SocketPair socketPair = { sockets[0], sockets[1] }; diff --git a/Source/WebKit2/Platform/SharedMemory.h b/Source/WebKit2/Platform/SharedMemory.h index 4fd58711f..165ecfae5 100644 --- a/Source/WebKit2/Platform/SharedMemory.h +++ b/Source/WebKit2/Platform/SharedMemory.h @@ -28,6 +28,7 @@ #include #include +#include #include #if PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL) @@ -122,7 +123,7 @@ private: Protection m_protection; #if USE(UNIX_DOMAIN_SOCKETS) - int m_fileDescriptor; + Optional m_fileDescriptor; bool m_isWrappingMap { false }; #elif OS(DARWIN) mach_port_t m_port; diff --git a/Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp b/Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp index 56835e766..220592fd1 100644 --- a/Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp +++ b/Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp @@ -152,11 +152,14 @@ RefPtr SharedMemory::map(const Handle& handle, Protection protecti { ASSERT(!handle.isNull()); - void* data = mmap(0, handle.m_attachment.size(), accessModeMMap(protection), MAP_SHARED, handle.m_attachment.fileDescriptor(), 0); + int fd = handle.m_attachment.releaseFileDescriptor(); + void* data = mmap(0, handle.m_attachment.size(), accessModeMMap(protection), MAP_SHARED, fd, 0); + closeWithRetry(fd); if (data == MAP_FAILED) return nullptr; - RefPtr instance = wrapMap(data, handle.m_attachment.size(), handle.m_attachment.releaseFileDescriptor()); + RefPtr instance = wrapMap(data, handle.m_attachment.size(), -1); + instance->m_fileDescriptor = Nullopt; instance->m_isWrappingMap = false; return instance; } @@ -173,33 +176,26 @@ RefPtr SharedMemory::wrapMap(void* data, size_t size, int fileDesc SharedMemory::~SharedMemory() { - if (!m_isWrappingMap) { - munmap(m_data, m_size); - closeWithRetry(m_fileDescriptor); - } + if (m_isWrappingMap) + return; + + munmap(m_data, m_size); + if (m_fileDescriptor) + closeWithRetry(m_fileDescriptor.value()); } bool SharedMemory::createHandle(Handle& handle, Protection) { ASSERT_ARG(handle, handle.isNull()); + ASSERT(m_fileDescriptor); // FIXME: Handle the case where the passed Protection is ReadOnly. // See https://bugs.webkit.org/show_bug.cgi?id=131542. - int duplicatedHandle; - while ((duplicatedHandle = dup(m_fileDescriptor)) == -1) { - if (errno != EINTR) { - ASSERT_NOT_REACHED(); - return false; - } - } - - while (fcntl(duplicatedHandle, F_SETFD, FD_CLOEXEC) == -1) { - if (errno != EINTR) { - ASSERT_NOT_REACHED(); - closeWithRetry(duplicatedHandle); - return false; - } + int duplicatedHandle = dupCloseOnExec(m_fileDescriptor.value()); + if (duplicatedHandle == -1) { + ASSERT_NOT_REACHED(); + return false; } handle.m_attachment = IPC::Attachment(duplicatedHandle, m_size); return true; diff --git a/Source/WebKit2/PlatformQt.cmake b/Source/WebKit2/PlatformQt.cmake new file mode 100644 index 000000000..38080b1a4 --- /dev/null +++ b/Source/WebKit2/PlatformQt.cmake @@ -0,0 +1,260 @@ +set(WebKit2_WebProcess_OUTPUT_NAME QtWebProcess) +set(WebKit2_NetworkProcess_OUTPUT_NAME QtWebNetworkProcess) +set(WebKit2_PluginProcess_OUTPUT_NAME QtWebPluginProcess) +set(WebKit2_DatabaseProcess_OUTPUT_NAME QtWebDatabaseProcess) + +#set(WebKit2_USE_PREFIX_HEADER ON) + +# FIXME: It should be in WebKitFS actually +set(FORWARDING_HEADERS_DIR "${DERIVED_SOURCES_DIR}/ForwardingHeaders") + +list(APPEND WebKit2_INCLUDE_DIRECTORIES + "${FORWARDING_HEADERS_DIR}" + + "${WEBCORE_DIR}/platform/graphics/opentype" + "${WEBCORE_DIR}/platform/graphics/qt" + "${WEBCORE_DIR}/platform/network/qt" + "${WEBCORE_DIR}/platform/qt" + + # The WebKit2 Qt APIs depend on qwebkitglobal.h, which lives in WebKit + "${WEBKIT_DIR}/qt/Api" + + "${WEBKIT2_DIR}/NetworkProcess/CustomProtocols/qt" + + "${WEBKIT2_DIR}/Shared/CoordinatedGraphics" + "${WEBKIT2_DIR}/Shared/qt" + "${WEBKIT2_DIR}/Shared/unix" + + "${WEBKIT2_DIR}/UIProcess/API/C/qt" + "${WEBKIT2_DIR}/UIProcess/API/qt" + "${WEBKIT2_DIR}/UIProcess/API/cpp/qt" + "${WEBKIT2_DIR}/UIProcess/CoordinatedGraphics" + "${WEBKIT2_DIR}/UIProcess/InspectorServer/qt" + "${WEBKIT2_DIR}/UIProcess/gstreamer" + "${WEBKIT2_DIR}/UIProcess/qt" + "${WEBKIT2_DIR}/WebProcess/WebCoreSupport/qt" + "${WEBKIT2_DIR}/WebProcess/WebPage/CoordinatedGraphics" + "${WEBKIT2_DIR}/WebProcess/qt" +) + +list(APPEND WebKit2_SOURCES + NetworkProcess/CustomProtocols/qt/CustomProtocolManagerImpl.cpp + NetworkProcess/CustomProtocols/qt/CustomProtocolManagerQt.cpp + + NetworkProcess/Downloads/qt/DownloadQt.cpp + NetworkProcess/Downloads/qt/QtFileDownloader.cpp + + NetworkProcess/qt/NetworkProcessMainQt.cpp + NetworkProcess/qt/NetworkProcessQt.cpp + NetworkProcess/qt/RemoteNetworkingContextQt.cpp + + Platform/qt/LoggingQt.cpp + Platform/qt/ModuleQt.cpp + + PluginProcess/qt/PluginControllerProxyQt.cpp + PluginProcess/qt/PluginProcessMainQt.cpp + PluginProcess/qt/PluginProcessQt.cpp + + Shared/API/c/qt/WKImageQt.cpp + + Shared/Authentication/qt/AuthenticationManagerQt.cpp + + Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp + Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp + Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp + Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp + + Shared/qt/ArgumentCodersQt.cpp + Shared/qt/NativeWebKeyboardEventQt.cpp + Shared/qt/NativeWebMouseEventQt.cpp + Shared/qt/NativeWebTouchEventQt.cpp + Shared/qt/NativeWebWheelEventQt.cpp + Shared/qt/ProcessExecutablePathQt.cpp + Shared/qt/QtNetworkReplyData.cpp + Shared/qt/QtNetworkRequestData.cpp + Shared/qt/ShareableBitmapQt.cpp + Shared/qt/WebCoreArgumentCodersQt.cpp + Shared/qt/WebEventFactoryQt.cpp + + Shared/unix/ChildProcessMain.cpp + + UIProcess/BackingStore.cpp + UIProcess/DefaultUndoController.cpp + UIProcess/DrawingAreaProxyImpl.cpp + UIProcess/LegacySessionStateCodingNone.cpp + + UIProcess/API/C/qt/WKIconDatabaseQt.cpp + + UIProcess/API/cpp/qt/WKStringQt.cpp + UIProcess/API/cpp/qt/WKURLQt.cpp + + UIProcess/API/qt/qquicknetworkreply.cpp + UIProcess/API/qt/qquicknetworkrequest.cpp + UIProcess/API/qt/qquickurlschemedelegate.cpp + UIProcess/API/qt/qquickwebpage.cpp + UIProcess/API/qt/qquickwebview.cpp + UIProcess/API/qt/qtwebsecurityorigin.cpp + UIProcess/API/qt/qwebchannelwebkittransport.cpp + UIProcess/API/qt/qwebdownloaditem.cpp + UIProcess/API/qt/qwebdownloaditem_p.h + UIProcess/API/qt/qwebdownloaditem_p_p.h + UIProcess/API/qt/qwebiconimageprovider.cpp + UIProcess/API/qt/qwebkittest.cpp + UIProcess/API/qt/qwebloadrequest.cpp + UIProcess/API/qt/qwebnavigationhistory.cpp + UIProcess/API/qt/qwebnavigationrequest.cpp + UIProcess/API/qt/qwebpermissionrequest.cpp + UIProcess/API/qt/qwebpreferences.cpp + + UIProcess/CoordinatedGraphics/CoordinatedDrawingAreaProxy.cpp + UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp + UIProcess/CoordinatedGraphics/PageViewportController.cpp + UIProcess/CoordinatedGraphics/WebPageProxyCoordinatedGraphics.cpp + + UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp + UIProcess/InspectorServer/qt/WebSocketServerQt.cpp + + UIProcess/Launcher/qt/ProcessLauncherQt.cpp + + UIProcess/Network/CustomProtocols/qt/CustomProtocolManagerProxyQt.cpp + + UIProcess/Plugins/qt/PluginProcessProxyQt.cpp + + UIProcess/Storage/StorageManager.cpp + + UIProcess/WebsiteData/unix/WebsiteDataStoreUnix.cpp + + UIProcess/gstreamer/InstallMissingMediaPluginsPermissionRequest.cpp + UIProcess/gstreamer/WebPageProxyGStreamer.cpp + + UIProcess/qt/BackingStoreQt.cpp + UIProcess/qt/PageViewportControllerClientQt.cpp + UIProcess/qt/QtDialogRunner.cpp + UIProcess/qt/QtDownloadManager.cpp + UIProcess/qt/QtGestureRecognizer.cpp + UIProcess/qt/QtPageClient.cpp + UIProcess/qt/QtPanGestureRecognizer.cpp + UIProcess/qt/QtPinchGestureRecognizer.cpp + UIProcess/qt/QtTapGestureRecognizer.cpp + UIProcess/qt/QtWebContext.cpp + UIProcess/qt/QtWebError.cpp + UIProcess/qt/QtWebIconDatabaseClient.cpp + UIProcess/qt/QtWebPageEventHandler.cpp + UIProcess/qt/QtWebPagePolicyClient.cpp + UIProcess/qt/QtWebPageSGNode.cpp + UIProcess/qt/QtWebPageUIClient.cpp + UIProcess/qt/TextCheckerQt.cpp + UIProcess/qt/WebColorPickerQt.cpp + UIProcess/qt/WebContextMenuProxyQt.cpp + UIProcess/qt/WebFullScreenManagerProxyQt.cpp + UIProcess/qt/WebGeolocationProviderQt.cpp + UIProcess/qt/WebInspectorProxyQt.cpp + UIProcess/qt/WebPageProxyQt.cpp + UIProcess/qt/WebPopupMenuProxyQt.cpp + UIProcess/qt/WebPreferencesQt.cpp + UIProcess/qt/WebProcessPoolQt.cpp + + WebProcess/Cookies/qt/WebCookieManagerQt.cpp + + WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp + + WebProcess/Plugins/Netscape/qt/PluginProxyQt.cpp + + WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp + WebProcess/WebCoreSupport/qt/WebDragClientQt.cpp + WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp + WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp + WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp + + WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp + WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp + WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp + + WebProcess/WebPage/gstreamer/WebPageGStreamer.cpp + + WebProcess/WebPage/qt/WebInspectorUIQt.cpp + WebProcess/WebPage/qt/WebPageQt.cpp + + WebProcess/qt/QtBuiltinBundle.cpp + WebProcess/qt/QtBuiltinBundlePage.cpp + WebProcess/qt/QtNetworkAccessManager.cpp + WebProcess/qt/QtNetworkReply.cpp + WebProcess/qt/SeccompFiltersWebProcessQt.cpp + WebProcess/qt/WebProcessMainQt.cpp + WebProcess/qt/WebProcessQt.cpp +) + +if (APPLE) + list(APPEND WebKit2_INCLUDE_DIRECTORIES + "${WEBKIT2_DIR}/Platform/IPC/mac" + "${WEBKIT2_DIR}/Platform/mac" + ) + list(APPEND WebKit2_SOURCES + Platform/IPC/mac/ConnectionMac.mm + + Platform/mac/MachUtilities.cpp + Platform/mac/SharedMemoryMac.cpp + ) +elseif (WIN32) + list(APPEND WebKit2_SOURCES + Platform/IPC/win/ConnectionWin.cpp + + Platform/win/SharedMemoryWin.cpp + ) +else () + list(APPEND WebKit2_SOURCES + Platform/IPC/unix/AttachmentUnix.cpp + Platform/IPC/unix/ConnectionUnix.cpp + + Platform/unix/SharedMemoryUnix.cpp + ) +endif () + +list(APPEND WebKit2_SYSTEM_INCLUDE_DIRECTORIES + ${GSTREAMER_INCLUDE_DIRS} + ${Qt5Quick_INCLUDE_DIRS} + ${Qt5Quick_PRIVATE_INCLUDE_DIRS} +) + +list(APPEND WebKit2_LIBRARIES + ${Qt5Positioning_LIBRARIES} + ${Qt5Quick_LIBRARIES} +) + +list(APPEND WebKit2_MESSAGES_IN_FILES + UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.messages.in + + WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.messages.in +) + +list(APPEND WebProcess_SOURCES + qt/MainQt.cpp +) + +# FIXME: Allow building without widgets +list(APPEND WebProcess_LIBRARIES + Qt5::Widgets + WebKitWidgets +) + +list(APPEND NetworkProcess_SOURCES + NetworkProcess/EntryPoint/qt/NetworkProcessMain.cpp +) + +# FIXME +list(APPEND DatabaseProcess_SOURCES + DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp +) + +list(APPEND PluginProcess_SOURCES + qt/PluginMainQt.cpp +) + +add_custom_target(WebKit2-forwarding-headers + COMMAND ${PERL_EXECUTABLE} ${WEBKIT2_DIR}/Scripts/generate-forwarding-headers.pl --include-path ${WEBKIT2_DIR} --output ${FORWARDING_HEADERS_DIR} --platform qt +) + +set(WEBKIT2_EXTRA_DEPENDENCIES + WebKit2-forwarding-headers +) + diff --git a/Source/WebKit2/Shared/API/c/qt/WKImageQt.h b/Source/WebKit2/Shared/API/c/qt/WKImageQt.h index 5abef4818..6bcc5a432 100644 --- a/Source/WebKit2/Shared/API/c/qt/WKImageQt.h +++ b/Source/WebKit2/Shared/API/c/qt/WKImageQt.h @@ -23,8 +23,8 @@ #define WKImageQt_h #include -#include -#include +#include +#include WK_EXPORT QImage WKImageCreateQImage(WKImageRef image); WK_EXPORT WKImageRef WKImageCreateFromQImage(const QImage& image); diff --git a/Source/WebKit2/Shared/Downloads/qt/DownloadQt.cpp b/Source/WebKit2/Shared/Downloads/qt/DownloadQt.cpp deleted file mode 100644 index 889e4712f..000000000 --- a/Source/WebKit2/Shared/Downloads/qt/DownloadQt.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. - * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) - * - * 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 "Download.h" - -#include "QtFileDownloader.h" -#include "WebProcess.h" -#include -#include -#include -#include -#include - -using namespace WebCore; - -namespace WebKit { - -void Download::start() -{ - QNetworkAccessManager* manager = WebProcess::shared().networkAccessManager(); - ASSERT(manager); - ASSERT(!m_qtDownloader); - - m_qtDownloader = new QtFileDownloader(this, adoptPtr(manager->get(m_request.toNetworkRequest()))); - m_qtDownloader->init(); -} - -void Download::startWithHandle(ResourceHandle* handle, const ResourceResponse& resp) -{ - ASSERT(!m_qtDownloader); - m_qtDownloader = new QtFileDownloader(this, adoptPtr(handle->getInternal()->m_job->release())); - m_qtDownloader->init(); -} - -void Download::cancel() -{ - ASSERT(m_qtDownloader); - m_qtDownloader->cancel(); -} - -void Download::platformInvalidate() -{ - ASSERT(m_qtDownloader); - m_qtDownloader->deleteLater(); - m_qtDownloader = 0; -} - -void Download::didDecideDestination(const String& destination, bool allowOverwrite) -{ - notImplemented(); -} - -void Download::startTransfer(const String& destination) -{ - m_qtDownloader->startTransfer(destination); -} - -void Download::platformDidFinish() -{ - notImplemented(); -} - -void Download::receivedCredential(const AuthenticationChallenge& authenticationChallenge, const Credential& credential) -{ - notImplemented(); -} - -void Download::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge& authenticationChallenge) -{ - notImplemented(); -} - -void Download::receivedCancellation(const AuthenticationChallenge& authenticationChallenge) -{ - notImplemented(); -} - -} // namespace WebKit diff --git a/Source/WebKit2/Shared/Downloads/qt/QtFileDownloader.cpp b/Source/WebKit2/Shared/Downloads/qt/QtFileDownloader.cpp deleted file mode 100644 index f16b0c2e5..000000000 --- a/Source/WebKit2/Shared/Downloads/qt/QtFileDownloader.cpp +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ -#include "config.h" -#include "QtFileDownloader.h" - -#include "DataReference.h" -#include "Download.h" -#include "HTTPParsers.h" -#include "MIMETypeRegistry.h" -#include -#include -#include -#include -#include -#include -#include - -using namespace WebCore; -using namespace WTF; - -namespace WebKit { - -QtFileDownloader::QtFileDownloader(Download* download, PassOwnPtr reply) - : m_download(download) - , m_reply(reply) - , m_error(QNetworkReply::NoError) - , m_headersRead(false) -{ -} - -QtFileDownloader::~QtFileDownloader() -{ - if (!m_destinationFile) - return; - - abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorAborted); -} - -void QtFileDownloader::init() -{ - connect(m_reply.get(), SIGNAL(readyRead()), SLOT(onReadyRead())); - connect(m_reply.get(), SIGNAL(finished()), SLOT(onFinished())); - connect(m_reply.get(), SIGNAL(error(QNetworkReply::NetworkError)), SLOT(onError(QNetworkReply::NetworkError))); -} - -QString QtFileDownloader::determineFilename() -{ - ASSERT(!m_destinationFile); - - QString filenameCandidate = filenameFromHTTPContentDisposition(QString::fromLatin1(m_reply->rawHeader("Content-Disposition"))); - if (filenameCandidate.isEmpty()) { - URL kurl = m_reply->url(); - filenameCandidate = decodeURLEscapeSequences(kurl.lastPathComponent()); - } - - if (filenameCandidate.isEmpty()) { - abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorCannotDetermineFilename); - return QString(); - } - - // Make sure that we remove possible "../.." parts in the given file name. - QFileInfo filenameFilter(filenameCandidate); - QString filename = filenameFilter.fileName(); - - if (filename.isEmpty()) { - abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorCannotDetermineFilename); - return QString(); - } - - return filename; -} - -void QtFileDownloader::startTransfer(const QString& decidedFilePath) -{ - ASSERT(!m_destinationFile); - - // Error might have occured during destination query. - if (m_error != QNetworkReply::NoError) { - abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorNetworkFailure); - return; - } - - if (decidedFilePath.isEmpty()) { - abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorCancelled); - return; - } - - OwnPtr downloadFile = adoptPtr(new QFile(decidedFilePath)); - - if (!downloadFile->open(QIODevice::WriteOnly | QIODevice::Truncate)) { - abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorCannotOpenFile); - return; - } - - // Assigning to m_destinationFile flags that either error or - // finished shall be called in the end. - m_destinationFile = downloadFile.release(); - - m_download->didCreateDestination(m_destinationFile->fileName()); - - // We might have gotten readyRead already even before this function - // was called. - if (m_reply->bytesAvailable()) - onReadyRead(); - - // We might have gotten finished already even before this - // function was called. - if (m_reply->isFinished()) - onFinished(); -} - -void QtFileDownloader::abortDownloadWritingAndEmitError(QtFileDownloader::DownloadError errorCode) -{ - m_reply->abort(); - - // On network failures it's QNetworkReplyHandler::errorForReply who will handle errors. - if (errorCode == QtFileDownloader::DownloadErrorNetworkFailure) { - m_download->didFail(QNetworkReplyHandler::errorForReply(m_reply.get()), CoreIPC::DataReference(0, 0)); - return; - } - - QString translatedErrorMessage; - switch (errorCode) { - case QtFileDownloader::DownloadErrorAborted: - translatedErrorMessage = QCoreApplication::translate("QtFileDownloader", "Download aborted"); - break; - case QtFileDownloader::DownloadErrorCannotWriteToFile: - translatedErrorMessage = QCoreApplication::translate("QtFileDownloader", "Cannot write to file"); - break; - case QtFileDownloader::DownloadErrorCannotOpenFile: - translatedErrorMessage = QCoreApplication::translate("QtFileDownloader", "Cannot open file for writing"); - break; - case QtFileDownloader::DownloadErrorDestinationAlreadyExists: - translatedErrorMessage = QCoreApplication::translate("QtFileDownloader", "Destination already exists"); - break; - case QtFileDownloader::DownloadErrorCancelled: - translatedErrorMessage = QCoreApplication::translate("QtFileDownloader", "Download cancelled by caller"); - break; - case QtFileDownloader::DownloadErrorCannotDetermineFilename: - translatedErrorMessage = QCoreApplication::translate("QtFileDownloader", "Cannot determine filename"); - break; - default: - ASSERT_NOT_REACHED(); - } - - ResourceError downloadError("Download", errorCode, m_reply->url().toString(), translatedErrorMessage); - - m_download->didFail(downloadError, CoreIPC::DataReference(0, 0)); -} - -void QtFileDownloader::handleDownloadResponse() -{ - // By API contract, QNetworkReply::metaDataChanged cannot really be trusted. - // Thus we need to call this upon receiving first data. - String contentType = m_reply->header(QNetworkRequest::ContentTypeHeader).toString(); - String encoding = extractCharsetFromMediaType(contentType); - String mimeType = extractMIMETypeFromMediaType(contentType); - String filename = determineFilename(); - - // If filename is empty it means determineFilename aborted and emitted an error. - if (filename.isEmpty()) - return; - - // Let's try to guess from the extension. - if (mimeType.isEmpty()) - mimeType = MIMETypeRegistry::getMIMETypeForPath(m_reply->url().path()); - - ResourceResponse response(m_reply->url(), mimeType, m_reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), encoding, filename); - m_download->didReceiveResponse(response); -} - -void QtFileDownloader::onReadyRead() -{ - if (m_destinationFile) { - QByteArray content = m_reply->readAll(); - if (content.size() <= 0) - return; - - qint64 bytesWritten = m_destinationFile->write(content); - - if (bytesWritten == -1) { - abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorCannotWriteToFile); - return; - } - - // There might a corner case to be fixed here if bytesWritten != content.size() - // does not actually represent an error. - ASSERT(bytesWritten == content.size()); - - m_download->didReceiveData(bytesWritten); - } else if (!m_headersRead) { - handleDownloadResponse(); - m_headersRead = true; - } -} - -void QtFileDownloader::onFinished() -{ - // If it's finished and we haven't even read the headers, it means we never got to onReadyRead and that we are - // probably dealing with the download of a local file or of a small file that was started with a handle. - if (!m_headersRead) { - handleDownloadResponse(); - m_headersRead = true; - return; - } - - if (!m_destinationFile) - return; - - m_destinationFile.clear(); - - if (m_error == QNetworkReply::NoError) - m_download->didFinish(); - else if (m_error == QNetworkReply::OperationCanceledError) - abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorCancelled); - else - abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorNetworkFailure); -} - -void QtFileDownloader::onError(QNetworkReply::NetworkError code) -{ - m_error = code; -} - -void QtFileDownloader::cancel() -{ - m_reply->abort(); - // QtFileDownloader::onFinished() will be called and will raise a DownloadErrorCancelled. -} - -} // namespace WebKit -#include "moc_QtFileDownloader.cpp" diff --git a/Source/WebKit2/Shared/Downloads/qt/QtFileDownloader.h b/Source/WebKit2/Shared/Downloads/qt/QtFileDownloader.h deleted file mode 100644 index f688063af..000000000 --- a/Source/WebKit2/Shared/Downloads/qt/QtFileDownloader.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef QtFileDownloader_h -#define QtFileDownloader_h - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE -class QFile; -class QNetworkAccessManager; -class QNetworkRequest; -QT_END_NAMESPACE - -namespace WebCore { -class ResourceError; -} - -namespace WebKit { -class Download; - -class QtFileDownloader : public QObject { - Q_OBJECT -public: - QtFileDownloader(Download*, PassOwnPtr); - virtual ~QtFileDownloader(); - void cancel(); - void init(); - void startTransfer(const QString& destination); - - enum DownloadError { - DownloadErrorAborted = 0, - DownloadErrorCannotWriteToFile, - DownloadErrorCannotOpenFile, - DownloadErrorDestinationAlreadyExists, - DownloadErrorCancelled, - DownloadErrorCannotDetermineFilename, - DownloadErrorNetworkFailure - }; - -private Q_SLOTS: - void onReadyRead(); - void onFinished(); - void onError(QNetworkReply::NetworkError); - -private: - void abortDownloadWritingAndEmitError(QtFileDownloader::DownloadError); - QString determineFilename(); - void handleDownloadResponse(); - - Download* m_download; - OwnPtr m_reply; - OwnPtr m_destinationFile; - QNetworkReply::NetworkError m_error; - bool m_headersRead; -}; - -} // namespace WebKit - -#endif diff --git a/Source/WebKit2/Shared/LayerTreeContext.h b/Source/WebKit2/Shared/LayerTreeContext.h index f39af10e8..43314c215 100644 --- a/Source/WebKit2/Shared/LayerTreeContext.h +++ b/Source/WebKit2/Shared/LayerTreeContext.h @@ -52,11 +52,7 @@ public: bool isEmpty() const; -#if PLATFORM(QT) - uint32_t coordinatedLayerID; -#else uint64_t contextID; -#endif }; bool operator==(const LayerTreeContext&, const LayerTreeContext&); diff --git a/Source/WebKit2/Shared/qt/ArgumentCodersQt.cpp b/Source/WebKit2/Shared/qt/ArgumentCodersQt.cpp index 44c855b6b..766568519 100644 --- a/Source/WebKit2/Shared/qt/ArgumentCodersQt.cpp +++ b/Source/WebKit2/Shared/qt/ArgumentCodersQt.cpp @@ -29,7 +29,7 @@ using namespace WebCore; -namespace CoreIPC { +namespace IPC { typedef HashMap > MIMEDataHashMap; diff --git a/Source/WebKit2/Shared/qt/ArgumentCodersQt.h b/Source/WebKit2/Shared/qt/ArgumentCodersQt.h index 8d66e57f3..9b3bc9c2d 100644 --- a/Source/WebKit2/Shared/qt/ArgumentCodersQt.h +++ b/Source/WebKit2/Shared/qt/ArgumentCodersQt.h @@ -24,7 +24,7 @@ #include "ArgumentEncoder.h" #include "DragData.h" -namespace CoreIPC { +namespace IPC { void encode(ArgumentEncoder&, const WebCore::DragData&); bool decode(ArgumentDecoder&, WebCore::DragData&); diff --git a/Source/WebKit2/Shared/qt/LayerTreeContextQt.cpp b/Source/WebKit2/Shared/qt/LayerTreeContextQt.cpp deleted file mode 100644 index a2f01f953..000000000 --- a/Source/WebKit2/Shared/qt/LayerTreeContextQt.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2011 Apple Inc. All rights reserved. - * - * 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 "LayerTreeContext.h" - -#include "ArgumentDecoder.h" -#include "ArgumentEncoder.h" - -namespace WebKit { - -LayerTreeContext::LayerTreeContext() - : coordinatedLayerID(0) -{ -} - -LayerTreeContext::~LayerTreeContext() -{ -} - -void LayerTreeContext::encode(CoreIPC::ArgumentEncoder& encoder) const -{ - encoder << coordinatedLayerID; -} - -bool LayerTreeContext::decode(CoreIPC::ArgumentDecoder& decoder, LayerTreeContext& context) -{ - return decoder.decode(context.coordinatedLayerID); -} - -bool LayerTreeContext::isEmpty() const -{ - return !coordinatedLayerID; -} - -bool operator==(const LayerTreeContext& a, const LayerTreeContext& b) -{ - return a.coordinatedLayerID == b.coordinatedLayerID; -} - -} // namespace WebKit diff --git a/Source/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp b/Source/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp index 9a2d6663b..996b98ae2 100644 --- a/Source/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp +++ b/Source/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "NativeWebKeyboardEvent.h" -#include "WebEventFactoryQt.h" +#include "WebEventFactory.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/qt/NativeWebMouseEventQt.cpp b/Source/WebKit2/Shared/qt/NativeWebMouseEventQt.cpp index e8fd39ce7..f30dccbbb 100644 --- a/Source/WebKit2/Shared/qt/NativeWebMouseEventQt.cpp +++ b/Source/WebKit2/Shared/qt/NativeWebMouseEventQt.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "NativeWebMouseEvent.h" -#include "WebEventFactoryQt.h" +#include "WebEventFactory.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/qt/NativeWebTouchEventQt.cpp b/Source/WebKit2/Shared/qt/NativeWebTouchEventQt.cpp index 78c0883d6..5792ef623 100644 --- a/Source/WebKit2/Shared/qt/NativeWebTouchEventQt.cpp +++ b/Source/WebKit2/Shared/qt/NativeWebTouchEventQt.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "NativeWebTouchEvent.h" -#include "WebEventFactoryQt.h" +#include "WebEventFactory.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/qt/NativeWebWheelEventQt.cpp b/Source/WebKit2/Shared/qt/NativeWebWheelEventQt.cpp index 3c1ba9f8f..21175cdbf 100644 --- a/Source/WebKit2/Shared/qt/NativeWebWheelEventQt.cpp +++ b/Source/WebKit2/Shared/qt/NativeWebWheelEventQt.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "NativeWebWheelEvent.h" -#include "WebEventFactoryQt.h" +#include "WebEventFactory.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/qt/PlatformCertificateInfo.h b/Source/WebKit2/Shared/qt/PlatformCertificateInfo.h index c1b9de698..b03b1fcd6 100644 --- a/Source/WebKit2/Shared/qt/PlatformCertificateInfo.h +++ b/Source/WebKit2/Shared/qt/PlatformCertificateInfo.h @@ -42,11 +42,11 @@ public: { } - void encode(CoreIPC::ArgumentEncoder&) const + void encode(IPC::ArgumentEncoder&) const { } - static bool decode(CoreIPC::ArgumentDecoder&, PlatformCertificateInfo&) + static bool decode(IPC::ArgumentDecoder&, PlatformCertificateInfo&) { return true; } diff --git a/Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp b/Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp index b835af2b2..22a9b7d44 100644 --- a/Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp +++ b/Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp @@ -27,8 +27,8 @@ #include "QtNetworkReplyData.h" #include "ArgumentCodersQt.h" -#include "URL.h" #include "SharedMemory.h" +#include "URL.h" #include "WebCoreArgumentCoders.h" #include #include @@ -41,7 +41,7 @@ QtNetworkReplyData::QtNetworkReplyData() : m_contentLength(0) { } -void QtNetworkReplyData::encode(CoreIPC::ArgumentEncoder& encoder) const +void QtNetworkReplyData::encode(IPC::ArgumentEncoder& encoder) const { encoder << m_urlString; encoder << m_contentType; @@ -50,7 +50,7 @@ void QtNetworkReplyData::encode(CoreIPC::ArgumentEncoder& encoder) const encoder << m_dataHandle; } -bool QtNetworkReplyData::decode(CoreIPC::ArgumentDecoder& decoder, QtNetworkReplyData& destination) +bool QtNetworkReplyData::decode(IPC::ArgumentDecoder& decoder, QtNetworkReplyData& destination) { if (!decoder.decode(destination.m_urlString)) return false; @@ -66,5 +66,3 @@ bool QtNetworkReplyData::decode(CoreIPC::ArgumentDecoder& decoder, QtNetworkRepl } } // namespace WebKit - - diff --git a/Source/WebKit2/Shared/qt/QtNetworkReplyData.h b/Source/WebKit2/Shared/qt/QtNetworkReplyData.h index 6480fb2f2..19d16c6a7 100644 --- a/Source/WebKit2/Shared/qt/QtNetworkReplyData.h +++ b/Source/WebKit2/Shared/qt/QtNetworkReplyData.h @@ -32,7 +32,7 @@ #include #include -namespace CoreIPC { +namespace IPC { class ArgumentEncoder; class ArgumentDecoder; }; @@ -42,8 +42,8 @@ namespace WebKit { struct QtNetworkReplyData { QtNetworkReplyData(); - void encode(CoreIPC::ArgumentEncoder&) const; - static bool decode(CoreIPC::ArgumentDecoder&, QtNetworkReplyData&); + void encode(IPC::ArgumentEncoder&) const; + static bool decode(IPC::ArgumentDecoder&, QtNetworkReplyData&); WTF::String m_urlString; diff --git a/Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp b/Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp index 5a2877451..a345dd32f 100644 --- a/Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp +++ b/Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp @@ -49,14 +49,14 @@ QtNetworkRequestData::QtNetworkRequestData(const QNetworkRequest& request, QNetw m_replyUuid = QUuid::createUuid().toString(); } -void QtNetworkRequestData::encode(CoreIPC::ArgumentEncoder& encoder) const +void QtNetworkRequestData::encode(IPC::ArgumentEncoder& encoder) const { encoder << m_scheme; encoder << m_urlString; encoder << m_replyUuid; } -bool QtNetworkRequestData::decode(CoreIPC::ArgumentDecoder& decoder, QtNetworkRequestData& destination) +bool QtNetworkRequestData::decode(IPC::ArgumentDecoder& decoder, QtNetworkRequestData& destination) { if (!decoder.decode(destination.m_scheme)) return false; @@ -68,4 +68,3 @@ bool QtNetworkRequestData::decode(CoreIPC::ArgumentDecoder& decoder, QtNetworkRe } } // namespace WebKit - diff --git a/Source/WebKit2/Shared/qt/QtNetworkRequestData.h b/Source/WebKit2/Shared/qt/QtNetworkRequestData.h index 22a4a8d4a..2a9b98a4c 100644 --- a/Source/WebKit2/Shared/qt/QtNetworkRequestData.h +++ b/Source/WebKit2/Shared/qt/QtNetworkRequestData.h @@ -29,7 +29,7 @@ #include #include -namespace CoreIPC { +namespace IPC { class ArgumentEncoder; class ArgumentDecoder; }; @@ -44,8 +44,8 @@ namespace WebKit { struct QtNetworkRequestData { QtNetworkRequestData(); QtNetworkRequestData(const QNetworkRequest&, QNetworkReply*); - void encode(CoreIPC::ArgumentEncoder&) const; - static bool decode(CoreIPC::ArgumentDecoder&, QtNetworkRequestData&); + void encode(IPC::ArgumentEncoder&) const; + static bool decode(IPC::ArgumentDecoder&, QtNetworkRequestData&); String m_scheme; String m_urlString; diff --git a/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp b/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp index 35bf22f0b..f0b71844e 100644 --- a/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp +++ b/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp @@ -32,7 +32,7 @@ using namespace WebCore; -namespace CoreIPC { +namespace IPC { void ArgumentCoder::encodePlatformData(ArgumentEncoder& encoder, const ResourceRequest& resourceRequest) { @@ -43,17 +43,6 @@ bool ArgumentCoder::decodePlatformData(ArgumentDecoder& decoder return true; } - -void ArgumentCoder::encodePlatformData(ArgumentEncoder& encoder, const ResourceResponse& resourceResponse) -{ -} - -bool ArgumentCoder::decodePlatformData(ArgumentDecoder& decoder, ResourceResponse& resourceResponse) -{ - return true; -} - - void ArgumentCoder::encodePlatformData(ArgumentEncoder& encoder, const ResourceError& resourceError) { } @@ -63,4 +52,4 @@ bool ArgumentCoder::decodePlatformData(ArgumentDecoder& decoder, return true; } -} // namespace CoreIPC +} // namespace IPC diff --git a/Source/WebKit2/Shared/qt/WebEventFactory.h b/Source/WebKit2/Shared/qt/WebEventFactory.h new file mode 100644 index 000000000..e5e3a101b --- /dev/null +++ b/Source/WebKit2/Shared/qt/WebEventFactory.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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. + */ + +#ifndef WebEventFactory_h +#define WebEventFactory_h + +#include "WebEvent.h" + +QT_BEGIN_NAMESPACE + +#if ENABLE(TOUCH_EVENTS) +class QTouchEvent; +#endif + +class QMouseEvent; +class QWheelEvent; +class QKeyEvent; +class QTransform; + +QT_END_NAMESPACE + +namespace WebKit { + +class WebEventFactory { +public: + static WebMouseEvent createWebMouseEvent(QMouseEvent*, const QTransform& fromItemTransform, int eventClickCount); + static WebWheelEvent createWebWheelEvent(QWheelEvent*, const QTransform& fromItemTransform); + static WebKeyboardEvent createWebKeyboardEvent(QKeyEvent*); +#if ENABLE(TOUCH_EVENTS) + static WebTouchEvent createWebTouchEvent(const QTouchEvent*, const QTransform& fromItemTransform); +#endif +}; + +} // namespace WebKit + +#endif // WebEventFactory_h diff --git a/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp b/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp index 0240729c0..ebf9d5f43 100644 --- a/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp +++ b/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp @@ -25,7 +25,8 @@ */ #include "config.h" -#include "WebEventFactoryQt.h" +#include "WebEventFactory.h" + #include #include #include @@ -186,13 +187,13 @@ WebTouchEvent WebEventFactory::createWebTouchEvent(const QTouchEvent* event, con { WebEvent::Type type = webEventTypeForEvent(event); WebPlatformTouchPoint::TouchPointState state = static_cast(0); - unsigned int id; + unsigned id; WebEvent::Modifiers modifiers = modifiersForEvent(event->modifiers()); double timestamp = currentTimeForEvent(event); const QList& points = event->touchPoints(); - Vector m_touchPoints; + Vector touchPoints; for (int i = 0; i < points.count(); ++i) { const QTouchEvent::TouchPoint& touchPoint = points.at(i); id = static_cast(touchPoint.id()); @@ -220,10 +221,10 @@ WebTouchEvent WebEventFactory::createWebTouchEvent(const QTouchEvent* event, con state = WebPlatformTouchPoint::TouchCancelled; IntSize radius(touchPoint.rect().width()/ 2, touchPoint.rect().height() / 2); - m_touchPoints.append(WebPlatformTouchPoint(id, state, touchPoint.screenPos().toPoint(), fromItemTransform.map(touchPoint.pos()).toPoint(), radius, 0.0, touchPoint.pressure())); + touchPoints.append(WebPlatformTouchPoint(id, state, touchPoint.screenPos().toPoint(), fromItemTransform.map(touchPoint.pos()).toPoint(), radius, 0.0, touchPoint.pressure())); } - return WebTouchEvent(type, m_touchPoints, modifiers, timestamp); + return WebTouchEvent(type, WTFMove(touchPoints), modifiers, timestamp); } #endif diff --git a/Source/WebKit2/Shared/qt/WebEventFactoryQt.h b/Source/WebKit2/Shared/qt/WebEventFactoryQt.h deleted file mode 100644 index e5e3a101b..000000000 --- a/Source/WebKit2/Shared/qt/WebEventFactoryQt.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) - * - * 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. - */ - -#ifndef WebEventFactory_h -#define WebEventFactory_h - -#include "WebEvent.h" - -QT_BEGIN_NAMESPACE - -#if ENABLE(TOUCH_EVENTS) -class QTouchEvent; -#endif - -class QMouseEvent; -class QWheelEvent; -class QKeyEvent; -class QTransform; - -QT_END_NAMESPACE - -namespace WebKit { - -class WebEventFactory { -public: - static WebMouseEvent createWebMouseEvent(QMouseEvent*, const QTransform& fromItemTransform, int eventClickCount); - static WebWheelEvent createWebWheelEvent(QWheelEvent*, const QTransform& fromItemTransform); - static WebKeyboardEvent createWebKeyboardEvent(QKeyEvent*); -#if ENABLE(TOUCH_EVENTS) - static WebTouchEvent createWebTouchEvent(const QTouchEvent*, const QTransform& fromItemTransform); -#endif -}; - -} // namespace WebKit - -#endif // WebEventFactory_h diff --git a/Source/WebKit2/Shared/qt/WebURLRequestQt.cpp b/Source/WebKit2/Shared/qt/WebURLRequestQt.cpp deleted file mode 100644 index 717a4cc47..000000000 --- a/Source/WebKit2/Shared/qt/WebURLRequestQt.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * 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 "WebURLRequest.h" - -namespace WebKit { - -WebURLRequest::WebURLRequest(PlatformRequest) -{ - ASSERT_NOT_REACHED(); -} - -PlatformRequest WebURLRequest::platformRequest() const -{ - ASSERT_NOT_REACHED(); - return 0; -} - -} // namespace WebKit diff --git a/Source/WebKit2/Shared/qt/WebURLResponseQt.cpp b/Source/WebKit2/Shared/qt/WebURLResponseQt.cpp deleted file mode 100644 index 35625e339..000000000 --- a/Source/WebKit2/Shared/qt/WebURLResponseQt.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * 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 "WebURLResponse.h" - -namespace WebKit { - -WebURLResponse::WebURLResponse(PlatformResponse) -{ - ASSERT_NOT_REACHED(); -} - -PlatformResponse WebURLResponse::platformResponse() const -{ - ASSERT_NOT_REACHED(); - return 0; -} - -} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/API/C/qt/WKIconDatabaseQt.h b/Source/WebKit2/UIProcess/API/C/qt/WKIconDatabaseQt.h index d9352a271..2035c3c0f 100644 --- a/Source/WebKit2/UIProcess/API/C/qt/WKIconDatabaseQt.h +++ b/Source/WebKit2/UIProcess/API/C/qt/WKIconDatabaseQt.h @@ -27,8 +27,8 @@ #ifndef WKIconDatabaseQt_h #define WKIconDatabaseQt_h -#include -#include +#include +#include QT_BEGIN_NAMESPACE class QImage; diff --git a/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.h b/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.h index ff2cfa837..3c2fda240 100644 --- a/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.h +++ b/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.h @@ -22,7 +22,7 @@ #define WKStringQt_h #include -#include +#include WK_EXPORT WKStringRef WKStringCreateWithQString(const QString& string); WK_EXPORT QString WKStringCopyQString(WKStringRef string); diff --git a/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.h b/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.h index b12f97459..6cef82f7c 100644 --- a/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.h +++ b/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.h @@ -22,8 +22,8 @@ #define WKURLQt_h #include -#include -#include +#include +#include WK_EXPORT WKURLRef WKURLCreateWithQString(const QString& url); WK_EXPORT QString WKURLCopyQString(WKURLRef url); diff --git a/Source/WebKit2/UIProcess/API/qt/qquicknetworkreply.cpp b/Source/WebKit2/UIProcess/API/qt/qquicknetworkreply.cpp index 38ac7b909..79a67bc76 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquicknetworkreply.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquicknetworkreply.cpp @@ -82,14 +82,14 @@ void QQuickNetworkReply::send() return; } - WTF::RefPtr sharedMemory = SharedMemory::create(smLength); + WTF::RefPtr sharedMemory = SharedMemory::allocate(smLength); if (!sharedMemory) return; // The size of the allocated shared memory can be bigger than requested. // Usually the size will be rounded up to the next multiple of a page size. memcpy(sharedMemory->data(), ptrData, smLength); - if (sharedMemory->createHandle(m_networkReplyData->data().m_dataHandle, SharedMemory::ReadOnly)) { + if (sharedMemory->createHandle(m_networkReplyData->data().m_dataHandle, SharedMemory::Protection::ReadOnly)) { m_networkReplyData->data().m_contentLength = smLength; if (m_webViewExperimental) m_webViewExperimental.data()->sendApplicationSchemeReply(this); diff --git a/Source/WebKit2/UIProcess/API/qt/qquicknetworkreply_p.h b/Source/WebKit2/UIProcess/API/qt/qquicknetworkreply_p.h index 2f87acf1e..453e766b0 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquicknetworkreply_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquicknetworkreply_p.h @@ -23,8 +23,8 @@ #include "QtNetworkReplyData.h" #include "QtNetworkRequestData.h" -#include "qquickwebview_p.h" #include "SharedMemory.h" +#include "qquickwebview_p.h" #include "qwebkitglobal.h" #include #include @@ -64,4 +64,3 @@ private: QML_DECLARE_TYPE(QQuickNetworkReply) #endif // qquicknetworkreply_p_h - diff --git a/Source/WebKit2/UIProcess/API/qt/qquicknetworkrequest.cpp b/Source/WebKit2/UIProcess/API/qt/qquicknetworkrequest.cpp index 152ef4e5d..1db8100d8 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquicknetworkrequest.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquicknetworkrequest.cpp @@ -45,4 +45,3 @@ QUrl QQuickNetworkRequest::url() const } #include "moc_qquicknetworkrequest_p.cpp" - diff --git a/Source/WebKit2/UIProcess/API/qt/qquicknetworkrequest_p.h b/Source/WebKit2/UIProcess/API/qt/qquicknetworkrequest_p.h index 69a2d48df..399c45ccd 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquicknetworkrequest_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquicknetworkrequest_p.h @@ -22,11 +22,11 @@ #define qquicknetworkrequest_p_h #include "QtNetworkRequestData.h" -#include "wtf/RefPtr.h" #include "qwebkitglobal.h" #include #include #include +#include class QWEBKIT_EXPORT QQuickNetworkRequest : public QObject { Q_OBJECT @@ -46,4 +46,3 @@ private: QML_DECLARE_TYPE(QQuickNetworkRequest) #endif // qquicknetworkrequest_p_h - diff --git a/Source/WebKit2/UIProcess/API/qt/qquickurlschemedelegate_p.h b/Source/WebKit2/UIProcess/API/qt/qquickurlschemedelegate_p.h index 98de616cc..3080a0a2c 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickurlschemedelegate_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickurlschemedelegate_p.h @@ -68,5 +68,3 @@ private: }; #endif // qquickurlschemedelegate_p_h - - diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp index e8e646a7f..a991bcfdd 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp @@ -21,6 +21,7 @@ #include "config.h" #include "qquickwebpage_p.h" +#include "CoordinatedGraphicsScene.h" #include "QtWebPageEventHandler.h" #include "QtWebPageSGNode.h" #include "TransformationMatrix.h" @@ -30,7 +31,6 @@ #include "qwebkittest_p.h" #include #include -#include using namespace WebKit; @@ -61,7 +61,7 @@ QQuickWebPagePrivate::QQuickWebPagePrivate(QQuickWebPage* q, QQuickWebView* view void QQuickWebPagePrivate::paint(QPainter* painter) { - if (WebCore::CoordinatedGraphicsScene* scene = QQuickWebViewPrivate::get(viewportItem)->coordinatedGraphicsScene()) + if (CoordinatedGraphicsScene* scene = QQuickWebViewPrivate::get(viewportItem)->coordinatedGraphicsScene()) scene->paintToGraphicsContext(painter); } @@ -70,7 +70,7 @@ QSGNode* QQuickWebPage::updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData*) { QQuickWebViewPrivate* webViewPrivate = QQuickWebViewPrivate::get(d->viewportItem); - WebCore::CoordinatedGraphicsScene* scene = webViewPrivate->coordinatedGraphicsScene(); + CoordinatedGraphicsScene* scene = webViewPrivate->coordinatedGraphicsScene(); if (!scene) return oldNode; diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index 32ac886f3..4c412e1dd 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -23,6 +23,7 @@ #include "config.h" #include "qquickwebview_p.h" +#include "CoordinatedGraphicsScene.h" #include "CoordinatedLayerTreeHostProxy.h" #include "DownloadProxy.h" #include "DrawingAreaProxyImpl.h" @@ -35,7 +36,6 @@ #include "QtWebPageEventHandler.h" #include "QtWebPagePolicyClient.h" #include "WebBackForwardList.h" -#include "WebContext.h" #include "WebFindOptions.h" #if ENABLE(INSPECTOR_SERVER) #include "WebInspectorProxy.h" @@ -46,6 +46,7 @@ #endif #include "WebPageGroup.h" #include "WebPreferences.h" +#include "WebProcessPool.h" #include "qglobal.h" #include "qquicknetworkreply_p.h" #include "qquicknetworkrequest_p.h" @@ -70,12 +71,11 @@ #include #include #include -#include +#include #include #include #include #include -#include #include #include #include @@ -85,8 +85,8 @@ #include #ifdef HAVE_WEBCHANNEL -#include #include "qwebchannelwebkittransport_p.h" +#include #endif using namespace WebCore; @@ -331,7 +331,7 @@ void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pa pageGroup = adoptWK(WKPageGroupCreateWithIdentifier(0)); context = contextRef ? QtWebContext::create(contextRef) : QtWebContext::defaultContext(); - webPageProxy = toImpl(context->context())->createWebPage(&pageClient, toImpl(pageGroup.get())); + webPageProxy = toImpl(context->context())->createWebPage(pageClient, toImpl(pageGroup.get())); webPage = toAPI(webPageProxy.get()); pageToView()->insert(webPage.get(), this); @@ -376,7 +376,7 @@ void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pa pagePolicyClient.reset(new QtWebPagePolicyClient(webPage.get(), q_ptr)); pageUIClient.reset(new QtWebPageUIClient(webPage.get(), q_ptr)); - navigationHistory = adoptPtr(QWebNavigationHistoryPrivate::createHistory(webPage.get())); + navigationHistory.reset(QWebNavigationHistoryPrivate::createHistory(webPage.get())); QtWebIconDatabaseClient* iconDatabase = context->iconDatabase(); QObject::connect(iconDatabase, SIGNAL(iconChangedForPageURL(QString)), q_ptr, SLOT(_q_onIconChangedForPageURL(QString))); @@ -389,7 +389,7 @@ void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pa WKPreferencesSetCompositingRepaintCountersVisible(preferencesRef, showDebugVisuals); WKPreferencesSetFrameFlatteningEnabled(preferencesRef, true); WKPreferencesSetWebGLEnabled(preferencesRef, true); - webPageProxy->pageGroup()->preferences()->setForceCompositingMode(true); + webPageProxy->pageGroup().preferences().setForceCompositingMode(true); pageClient.initialize(q_ptr, pageEventHandler.data(), &undoController); webPageProxy->initializeWebPage(); @@ -526,13 +526,12 @@ void QQuickWebViewPrivate::didChangeBackForwardList(WKPageRef, WKBackForwardList void QQuickWebViewPrivate::setTransparentBackground(bool enable) { - webPageProxy->setDrawsTransparentBackground(enable); webPageProxy->setDrawsBackground(!enable); } bool QQuickWebViewPrivate::transparentBackground() const { - return webPageProxy->drawsTransparentBackground(); + return !webPageProxy->drawsBackground(); } void QQuickWebViewPrivate::loadProgressDidChange(int loadProgress) @@ -644,7 +643,7 @@ void QQuickWebViewPrivate::processDidBecomeResponsive(WKPageRef, const void* cli std::unique_ptr QQuickWebViewPrivate::createDrawingAreaProxy() { - return std::make_unique(webPageProxy.get()); + return std::make_unique(*webPageProxy.get()); } void QQuickWebViewPrivate::handleDownloadRequest(DownloadProxy* download) @@ -663,7 +662,7 @@ void QQuickWebViewPrivate::handleDownloadRequest(DownloadProxy* download) void QQuickWebViewPrivate::_q_onVisibleChanged() { - webPageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible); + webPageProxy->viewStateDidChange(ViewState::IsVisible); } void QQuickWebViewPrivate::_q_onUrlChanged() @@ -806,11 +805,11 @@ void QQuickWebViewPrivate::chooseFiles(WKOpenPanelResultListenerRef listenerRef, if (dialogRunner.wasAccepted()) { QStringList selectedPaths = dialogRunner.filePaths(); - Vector > wkFiles(selectedPaths.size()); + Vector > wkFiles(selectedPaths.size()); for (unsigned i = 0; i < selectedPaths.size(); ++i) - wkFiles[i] = WebURL::create(QUrl::fromLocalFile(selectedPaths.at(i)).toString()); + wkFiles[i] = API::URL::create(QUrl::fromLocalFile(selectedPaths.at(i)).toString()); - WKOpenPanelResultListenerChooseFiles(listenerRef, toAPI(ImmutableArray::adopt(wkFiles).leakRef())); + WKOpenPanelResultListenerChooseFiles(listenerRef, toAPI(&API::Array::create(WTFMove(wkFiles)).leakRef())); } else WKOpenPanelResultListenerCancel(listenerRef); @@ -1064,7 +1063,7 @@ void QQuickWebViewFlickablePrivate::onComponentComplete() Q_Q(QQuickWebView); m_pageViewportControllerClient.reset(new PageViewportControllerClientQt(q, pageView.data())); - m_pageViewportController.reset(new PageViewportController(webPageProxy.get(), m_pageViewportControllerClient.data())); + m_pageViewportController.reset(new PageViewportController(webPageProxy.get(), *m_pageViewportControllerClient.data())); pageEventHandler->setViewportController(m_pageViewportControllerClient.data()); // Trigger setting of correct visibility flags after everything was allocated and initialized. @@ -1173,18 +1172,18 @@ void QQuickWebViewExperimental::setUseDefaultContentItemSize(bool enable) int QQuickWebViewExperimental::preferredMinimumContentsWidth() const { Q_D(const QQuickWebView); - return d->webPageProxy->pageGroup()->preferences()->layoutFallbackWidth(); + return d->webPageProxy->pageGroup().preferences().layoutFallbackWidth(); } void QQuickWebViewExperimental::setPreferredMinimumContentsWidth(int width) { Q_D(QQuickWebView); - WebPreferences* webPreferences = d->webPageProxy->pageGroup()->preferences(); + WebPreferences& webPreferences = d->webPageProxy->pageGroup().preferences(); - if (width == webPreferences->layoutFallbackWidth()) + if (width == webPreferences.layoutFallbackWidth()) return; - webPreferences->setLayoutFallbackWidth(width); + webPreferences.setLayoutFallbackWidth(width); emit preferredMinimumContentsWidthChanged(); } @@ -1295,7 +1294,7 @@ QWebPreferences* QQuickWebViewExperimental::preferences() const { QQuickWebViewPrivate* const d = d_ptr; if (!d->preferences) - d->preferences = adoptPtr(QWebPreferencesPrivate::createPreferences(d)); + d->preferences.reset(QWebPreferencesPrivate::createPreferences(d)); return d->preferences.get(); } @@ -1446,13 +1445,13 @@ void QQuickWebViewExperimental::setUserAgent(const QString& userAgent) int QQuickWebViewExperimental::deviceWidth() const { Q_D(const QQuickWebView); - return d->webPageProxy->pageGroup()->preferences()->deviceWidth(); + return d->webPageProxy->pageGroup().preferences().deviceWidth(); } void QQuickWebViewExperimental::setDeviceWidth(int value) { Q_D(QQuickWebView); - d->webPageProxy->pageGroup()->preferences()->setDeviceWidth(qMax(0, value)); + d->webPageProxy->pageGroup().preferences().setDeviceWidth(qMax(0, value)); emit deviceWidthChanged(); } @@ -1470,13 +1469,13 @@ void QQuickWebViewExperimental::setDeviceWidth(int value) int QQuickWebViewExperimental::deviceHeight() const { Q_D(const QQuickWebView); - return d->webPageProxy->pageGroup()->preferences()->deviceHeight(); + return d->webPageProxy->pageGroup().preferences().deviceHeight(); } void QQuickWebViewExperimental::setDeviceHeight(int value) { Q_D(QQuickWebView); - d->webPageProxy->pageGroup()->preferences()->setDeviceHeight(qMax(0, value)); + d->webPageProxy->pageGroup().preferences().setDeviceHeight(qMax(0, value)); emit deviceHeightChanged(); } @@ -1557,7 +1556,7 @@ void QQuickWebViewExperimental::setUserStyleSheets(const QList& userStyleS QUrl QQuickWebViewExperimental::remoteInspectorUrl() const { #if ENABLE(INSPECTOR_SERVER) - return QUrl(WebInspectorServer::shared().inspectorUrlForPageID(d_ptr->webPageProxy->inspector()->remoteInspectionPageID())); + return QUrl(WebInspectorServer::singleton().inspectorUrlForPageID(d_ptr->webPageProxy->inspector()->remoteInspectionPageID())); #else return QUrl(); #endif @@ -1822,7 +1821,7 @@ void QQuickWebView::reload() // about the unreachable url yet. If we just do a reload at this point WebCore will try to // reload the currently committed url instead of the unrachable url. To work around this // we override the reload here by doing a manual load. - d->webPageProxy->loadURL(mainFrame->unreachableURL()); + d->webPageProxy->loadRequest(mainFrame->unreachableURL()); // FIXME: We should make WebCore aware of the unreachable url regardless of substitute-loads return; } @@ -1866,7 +1865,7 @@ void QQuickWebView::emitUrlChangeIfNeeded() { Q_D(QQuickWebView); - QString activeUrl = d->webPageProxy->activeURL(); + QString activeUrl = d->webPageProxy->pageLoadState().activeURL(); if (activeUrl != d->m_currentUrl) { d->m_currentUrl = activeUrl; emit urlChanged(); @@ -2002,7 +2001,7 @@ QVariant QQuickWebView::inputMethodQuery(Qt::InputMethodQuery property) const Q_D(const QQuickWebView); const EditorState& state = d->webPageProxy->editorState(); - switch(property) { + switch (property) { case Qt::ImCursorRectangle: return QRectF(state.cursorRect); case Qt::ImFont: diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h index 2d1e5d911..5dcdb1a27 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h @@ -27,21 +27,17 @@ #include "QtPageClient.h" #include "QtWebPageUIClient.h" -#include "qquickwebview_p.h" #include "qquickwebpage_p.h" +#include "qquickwebview_p.h" #include #include #include #include -#include -#include +#include #include -namespace WebCore { -class CoordinatedGraphicsScene; -} - namespace WebKit { +class CoordinatedGraphicsScene; class DownloadProxy; class DrawingAreaProxy; class QtDialogRunner; @@ -143,7 +139,7 @@ public: void didReceiveMessageFromNavigatorQtWebChannelTransportObject(WKStringRef message); #endif - WebCore::CoordinatedGraphicsScene* coordinatedGraphicsScene(); + WebKit::CoordinatedGraphicsScene* coordinatedGraphicsScene(); float deviceScaleFactor(); void setIntrinsicDeviceScaleFactor(float); @@ -189,8 +185,8 @@ protected: WebKit::QtPageClient pageClient; WebKit::DefaultUndoController undoController; - OwnPtr navigationHistory; - OwnPtr preferences; + std::unique_ptr navigationHistory; + std::unique_ptr preferences; QScopedPointer pagePolicyClient; QScopedPointer pageUIClient; diff --git a/Source/WebKit2/UIProcess/API/qt/qtwebsecurityorigin.cpp b/Source/WebKit2/UIProcess/API/qt/qtwebsecurityorigin.cpp index 4491dc40a..fad9748cf 100644 --- a/Source/WebKit2/UIProcess/API/qt/qtwebsecurityorigin.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qtwebsecurityorigin.cpp @@ -24,9 +24,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include using namespace WebCore; diff --git a/Source/WebKit2/UIProcess/API/qt/qtwebsecurityorigin_p.h b/Source/WebKit2/UIProcess/API/qt/qtwebsecurityorigin_p.h index df09fb8ea..e6d59acba 100644 --- a/Source/WebKit2/UIProcess/API/qt/qtwebsecurityorigin_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qtwebsecurityorigin_p.h @@ -21,7 +21,6 @@ #include "qwebkitglobal.h" -#include #include #include #include diff --git a/Source/WebKit2/UIProcess/API/qt/qwebchannelwebkittransport.cpp b/Source/WebKit2/UIProcess/API/qt/qwebchannelwebkittransport.cpp index 209596954..b74c45b3c 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebchannelwebkittransport.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebchannelwebkittransport.cpp @@ -39,13 +39,16 @@ ** ****************************************************************************/ +#include "config.h" #include "qwebchannelwebkittransport_p.h" -#include -#include +#ifdef HAVE_WEBCHANNEL #include "qquickwebview_p.h" +#include +#include + QWebChannelWebKitTransport::QWebChannelWebKitTransport(QQuickWebViewExperimental* experimental) : QWebChannelAbstractTransport(experimental) , m_experimental(experimental) @@ -72,3 +75,5 @@ void QWebChannelWebKitTransport::receiveMessage(const QByteArray& message) } emit messageReceived(doc.object(), this); } + +#endif // HAVE_WEBCHANNEL diff --git a/Source/WebKit2/UIProcess/API/qt/qwebchannelwebkittransport_p.h b/Source/WebKit2/UIProcess/API/qt/qwebchannelwebkittransport_p.h index ef6140359..2cbfdafee 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebchannelwebkittransport_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwebchannelwebkittransport_p.h @@ -39,15 +39,15 @@ ** ****************************************************************************/ -#ifndef QWEBCHANNELWEBKITTRANSPORT_H -#define QWEBCHANNELWEBKITTRANSPORT_H +#pragma once + +#ifdef HAVE_WEBCHANNEL #include class QQuickWebViewExperimental; -class QWebChannelWebKitTransport : public QWebChannelAbstractTransport -{ +class QWebChannelWebKitTransport : public QWebChannelAbstractTransport { Q_OBJECT public: explicit QWebChannelWebKitTransport(QQuickWebViewExperimental* experimental); @@ -60,4 +60,4 @@ private: QQuickWebViewExperimental* m_experimental; }; -#endif // QWEBCHANNELWEBKITTRANSPORT_H +#endif // HAVE_WEBCHANNEL diff --git a/Source/WebKit2/UIProcess/API/qt/qwebdownloaditem.cpp b/Source/WebKit2/UIProcess/API/qt/qwebdownloaditem.cpp index 85476431f..949636a0c 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebdownloaditem.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebdownloaditem.cpp @@ -93,4 +93,3 @@ void QWebDownloadItem::start() d->downloadProxy->startTransfer(d->destinationPath); } - diff --git a/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h b/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h index 5cbdddd54..e017d906f 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h @@ -21,8 +21,8 @@ #ifndef qwebkittest_p_h #define qwebkittest_p_h -#include "qwebkitglobal.h" #include "qquickwebview_p.h" +#include "qwebkitglobal.h" #include #include diff --git a/Source/WebKit2/UIProcess/API/qt/qwebloadrequest.cpp b/Source/WebKit2/UIProcess/API/qt/qwebloadrequest.cpp index 8aaadb73c..6271ebfa6 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebloadrequest.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebloadrequest.cpp @@ -18,7 +18,6 @@ */ #include "config.h" - #include "qwebloadrequest_p.h" class QWebLoadRequestPrivate { diff --git a/Source/WebKit2/UIProcess/API/qt/qwebnavigationhistory.cpp b/Source/WebKit2/UIProcess/API/qt/qwebnavigationhistory.cpp index 95f40498f..fa8982c4f 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebnavigationhistory.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebnavigationhistory.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "qwebnavigationhistory_p.h" -#include "WKBackForwardList.h" +#include "WKBackForwardListRef.h" #include "WKStringQt.h" #include "WKURL.h" #include "WKURLQt.h" @@ -35,12 +35,11 @@ #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include using namespace WebKit; @@ -61,8 +60,8 @@ QWebNavigationListModel* QWebNavigationListModelPrivate::createWebNavigationMode QWebNavigationHistoryPrivate::QWebNavigationHistoryPrivate(WKPageRef page) : m_page(page) , m_backForwardList(WKPageGetBackForwardList(page)) - , m_backNavigationModel(adoptPtr(QWebNavigationListModelPrivate::createWebNavigationModel(m_backForwardList.get()))) - , m_forwardNavigationModel(adoptPtr(QWebNavigationListModelPrivate::createWebNavigationModel(m_backForwardList.get()))) + , m_backNavigationModel(QWebNavigationListModelPrivate::createWebNavigationModel(m_backForwardList.get())) + , m_forwardNavigationModel(QWebNavigationListModelPrivate::createWebNavigationModel(m_backForwardList.get())) { m_backNavigationModel->d->count = &WKBackForwardListGetBackListCount; m_backNavigationModel->d->indexSign = -1; diff --git a/Source/WebKit2/UIProcess/API/qt/qwebnavigationhistory_p_p.h b/Source/WebKit2/UIProcess/API/qt/qwebnavigationhistory_p_p.h index c8cc5ab32..527aa4658 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebnavigationhistory_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwebnavigationhistory_p_p.h @@ -29,9 +29,8 @@ #include "qwebkitglobal.h" #include -#include -#include -#include +#include +#include #include namespace WebKit { @@ -63,8 +62,8 @@ public: WKRetainPtr m_page; WKRetainPtr m_backForwardList; - OwnPtr m_backNavigationModel; - OwnPtr m_forwardNavigationModel; + std::unique_ptr m_backNavigationModel; + std::unique_ptr m_forwardNavigationModel; }; #endif /* qwebnavigationhistory_p_p_h */ diff --git a/Source/WebKit2/UIProcess/API/qt/qwebnavigationrequest.cpp b/Source/WebKit2/UIProcess/API/qt/qwebnavigationrequest.cpp index 7a75c583a..4d835fa2c 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebnavigationrequest.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebnavigationrequest.cpp @@ -18,7 +18,6 @@ */ #include "config.h" - #include "qwebnavigationrequest_p.h" #include "qquickwebview_p.h" diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest.cpp b/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest.cpp index 45697a22b..e059d9c11 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest.cpp @@ -18,12 +18,11 @@ */ #include "config.h" - #include "qwebpermissionrequest_p.h" #include "WKStringQt.h" -#include -#include +#include +#include class QWebPermissionRequestPrivate : public QSharedData { public: @@ -118,4 +117,3 @@ QtWebSecurityOrigin* QWebPermissionRequest::securityOrigin() { return &(d->securityInfo); } - diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest_p.h b/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest_p.h index 000252bdb..5f2daa811 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest_p.h @@ -25,9 +25,9 @@ #include #include -#include -#include -#include +#include +#include +#include class QWebPermissionRequestPrivate; diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp b/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp index edca4c901..b486e9391 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp @@ -23,7 +23,7 @@ #include "qquickwebview_p_p.h" #include "qwebpreferences_p_p.h" #include -#include +#include #include #include diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp index 31b3d8177..3206481c8 100644 --- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp @@ -20,6 +20,7 @@ #include "config.h" #include "qrawwebview_p.h" +#include "CoordinatedGraphicsScene.h" #include "CoordinatedLayerTreeHostProxy.h" #include "Cursor.h" #include "DrawingAreaProxyImpl.h" @@ -34,7 +35,6 @@ #include "WebPageGroup.h" #include "WebPreferences.h" #include "qrawwebview_p_p.h" -#include #include void QRawWebViewPrivate::didChangeViewportProperties(const WebCore::ViewportAttributes& attr) @@ -352,7 +352,7 @@ WKPageRef QRawWebView::pageRef() return toAPI(d->m_webPageProxy.get()); } -WebCore::CoordinatedGraphicsScene* QRawWebView::coordinatedGraphicsScene() const +WebKit::CoordinatedGraphicsScene* QRawWebView::coordinatedGraphicsScene() const { WebKit::DrawingAreaProxy* drawingArea = d->m_webPageProxy->drawingArea(); if (!drawingArea) diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h index 4ae3e5e53..00cf438b4 100644 --- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h +++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h @@ -47,7 +47,7 @@ QT_END_NAMESPACE class QRawWebViewPrivate; -namespace WebCore { +namespace WebKit { class CoordinatedGraphicsScene; } @@ -101,7 +101,7 @@ public: void sendTouchEvent(QTouchEvent*); private: - WebCore::CoordinatedGraphicsScene* coordinatedGraphicsScene() const; + WebKit::CoordinatedGraphicsScene* coordinatedGraphicsScene() const; QRawWebViewPrivate* d; }; diff --git a/Source/WebKit2/UIProcess/InspectorServer/WebSocketServer.h b/Source/WebKit2/UIProcess/InspectorServer/WebSocketServer.h index 8472eefb5..206cc6a81 100644 --- a/Source/WebKit2/UIProcess/InspectorServer/WebSocketServer.h +++ b/Source/WebKit2/UIProcess/InspectorServer/WebSocketServer.h @@ -82,7 +82,7 @@ private: String m_bindAddress; unsigned short m_port; #if PLATFORM(QT) - OwnPtr m_tcpServerHandler; + std::unique_ptr m_tcpServerHandler; #elif USE(SOUP) GRefPtr m_socketService; #endif diff --git a/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp b/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp index 2d060d068..317508b76 100644 --- a/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp +++ b/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp @@ -28,6 +28,7 @@ #include "WebPageProxy.h" #include #include +#include #include #include @@ -35,7 +36,7 @@ namespace WebKit { static String remoteInspectorPagePath() { - DEFINE_STATIC_LOCAL(String, pagePath, (ASCIILiteral("/webkit/inspector/inspector.html?page="))); + static NeverDestroyed pagePath(ASCIILiteral("/webkit/inspector/inspector.html?page=")); return pagePath; } @@ -84,15 +85,15 @@ void WebInspectorServer::buildPageList(Vector& data, String& contentType) builder.appendLiteral("[ "); ClientMap::iterator end = m_clientMap.end(); for (ClientMap::iterator it = m_clientMap.begin(); it != end; ++it) { - WebPageProxy* webPage = it->value->page(); + WebPageProxy* webPage = it->value->inspectedPage(); if (it != m_clientMap.begin()) builder.appendLiteral(", "); builder.appendLiteral("{ \"id\": "); builder.appendNumber(it->key); builder.appendLiteral(", \"title\": \""); - builder.append(webPage->pageTitle()); + builder.append(webPage->pageLoadState().title()); builder.appendLiteral("\", \"url\": \""); - builder.append(webPage->activeURL()); + builder.append(webPage->pageLoadState().activeURL()); builder.appendLiteral("\", \"inspectorUrl\": \""); builder.append(remoteInspectorPagePath()); builder.appendNumber(it->key); diff --git a/Source/WebKit2/UIProcess/InspectorServer/qt/WebSocketServerQt.cpp b/Source/WebKit2/UIProcess/InspectorServer/qt/WebSocketServerQt.cpp index 4503104a3..fd7ad123b 100644 --- a/Source/WebKit2/UIProcess/InspectorServer/qt/WebSocketServerQt.cpp +++ b/Source/WebKit2/UIProcess/InspectorServer/qt/WebSocketServerQt.cpp @@ -25,7 +25,6 @@ #include "WebSocketServer.h" #include "WebSocketServerConnection.h" #include -#include using namespace WebCore; @@ -33,7 +32,7 @@ namespace WebKit { void WebSocketServer::platformInitialize() { - m_tcpServerHandler = adoptPtr(new QtTcpServerHandler(this)); + m_tcpServerHandler.reset(new QtTcpServerHandler(this)); } bool WebSocketServer::platformListen(const String& bindAddress, unsigned short port) @@ -56,9 +55,9 @@ void QtTcpServerHandler::handleNewConnection() { QTcpSocket* socket = m_serverSocket.nextPendingConnection(); ASSERT(socket); - OwnPtr conection = adoptPtr(new WebSocketServerConnection(m_webSocketServer->client(), m_webSocketServer)); - conection->setSocketHandle(SocketStreamHandle::create(socket, conection.get())); - m_webSocketServer->didAcceptConnection(conection.release()); + auto connection = std::make_unique(m_webSocketServer->client(), m_webSocketServer); + connection->setSocketHandle(SocketStreamHandle::create(socket, connection.get())); + m_webSocketServer->didAcceptConnection(WTFMove(connection)); } bool QtTcpServerHandler::listen(const String& bindAddress, unsigned short port) diff --git a/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp index 7d0203478..653dfb52f 100644 --- a/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp +++ b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp @@ -36,9 +36,9 @@ #include #include #include -#include #include #include +#include #include #include @@ -54,8 +54,8 @@ #endif #if defined(Q_OS_LINUX) -#include #include +#include #endif #if OS(WINDOWS) @@ -84,8 +84,7 @@ using namespace WebCore; namespace WebKit { -class QtWebProcess : public QProcess -{ +class QtWebProcess : public QProcess { Q_OBJECT public: QtWebProcess(QObject* parent = 0) @@ -143,8 +142,8 @@ void ProcessLauncher::launchProcess() commandLine = commandLine.arg(serviceName); #elif OS(WINDOWS) - CoreIPC::Connection::Identifier connector, clientIdentifier; - if (!CoreIPC::Connection::createServerAndClientIdentifiers(connector, clientIdentifier)) { + IPC::Connection::Identifier connector, clientIdentifier; + if (!IPC::Connection::createServerAndClientIdentifiers(connector, clientIdentifier)) { // FIXME: What should we do here? ASSERT_NOT_REACHED(); } diff --git a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp index 294c77117..eeb5087da 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp +++ b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp @@ -93,7 +93,7 @@ void PluginInfoStore::loadPluginsIfNecessary() m_plugins.clear(); for (const auto& pluginPath : uniquePluginPaths) - loadPlugin(m_plugins, *it); + loadPlugin(m_plugins, pluginPath); m_pluginListIsUpToDate = true; diff --git a/Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp b/Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp index cfe9bd7b4..35afe9fab 100644 --- a/Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp +++ b/Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp @@ -33,6 +33,7 @@ #include "NetscapePluginModule.h" #include "PluginSearchPath.h" +#include "ProcessExecutablePath.h" #include #if PLATFORM(GTK) @@ -69,8 +70,17 @@ Vector PluginInfoStore::individualPluginPaths() bool PluginInfoStore::getPluginInfo(const String& pluginPath, PluginModuleInfo& plugin) { #if PLATFORM(GTK) - if (PluginInfoCache::singleton().getPluginInfo(pluginPath, plugin)) + if (PluginInfoCache::singleton().getPluginInfo(pluginPath, plugin)) { +#if ENABLE(PLUGIN_PROCESS_GTK2) + if (plugin.requiresGtk2) { + String pluginProcessPath = executablePathOfPluginProcess(); + pluginProcessPath.append('2'); + if (!fileExists(pluginProcessPath)) + return false; + } +#endif return true; + } if (NetscapePluginModule::getPluginInfo(pluginPath, plugin)) { PluginInfoCache::singleton().updatePluginInfo(pluginPath, plugin); diff --git a/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp b/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp index 8569450ba..a6c52f8b4 100644 --- a/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp +++ b/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp @@ -83,12 +83,15 @@ bool PluginProcessProxy::scanPlugin(const String& pluginPath, RawPluginMetaData& #if PLATFORM(GTK) bool requiresGtk2 = pluginRequiresGtk2(pluginPath); - if (requiresGtk2) + if (requiresGtk2) { #if ENABLE(PLUGIN_PROCESS_GTK2) pluginProcessPath.append('2'); + if (!fileExists(pluginProcessPath)) + return false; #else return false; #endif + } #endif CString binaryPath = fileSystemRepresentation(pluginProcessPath); diff --git a/Source/WebKit2/UIProcess/Storage/LocalStorageDatabase.cpp b/Source/WebKit2/UIProcess/Storage/LocalStorageDatabase.cpp index 1367438af..3468b5df6 100644 --- a/Source/WebKit2/UIProcess/Storage/LocalStorageDatabase.cpp +++ b/Source/WebKit2/UIProcess/Storage/LocalStorageDatabase.cpp @@ -181,7 +181,10 @@ void LocalStorageDatabase::importItems(StorageMap& storageMap) int result = query.step(); while (result == SQLITE_ROW) { - items.set(query.getColumnText(0), query.getColumnBlobAsString(1)); + String key = query.getColumnText(0); + String value = query.getColumnBlobAsString(1); + if (!key.isNull() && !value.isNull()) + items.set(key, value); result = query.step(); } diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp index 85fdbf8ed..3e221a920 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp @@ -348,7 +348,6 @@ WebPageProxy::WebPageProxy(PageClient& pageClient, WebProcessProxy& process, uin , m_alwaysRunsAtForegroundPriority(m_configuration->alwaysRunsAtForegroundPriority()) #endif , m_backForwardList(WebBackForwardList::create(*this)) - , m_loadStateAtProcessExit(FrameLoadState::LoadStateFinished) , m_maintainsInactiveSelection(false) , m_isEditable(false) , m_textZoomFactor(1) @@ -5137,10 +5136,8 @@ void WebPageProxy::resetStateAfterProcessExited() m_editorState = EditorState(); - if (m_mainFrame) { + if (m_mainFrame) m_urlAtProcessExit = m_mainFrame->url(); - m_loadStateAtProcessExit = m_mainFrame->loadState(); - } m_pageClient.processDidExit(); diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index 8c9bad74d..fb39d86f4 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -110,6 +110,7 @@ OBJC_CLASS _WKRemoteObjectRegistry; #endif #if PLATFORM(QT) +#include "ArgumentCodersQt.h" #include "QtNetworkRequestData.h" #endif @@ -865,7 +866,6 @@ public: bool isValid() const; const String& urlAtProcessExit() const { return m_urlAtProcessExit; } - FrameLoadState::LoadState loadStateAtProcessExit() const { return m_loadStateAtProcessExit; } #if ENABLE(DRAG_SUPPORT) WebCore::DragOperation currentDragOperation() const { return m_currentDragOperation; } @@ -1147,8 +1147,8 @@ private: virtual void failedToShowPopupMenu() override; #endif #if PLATFORM(QT) - virtual void changeSelectedIndex(int32_t newSelectedIndex); - virtual void closePopupMenu(); + void changeSelectedIndex(int32_t newSelectedIndex) override; + void closePopupMenu() override; #endif void didCreateMainFrame(uint64_t frameID); @@ -1631,7 +1631,6 @@ private: String m_toolTip; String m_urlAtProcessExit; - FrameLoadState::LoadState m_loadStateAtProcessExit; EditorState m_editorState; bool m_isEditable; diff --git a/Source/WebKit2/UIProcess/qt/BackingStoreQt.cpp b/Source/WebKit2/UIProcess/qt/BackingStoreQt.cpp index 1af16d842..a44ed681d 100644 --- a/Source/WebKit2/UIProcess/qt/BackingStoreQt.cpp +++ b/Source/WebKit2/UIProcess/qt/BackingStoreQt.cpp @@ -28,8 +28,8 @@ #include "config.h" #include "BackingStore.h" -#include "UpdateInfo.h" #include "ShareableBitmap.h" +#include "UpdateInfo.h" #include #include diff --git a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp index f72946529..0dbaa651e 100644 --- a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp +++ b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp @@ -274,7 +274,7 @@ void PageViewportControllerClientQt::zoomToAreaGestureEnded(const QPointF& touch // Zoom back out if attempting to scale to the same current scale, or // attempting to continue scaling out from the inner most level. // Use fuzzy compare with a fixed error to be able to deal with largish differences due to pixel rounding. - if (!m_scaleStack.isEmpty() && fuzzyCompare(targetScale, currentScale, 0.01)) { + if (!m_scaleStack.isEmpty() && WTF::areEssentiallyEqual(targetScale, currentScale, qreal(0.01))) { // If moving the viewport would expose more of the targetRect and move at least 40 pixels, update position but do not scale out. QRectF currentContentRect(m_viewportItem->mapRectToWebContent(viewportRect)); QRectF targetIntersection = endVisibleContentRect.intersected(targetArea); @@ -284,7 +284,7 @@ void PageViewportControllerClientQt::zoomToAreaGestureEnded(const QPointF& touch zoomAction = NoZoom; else zoomAction = ZoomBack; - } else if (fuzzyCompare(targetScale, m_zoomOutScale, 0.01)) + } else if (WTF::areEssentiallyEqual(targetScale, m_zoomOutScale, qreal(0.01))) zoomAction = ZoomBack; else if (targetScale < currentScale) zoomAction = ZoomOut; diff --git a/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp b/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp index 0dd547102..6d1949830 100644 --- a/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp +++ b/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp @@ -29,7 +29,6 @@ #include #include #include -#include namespace WebKit { @@ -413,7 +412,7 @@ bool QtDialogRunner::createDialog(QQmlComponent* component, QObject* contextObje QQmlContext* baseContext = component->creationContext(); if (!baseContext) baseContext = QQmlEngine::contextForObject(m_webView); - m_dialogContext = adoptPtr(new QQmlContext(baseContext)); + m_dialogContext = std::make_unique(baseContext); // This makes both "message" and "model.message" work for the dialog, // just like QtQuick's ListView delegates. @@ -423,14 +422,13 @@ bool QtDialogRunner::createDialog(QQmlComponent* component, QObject* contextObje QObject* object = component->beginCreate(m_dialogContext.get()); if (!object) { - m_dialogContext.clear(); + m_dialogContext = nullptr; return false; } - m_dialog = adoptPtr(qobject_cast(object)); + m_dialog.reset(qobject_cast(object)); if (!m_dialog) { - m_dialogContext.clear(); - m_dialog.clear(); + m_dialogContext = nullptr; return false; } @@ -480,4 +478,3 @@ void QtDialogRunner::onDatabaseQuotaAccepted(quint64 quota) #include "QtDialogRunner.moc" #include "moc_QtDialogRunner.cpp" - diff --git a/Source/WebKit2/UIProcess/qt/QtDialogRunner.h b/Source/WebKit2/UIProcess/qt/QtDialogRunner.h index b70044076..fcb276080 100644 --- a/Source/WebKit2/UIProcess/qt/QtDialogRunner.h +++ b/Source/WebKit2/UIProcess/qt/QtDialogRunner.h @@ -21,11 +21,10 @@ #ifndef QtDialogRunner_h #define QtDialogRunner_h -#include "WKSecurityOrigin.h" +#include "WKSecurityOriginRef.h" #include "qquickwebview_p.h" #include #include -#include QT_BEGIN_NAMESPACE class QQmlComponent; @@ -75,8 +74,8 @@ private: bool createDialog(QQmlComponent*, QObject* contextObject); QQuickWebView* m_webView; - OwnPtr m_dialogContext; - OwnPtr m_dialog; + std::unique_ptr m_dialogContext; + std::unique_ptr m_dialog; QString m_result; bool m_wasAccepted; diff --git a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp index 8c0e0c31a..1b62c94ba 100644 --- a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp @@ -209,14 +209,14 @@ IntRect QtPageClient::windowToScreen(const IntRect& rect) return rect; } -PassRefPtr QtPageClient::createPopupMenuProxy(WebPageProxy* webPageProxy) +RefPtr QtPageClient::createPopupMenuProxy(WebPageProxy& webPageProxy) { return WebPopupMenuProxyQt::create(webPageProxy, m_webView); } -PassRefPtr QtPageClient::createContextMenuProxy(WebPageProxy* webPageProxy) +std::unique_ptr QtPageClient::createContextMenuProxy(WebPageProxy&, const ContextMenuContextData& context, const UserData& userData) { - return WebContextMenuProxyQt::create(webPageProxy); + return std::make_unique(context, userData); } #if ENABLE(INPUT_TYPE_COLOR) @@ -226,11 +226,6 @@ PassRefPtr QtPageClient::createColorPicker(WebPageProxy* webPage } #endif -void QtPageClient::flashBackingStoreUpdates(const Vector&) -{ - notImplemented(); -} - void QtPageClient::pageTransitionViewportReady() { PageViewportController* pvc = QQuickWebViewPrivate::get(m_webView)->viewportController(); diff --git a/Source/WebKit2/UIProcess/qt/QtPageClient.h b/Source/WebKit2/UIProcess/qt/QtPageClient.h index 3cb5a8e07..2f63db4b6 100644 --- a/Source/WebKit2/UIProcess/qt/QtPageClient.h +++ b/Source/WebKit2/UIProcess/qt/QtPageClient.h @@ -21,7 +21,6 @@ #ifndef QtPageClient_h #define QtPageClient_h -#include "FindIndicator.h" #include "PageClient.h" class QQuickWebView; @@ -42,65 +41,63 @@ public: void initialize(QQuickWebView*, QtWebPageEventHandler*, WebKit::DefaultUndoController*); // QQuickWebView. - virtual void setViewNeedsDisplay(const WebCore::IntRect&); - virtual void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect); - virtual WebCore::IntSize viewSize(); - virtual bool isViewFocused(); - virtual bool isViewVisible(); - virtual void pageDidRequestScroll(const WebCore::IntPoint&); - virtual void didChangeContentsSize(const WebCore::IntSize&); - virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&); - virtual void processDidCrash(); - virtual void didRelaunchProcess(); - virtual std::unique_ptr createDrawingAreaProxy(); - virtual void handleDownloadRequest(DownloadProxy*); - virtual void handleApplicationSchemeRequest(PassRefPtr); - virtual void handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password); - virtual void handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors); - virtual void handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password); + void setViewNeedsDisplay(const WebCore::IntRect&) override; + void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect) override; + WebCore::IntSize viewSize() override; + bool isViewFocused() override; + bool isViewVisible() override; + void pageDidRequestScroll(const WebCore::IntPoint&) override; + void didChangeContentsSize(const WebCore::IntSize&) override; + void didChangeViewportProperties(const WebCore::ViewportAttributes&) override; + void processDidCrash() override; + void didRelaunchProcess() override; + std::unique_ptr createDrawingAreaProxy() override; + void handleDownloadRequest(DownloadProxy*) override; + void handleApplicationSchemeRequest(PassRefPtr) override; + 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; - virtual void displayView(); - virtual bool canScrollView() { return false; } - virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset); - virtual bool isViewWindowActive(); - virtual bool isViewInWindow(); -#if USE(ACCELERATED_COMPOSITING) - virtual void enterAcceleratedCompositingMode(const LayerTreeContext&); - virtual void exitAcceleratedCompositingMode(); - virtual void updateAcceleratedCompositingMode(const LayerTreeContext&); -#endif // USE(ACCELERATED_COMPOSITING) - virtual void pageClosed() { } - virtual void preferencesDidChange() { } - virtual void startDrag(const WebCore::DragData&, PassRefPtr dragImage); - virtual void setCursor(const WebCore::Cursor&); - virtual void setCursorHiddenUntilMouseMoves(bool); - virtual void toolTipChanged(const String&, const String&); + void displayView() override; + bool canScrollView() override { return false; } + void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) override; + bool isViewWindowActive() override; + bool isViewInWindow() override; + void enterAcceleratedCompositingMode(const LayerTreeContext&) override; + void exitAcceleratedCompositingMode() override; + void updateAcceleratedCompositingMode(const LayerTreeContext&) override; + void pageClosed() override { } + void preferencesDidChange() override { } + void startDrag(const WebCore::DragData&, PassRefPtr dragImage) override; + void setCursor(const WebCore::Cursor&) override; + void setCursorHiddenUntilMouseMoves(bool) override; + void toolTipChanged(const String&, const String&) override; // DefaultUndoController - virtual void registerEditCommand(PassRefPtr, WebPageProxy::UndoOrRedo); - virtual void clearAllEditCommands(); - virtual bool canUndoRedo(WebPageProxy::UndoOrRedo); - virtual void executeUndoRedo(WebPageProxy::UndoOrRedo); + void registerEditCommand(PassRefPtr, WebPageProxy::UndoOrRedo) override; + void clearAllEditCommands() override; + bool canUndoRedo(WebPageProxy::UndoOrRedo) override; + void executeUndoRedo(WebPageProxy::UndoOrRedo) override; - virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&); - virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&); - virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&); - virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&); - virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) { } - virtual PassRefPtr createPopupMenuProxy(WebPageProxy*); - virtual PassRefPtr createContextMenuProxy(WebPageProxy*); + 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; + void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) override { } + RefPtr createPopupMenuProxy(WebPageProxy&) override; + std::unique_ptr createContextMenuProxy(WebPageProxy&, const ContextMenuContextData&, const UserData&) override; #if ENABLE(INPUT_TYPE_COLOR) virtual PassRefPtr createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&); #endif - virtual void setFindIndicator(PassRefPtr, bool fadeOut, bool animate) { } - virtual void flashBackingStoreUpdates(const Vector& updateRects); - virtual void pageTransitionViewportReady(); - virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&); - virtual void updateTextInputState(); - virtual void handleWillSetInputMethodState(); - virtual void doneWithGestureEvent(const WebGestureEvent&, bool wasEventHandled); + void pageTransitionViewportReady() override; + void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) override; + void updateTextInputState() override; + void handleWillSetInputMethodState() override; +#if ENABLE(GESTURE_EVENTS) + void doneWithGestureEvent(const WebGestureEvent&, bool wasEventHandled) override; +#endif #if ENABLE(TOUCH_EVENTS) - virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled); + void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) override; #endif private: diff --git a/Source/WebKit2/UIProcess/qt/QtPinchGestureRecognizer.cpp b/Source/WebKit2/UIProcess/qt/QtPinchGestureRecognizer.cpp index 7fa58014f..a26c01062 100644 --- a/Source/WebKit2/UIProcess/qt/QtPinchGestureRecognizer.cpp +++ b/Source/WebKit2/UIProcess/qt/QtPinchGestureRecognizer.cpp @@ -103,4 +103,3 @@ void QtPinchGestureRecognizer::cancel() } } // namespace WebKit - diff --git a/Source/WebKit2/UIProcess/qt/QtWebContext.cpp b/Source/WebKit2/UIProcess/qt/QtWebContext.cpp index 6d80596dd..7d3ecc920 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebContext.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebContext.cpp @@ -67,7 +67,7 @@ static void initInspectorServer() return; } - bool success = WebInspectorServer::shared().listen(bindAddress, port); + bool success = WebInspectorServer::singleton().listen(bindAddress, port); if (success) { QString inspectorServerUrl = QString::fromLatin1("http://%1:%2").arg(bindAddress).arg(port); qWarning("Inspector server started successfully. Try pointing a WebKit browser to %s", qPrintable(inspectorServerUrl)); @@ -206,4 +206,3 @@ QString QtWebContext::preparedStoragePath(StorageType type) } } // namespace WebKit - diff --git a/Source/WebKit2/UIProcess/qt/QtWebError.cpp b/Source/WebKit2/UIProcess/qt/QtWebError.cpp index c2f506c8f..940e2a510 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebError.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebError.cpp @@ -21,6 +21,8 @@ #include "config.h" #include "QtWebError.h" +#include "WKErrorRef.h" + #include #include #include diff --git a/Source/WebKit2/UIProcess/qt/QtWebError.h b/Source/WebKit2/UIProcess/qt/QtWebError.h index c2b922603..660aee855 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebError.h +++ b/Source/WebKit2/UIProcess/qt/QtWebError.h @@ -22,8 +22,8 @@ #define QtWebError_h #include "qwebdownloaditem_p.h" +#include #include -#include #include QT_BEGIN_NAMESPACE diff --git a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp index 86ac710bf..f28fb4163 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp @@ -92,4 +92,3 @@ void QtWebIconDatabaseClient::releaseIconForPageURL(const QString& pageURL) } // namespace WebKit #include "moc_QtWebIconDatabaseClient.cpp" - diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp index 8e7c5c221..9b620fb9d 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp @@ -188,7 +188,7 @@ void QtWebPageEventHandler::handleDragEnterEvent(QDragEnterEvent* ev) QTransform fromItemTransform = m_webPage->transformFromItem(); // FIXME: Should not use QCursor::pos() DragData dragData(ev->mimeData(), fromItemTransform.map(ev->pos()), QCursor::pos(), dropActionToDragOperation(ev->possibleActions())); - m_webPageProxy->dragEntered(&dragData); + m_webPageProxy->dragEntered(dragData); ev->acceptProposedAction(); } @@ -198,7 +198,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->dragExited(dragData); m_webPageProxy->resetDragOperation(); ev->setAccepted(accepted); @@ -211,7 +211,7 @@ void QtWebPageEventHandler::handleDragMoveEvent(QDragMoveEvent* ev) QTransform fromItemTransform = m_webPage->transformFromItem(); // FIXME: Should not use QCursor::pos() DragData dragData(ev->mimeData(), fromItemTransform.map(ev->pos()), QCursor::pos(), dropActionToDragOperation(ev->possibleActions())); - m_webPageProxy->dragUpdated(&dragData); + m_webPageProxy->dragUpdated(dragData); ev->setDropAction(dragOperationToDropAction(m_webPageProxy->dragSession().operation)); if (m_webPageProxy->dragSession().operation != DragOperationNone) ev->accept(); @@ -227,7 +227,7 @@ void QtWebPageEventHandler::handleDropEvent(QDropEvent* ev) DragData dragData(ev->mimeData(), fromItemTransform.map(ev->pos()), QCursor::pos(), dropActionToDragOperation(ev->possibleActions())); SandboxExtension::Handle handle; SandboxExtension::HandleArray sandboxExtensionForUpload; - m_webPageProxy->performDrag(&dragData, String(), handle, sandboxExtensionForUpload); + m_webPageProxy->performDragOperation(dragData, String(), handle, sandboxExtensionForUpload); ev->setDropAction(dragOperationToDropAction(m_webPageProxy->dragSession().operation)); ev->accept(); @@ -261,12 +261,14 @@ void QtWebPageEventHandler::deactivateTapHighlight() void QtWebPageEventHandler::handleSingleTapEvent(const QTouchEvent::TouchPoint& point) { +#if ENABLE(GESTURE_EVENTS) deactivateTapHighlight(); m_postponeTextInputStateChanged = true; QTransform fromItemTransform = m_webPage->transformFromItem(); WebGestureEvent gesture(WebEvent::GestureSingleTap, fromItemTransform.map(point.pos()).toPoint(), point.screenPos().toPoint(), WebEvent::Modifiers(0), 0, IntSize(point.rect().size().toSize()), FloatPoint(0, 0)); m_webPageProxy->handleGestureEvent(gesture); +#endif } void QtWebPageEventHandler::handleDoubleTapEvent(const QTouchEvent::TouchPoint& point) @@ -300,12 +302,12 @@ void QtWebPageEventHandler::handleKeyReleaseEvent(QKeyEvent* ev) void QtWebPageEventHandler::handleFocusInEvent(QFocusEvent*) { - m_webPageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive); + m_webPageProxy->viewStateDidChange(ViewState::IsFocused | ViewState::WindowIsActive); } void QtWebPageEventHandler::handleFocusLost() { - m_webPageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive); + m_webPageProxy->viewStateDidChange(ViewState::IsFocused | ViewState::WindowIsActive); } void QtWebPageEventHandler::setViewportController(PageViewportControllerClientQt* controller) @@ -446,6 +448,7 @@ void QtWebPageEventHandler::handleWillSetInputMethodState() void QtWebPageEventHandler::doneWithGestureEvent(const WebGestureEvent& event, bool wasEventHandled) { +#if ENABLE(GESTURE_EVENTS) if (event.type() != WebEvent::GestureSingleTap) return; @@ -455,6 +458,7 @@ void QtWebPageEventHandler::doneWithGestureEvent(const WebGestureEvent& event, b return; updateTextInputState(); +#endif } void QtWebPageEventHandler::handleInputEvent(const QInputEvent* event) diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h index 005cb4ca0..cd44ddc85 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h @@ -84,7 +84,7 @@ public: void didFindZoomableArea(const WebCore::IntPoint& target, const WebCore::IntRect& area); void updateTextInputState(); - void doneWithGestureEvent(const WebGestureEvent& event, bool wasEventHandled); + void doneWithGestureEvent(const WebGestureEvent&, bool wasEventHandled); #if ENABLE(TOUCH_EVENTS) void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled); #endif diff --git a/Source/WebKit2/UIProcess/qt/QtWebPagePolicyClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebPagePolicyClient.cpp index 0c800ed64..88a9436af 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPagePolicyClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPagePolicyClient.cpp @@ -158,4 +158,3 @@ void QtWebPagePolicyClient::decidePolicyForResponse(WKPageRef page, WKFrameRef f } } // namespace WebKit - diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp index 9a7b34951..1382312db 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp @@ -21,11 +21,12 @@ #include "config.h" #include "QtWebPageSGNode.h" +#include "CoordinatedGraphicsScene.h" + #include #include #include #include -#include #include #if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) @@ -110,7 +111,7 @@ public: return parent; } - WebCore::CoordinatedGraphicsScene* coordinatedGraphicsScene() const { return m_scene.get(); } + CoordinatedGraphicsScene* coordinatedGraphicsScene() const { return m_scene.get(); } private: QRectF clipRect() const @@ -159,7 +160,7 @@ private: return resultRect; } - RefPtr m_scene; + RefPtr m_scene; }; QtWebPageSGNode::QtWebPageSGNode() @@ -183,7 +184,7 @@ void QtWebPageSGNode::setScale(float scale) setMatrix(matrix); } -void QtWebPageSGNode::setCoordinatedGraphicsScene(PassRefPtr scene) +void QtWebPageSGNode::setCoordinatedGraphicsScene(PassRefPtr scene) { if (m_contentsNode && m_contentsNode->coordinatedGraphicsScene() == scene) return; diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.h b/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.h index 77ad81b6f..22d3767bf 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.h +++ b/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.h @@ -29,20 +29,17 @@ class QQuickItem; class QSGSimpleRectNode; QT_END_NAMESPACE -namespace WebCore { -class CoordinatedGraphicsScene; -} - namespace WebKit { class ContentsSGNode; +class CoordinatedGraphicsScene; class QtWebPageSGNode : public QSGTransformNode { public: QtWebPageSGNode(); void setBackground(const QRectF&, const QColor&); void setScale(float); - void setCoordinatedGraphicsScene(PassRefPtr); + void setCoordinatedGraphicsScene(PassRefPtr); qreal devicePixelRatio() const { return m_devicePixelRatio; } void setDevicePixelRatio(qreal devicePixelRatio) { m_devicePixelRatio = devicePixelRatio; } diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp index af88423c6..482076370 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp @@ -119,8 +119,8 @@ bool QtWebPageUIClient::runJavaScriptConfirm(WKPageRef, WKStringRef message, WKF static inline WKStringRef createNullWKString() { - RefPtr webString = WebString::createNull(); - return toAPI(webString.release().leakRef()); + RefPtr apiString = API::String::createNull(); + return toAPI(apiString.release().leakRef()); } WKStringRef QtWebPageUIClient::runJavaScriptPrompt(WKPageRef, WKStringRef message, WKStringRef defaultValue, WKFrameRef, const void* clientInfo) @@ -174,4 +174,3 @@ void QtWebPageUIClient::policyForNotificationPermissionRequest(WKPageRef page, W } } // namespace WebKit - diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.h b/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.h index e8aaa826b..b608d5880 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.h +++ b/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include class QQuickWebView; class QWebPermissionRequest; diff --git a/Source/WebKit2/UIProcess/qt/WebColorPickerQt.cpp b/Source/WebKit2/UIProcess/qt/WebColorPickerQt.cpp index 1bfa37624..d23cff04a 100644 --- a/Source/WebKit2/UIProcess/qt/WebColorPickerQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebColorPickerQt.cpp @@ -82,13 +82,13 @@ void WebColorPickerQt::createItem(QObject* contextObject) createContext(component, contextObject); QObject* object = component->beginCreate(m_context.get()); if (!object) { - m_context.clear(); + m_context = nullptr; return; } - m_colorChooser = adoptPtr(qobject_cast(object)); + m_colorChooser.reset(qobject_cast(object)); if (!m_colorChooser) { - m_context.clear(); + m_context = nullptr; return; } @@ -107,7 +107,7 @@ void WebColorPickerQt::createContext(QQmlComponent* component, QObject* contextO QQmlContext* baseContext = component->creationContext(); if (!baseContext) baseContext = QQmlEngine::contextForObject(m_webView); - m_context = adoptPtr(new QQmlContext(baseContext)); + m_context.reset(new QQmlContext(baseContext)); contextObject->setParent(m_context.get()); m_context->setContextProperty(QLatin1String("model"), contextObject); @@ -137,8 +137,8 @@ void WebColorPickerQt::notifyColorSelected(const QColor& color) void WebColorPickerQt::endPicker() { - m_colorChooser.clear(); - m_context.clear(); + m_colorChooser = nullptr; + m_context = nullptr; if (!m_client) return; diff --git a/Source/WebKit2/UIProcess/qt/WebColorPickerQt.h b/Source/WebKit2/UIProcess/qt/WebColorPickerQt.h index 00c72d7ab..08c4e7dcd 100644 --- a/Source/WebKit2/UIProcess/qt/WebColorPickerQt.h +++ b/Source/WebKit2/UIProcess/qt/WebColorPickerQt.h @@ -24,7 +24,6 @@ #include "IntRect.h" #include "WebColorPicker.h" #include -#include QT_BEGIN_NAMESPACE class QQmlComponent; @@ -64,8 +63,8 @@ private: void createItem(QObject*); void createContext(QQmlComponent*, QObject*); - OwnPtr m_context; - OwnPtr m_colorChooser; + std::unique_ptr m_context; + std::unique_ptr m_colorChooser; QQuickWebView* m_webView; }; diff --git a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp index d510c53ff..1ff57e9c9 100644 --- a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp @@ -31,16 +31,12 @@ using namespace WebCore; namespace WebKit { -WebContextMenuProxyQt::WebContextMenuProxyQt(WebPageProxy*) +WebContextMenuProxyQt::WebContextMenuProxyQt(const ContextMenuContextData& context, const UserData& userData) + : WebContextMenuProxy(context, userData) { } -PassRefPtr WebContextMenuProxyQt::create(WebPageProxy* webPageProxy) -{ - return adoptRef(new WebContextMenuProxyQt(webPageProxy)); -} - -void WebContextMenuProxyQt::showContextMenu(const IntPoint& position, const Vector& items) +void WebContextMenuProxyQt::showContextMenu(const IntPoint&, const Vector&) { } @@ -51,4 +47,3 @@ void WebContextMenuProxyQt::hideContextMenu() #include "moc_WebContextMenuProxyQt.cpp" } // namespace WebKit - diff --git a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h index bd7aebd6f..a0cc82d0a 100644 --- a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h +++ b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h @@ -37,11 +37,9 @@ class WebPageProxy; class WebContextMenuProxyQt : public QObject, public WebContextMenuProxy { Q_OBJECT public: - static PassRefPtr create(WebPageProxy*); + WebContextMenuProxyQt(const ContextMenuContextData&, const UserData&); private: - WebContextMenuProxyQt(WebPageProxy*); - virtual void showContextMenu(const WebCore::IntPoint&, const Vector&); virtual void hideContextMenu(); }; diff --git a/Source/WebKit2/UIProcess/qt/WebContextQt.cpp b/Source/WebKit2/UIProcess/qt/WebContextQt.cpp deleted file mode 100644 index 7661559fe..000000000 --- a/Source/WebKit2/UIProcess/qt/WebContextQt.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * Copyright (C) 2010 University of Szeged - * - * 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 "WebContext.h" - -#include "ApplicationCacheStorage.h" -#include "WKSharedAPICast.h" -#include "WebProcessCreationParameters.h" -#include - -#if ENABLE(GEOLOCATION) -#include "WebGeolocationManagerProxy.h" -#include "WebGeolocationProviderQt.h" -#endif - -namespace WebKit { - -String WebContext::platformDefaultApplicationCacheDirectory() const -{ - const String cacheDirectory = WebCore::cacheStorage().cacheDirectory(); - - if (cacheDirectory.isEmpty()) - return diskCacheDirectory(); - - return cacheDirectory; -} - -void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& parameters) -{ - qRegisterMetaType("QProcess::ExitStatus"); -#if ENABLE(GEOLOCATION) && HAVE(QTLOCATION) - static WebGeolocationProviderQt* location = WebGeolocationProviderQt::create(toAPI(supplement())); - WKGeolocationManagerSetProvider(toAPI(supplement()), WebGeolocationProviderQt::provider(location)); -#endif -} - -void WebContext::platformInvalidateContext() -{ -} - -String WebContext::platformDefaultDatabaseDirectory() const -{ - return String(); -} - -String WebContext::platformDefaultIconDatabasePath() const -{ - return String(); -} - -String WebContext::platformDefaultLocalStorageDirectory() const -{ - return String(); -} - -String WebContext::platformDefaultDiskCacheDirectory() const -{ - return String(); -} - -String WebContext::platformDefaultCookieStorageDirectory() const -{ - return String(); -} - -} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebGeolocationProviderQt.h b/Source/WebKit2/UIProcess/qt/WebGeolocationProviderQt.h index e476b128d..177266b4e 100644 --- a/Source/WebKit2/UIProcess/qt/WebGeolocationProviderQt.h +++ b/Source/WebKit2/UIProcess/qt/WebGeolocationProviderQt.h @@ -22,9 +22,9 @@ #define WebGeolocationProviderQt_h #include -#include -#include -#include +#include +#include +#include QT_BEGIN_NAMESPACE class QGeoPositionInfoSource; diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp index a89782506..541cca01f 100644 --- a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp @@ -62,7 +62,7 @@ void WebPageProxy::loadRecentSearches(const String&, Vector&) void WebPageProxy::registerApplicationScheme(const String& scheme) { - process()->send(Messages::WebPage::RegisterApplicationScheme(scheme), m_pageID); + process().send(Messages::WebPage::RegisterApplicationScheme(scheme), m_pageID); } void WebPageProxy::resolveApplicationSchemeRequest(QtNetworkRequestData request) @@ -80,7 +80,7 @@ void WebPageProxy::sendApplicationSchemeReply(const QQuickNetworkReply* reply) RefPtr requestData = reply->networkRequestData(); if (m_applicationSchemeRequests.contains(requestData)) { RefPtr replyData = reply->networkReplyData(); - process()->send(Messages::WebPage::ApplicationSchemeReply(replyData->data()), pageID()); + process().send(Messages::WebPage::ApplicationSchemeReply(replyData->data()), pageID()); m_applicationSchemeRequests.remove(requestData); } #endif @@ -88,17 +88,17 @@ void WebPageProxy::sendApplicationSchemeReply(const QQuickNetworkReply* reply) void WebPageProxy::authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) { - m_pageClient->handleAuthenticationRequiredRequest(hostname, realm, prefilledUsername, username, password); + m_pageClient.handleAuthenticationRequiredRequest(hostname, realm, prefilledUsername, username, password); } void WebPageProxy::proxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password) { - m_pageClient->handleProxyAuthenticationRequiredRequest(hostname, port, prefilledUsername, username, password); + m_pageClient.handleProxyAuthenticationRequiredRequest(hostname, port, prefilledUsername, username, password); } void WebPageProxy::certificateVerificationRequest(const String& hostname, bool& ignoreErrors) { - m_pageClient->handleCertificateVerificationRequest(hostname, ignoreErrors); + m_pageClient.handleCertificateVerificationRequest(hostname, ignoreErrors); } #if PLUGIN_ARCHITECTURE(X11) @@ -115,17 +115,17 @@ void WebPageProxy::windowedPluginGeometryDidChange(const WebCore::IntRect& frame void WebPageProxy::changeSelectedIndex(int32_t selectedIndex) { - process()->send(Messages::WebPage::SelectedIndex(selectedIndex), m_pageID); + process().send(Messages::WebPage::SelectedIndex(selectedIndex), m_pageID); } void WebPageProxy::closePopupMenu() { - process()->send(Messages::WebPage::HidePopupMenu(), m_pageID); + process().send(Messages::WebPage::HidePopupMenu(), m_pageID); } void WebPageProxy::willSetInputMethodState() { - m_pageClient->handleWillSetInputMethodState(); + m_pageClient.handleWillSetInputMethodState(); } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp index 128379f26..d82aa23ad 100644 --- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp @@ -262,7 +262,7 @@ void PopupMenuItemModel::buildItems(const Vector& webPopupItems) } } -WebPopupMenuProxyQt::WebPopupMenuProxyQt(WebPopupMenuProxy::Client* client, QQuickWebView* webView) +WebPopupMenuProxyQt::WebPopupMenuProxyQt(WebPopupMenuProxy::Client& client, QQuickWebView* webView) : WebPopupMenuProxy(client) , m_webView(webView) { @@ -287,8 +287,8 @@ void WebPopupMenuProxyQt::showPopupMenu(const IntRect& rect, WebCore::TextDirect void WebPopupMenuProxyQt::hidePopupMenu() { - m_itemSelector.clear(); - m_context.clear(); + m_itemSelector = nullptr; + m_context = nullptr; if (m_client) { m_client->closePopupMenu(); @@ -314,7 +314,7 @@ void WebPopupMenuProxyQt::createItem(QObject* contextObject) if (!object) return; - m_itemSelector = adoptPtr(qobject_cast(object)); + m_itemSelector.reset(qobject_cast(object)); if (!m_itemSelector) return; @@ -339,7 +339,7 @@ void WebPopupMenuProxyQt::createContext(QQmlComponent* component, QObject* conte QQmlContext* baseContext = component->creationContext(); if (!baseContext) baseContext = QQmlEngine::contextForObject(m_webView); - m_context = adoptPtr(new QQmlContext(baseContext)); + m_context.reset(new QQmlContext(baseContext)); contextObject->setParent(m_context.get()); m_context->setContextProperty(QLatin1String("model"), contextObject); diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h index e622f9006..fa03dbf07 100644 --- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h +++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h @@ -29,7 +29,6 @@ #include "WebPopupMenuProxy.h" #include -#include QT_BEGIN_NAMESPACE class QQmlComponent; @@ -50,9 +49,9 @@ public: MultipleSelection }; - static PassRefPtr create(WebPopupMenuProxy::Client* client, QQuickWebView* webView) + static Ref create(WebPopupMenuProxy::Client& client, QQuickWebView* webView) { - return adoptRef(new WebPopupMenuProxyQt(client, webView)); + return adoptRef(*new WebPopupMenuProxyQt(client, webView)); } ~WebPopupMenuProxyQt(); @@ -65,12 +64,12 @@ private Q_SLOTS: void selectIndex(int); private: - WebPopupMenuProxyQt(WebPopupMenuProxy::Client*, QQuickWebView*); + WebPopupMenuProxyQt(WebPopupMenuProxy::Client&, QQuickWebView*); void createItem(QObject*); void createContext(QQmlComponent*, QObject*); - OwnPtr m_context; - OwnPtr m_itemSelector; + std::unique_ptr m_context; + std::unique_ptr m_itemSelector; QQuickWebView* m_webView; SelectionType m_selectionType; diff --git a/Source/WebKit2/UIProcess/qt/WebProcessPoolQt.cpp b/Source/WebKit2/UIProcess/qt/WebProcessPoolQt.cpp new file mode 100644 index 000000000..11ef5e380 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/WebProcessPoolQt.cpp @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 University of Szeged + * + * 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 "WebProcessPool.h" + +#include "WKSharedAPICast.h" +#include "WebProcessCreationParameters.h" +#include +#include + +#if ENABLE(GEOLOCATION) +#include "WebGeolocationManagerProxy.h" +#include "WebGeolocationProviderQt.h" +#endif + +namespace WebKit { + +String WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory() +{ + const String cacheDirectory = WebCore::cacheStorage().cacheDirectory(); + + if (cacheDirectory.isEmpty()) + return diskCacheDirectory(); + + return cacheDirectory; +} + +void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters& parameters) +{ + qRegisterMetaType("QProcess::ExitStatus"); +#if ENABLE(GEOLOCATION) && HAVE(QTPOSITIONING) + static WebGeolocationProviderQt* location = WebGeolocationProviderQt::create(toAPI(supplement())); + WKGeolocationManagerSetProvider(toAPI(supplement()), WebGeolocationProviderQt::provider(location)); +#endif +} + +void WebProcessPool::platformInvalidateContext() +{ +} + + +String WebProcessPool::platformDefaultIconDatabasePath() const +{ + return String(); +} + +String WebProcessPool::platformDefaultLocalStorageDirectory() const +{ + return String(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebProcessProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebProcessProxyQt.cpp deleted file mode 100644 index e8b173d07..000000000 --- a/Source/WebKit2/UIProcess/qt/WebProcessProxyQt.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * 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 "WebProcessProxy.h" - -namespace WebKit { - -void WebProcessProxy::platformGetLaunchOptions(ProcessLauncher::LaunchOptions&) -{ -} - -} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp b/Source/WebKit2/WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp index a5183b135..9f5ff5d0e 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp @@ -54,8 +54,4 @@ bool InjectedBundle::load(APIObject* initializationUserData) return true; } -void InjectedBundle::activateMacFontAscentHack() -{ -} - } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp index b396b0b34..8b8eaa0bc 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp @@ -51,13 +51,14 @@ bool NetscapePlugin::platformPostInitialize() } #endif - if (m_impl) { - m_npWindow.type = m_impl->windowType(); - m_npWindow.window = m_impl->window(); - m_npWindow.ws_info = m_impl->windowSystemInfo(); - callSetWindow(); - } + // Windowed plugins need a platform implementation. + if (!m_impl) + return !m_isWindowed; + m_npWindow.type = m_impl->windowType(); + m_npWindow.window = m_impl->window(); + m_npWindow.ws_info = m_impl->windowSystemInfo(); + callSetWindow(); return true; } diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp index 175a20006..61cf8130f 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp @@ -221,7 +221,7 @@ void WebEditorClient::discardedComposition(Frame*) void WebEditorClient::updateGlobalSelection(Frame* frame) { if (supportsGlobalSelection() && frame->selection().isRange()) - Pasteboard::createForGlobalSelection()->writeSelection(frame->selection().toNormalizedRange().get(), frame->editor().canSmartCopyOrDelete(), frame); + Pasteboard::createForGlobalSelection()->writeSelection(*frame->selection().toNormalizedRange(), frame->editor().canSmartCopyOrDelete(), *frame); } #endif diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp index 00828dde6..5c341bacf 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp @@ -1155,9 +1155,9 @@ bool WebFrameLoaderClient::shouldFallBack(const ResourceError& error) return false; #if PLATFORM(QT) - DEFINE_STATIC_LOCAL(const ResourceError, errorInterruptedForPolicyChange, (this->interruptedForPolicyChangeError(ResourceRequest()))); + static NeverDestroyed errorInterruptedForPolicyChange(this->interruptedForPolicyChangeError(ResourceRequest())); - if (error.errorCode() == errorInterruptedForPolicyChange.errorCode() && error.domain() == errorInterruptedForPolicyChange.domain()) + if (error.errorCode() == errorInterruptedForPolicyChange.get().errorCode() && error.domain() == errorInterruptedForPolicyChange.get().domain()) return false; #endif diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDragClientQt.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDragClientQt.cpp index 056412894..380208a46 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDragClientQt.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDragClientQt.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "WebDragClient.h" -#include "Clipboard.h" +#include "DataTransfer.h" #include "DragData.h" #include "GraphicsContext.h" #include "Pasteboard.h" @@ -51,11 +51,11 @@ static PassRefPtr convertQPixmapToShareableBitmap(QPixmap* pixm return bitmap.release(); } -void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& clientPosition, const IntPoint& globalPosition, Clipboard* clipboard, Frame*, bool) +void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& clientPosition, const IntPoint& globalPosition, DataTransfer& dataTransfer, Frame&, bool) { - QMimeData* clipboardData = clipboard->pasteboard().clipboardData(); - DragOperation dragOperationMask = clipboard->sourceOperation(); - clipboard->pasteboard().invalidateWritableData(); + QMimeData* clipboardData = dataTransfer.pasteboard().clipboardData(); + DragOperation dragOperationMask = dataTransfer.sourceOperation(); + dataTransfer.pasteboard().invalidateWritableData(); DragData dragData(clipboardData, clientPosition, globalPosition, dragOperationMask); RefPtr bitmap = convertQPixmapToShareableBitmap(dragImage); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp index 7f2e74ce8..db024165d 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp @@ -27,22 +27,21 @@ #include "config.h" #include "WebErrors.h" -#include "WKError.h" -#include "WebError.h" +#include "APIError.h" +#include "WKErrorRef.h" +#include +#include #include #include #include -#include -#include - using namespace WebCore; namespace WebKit { ResourceError cancelledError(const ResourceRequest& request) { - ResourceError error = ResourceError("QtNetwork", QNetworkReply::OperationCanceledError, request.url().string(), + ResourceError error = ResourceError("QtNetwork", QNetworkReply::OperationCanceledError, request.url(), QCoreApplication::translate("QWebFrame", "Request cancelled")); error.setIsCancellation(true); return error; @@ -50,38 +49,50 @@ ResourceError cancelledError(const ResourceRequest& request) ResourceError blockedError(const ResourceRequest& request) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCannotUseRestrictedPort, request.url().string(), + return ResourceError(API::Error::webKitErrorDomain(), kWKErrorCodeCannotUseRestrictedPort, request.url(), QCoreApplication::translate("QWebFrame", "Request blocked")); } +ResourceError blockedByContentBlockerError(const WebCore::ResourceRequest& request) +{ + return ResourceError(API::Error::webKitErrorDomain(), kWKErrorCodeFrameLoadBlockedByContentBlocker, request.url(), + QCoreApplication::translate("QWebFrame", "The URL was blocked by a content blocker")); +} + ResourceError cannotShowURLError(const ResourceRequest& request) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCannotShowURL, request.url().string(), + return ResourceError(API::Error::webKitErrorDomain(), kWKErrorCodeCannotShowURL, request.url(), QCoreApplication::translate("QWebFrame", "Cannot show URL")); } ResourceError interruptedForPolicyChangeError(const ResourceRequest& request) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeFrameLoadInterruptedByPolicyChange, request.url().string(), + return ResourceError(API::Error::webKitErrorDomain(), kWKErrorCodeFrameLoadInterruptedByPolicyChange, request.url(), QCoreApplication::translate("QWebFrame", "Frame load interrupted by policy change")); } ResourceError cannotShowMIMETypeError(const ResourceResponse& response) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCannotShowMIMEType, response.url().string(), + return ResourceError(API::Error::webKitErrorDomain(), kWKErrorCodeCannotShowMIMEType, response.url(), QCoreApplication::translate("QWebFrame", "Cannot show mimetype")); } ResourceError fileDoesNotExistError(const ResourceResponse& response) { - return ResourceError("QtNetwork", QNetworkReply::ContentNotFoundError, response.url().string(), + return ResourceError("QtNetwork", QNetworkReply::ContentNotFoundError, response.url(), QCoreApplication::translate("QWebFrame", "File does not exist")); } ResourceError pluginWillHandleLoadError(const ResourceResponse& response) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodePlugInWillHandleLoad, response.url().string(), + return ResourceError(API::Error::webKitErrorDomain(), kWKErrorCodePlugInWillHandleLoad, response.url(), QCoreApplication::translate("QWebFrame", "Loading is handled by the media engine")); } +ResourceError internalError(const WebCore::URL& url) +{ + return ResourceError(API::Error::webKitErrorDomain(), kWKErrorInternal, url, + QCoreApplication::translate("QWebFrame", "WebKit encountered an internal error")); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp index 7d8a7908e..e17ca0376 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp @@ -33,7 +33,7 @@ WebFrameNetworkingContext::WebFrameNetworkingContext(WebFrame* frame) { // Save the page ID for a valid page as it is needed later for HTTP authentication and SSL errors. if (frame->page()) { - m_originatingObject = adoptPtr(new QObject); + m_originatingObject.reset(new QObject); m_originatingObject->setProperty("pageID", qulonglong(frame->page()->pageID())); } } diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.h b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.h index 966e6d2e9..8e72baef6 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.h @@ -22,7 +22,6 @@ #include "WebProcess.h" #include -#include namespace WebKit { @@ -31,17 +30,18 @@ class WebFrame; class WebFrameNetworkingContext : public WebCore::FrameNetworkingContext { public: static PassRefPtr create(WebFrame*); - QObject* originatingObject() const { return m_originatingObject.get(); } + + QObject* originatingObject() const override { return m_originatingObject.get(); } private: WebFrameNetworkingContext(WebFrame*); ~WebFrameNetworkingContext() { } - QNetworkAccessManager* networkAccessManager() const { return WebProcess::shared().networkAccessManager(); } - bool mimeSniffingEnabled() const { return m_mimeSniffingEnabled; } - bool thirdPartyCookiePolicyPermission(const QUrl&) const { /*TODO. Used QWebSettings in WK1.*/ return true; } + QNetworkAccessManager* networkAccessManager() const override { return WebProcess::singleton().networkAccessManager(); } + bool mimeSniffingEnabled() const override { return m_mimeSniffingEnabled; } + bool thirdPartyCookiePolicyPermission(const QUrl&) const override { /*TODO. Used QWebSettings in WK1.*/ return true; } - OwnPtr m_originatingObject; + std::unique_ptr m_originatingObject; bool m_mimeSniffingEnabled; }; diff --git a/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp b/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp index 508595b0f..e086edab4 100644 --- a/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp +++ b/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp @@ -75,11 +75,11 @@ void TapHighlightController::hideHighlight() m_webPage->mainFrame()->pageOverlayController().uninstallPageOverlay(m_overlay, PageOverlay::FadeMode::Fade); } -void TapHighlightController::pageOverlayDestroyed(PageOverlay*) +void TapHighlightController::pageOverlayDestroyed(PageOverlay&) { } -void TapHighlightController::willMoveToWebPage(PageOverlay*, WebPage* webPage) +void TapHighlightController::willMoveToPage(PageOverlay&, WebCore::Page* webPage) { if (webPage) return; @@ -89,7 +89,7 @@ void TapHighlightController::willMoveToWebPage(PageOverlay*, WebPage* webPage) m_overlay = 0; } -void TapHighlightController::didMoveToWebPage(PageOverlay*, WebPage*) +void TapHighlightController::didMoveToPage(PageOverlay&, WebCore::Page*) { } @@ -98,19 +98,19 @@ static Color highlightColor(Color baseColor, float fractionFadedIn) return Color(baseColor.red(), baseColor.green(), baseColor.blue(), int(baseColor.alpha() * fractionFadedIn)); } -void TapHighlightController::drawRect(PageOverlay* /*pageOverlay*/, GraphicsContext& context, const IntRect& /*dirtyRect*/) +void TapHighlightController::drawRect(PageOverlay& /*pageOverlay*/, GraphicsContext& context, const IntRect& /*dirtyRect*/) { if (m_path.isEmpty()) return; { GraphicsContextStateSaver stateSaver(context); - context.setFillColor(highlightColor(m_color, 0.5f), ColorSpaceSRGB); + context.setFillColor(highlightColor(m_color, 0.5f)); context.fillPath(m_path); } } -bool TapHighlightController::mouseEvent(PageOverlay*, const WebMouseEvent&) +bool TapHighlightController::mouseEvent(PageOverlay&, const WebCore::PlatformMouseEvent&) { return false; } diff --git a/Source/WebKit2/WebProcess/WebPage/TapHighlightController.h b/Source/WebKit2/WebProcess/WebPage/TapHighlightController.h index 5c39f7e64..f78b7f469 100644 --- a/Source/WebKit2/WebProcess/WebPage/TapHighlightController.h +++ b/Source/WebKit2/WebProcess/WebPage/TapHighlightController.h @@ -36,6 +36,7 @@ namespace WebCore { class Frame; class IntRect; class Node; +class Page; } namespace WebKit { @@ -54,11 +55,11 @@ public: private: // PageOverlay::Client. - virtual void pageOverlayDestroyed(WebCore::PageOverlay*); - virtual void willMoveToWebPage(WebCore::PageOverlay*, WebPage*); - virtual void didMoveToWebPage(WebCore::PageOverlay*, WebPage*); - virtual bool mouseEvent(WebCore::PageOverlay*, const WebMouseEvent&); - virtual void drawRect(WebCore::PageOverlay*, WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect); + void pageOverlayDestroyed(WebCore::PageOverlay&) override; + void willMoveToPage(WebCore::PageOverlay&, WebCore::Page*) override; + void didMoveToPage(WebCore::PageOverlay&, WebCore::Page*) override; + bool mouseEvent(WebCore::PageOverlay&, const WebCore::PlatformMouseEvent&) override; + void drawRect(WebCore::PageOverlay&, WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect) override; private: WebPage* m_webPage; diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index 71fe0688e..2cd709f22 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -834,8 +834,8 @@ EditorState WebPage::editorState(IncludePostLayoutDataHint shouldIncludePostLayo if (!scope) return result; - if (isHTMLInputElement(scope)) { - HTMLInputElement* input = toHTMLInputElement(scope); + if (is(scope)) { + HTMLInputElement* input = downcast(scope); if (input->isTelephoneField()) result.inputMethodHints |= Qt::ImhDialableCharactersOnly; else if (input->isNumberField()) @@ -881,8 +881,8 @@ EditorState WebPage::editorState(IncludePostLayoutDataHint shouldIncludePostLayo // FIXME: We should only transfer innerText when it changes and do this on the UI side. if (result.isContentEditable) { - if (isHTMLTextFormControlElement(scope)) - result.surroundingText = toHTMLTextFormControlElement(scope)->innerTextValue(); + if (is(scope)) + result.surroundingText = downcast(scope)->innerTextValue(); else result.surroundingText = scope->innerText(); @@ -2306,7 +2306,7 @@ void WebPage::highlightPotentialActivation(const IntPoint& point, const IntSize& break; // We always highlight focusable (form-elements), image links or content-editable elements. - if ((node->isElementNode() && toElement(node)->isMouseFocusable()) || node->isLink() || node->isContentEditable()) + if ((node->isElementNode() && downcast(node)->isMouseFocusable()) || node->isLink() || node->isContentEditable()) activationNode = node; else if (node->willRespondToMouseClickEvents()) { // Highlight elements with default mouse-click handlers, but highlight only inline elements with diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index 0a7516c12..8be9a42a9 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -83,6 +83,7 @@ #include "QtNetworkReply.h" #include "QtNetworkReplyData.h" #include "QtNetworkRequestData.h" +#include "TapHighlightController.h" #include #include #endif diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp deleted file mode 100644 index 1d7d539cc..000000000 --- a/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * 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 "WebInspector.h" - -#if ENABLE(INSPECTOR) - -#include -#include - -namespace WebKit { - -bool WebInspector::canSave() const -{ - return false; -} - -String WebInspector::localizedStringsURL() const -{ - notImplemented(); - return String(); -} - -} // namespace WebKit - -#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorUIQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorUIQt.cpp new file mode 100644 index 000000000..838627309 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorUIQt.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * 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 "WebInspectorUI.h" + +#if ENABLE(INSPECTOR) + +#include +#include + +namespace WebKit { + +bool WebInspectorUI::canSave() +{ + return false; +} + +String WebInspectorUI::localizedStringsURL() +{ + return ASCIILiteral("qrc:///org/webkitgtk/inspector/Localizations/en.lproj/localizedStrings.js"); +} + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp index 6ee8a1d12..654829487 100644 --- a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp +++ b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp @@ -300,7 +300,7 @@ PassRefPtr WebPage::cachedResponseDataForURL(const URL&) void WebPage::registerApplicationScheme(const String& scheme) { - QtNetworkAccessManager* qnam = qobject_cast(WebProcess::shared().networkAccessManager()); + QtNetworkAccessManager* qnam = qobject_cast(WebProcess::singleton().networkAccessManager()); if (!qnam) return; qnam->registerApplicationScheme(this, QString(scheme)); @@ -334,7 +334,7 @@ void WebPage::hidePopupMenu() return; m_activePopupMenu->client()->popupDidHide(); - m_activePopupMenu = 0; + m_activePopupMenu = nullptr; } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/qt/QtBuiltinBundle.cpp b/Source/WebKit2/WebProcess/qt/QtBuiltinBundle.cpp index 3bb795cad..c0894bff7 100644 --- a/Source/WebKit2/WebProcess/qt/QtBuiltinBundle.cpp +++ b/Source/WebKit2/WebProcess/qt/QtBuiltinBundle.cpp @@ -33,13 +33,12 @@ #include "WKString.h" #include "WKStringQt.h" #include "WKType.h" -#include namespace WebKit { QtBuiltinBundle::~QtBuiltinBundle() { - // For OwnPtr's sake. + // For unique_ptr's sake. } QtBuiltinBundle& QtBuiltinBundle::shared() @@ -79,7 +78,7 @@ void QtBuiltinBundle::didReceiveMessageToPage(WKBundleRef, WKBundlePageRef page, void QtBuiltinBundle::didCreatePage(WKBundlePageRef page) { - m_pages.add(page, adoptPtr(new QtBuiltinBundlePage(this, page))); + m_pages.add(page, std::make_unique(this, page)); } void QtBuiltinBundle::willDestroyPage(WKBundlePageRef page) diff --git a/Source/WebKit2/WebProcess/qt/QtBuiltinBundle.h b/Source/WebKit2/WebProcess/qt/QtBuiltinBundle.h index 55f042b6c..fea74f8c5 100644 --- a/Source/WebKit2/WebProcess/qt/QtBuiltinBundle.h +++ b/Source/WebKit2/WebProcess/qt/QtBuiltinBundle.h @@ -30,7 +30,6 @@ #include "WKBundle.h" #include "WKBundlePage.h" #include -#include namespace WebKit { @@ -61,7 +60,7 @@ private: void handleMessageToNavigatorQtWebChannelTransport(WKBundlePageRef, WKTypeRef messageBody); #endif - HashMap > m_pages; + HashMap> m_pages; WKBundleRef m_bundle; }; diff --git a/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.h b/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.h index fe37bda1f..5a3934b0e 100644 --- a/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.h +++ b/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.h @@ -44,7 +44,7 @@ public: void registerApplicationScheme(const WebPage*, const QString& scheme); protected: - virtual QNetworkReply* createRequest(Operation, const QNetworkRequest&, QIODevice* outgoingData = 0) OVERRIDE; + QNetworkReply* createRequest(Operation, const QNetworkRequest&, QIODevice* outgoingData = 0) override; private Q_SLOTS: void onAuthenticationRequired(QNetworkReply *, QAuthenticator *); diff --git a/Source/WebKit2/WebProcess/qt/QtNetworkReply.cpp b/Source/WebKit2/WebProcess/qt/QtNetworkReply.cpp index 87689d971..bcda4380b 100644 --- a/Source/WebKit2/WebProcess/qt/QtNetworkReply.cpp +++ b/Source/WebKit2/WebProcess/qt/QtNetworkReply.cpp @@ -51,7 +51,7 @@ void QtNetworkReply::setData(const SharedMemory::Handle& handle, qint64 dataSize { if (handle.isNull()) return; - m_sharedMemory = SharedMemory::create(handle, SharedMemory::ReadOnly); + m_sharedMemory = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly); if (!m_sharedMemory) return; @@ -98,4 +98,3 @@ void QtNetworkReply::finalize() } } // namespace WebKit - diff --git a/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp b/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp index 474b6c6fe..1c202cf08 100644 --- a/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp +++ b/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp @@ -36,8 +36,8 @@ #include #include #include -#include #include +#include #ifndef NDEBUG #if !OS(WINDOWS) @@ -72,14 +72,13 @@ static void sleep(unsigned seconds) #endif #endif -class EnvHttpProxyFactory : public QNetworkProxyFactory -{ +class EnvHttpProxyFactory : public QNetworkProxyFactory { public: EnvHttpProxyFactory() { } bool initializeFromEnvironment(); - QList queryProxy(const QNetworkProxyQuery& query = QNetworkProxyQuery()); + QList queryProxy(const QNetworkProxyQuery& = QNetworkProxyQuery()); private: QList m_httpProxy; @@ -132,9 +131,9 @@ static void initializeProxy() if (proxylist.count() == 1) { QNetworkProxy proxy = proxylist.first(); if (proxy == QNetworkProxy::NoProxy || proxy == QNetworkProxy::DefaultProxy) { - OwnPtr proxyFactory = adoptPtr(new EnvHttpProxyFactory()); + auto proxyFactory = std::make_unique(); if (proxyFactory->initializeFromEnvironment()) { - QNetworkProxyFactory::setApplicationProxyFactory(proxyFactory.leakPtr()); + QNetworkProxyFactory::setApplicationProxyFactory(proxyFactory.release()); return; } } @@ -232,13 +231,13 @@ Q_DECL_EXPORT int WebProcessMainQt(QGuiApplication* app) qDebug() << "Error: connection identifier wrong."; return 1; } - CoreIPC::Connection::Identifier identifier; + IPC::Connection::Identifier identifier; #if OS(WINDOWS) // Convert to HANDLE - identifier = reinterpret_cast(id); + identifier = reinterpret_cast(id); #else // Convert to int - identifier = static_cast(id); + identifier = static_cast(id); #endif #endif @@ -246,7 +245,7 @@ Q_DECL_EXPORT int WebProcessMainQt(QGuiApplication* app) WebKit::ChildProcessInitializationParameters parameters; parameters.connectionIdentifier = identifier; - WebKit::WebProcess::shared().initialize(parameters); + WebKit::WebProcess::singleton().initialize(parameters); RunLoop::run(); diff --git a/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp b/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp index 4035f6734..f395198ef 100644 --- a/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp +++ b/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp @@ -72,7 +72,7 @@ void WebProcess::platformSetCacheModel(CacheModel cacheModel) unsigned cacheTotalCapacity = 0; unsigned cacheMinDeadCapacity = 0; unsigned cacheMaxDeadCapacity = 0; - double deadDecodedDataDeletionInterval = 0; + auto deadDecodedDataDeletionInterval = std::chrono::seconds { 0 }; unsigned pageCacheCapacity = 0; unsigned long urlCacheMemoryCapacity = 0; unsigned long urlCacheDiskCapacity = 0; @@ -84,10 +84,11 @@ void WebProcess::platformSetCacheModel(CacheModel cacheModel) if (diskCache) diskCache->setMaximumCacheSize(urlCacheDiskCapacity); - memoryCache()->setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity); - memoryCache()->setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval); + auto& memoryCache = MemoryCache::singleton(); + memoryCache.setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity); + memoryCache.setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval); - pageCache()->setCapacity(pageCacheCapacity); + PageCache::singleton().setMaxSize(pageCacheCapacity); // FIXME: Implement hybrid in-memory- and disk-caching as e.g. the Mac port does. } @@ -103,7 +104,7 @@ static void parentProcessDiedCallback(void*) } #endif -void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters& parameters, CoreIPC::MessageDecoder&) +void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters& parameters, IPC::MessageDecoder&) { #if ENABLE(SECCOMP_FILTERS) { @@ -138,13 +139,10 @@ void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters } #endif - WebCore::RuntimeEnabledFeatures::sharedFeatures().setSpeechInputEnabled(false); - // We'll only install the Qt builtin bundle if we don't have one given by the UI process. // Currently only WTR provides its own bundle. if (parameters.injectedBundlePath.isEmpty()) { - m_injectedBundle = InjectedBundle::create(String()); - m_injectedBundle->setSandboxExtension(SandboxExtension::create(parameters.injectedBundlePathExtensionHandle)); + InjectedBundle::create(parameters, transformHandlesToObjects(parameters.initializationUserData.object()).get()); QtBuiltinBundle::shared().initialize(toAPI(m_injectedBundle.get())); } } -- cgit v1.2.1