diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2017-04-24 22:40:03 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-04-25 18:29:55 +0000 |
commit | 4bd713d56aa9bb86bc96ea9cb0c64cbf94bf43d4 (patch) | |
tree | 02bd448d49627f059df0d8036fbdb9d9ee883a50 /Source/WebKit | |
parent | bd3f57b00bee3088971209a0ebc513eb1ef4ba14 (diff) |
Import WebKit commit 3040e0455efecd271f1aeef53cf287e75486a70d
Change-Id: I7df106cef8ce93ce33e49ad6fb0d202cd066d87c
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebKit')
17 files changed, 184 insertions, 222 deletions
diff --git a/Source/WebKit/CMakeLists.txt b/Source/WebKit/CMakeLists.txt index ac9c295ec..edc22fee9 100644 --- a/Source/WebKit/CMakeLists.txt +++ b/Source/WebKit/CMakeLists.txt @@ -74,6 +74,10 @@ if (${PORT} STREQUAL "Qt") MACOSX_FRAMEWORK_IDENTIFIER org.qt-project.QtWebKit ) endif () + + if (ENABLE_WEBKIT2) + add_dependencies(WebKit WebKit2) + endif () endif () add_dependencies(WebKit WebCore) diff --git a/Source/WebKit/PlatformQt.cmake b/Source/WebKit/PlatformQt.cmake index 6b6e0562e..beee95a5d 100644 --- a/Source/WebKit/PlatformQt.cmake +++ b/Source/WebKit/PlatformQt.cmake @@ -18,6 +18,8 @@ list(APPEND WebKit_INCLUDE_DIRECTORIES "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}" "${DERIVED_SOURCES_WEBCORE_DIR}" "${JAVASCRIPTCORE_DIR}" + "${THIRDPARTY_DIR}/ANGLE" + "${THIRDPARTY_DIR}/ANGLE/include/KHR" # Copied from WebCore/CMakeLists.txt "${WEBCORE_DIR}/Modules/airplay" @@ -145,6 +147,7 @@ list(APPEND WebKit_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/network" "${WEBCORE_DIR}/platform/network/qt" "${WEBCORE_DIR}/platform/text/qt" + "${WEBCORE_DIR}/plugins/qt" "${WEBCORE_DIR}/rendering" "${WEBCORE_DIR}/rendering/style" @@ -225,6 +228,26 @@ list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES # Build the include path with duplicates removed list(REMOVE_DUPLICATES WebKit_SYSTEM_INCLUDE_DIRECTORIES) +if (ENABLE_WEBKIT2) + if (APPLE) + set(WEBKIT2_LIBRARY -Wl,-force_load WebKit2) + elseif (MSVC) + set(WEBKIT2_LIBRARY "-WHOLEARCHIVE:WebKit2") + elseif (UNIX) + set(WEBKIT2_LIBRARY -Wl,--whole-archive WebKit2 -Wl,--no-whole-archive) + else () + message(WARNING "Unknown system, linking with WebKit2 may fail!") + set(WEBKIT2_LIBRARY WebKit2) + endif () +endif () + +list(APPEND WebKit_LIBRARIES + PRIVATE + ${WEBKIT2_LIBRARY} + ${Qt5Quick_LIBRARIES} + ${Qt5WebChannel_LIBRARIES} +) + list(APPEND WebKit_LIBRARIES PRIVATE ${ICU_LIBRARIES} @@ -279,12 +302,6 @@ if (ENABLE_NETSCAPE_PLUGIN_API) ) endif () - if (PLUGIN_BACKEND_XLIB) - list(APPEND WebKit_SOURCES - qt/Plugins/QtX11ImageConversion.cpp - ) - endif () - if (WIN32) list(APPEND WebKit_INCLUDE_DIRECTORIES ${WEBCORE_DIR}/platform/win @@ -335,10 +352,16 @@ ecm_generate_headers( QWebSettings COMMON_HEADER QtWebKit + COMMON_HEADER_EXTRAS + <QtWebKit/QtWebKitDepends> + \"qwebkitglobal.h\" + \"qtwebkitversion.h\" + COMMON_HEADER_GUARD_NAME + QT_QTWEBKIT_MODULE_H RELATIVE qt/Api OUTPUT_DIR - "${DERIVED_SOURCES_DIR}/ForwardingHeaders/QtWebKit" + "${FORWARDING_HEADERS_DIR}/QtWebKit" REQUIRED_HEADERS QtWebKit_HEADERS ) @@ -349,7 +372,7 @@ set(WebKit_PUBLIC_HEADERS ${QtWebKit_FORWARDING_HEADERS} ) -generate_header("${DERIVED_SOURCES_DIR}/ForwardingHeaders/QtWebKit/qtwebkitversion.h" +generate_header("${FORWARDING_HEADERS_DIR}/QtWebKit/qtwebkitversion.h" WebKit_PUBLIC_HEADERS "#ifndef QT_QTWEBKIT_VERSION_H #define QT_QTWEBKIT_VERSION_H @@ -360,11 +383,11 @@ generate_header("${DERIVED_SOURCES_DIR}/ForwardingHeaders/QtWebKit/qtwebkitversi #endif ") -generate_header("${DERIVED_SOURCES_DIR}/ForwardingHeaders/QtWebKit/QtWebKitVersion" +generate_header("${FORWARDING_HEADERS_DIR}/QtWebKit/QtWebKitVersion" WebKit_PUBLIC_HEADERS "#include \"qtwebkitversion.h\"") -generate_header("${DERIVED_SOURCES_DIR}/ForwardingHeaders/QtWebKit/QtWebKitDepends" +generate_header("${FORWARDING_HEADERS_DIR}/QtWebKit/QtWebKitDepends" WebKit_PUBLIC_HEADERS "#ifdef __cplusplus /* create empty PCH in C mode */ #include <QtCore/QtCore> @@ -586,10 +609,15 @@ ecm_generate_headers( QWebView COMMON_HEADER QtWebKitWidgets + COMMON_HEADER_EXTRAS + <QtWebKitWidgets/QtWebKitWidgetsDepends> + \"qtwebkitwidgetsversion.h\" + COMMON_HEADER_GUARD_NAME + QT_QTWEBKITWIDGETS_MODULE_H RELATIVE qt/WidgetApi OUTPUT_DIR - "${DERIVED_SOURCES_DIR}/ForwardingHeaders/QtWebKitWidgets" + "${FORWARDING_HEADERS_DIR}/QtWebKitWidgets" REQUIRED_HEADERS QtWebKitWidgets_HEADERS ) @@ -599,7 +627,7 @@ set(WebKitWidgets_PUBLIC_HEADERS ${QtWebKitWidgets_FORWARDING_HEADERS} ) -generate_header("${DERIVED_SOURCES_DIR}/ForwardingHeaders/QtWebKitWidgets/qtwebkitwidgetsversion.h" +generate_header("${FORWARDING_HEADERS_DIR}/QtWebKitWidgets/qtwebkitwidgetsversion.h" WebKitWidgets_PUBLIC_HEADERS "#ifndef QT_QTWEBKITWIDGETS_VERSION_H #define QT_QTWEBKITWIDGETS_VERSION_H @@ -610,11 +638,11 @@ generate_header("${DERIVED_SOURCES_DIR}/ForwardingHeaders/QtWebKitWidgets/qtwebk #endif ") -generate_header("${DERIVED_SOURCES_DIR}/ForwardingHeaders/QtWebKitWidgets/QtWebKitWidgetsVersion" +generate_header("${FORWARDING_HEADERS_DIR}/QtWebKitWidgets/QtWebKitWidgetsVersion" WebKitWidgets_PUBLIC_HEADERS "#include \"qtwebkitwidgetsversion.h\"") -generate_header("${DERIVED_SOURCES_DIR}/ForwardingHeaders/QtWebKitWidgets/QtWebKitWidgetsDepends" +generate_header("${FORWARDING_HEADERS_DIR}/QtWebKitWidgets/QtWebKitWidgetsDepends" WebKitWidgets_PUBLIC_HEADERS "#ifdef __cplusplus /* create empty PCH in C mode */ #include <QtCore/QtCore> @@ -796,4 +824,10 @@ if (COMPILER_IS_GCC_OR_CLANG) ) endif () -add_subdirectory(qt/tests) +if (ENABLE_WEBKIT2) + add_subdirectory(qt/declarative) +endif () + +if (ENABLE_API_TESTS) + add_subdirectory(qt/tests) +endif () diff --git a/Source/WebKit/qt/Plugins/QtX11ImageConversion.cpp b/Source/WebKit/qt/Plugins/QtX11ImageConversion.cpp deleted file mode 100644 index 0a76fe239..000000000 --- a/Source/WebKit/qt/Plugins/QtX11ImageConversion.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) - * - * This library 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 "QtX11ImageConversion.h" - -namespace WebCore { - -QImage qimageFromXImage(XImage* xi) -{ - QImage::Format format = QImage::Format_ARGB32_Premultiplied; - if (xi->depth == 24) - format = QImage::Format_RGB32; - else if (xi->depth == 16) - format = QImage::Format_RGB16; - - QImage image = QImage(reinterpret_cast<uchar*>(xi->data), xi->width, xi->height, xi->bytes_per_line, format).copy(); - - // we may have to swap the byte order - if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && xi->byte_order == MSBFirst) - || (QSysInfo::ByteOrder == QSysInfo::BigEndian && xi->byte_order == LSBFirst)) { - - for (int i = 0; i < image.height(); i++) { - if (xi->depth == 16) { - ushort* p = reinterpret_cast<ushort*>(image.scanLine(i)); - ushort* end = p + image.width(); - while (p < end) { - *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff); - p++; - } - } else { - uint* p = reinterpret_cast<uint*>(image.scanLine(i)); - uint* end = p + image.width(); - while (p < end) { - *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) - | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff); - p++; - } - } - } - } - - // fix-up alpha channel - if (format == QImage::Format_RGB32) { - QRgb* p = reinterpret_cast<QRgb*>(image.bits()); - for (int y = 0; y < xi->height; ++y) { - for (int x = 0; x < xi->width; ++x) - p[x] |= 0xff000000; - p += xi->bytes_per_line / 4; - } - } - - return image; -} - -} // namespace WebKit diff --git a/Source/WebKit/qt/Plugins/QtX11ImageConversion.h b/Source/WebKit/qt/Plugins/QtX11ImageConversion.h deleted file mode 100644 index 1a999a4ca..000000000 --- a/Source/WebKit/qt/Plugins/QtX11ImageConversion.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) - * - * This library 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 QtX11ImageConversion_h -#define QtX11ImageConversion_h - -#include <QImage> -#include <X11/Xlib.h> - -namespace WebCore { - -QImage qimageFromXImage(XImage*); - -} - -#endif diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index 37e66a0ef..0200557c2 100644 --- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -453,7 +453,7 @@ void ChromeClientQt::scroll(const IntSize& delta, const IntRect& scrollViewRect, QMetaObject::invokeMethod(m_webPage->handle(), "scrollRequested", Q_ARG(int, delta.width()), Q_ARG(int, delta.height()), Q_ARG(QRect, scrollViewRect)); } -#if USE(TILED_BACKING_STORE) +#if USE(COORDINATED_GRAPHICS) void ChromeClientQt::delegatedScrollRequested(const IntPoint& point) { diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h index 11826d535..393da12ac 100644 --- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h @@ -119,7 +119,7 @@ public: void invalidateContentsAndRootView(const IntRect&) final; void invalidateContentsForSlowScroll(const IntRect&) final; void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) final; -#if USE(TILED_BACKING_STORE) +#if USE(COORDINATED_GRAPHICS) void delegatedScrollRequested(const IntPoint& scrollPoint) final; #endif diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index 24578ae38..42fbdf25f 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -467,7 +467,7 @@ void DumpRenderTreeSupportQt::dumpSetAcceptsEditing(bool b) void DumpRenderTreeSupportQt::dumpNotification(bool b) { -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) NotificationPresenterClientQt::dumpNotification = b; #endif } @@ -633,7 +633,7 @@ void DumpRenderTreeSupportQt::removeUserStyleSheets(QWebPageAdapter* adapter) void DumpRenderTreeSupportQt::simulateDesktopNotificationClick(const QString& title) { -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) NotificationPresenterClientQt::notificationPresenter()->notificationClicked(title); #endif } @@ -870,7 +870,7 @@ QString DumpRenderTreeSupportQt::frameRenderTreeDump(QWebFrameAdapter* adapter) void DumpRenderTreeSupportQt::clearNotificationPermissions() { -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) WebCore::NotificationPresenterClientQt::notificationPresenter()->clearCachedPermissions(); #endif } diff --git a/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp index fa57dfe1a..ccd1afb3e 100644 --- a/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp @@ -49,7 +49,7 @@ namespace WebCore { -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) const double notificationTimeout = 10.0; @@ -72,28 +72,28 @@ NotificationWrapper::NotificationWrapper() : m_closeTimer(*this, &NotificationWrapper::close) , m_displayEventTimer(*this, &NotificationWrapper::sendDisplayEvent) { -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) m_presenter = nullptr; #endif } void NotificationWrapper::close() { -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) NotificationPresenterClientQt::notificationPresenter()->cancel(this); #endif } void NotificationWrapper::sendDisplayEvent() { -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) NotificationPresenterClientQt::notificationPresenter()->sendDisplayEvent(this); #endif } const QString NotificationWrapper::title() const { -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) Notification* notification = NotificationPresenterClientQt::notificationPresenter()->notificationForWrapper(this); if (notification) return notification->title(); @@ -103,7 +103,7 @@ const QString NotificationWrapper::title() const const QString NotificationWrapper::message() const { -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) Notification* notification = NotificationPresenterClientQt::notificationPresenter()->notificationForWrapper(this); if (notification) return notification->body(); @@ -113,7 +113,7 @@ const QString NotificationWrapper::message() const const QUrl NotificationWrapper::iconUrl() const { -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) Notification* notification = NotificationPresenterClientQt::notificationPresenter()->notificationForWrapper(this); if (notification) return notification->iconURL(); @@ -124,7 +124,7 @@ const QUrl NotificationWrapper::iconUrl() const const QUrl NotificationWrapper::openerPageUrl() const { QUrl url; -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) Notification* notification = NotificationPresenterClientQt::notificationPresenter()->notificationForWrapper(this); if (notification) { if (notification->scriptExecutionContext()) @@ -136,19 +136,19 @@ const QUrl NotificationWrapper::openerPageUrl() const void NotificationWrapper::notificationClicked() { -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) NotificationPresenterClientQt::notificationPresenter()->notificationClicked(this); #endif } void NotificationWrapper::notificationClosed() { -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) NotificationPresenterClientQt::notificationPresenter()->cancel(this); #endif } -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) NotificationPresenterClientQt::NotificationPresenterClientQt() : m_clientCount(0) { @@ -292,37 +292,6 @@ void NotificationPresenterClientQt::notificationControllerDestroyed() { } -#if ENABLE(LEGACY_NOTIFICATIONS) -void NotificationPresenterClientQt::requestPermission(ScriptExecutionContext* context, PassRefPtr<VoidCallback> callback) -{ - if (dumpNotification) - printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %s\n", QString(context->securityOrigin()->toString()).toUtf8().constData()); - - NotificationClient::Permission permission = checkPermission(context); - if (permission != NotificationClient::PermissionNotAllowed) { - if (callback) - callback->handleEvent(); - return; - } - - QHash<ScriptExecutionContext*, CallbacksInfo >::iterator iter = m_pendingPermissionRequests.find(context); - if (iter != m_pendingPermissionRequests.end()) - iter.value().m_voidCallbacks.append(callback); - else { - RefPtr<VoidCallback> cb = callback; - CallbacksInfo info; - info.m_frame = toFrame(context); - info.m_voidCallbacks.append(cb); - - if (toPage(context) && toFrame(context)) { - m_pendingPermissionRequests.insert(context, info); - toPage(context)->notificationsPermissionRequested(toFrame(context)); - } - } -} -#endif - -#if ENABLE(NOTIFICATIONS) void NotificationPresenterClientQt::requestPermission(ScriptExecutionContext* context, PassRefPtr<NotificationPermissionCallback> callback) { if (dumpNotification) @@ -350,7 +319,6 @@ void NotificationPresenterClientQt::requestPermission(ScriptExecutionContext* co } } } -#endif bool NotificationPresenterClientQt::hasPendingPermissionRequests(ScriptExecutionContext* context) const { @@ -403,20 +371,11 @@ void NotificationPresenterClientQt::setNotificationsAllowedForFrame(Frame* frame if (iter == m_pendingPermissionRequests.end()) return; -#if ENABLE(LEGACY_NOTIFICATIONS) - QList<RefPtr<VoidCallback> >& voidCallbacks = iter.value().m_voidCallbacks; - Q_FOREACH(const RefPtr<VoidCallback>& callback, voidCallbacks) { - if (callback) - callback->handleEvent(); - } -#endif -#if ENABLE(NOTIFICATIONS) QList<RefPtr<NotificationPermissionCallback> >& callbacks = iter.value().m_callbacks; Q_FOREACH(const RefPtr<NotificationPermissionCallback>& callback, callbacks) { if (callback) callback->handleEvent(Notification::permissionString(permission)); } -#endif m_pendingPermissionRequests.remove(iter.key()); } @@ -508,7 +467,7 @@ QWebFrameAdapter* NotificationPresenterClientQt::toFrame(ScriptExecutionContext* return QWebFrameAdapter::kit(document->frame()); } -#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#endif // ENABLE(NOTIFICATIONS) } #include "moc_NotificationPresenterClientQt.cpp" diff --git a/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h b/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h index 5c53e93f3..f53fe5101 100644 --- a/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h @@ -74,7 +74,7 @@ private: friend class NotificationPresenterClientQt; }; -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) typedef QHash <Notification*, NotificationWrapper*> NotificationsQueue; @@ -88,12 +88,7 @@ public: void cancel(Notification*) override; void notificationObjectDestroyed(Notification*) override; void notificationControllerDestroyed() override; -#if ENABLE(LEGACY_NOTIFICATIONS) - void requestPermission(ScriptExecutionContext*, PassRefPtr<VoidCallback>) override; -#endif -#if ENABLE(NOTIFICATIONS) void requestPermission(ScriptExecutionContext*, PassRefPtr<NotificationPermissionCallback>) override; -#endif bool hasPendingPermissionRequests(ScriptExecutionContext*) const override; NotificationClient::Permission checkPermission(ScriptExecutionContext*) override; void cancelRequestsForPermission(ScriptExecutionContext*) override; @@ -132,12 +127,7 @@ private: int m_clientCount; struct CallbacksInfo { QWebFrameAdapter* m_frame; -#if ENABLE(LEGACY_NOTIFICATIONS) - QList<RefPtr<VoidCallback> > m_voidCallbacks; -#endif -#if ENABLE(NOTIFICATIONS) QList<RefPtr<NotificationPermissionCallback> > m_callbacks; -#endif }; QHash<ScriptExecutionContext*, CallbacksInfo > m_pendingPermissionRequests; QHash<ScriptExecutionContext*, NotificationClient::Permission> m_cachedPermissions; @@ -149,7 +139,7 @@ private: #endif }; -#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#endif // ENABLE(NOTIFICATIONS) } diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp index dc2370453..fb85535fc 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp @@ -287,7 +287,7 @@ void QWebPageAdapter::initializeWebCorePage() settings = new QWebSettings(&page->settings()); -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) WebCore::provideNotification(page, NotificationPresenterClientQt::notificationPresenter()); #endif @@ -299,7 +299,7 @@ QWebPageAdapter::~QWebPageAdapter() delete page; delete settings; -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) NotificationPresenterClientQt::notificationPresenter()->removeClient(); #endif #if ENABLE(DEVICE_ORIENTATION) @@ -1290,7 +1290,7 @@ QString QWebPageAdapter::contextMenuItemTagForAction(QWebPageAdapter::MenuAction } } -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) void QWebPageAdapter::setNotificationsAllowedForFrame(QWebFrameAdapter* frame, bool allowed) { NotificationPresenterClientQt::notificationPresenter()->setNotificationsAllowedForFrame(frame->frame, allowed); @@ -1312,7 +1312,7 @@ void QWebPageAdapter::setSystemTrayIcon(QObject *icon) NotificationPresenterClientQt::notificationPresenter()->setSystemTrayIcon(icon); } #endif // QT_NO_SYSTEMTRAYICON -#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#endif // ENABLE(NOTIFICATIONS) #if ENABLE(GEOLOCATION) && HAVE(QTPOSITIONING) void QWebPageAdapter::setGeolocationEnabledForFrame(QWebFrameAdapter* frame, bool on) diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h index 5e46fcdd7..48bc0afe0 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h @@ -352,14 +352,14 @@ public: #if ENABLE(GEOLOCATION) && HAVE(QTPOSITIONING) void setGeolocationEnabledForFrame(QWebFrameAdapter*, bool); #endif -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) void setNotificationsAllowedForFrame(QWebFrameAdapter*, bool allowed); void addNotificationPresenterClient(); #ifndef QT_NO_SYSTEMTRAYICON bool hasSystemTrayIcon() const; void setSystemTrayIcon(QObject*); #endif // QT_NO_SYSTEMTRAYICON -#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#endif // ENABLE(NOTIFICATIONS) // Called from QWebPage as private slots. void _q_cleanupLeakMessages(); diff --git a/Source/WebKit/qt/WidgetApi/qwebpage.cpp b/Source/WebKit/qt/WidgetApi/qwebpage.cpp index 11b5a9dd6..c2bc712e8 100644 --- a/Source/WebKit/qt/WidgetApi/qwebpage.cpp +++ b/Source/WebKit/qt/WidgetApi/qwebpage.cpp @@ -207,13 +207,13 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) initializeWebCorePage(); memset(actions, 0, sizeof(actions)); -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) addNotificationPresenterClient(); #ifndef QT_NO_SYSTEMTRAYICON if (!hasSystemTrayIcon()) setSystemTrayIcon(new QSystemTrayIcon); #endif // QT_NO_SYSTEMTRAYICON -#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#endif // ENABLE(NOTIFICATIONS) qRegisterMetaType<QWebFullScreenRequest>(); int fullScreenRequestedIndex = q->metaObject()->indexOfMethod("fullScreenRequested(QWebFullScreenRequest)"); @@ -1674,13 +1674,13 @@ bool QWebPage::shouldInterruptJavaScript() */ void QWebPage::setFeaturePermission(QWebFrame* frame, Feature feature, PermissionPolicy policy) { -#if !ENABLE(NOTIFICATIONS) && !ENABLE(LEGACY_NOTIFICATIONS) && !ENABLE(GEOLOCATION) +#if !ENABLE(NOTIFICATIONS) && !ENABLE(GEOLOCATION) Q_UNUSED(frame); Q_UNUSED(policy); #endif switch (feature) { case Notifications: -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) +#if ENABLE(NOTIFICATIONS) if (policy != PermissionUnknown) d->setNotificationsAllowedForFrame(frame->d, (policy == PermissionGrantedByUser)); #endif diff --git a/Source/WebKit/qt/declarative/CMakeLists.txt b/Source/WebKit/qt/declarative/CMakeLists.txt new file mode 100644 index 000000000..17502c664 --- /dev/null +++ b/Source/WebKit/qt/declarative/CMakeLists.txt @@ -0,0 +1,54 @@ +add_definitions(-DHAVE_WEBKIT2=1) +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/Source + "${FORWARDING_HEADERS_DIR}" + "${FORWARDING_HEADERS_DIR}/QtWebKit" + + # The WebKit2 Qt APIs depend on qwebkitglobal.h, which lives in WebKit + "${WEBKIT_DIR}/qt/Api" + + "${WEBKIT2_DIR}/Platform" + "${WEBKIT2_DIR}/Platform/IPC" + "${WEBKIT2_DIR}/Shared/qt" + "${WEBKIT2_DIR}/UIProcess/API/qt" + + ${WTF_DIR} +) +include_directories(SYSTEM + ${Qt5Quick_INCLUDE_DIRS} + ${Qt5Quick_PRIVATE_INCLUDE_DIRS} +) + +add_library(qmlwebkitplugin MODULE plugin.cpp) +target_link_libraries(qmlwebkitplugin + WebKit Qt5::Quick) + +set(qmlwebkit_output_dir "${CMAKE_BINARY_DIR}/imports/QtWebKit") +set(qmlwebkit_install_dir "${QML_INSTALL_DIR}/QtWebKit") + +set_target_properties(qmlwebkitplugin PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${qmlwebkit_output_dir} + LIBRARY_OUTPUT_DIRECTORY ${qmlwebkit_output_dir} + RUNTIME_OUTPUT_DIRECTORY ${qmlwebkit_output_dir} + ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${qmlwebkit_output_dir} + LIBRARY_OUTPUT_DIRECTORY_DEBUG ${qmlwebkit_output_dir} + RUNTIME_OUTPUT_DIRECTORY_DEBUG ${qmlwebkit_output_dir} + ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${qmlwebkit_output_dir} + LIBRARY_OUTPUT_DIRECTORY_RELEASE ${qmlwebkit_output_dir} + RUNTIME_OUTPUT_DIRECTORY_RELEASE ${qmlwebkit_output_dir} +) + +add_custom_target( + qmlwebkitplugin-files ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different qmldir "${CMAKE_BINARY_DIR}/imports/QtWebKit/qmldir" + COMMAND ${CMAKE_COMMAND} -E copy_if_different plugins.qmltypes "${CMAKE_BINARY_DIR}/imports/QtWebKit/plugins.qmltypes" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +install(TARGETS qmlwebkitplugin + DESTINATION ${qmlwebkit_install_dir}) +install(FILES qmldir plugins.qmltypes + DESTINATION ${qmlwebkit_install_dir}) + +add_subdirectory(experimental) diff --git a/Source/WebKit/qt/declarative/experimental/CMakeLists.txt b/Source/WebKit/qt/declarative/experimental/CMakeLists.txt new file mode 100644 index 000000000..e4d41798c --- /dev/null +++ b/Source/WebKit/qt/declarative/experimental/CMakeLists.txt @@ -0,0 +1,29 @@ +add_library(qmlwebkitexperimentalplugin MODULE plugin.cpp) +target_link_libraries(qmlwebkitexperimentalplugin + WebKit Qt5::Quick) + +set(qmlwebkitexperimental_output_dir "${CMAKE_BINARY_DIR}/imports/QtWebKit/experimental") +set(qmlwebkitexperimental_install_dir "${QML_INSTALL_DIR}/QtWebKit/experimental") + +set_target_properties(qmlwebkitexperimentalplugin PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${qmlwebkitexperimental_output_dir} + LIBRARY_OUTPUT_DIRECTORY ${qmlwebkitexperimental_output_dir} + RUNTIME_OUTPUT_DIRECTORY ${qmlwebkitexperimental_output_dir} + ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${qmlwebkitexperimental_output_dir} + LIBRARY_OUTPUT_DIRECTORY_DEBUG ${qmlwebkitexperimental_output_dir} + RUNTIME_OUTPUT_DIRECTORY_DEBUG ${qmlwebkitexperimental_output_dir} + ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${qmlwebkitexperimental_output_dir} + LIBRARY_OUTPUT_DIRECTORY_RELEASE ${qmlwebkitexperimental_output_dir} + RUNTIME_OUTPUT_DIRECTORY_RELEASE ${qmlwebkitexperimental_output_dir} +) + +add_custom_target( + qmlwebkitexperimentalplugin-files ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different qmldir "${CMAKE_BINARY_DIR}/imports/QtWebKit/experimental/qmldir" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +install(TARGETS qmlwebkitexperimentalplugin + DESTINATION ${qmlwebkitexperimental_install_dir}) +install(FILES qmldir + DESTINATION ${qmlwebkitexperimental_install_dir}) diff --git a/Source/WebKit/qt/declarative/experimental/plugin.cpp b/Source/WebKit/qt/declarative/experimental/plugin.cpp index e81c31dbd..9d483cd38 100644 --- a/Source/WebKit/qt/declarative/experimental/plugin.cpp +++ b/Source/WebKit/qt/declarative/experimental/plugin.cpp @@ -35,7 +35,7 @@ QT_BEGIN_NAMESPACE -class QQuickWebViewExperimentalExtension : public QObject { +class QQuickWebViewExperimentalExtension final : public QObject { Q_OBJECT Q_PROPERTY(QQuickWebViewExperimental* experimental READ experimental CONSTANT FINAL) public: @@ -43,11 +43,11 @@ public: QQuickWebViewExperimental* experimental() { return static_cast<QQuickWebView*>(parent())->experimental(); } }; -class WebKitQmlExperimentalExtensionPlugin: public QQmlExtensionPlugin { +class WebKitQmlExperimentalExtensionPlugin final : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid FILE "plugin.json") public: - void registerTypes(const char* uri) override + void registerTypes(const char* uri) final { qWarning("\nWARNING: This project is using the experimental QML API extensions for QtWebKit and is therefore tied to a specific QtWebKit release.\n" "WARNING: The experimental API will change from version to version, or even be removed. You have been warned!\n"); diff --git a/Source/WebKit/qt/declarative/plugin.cpp b/Source/WebKit/qt/declarative/plugin.cpp index bcd4c1187..8141914ad 100644 --- a/Source/WebKit/qt/declarative/plugin.cpp +++ b/Source/WebKit/qt/declarative/plugin.cpp @@ -37,19 +37,19 @@ QT_BEGIN_NAMESPACE -class WebKitQmlPlugin : public QQmlExtensionPlugin { +class WebKitQmlPlugin final : public QQmlExtensionPlugin { Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid FILE "plugin.json") Q_OBJECT public: #if defined(HAVE_WEBKIT2) - void initializeEngine(QQmlEngine* engine, const char* uri) override + void initializeEngine(QQmlEngine* engine, const char* uri) final { Q_UNUSED(uri); engine->addImageProvider(QLatin1String("webicon"), new QWebIconImageProvider); } #endif - void registerTypes(const char* uri) override + void registerTypes(const char* uri) final { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebKit")); diff --git a/Source/WebKit/qt/tests/CMakeLists.txt b/Source/WebKit/qt/tests/CMakeLists.txt index 2691196b3..4fd45c624 100644 --- a/Source/WebKit/qt/tests/CMakeLists.txt +++ b/Source/WebKit/qt/tests/CMakeLists.txt @@ -2,7 +2,7 @@ remove_definitions(-DQT_ASCII_CAST_WARNINGS) include_directories( "${CMAKE_SOURCE_DIR}/Source" - "${DERIVED_SOURCES_DIR}/ForwardingHeaders" + "${FORWARDING_HEADERS_DIR}" "${WEBKIT_DIR}/qt/Api" "${WEBKIT_DIR}/qt/WidgetApi" ) @@ -48,19 +48,17 @@ set(QtWK1ApiTests set(tst_hybridPixmap_SOURCES hybridPixmap/widget.cpp) qt5_wrap_ui(tst_hybridPixmap_SOURCES hybridPixmap/widget.ui) -if (ENABLE_API_TESTS) - foreach (testName ${QtWK1ApiTests}) - list(APPEND tst_${testName}_SOURCES ${testName}/tst_${testName}.cpp) - if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${testName}/tst_${testName}.qrc") - qt5_add_resources(tst_${testName}_SOURCES ${testName}/tst_${testName}.qrc) - endif () +foreach (testName ${QtWK1ApiTests}) + list(APPEND tst_${testName}_SOURCES ${testName}/tst_${testName}.cpp) + if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${testName}/tst_${testName}.qrc") + qt5_add_resources(tst_${testName}_SOURCES ${testName}/tst_${testName}.qrc) + endif () - add_executable(tst_${testName} ${tst_${testName}_SOURCES}) - target_include_directories(tst_${testName} PRIVATE ${testName}) - target_link_libraries(tst_${testName} ${QtWK1ApiTests_LIBRARIES}) - set_target_properties(tst_${testName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${QtWK1ApiTests_RUNTIME_OUTPUT_DIRECTORY}) + add_executable(tst_${testName} ${tst_${testName}_SOURCES}) + target_include_directories(tst_${testName} PRIVATE ${testName}) + target_link_libraries(tst_${testName} ${QtWK1ApiTests_LIBRARIES}) + set_target_properties(tst_${testName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${QtWK1ApiTests_RUNTIME_OUTPUT_DIRECTORY}) - add_test(${testName} "${QtWK1ApiTests_RUNTIME_OUTPUT_DIRECTORY}/tst_${testName}") - set_tests_properties(${testName} PROPERTIES TIMEOUT 60) - endforeach () -endif () + add_test(${testName} "${QtWK1ApiTests_RUNTIME_OUTPUT_DIRECTORY}/tst_${testName}") + set_tests_properties(${testName} PROPERTIES TIMEOUT 60) +endforeach () |