Diff
Modified: trunk/LayoutTests/ChangeLog (253044 => 253045)
--- trunk/LayoutTests/ChangeLog 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/LayoutTests/ChangeLog 2019-12-03 16:28:22 UTC (rev 253045)
@@ -1,3 +1,13 @@
+2019-12-03 youenn fablet <you...@apple.com>
+
+ Add support for camera rotation when capturing in UIProcess
+ https://bugs.webkit.org/show_bug.cgi?id=204750
+
+ Reviewed by Eric Carlson.
+
+ * webrtc/video-rotation.html:
+ Capture in UIProcess on Cocoa port and make use of test runner API to simulate device rotation.
+
2019-12-03 Per Arne Vollan <pvol...@apple.com>
Layout Test fast/layoutformattingcontext/flow-integration-basic.html is failing
Modified: trunk/LayoutTests/webrtc/video-rotation.html (253044 => 253045)
--- trunk/LayoutTests/webrtc/video-rotation.html 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/LayoutTests/webrtc/video-rotation.html 2019-12-03 16:28:22 UTC (rev 253045)
@@ -1,4 +1,3 @@
-<!-- webkit-test-runner [ enableCaptureVideoInUIProcess=false ] -->
<!doctype html>
<html>
<head>
@@ -89,6 +88,8 @@
if (window.internals)
window.internals.setCameraMediaStreamTrackOrientation(track, 90);
+ if (window.testRunner)
+ testRunner.setMockCameraOrientation(90);
await checkVideoBlack(false, localVideo, "canvas1");
await waitForVideoSize(localVideo, 240, 320);
@@ -97,6 +98,8 @@
promise_test((test) => {
if (window.internals)
window.internals.setCameraMediaStreamTrackOrientation(track, 90);
+ if (window.testRunner)
+ testRunner.setMockCameraOrientation(90);
return checkVideoBlack(false, remoteVideo, "canvas2").then(() => {
return waitForVideoSize(remoteVideo, 240, 320);
@@ -106,6 +109,8 @@
promise_test((test) => {
if (window.internals)
window.internals.setCameraMediaStreamTrackOrientation(track, 180);
+ if (window.testRunner)
+ testRunner.setMockCameraOrientation(180);
return checkVideoBlack(false, remoteVideo, "canvas3").then(() => {
return waitForVideoSize(remoteVideo, 320, 240);
Modified: trunk/Source/WebKit/ChangeLog (253044 => 253045)
--- trunk/Source/WebKit/ChangeLog 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/Source/WebKit/ChangeLog 2019-12-03 16:28:22 UTC (rev 253045)
@@ -1,3 +1,31 @@
+2019-12-03 youenn fablet <you...@apple.com>
+
+ Add support for camera rotation when capturing in UIProcess
+ https://bugs.webkit.org/show_bug.cgi?id=204750
+
+ Reviewed by Eric Carlson.
+
+ Make UserMediaCaptureManagerProxy have an OrientationNotifier.
+ It is updated by each web page of the web process being notified of a device orientation change.
+ Whenever a rotation happens, UIProcess sources are now notified to correctly compute the frame rotations.
+
+ Covered by existing tests.
+
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetMockCameraOrientation):
+ * UIProcess/API/C/WKPagePrivate.h:
+ * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
+ (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
+ (WebKit::UserMediaCaptureManagerProxy::setOrientation):
+ * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::setOrientationForMediaCapture):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebProcessProxy.h:
+ (WebKit::WebProcessProxy::userMediaCaptureManagerProxy):
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::setDeviceOrientation):
+
2019-12-03 Antti Koivisto <an...@apple.com>
[LFC][Integration] Shorten feature flag name
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp (253044 => 253045)
--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2019-12-03 16:28:22 UTC (rev 253045)
@@ -2930,3 +2930,10 @@
callback(callbackContext);
});
}
+
+void WKPageSetMockCameraOrientation(WKPageRef page, uint64_t orientation)
+{
+#if PLATFORM(COCOA) && ENABLE(MEDIA_STREAM)
+ toImpl(page)->setOrientationForMediaCapture(orientation);
+#endif
+}
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPagePrivate.h (253044 => 253045)
--- trunk/Source/WebKit/UIProcess/API/C/WKPagePrivate.h 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPagePrivate.h 2019-12-03 16:28:22 UTC (rev 253045)
@@ -191,6 +191,8 @@
typedef void (*WKPageMarkAdClickAttributionsAsExpiredForTestingFunction)(void* functionContext);
WK_EXPORT void WKPageMarkAdClickAttributionsAsExpiredForTesting(WKPageRef page, WKPageMarkAdClickAttributionsAsExpiredForTestingFunction callback, void* callbackContext);
+WK_EXPORT void WKPageSetMockCameraOrientation(WKPageRef page, uint64_t orientation);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp (253044 => 253045)
--- trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp 2019-12-03 16:28:22 UTC (rev 253045)
@@ -152,6 +152,8 @@
break;
case WebCore::CaptureDevice::DeviceType::Camera:
sourceOrError = RealtimeMediaSourceCenter::singleton().videoCaptureFactory().createVideoCaptureSource(device, WTFMove(hashSalt), &constraints);
+ if (sourceOrError)
+ sourceOrError.captureSource->monitorOrientation(m_orientationNotifier);
break;
case WebCore::CaptureDevice::DeviceType::Screen:
case WebCore::CaptureDevice::DeviceType::Window:
@@ -232,8 +234,13 @@
m_proxies.clear();
}
+void UserMediaCaptureManagerProxy::setOrientation(uint64_t orientation)
+{
+ m_orientationNotifier.orientationChanged(orientation);
}
+}
+
#undef MESSAGE_CHECK_CONTEXTID
#endif
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h (253044 => 253045)
--- trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h 2019-12-03 16:28:22 UTC (rev 253045)
@@ -30,6 +30,7 @@
#include "Connection.h"
#include "MessageReceiver.h"
#include "UserMediaCaptureManager.h"
+#include <WebCore/OrientationNotifier.h>
#include <WebCore/RealtimeMediaSource.h>
namespace WebKit {
@@ -46,6 +47,8 @@
WebProcessProxy& process() const { return m_process; }
void clear();
+ void setOrientation(uint64_t);
+
private:
// IPC::MessageReceiver
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
@@ -63,6 +66,7 @@
friend class SourceProxy;
HashMap<uint64_t, std::unique_ptr<SourceProxy>> m_proxies;
WebProcessProxy& m_process;
+ WebCore::OrientationNotifier m_orientationNotifier { 0 };
};
}
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (253044 => 253045)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-12-03 16:28:22 UTC (rev 253045)
@@ -196,6 +196,7 @@
#include "RemoteLayerTreeScrollingPerformanceData.h"
#include "TouchBarMenuData.h"
#include "TouchBarMenuItemData.h"
+#include "UserMediaCaptureManagerProxy.h"
#include "VersionChecks.h"
#include "VideoFullscreenManagerProxy.h"
#include "VideoFullscreenManagerProxyMessages.h"
@@ -9535,6 +9536,14 @@
m_process->send(Messages::WebPage::SetOverriddenMediaType(mediaType), m_webPageID);
}
+void WebPageProxy::setOrientationForMediaCapture(uint64_t orientation)
+{
+#if PLATFORM(COCOA) && ENABLE(MEDIA_STREAM)
+ if (auto* proxy = m_process->userMediaCaptureManagerProxy())
+ proxy->setOrientation(orientation);
+#endif
+}
+
} // namespace WebKit
#undef MERGE_WHEEL_EVENTS
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (253044 => 253045)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-12-03 16:28:22 UTC (rev 253045)
@@ -1627,6 +1627,8 @@
const String& overriddenMediaType() const { return m_overriddenMediaType; }
void setOverriddenMediaType(const String&);
+ void setOrientationForMediaCapture(uint64_t);
+
private:
WebPageProxy(PageClient&, WebProcessProxy&, Ref<API::PageConfiguration>&&);
void platformInitialize();
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.h (253044 => 253045)
--- trunk/Source/WebKit/UIProcess/WebProcessProxy.h 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.h 2019-12-03 16:28:22 UTC (rev 253045)
@@ -347,6 +347,10 @@
#endif
void setAssertionStateForTesting(AssertionState state) { didSetAssertionState(state); }
+#if PLATFORM(COCOA) && ENABLE(MEDIA_STREAM)
+ UserMediaCaptureManagerProxy* userMediaCaptureManagerProxy() { return m_userMediaCaptureManagerProxy.get(); }
+#endif
+
protected:
WebProcessProxy(WebProcessPool&, WebsiteDataStore*, IsPrewarmed);
Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (253044 => 253045)
--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2019-12-03 16:28:22 UTC (rev 253045)
@@ -357,8 +357,10 @@
{
if (deviceOrientation != m_deviceOrientation) {
m_deviceOrientation = deviceOrientation;
- if (hasRunningProcess())
+ if (hasRunningProcess()) {
m_process->send(Messages::WebPage::SetDeviceOrientation(deviceOrientation), m_webPageID);
+ setOrientationForMediaCapture(deviceOrientation);
+ }
}
}
Modified: trunk/Tools/ChangeLog (253044 => 253045)
--- trunk/Tools/ChangeLog 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/Tools/ChangeLog 2019-12-03 16:28:22 UTC (rev 253045)
@@ -1,5 +1,24 @@
2019-12-03 youenn fablet <you...@apple.com>
+ Add support for camera rotation when capturing in UIProcess
+ https://bugs.webkit.org/show_bug.cgi?id=204750
+
+ Reviewed by Eric Carlson.
+
+ Add test runner API to set the device rotation specifically for mock camera devices.
+
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::setMockCameraOrientation):
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::setMockCameraOrientation):
+ * WebKitTestRunner/TestController.h:
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+
+2019-12-03 youenn fablet <you...@apple.com>
+
Expose WKWebView API to stop ongoing capture
https://bugs.webkit.org/show_bug.cgi?id=204787
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (253044 => 253045)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2019-12-03 16:28:22 UTC (rev 253045)
@@ -386,6 +386,7 @@
void clearMockMediaDevices();
void removeMockMediaDevice(DOMString persistentId);
void resetMockMediaDevices();
+ void setMockCameraOrientation(unsigned long orientation);
void injectUserScript(DOMString string);
readonly attribute unsigned long userScriptInjectedCount;
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (253044 => 253045)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2019-12-03 16:28:22 UTC (rev 253045)
@@ -2398,6 +2398,13 @@
WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), nullptr, nullptr);
}
+void TestRunner::setMockCameraOrientation(unsigned orientation)
+{
+ auto messageName = adoptWK(WKStringCreateWithUTF8CString("SetMockCameraOrientation"));
+ auto messageBody = adoptWK(WKUInt64Create(orientation));
+ WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
+}
+
#if PLATFORM(MAC)
void TestRunner::connectMockGamepad(unsigned index)
{
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (253044 => 253045)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2019-12-03 16:28:22 UTC (rev 253045)
@@ -489,6 +489,7 @@
void clearMockMediaDevices();
void removeMockMediaDevice(JSStringRef persistentId);
void resetMockMediaDevices();
+ void setMockCameraOrientation(unsigned);
size_t userScriptInjectedCount() const;
void injectUserScript(JSStringRef);
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (253044 => 253045)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2019-12-03 16:28:22 UTC (rev 253045)
@@ -994,6 +994,8 @@
WKContextSetUseSeparateServiceWorkerProcess(TestController::singleton().context(), false);
+ WKPageSetMockCameraOrientation(m_mainWebView->page(), 0);
+
// FIXME: This function should also ensure that there is only one page open.
// Reset the EventSender for each test.
@@ -3624,6 +3626,11 @@
WKResetMockMediaDevices(platformContext());
}
+void TestController::setMockCameraOrientation(uint64_t orientation)
+{
+ WKPageSetMockCameraOrientation(m_mainWebView->page(), orientation);
+}
+
#if !PLATFORM(COCOA)
void TestController::platformAddTestOptions(TestOptions&) const
{
Modified: trunk/Tools/WebKitTestRunner/TestController.h (253044 => 253045)
--- trunk/Tools/WebKitTestRunner/TestController.h 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2019-12-03 16:28:22 UTC (rev 253045)
@@ -293,6 +293,7 @@
void clearMockMediaDevices();
void removeMockMediaDevice(WKStringRef persistentID);
void resetMockMediaDevices();
+ void setMockCameraOrientation(uint64_t);
void injectUserScript(WKStringRef);
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (253044 => 253045)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2019-12-03 15:46:56 UTC (rev 253044)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2019-12-03 16:28:22 UTC (rev 253045)
@@ -980,6 +980,11 @@
return nullptr;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "SetMockCameraOrientation")) {
+ TestController::singleton().setMockCameraOrientation(WKUInt64GetValue(static_cast<WKUInt64Ref>(messageBody)));
+ return nullptr;
+ }
+
#if PLATFORM(MAC)
if (WKStringIsEqualToUTF8CString(messageName, "ConnectMockGamepad")) {
ASSERT(WKGetTypeID(messageBody) == WKUInt64GetTypeID());