From aa80d42eb3696071da31827ff27b3963eda59ac0 Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Thu, 26 Oct 2017 22:16:56 +0300 Subject: Import WebKit commit 3d58c4e1c3d584799c4aa9a14d14e266695ee335 Change-Id: I1069f65fada85860f5c3da6c37a5ab5a8daecd51 Reviewed-by: Konstantin Tokarev --- Source/WTF/wtf/text/win/WCharStringExtras.h | 2 +- .../graphics/win/MediaPlayerPrivateMediaFoundation.cpp | 15 +++++++++++++++ .../graphics/win/MediaPlayerPrivateMediaFoundation.h | 1 + Source/WebKit/PlatformQt.cmake | 12 ++++++++++++ Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp | 12 ++++-------- Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h | 2 -- .../Databases/IndexedDB/WebIDBConnectionToServer.h | 2 +- .../WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h | 4 ++-- .../WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp | 2 ++ Source/cmake/OptionsQt.cmake | 4 ++++ Tools/PlatformQt.cmake | 8 ++++---- Tools/TestWebKitAPI/Tests/WTF/StringOperators.cpp | 3 ++- 12 files changed, 48 insertions(+), 19 deletions(-) diff --git a/Source/WTF/wtf/text/win/WCharStringExtras.h b/Source/WTF/wtf/text/win/WCharStringExtras.h index 9d004e515..d41f46294 100644 --- a/Source/WTF/wtf/text/win/WCharStringExtras.h +++ b/Source/WTF/wtf/text/win/WCharStringExtras.h @@ -60,7 +60,7 @@ inline String wcharToString(const wchar_t* characters, unsigned length) inline String nullTerminatedWCharToString(const wchar_t* characters) { - return wcharToString(characters, wcslen(characters) - 1); + return wcharToString(characters, wcslen(characters)); } } // namespace WTF diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp index 0610c85b6..98f2ec964 100644 --- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp +++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp @@ -542,6 +542,16 @@ bool MediaPlayerPrivateMediaFoundation::endGetEvent(IMFAsyncResult* asyncResult) break; } + case MESessionStarted: { + auto weakPtr = m_weakPtrFactory.createWeakPtr(); + callOnMainThread([weakPtr] { + if (!weakPtr) + return; + weakPtr->onSessionStarted(); + }); + break; + } + case MEBufferingStarted: { auto weakPtr = m_weakPtrFactory.createWeakPtr(); callOnMainThread([weakPtr] { @@ -940,6 +950,11 @@ void MediaPlayerPrivateMediaFoundation::onBufferingStopped() updateReadyState(); } +void MediaPlayerPrivateMediaFoundation::onSessionStarted() +{ + updateReadyState(); +} + void MediaPlayerPrivateMediaFoundation::onSessionEnded() { m_networkState = MediaPlayer::Loaded; diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h index c3303cf7b..0fe07fa13 100644 --- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h +++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h @@ -152,6 +152,7 @@ private: void onTopologySet(); void onBufferingStarted(); void onBufferingStopped(); + void onSessionStarted(); void onSessionEnded(); LPCWSTR registerVideoWindowClass(); diff --git a/Source/WebKit/PlatformQt.cmake b/Source/WebKit/PlatformQt.cmake index a192fbd48..8708cedf8 100644 --- a/Source/WebKit/PlatformQt.cmake +++ b/Source/WebKit/PlatformQt.cmake @@ -444,6 +444,13 @@ endif () if (ENABLE_DEVICE_ORIENTATION) set(WEBKIT_PRI_RUNTIME_DEPS "sensors ${WEBKIT_PRI_RUNTIME_DEPS}") endif () +if (USE_MEDIA_FOUNDATION) + set(WEBKIT_PRI_EXTRA_LIBS "-lmfuuid -lstrmiids ${WEBKIT_PRI_EXTRA_LIBS}") +endif () +if (USE_QT_MULTIMEDIA) + set(WEBKIT_PKGCONGIG_DEPS "${WEBKIT_PKGCONGIG_DEPS} Qt5Multimedia") + set(WEBKIT_PRI_RUNTIME_DEPS "multimedia ${WEBKIT_PRI_RUNTIME_DEPS}") +endif () set(WEBKITWIDGETS_PKGCONGIG_DEPS "${WEBKIT_PKGCONGIG_DEPS} Qt5Widgets Qt5WebKit") set(WEBKITWIDGETS_PRI_DEPS "${WEBKIT_PRI_DEPS} widgets webkit") @@ -457,6 +464,11 @@ if (ENABLE_PRINT_SUPPORT) set(WEBKITWIDGETS_PRI_RUNTIME_DEPS "${WEBKITWIDGETS_PRI_RUNTIME_DEPS} printsupport") endif () +if (USE_QT_MULTIMEDIA) + set(WEBKITWIDGETS_PKGCONGIG_DEPS "${WEBKITWIDGETS_PKGCONGIG_DEPS} Qt5MultimediaWidgets") + set(WEBKITWIDGETS_PRI_RUNTIME_DEPS "${WEBKITWIDGETS_PRI_RUNTIME_DEPS} multimediawidgets") +endif () + if (QT_STATIC_BUILD) set(WEBKITWIDGETS_PKGCONGIG_DEPS "${WEBKITWIDGETS_PKGCONGIG_DEPS} Qt5PrintSupport") set(WEBKITWIDGETS_PRI_DEPS "${WEBKITWIDGETS_PRI_DEPS} printsupport") diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 7312792ce..b3209a572 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -929,10 +929,12 @@ void FrameLoaderClientQt::convertMainResourceLoadToDownload(DocumentLoader* docu QNetworkReply* reply = handler->release(); if (reply) { - if (m_webFrame->pageAdapter->forwardUnsupportedContent) + if (m_webFrame->pageAdapter->forwardUnsupportedContent) { emit unsupportedContent(reply); - else + } else { reply->abort(); + reply->deleteLater(); + } } } @@ -1517,12 +1519,6 @@ String FrameLoaderClientQt::overrideMediaType() const return String(); } -QString FrameLoaderClientQt::chooseFile(const QString& oldFile) -{ - QStringList result = m_webFrame->pageAdapter->chooseFiles(m_webFrame, /*allowMulti*/ false, (QStringList() << oldFile)); - return result.isEmpty() ? QString() : result.first(); -} - PassRefPtr FrameLoaderClientQt::createNetworkingContext() { QVariant value = m_webFrame->pageAdapter->handle()->property("_q_MIMESniffingDisabled"); diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index a00bf6702..a20364f76 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -214,8 +214,6 @@ public: void updateCachedDocumentLoader(DocumentLoader &) override; void prefetchDNS(const WTF::String &) override; - QString chooseFile(const QString& oldFile); - PassRefPtr createNetworkingContext() override; const URL& lastRequestedUrl() const { return m_lastRequestedUrl; } diff --git a/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h b/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h index 35d4e8096..c787c35f7 100644 --- a/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h +++ b/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h @@ -95,7 +95,7 @@ private: virtual IPC::Connection* messageSenderConnection() override final; - uint64_t m_identifier; + uint64_t m_identifier { 0 }; bool m_isOpenInServer { false }; RefPtr m_connectionToServer; }; diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h index 1d8562b15..734ab3408 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h @@ -344,8 +344,8 @@ private: TimerMap m_timers; unsigned m_nextTimerID; - bool m_privateBrowsingState; - bool m_storageBlockingState; + bool m_privateBrowsingState { false }; + bool m_storageBlockingState { false }; #if PLUGIN_ARCHITECTURE(MAC) NPDrawingModel m_drawingModel; diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp index c612f0a30..e5e9a8dcf 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp @@ -213,6 +213,7 @@ NetscapePluginX11::NetscapePluginX11(NetscapePlugin& plugin, Display* display) Visual* visual = visualInfo.get()[0].visual; ASSERT(visual); + m_setWindowCallbackStruct.type = NP_SETWINDOW; m_setWindowCallbackStruct.visual = visual; m_setWindowCallbackStruct.colormap = XCreateColormap(hostDisplay, rootWindowID(), visual, AllocNone); } @@ -242,6 +243,7 @@ NetscapePluginX11::NetscapePluginX11(NetscapePlugin& plugin, Display* display, u Display* hostDisplay = x11HostDisplay(); m_npWindowID = gtk_socket_get_id(GTK_SOCKET(socket)); GdkWindow* window = gtk_widget_get_window(socket); + m_setWindowCallbackStruct.type = NP_SETWINDOW; m_setWindowCallbackStruct.display = GDK_WINDOW_XDISPLAY(window); m_setWindowCallbackStruct.visual = GDK_VISUAL_XVISUAL(gdk_window_get_visual(window)); m_setWindowCallbackStruct.depth = gdk_visual_get_depth(gdk_window_get_visual(window)); diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index 3fe374647..57ea7051d 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -283,6 +283,10 @@ WEBKIT_OPTION_DEPEND(ENABLE_3D_TRANSFORMS ENABLE_OPENGL) WEBKIT_OPTION_DEPEND(ENABLE_ACCELERATED_2D_CANVAS ENABLE_OPENGL) WEBKIT_OPTION_DEPEND(ENABLE_WEBGL ENABLE_OPENGL) +# Building video without these options is not supported +WEBKIT_OPTION_DEPEND(ENABLE_VIDEO ENABLE_VIDEO_TRACK) +WEBKIT_OPTION_DEPEND(ENABLE_VIDEO ENABLE_MEDIA_CONTROLS_SCRIPT) + # WebAudio and MediaSource are supported with GStreamer only WEBKIT_OPTION_DEPEND(ENABLE_WEB_AUDIO USE_GSTREAMER) WEBKIT_OPTION_DEPEND(ENABLE_LEGACY_WEB_AUDIO USE_GSTREAMER) diff --git a/Tools/PlatformQt.cmake b/Tools/PlatformQt.cmake index 9c5548aa3..41db83119 100644 --- a/Tools/PlatformQt.cmake +++ b/Tools/PlatformQt.cmake @@ -2,10 +2,6 @@ remove_definitions(-DQT_ASCII_CAST_WARNINGS) add_subdirectory(QtTestBrowser) -if (ENABLE_API_TESTS AND NOT ENABLE_WEBKIT2) - add_subdirectory(TestWebKitAPI) -endif () - if (ENABLE_TEST_SUPPORT) add_subdirectory(DumpRenderTree) add_subdirectory(ImageDiff) @@ -17,3 +13,7 @@ endif () # FIXME: Remove when WK2 Tools patches are merged set(ENABLE_WEBKIT2 0) + +if (ENABLE_API_TESTS AND NOT ENABLE_WEBKIT2) + add_subdirectory(TestWebKitAPI) +endif () diff --git a/Tools/TestWebKitAPI/Tests/WTF/StringOperators.cpp b/Tools/TestWebKitAPI/Tests/WTF/StringOperators.cpp index 7a1d9297f..fd8836fd1 100644 --- a/Tools/TestWebKitAPI/Tests/WTF/StringOperators.cpp +++ b/Tools/TestWebKitAPI/Tests/WTF/StringOperators.cpp @@ -148,7 +148,8 @@ TEST(WTF, StringOperators) EXPECT_N_WTF_STRING_COPIES(2, atomicString + (literal + string + literal)); EXPECT_N_WTF_STRING_COPIES(2, (atomicString + literal) + (string + literal)); -#if COMPILER(MSVC) +// FIXME: Fix compatibility with ICU >= 58.1 +#if COMPILER(MSVC) && !PLATFORM(QT) EXPECT_N_WTF_STRING_COPIES(1, L"wide string" + string); EXPECT_N_WTF_STRING_COPIES(1, string + L"wide string"); EXPECT_N_WTF_STRING_COPIES(1, L"wide string" + atomicString); -- cgit v1.2.3