Title: [261273] trunk/Source/WebCore
- Revision
- 261273
- Author
- [email protected]
- Date
- 2020-05-07 00:49:04 -0700 (Thu, 07 May 2020)
Log Message
[WebXR] Implement simulateUserActivation()
https://bugs.webkit.org/show_bug.cgi?id=211516
Reviewed by Youenn Fablet.
simulateUserActivation() is the method used by the WebXR Test API to
mock a user activation and thus let WebXR API think that the user is
behind the request that is going to be made in the function passed as
argument.
No new tests added as the imported WebXR web-platform-tests already make
use of this API.
* testing/WebXRTest.cpp:
(WebCore::WebXRTest::simulateUserActivation): Implemented.
* testing/WebXRTest.h: Added Document parameter.
* testing/WebXRTest.idl: Call with Document.
* testing/XRSimulateUserActivationFunction.h: Removed function params.
* testing/XRSimulateUserActivationFunction.idl: Ditto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (261272 => 261273)
--- trunk/Source/WebCore/ChangeLog 2020-05-07 07:34:55 UTC (rev 261272)
+++ trunk/Source/WebCore/ChangeLog 2020-05-07 07:49:04 UTC (rev 261273)
@@ -1,3 +1,25 @@
+2020-05-06 Sergio Villar Senin <[email protected]>
+
+ [WebXR] Implement simulateUserActivation()
+ https://bugs.webkit.org/show_bug.cgi?id=211516
+
+ Reviewed by Youenn Fablet.
+
+ simulateUserActivation() is the method used by the WebXR Test API to
+ mock a user activation and thus let WebXR API think that the user is
+ behind the request that is going to be made in the function passed as
+ argument.
+
+ No new tests added as the imported WebXR web-platform-tests already make
+ use of this API.
+
+ * testing/WebXRTest.cpp:
+ (WebCore::WebXRTest::simulateUserActivation): Implemented.
+ * testing/WebXRTest.h: Added Document parameter.
+ * testing/WebXRTest.idl: Call with Document.
+ * testing/XRSimulateUserActivationFunction.h: Removed function params.
+ * testing/XRSimulateUserActivationFunction.idl: Ditto.
+
2020-05-06 Yoshiaki Jitsukawa <[email protected]> and Fujii Hironori <[email protected]>
[Win] Implement DisplayRefreshMonitor by using RunLoop::Timer
Modified: trunk/Source/WebCore/testing/WebXRTest.cpp (261272 => 261273)
--- trunk/Source/WebCore/testing/WebXRTest.cpp 2020-05-07 07:34:55 UTC (rev 261272)
+++ trunk/Source/WebCore/testing/WebXRTest.cpp 2020-05-07 07:49:04 UTC (rev 261273)
@@ -30,6 +30,7 @@
#include "JSWebFakeXRDevice.h"
#include "JSXRReferenceSpaceType.h"
+#include "UserGestureIndicator.h"
#include "WebXRSystem.h"
#include "XRSessionMode.h"
@@ -95,8 +96,12 @@
});
}
-void WebXRTest::simulateUserActivation(XRSimulateUserActivationFunction&)
+void WebXRTest::simulateUserActivation(Document& document, XRSimulateUserActivationFunction& function)
{
+ // https://immersive-web.github.io/webxr-test-api/#dom-xrtest-simulateuseractivation
+ // Invoke function as if it had transient activation.
+ UserGestureIndicator gestureIndicator(ProcessingUserGesture, &document);
+ function.handleEvent();
}
void WebXRTest::disconnectAllDevices(DOMPromiseDeferred<void>&& promise)
Modified: trunk/Source/WebCore/testing/WebXRTest.h (261272 => 261273)
--- trunk/Source/WebCore/testing/WebXRTest.h 2020-05-07 07:34:55 UTC (rev 261272)
+++ trunk/Source/WebCore/testing/WebXRTest.h 2020-05-07 07:49:04 UTC (rev 261273)
@@ -63,7 +63,7 @@
// Simulates a user activation (aka user gesture) for the current scope.
// The activation is only guaranteed to be valid in the provided function and only applies to WebXR
// Device API methods.
- void simulateUserActivation(XRSimulateUserActivationFunction&);
+ void simulateUserActivation(Document&, XRSimulateUserActivationFunction&);
// Disconnect all fake devices
void disconnectAllDevices(DOMPromiseDeferred<void>&&);
Modified: trunk/Source/WebCore/testing/WebXRTest.idl (261272 => 261273)
--- trunk/Source/WebCore/testing/WebXRTest.idl 2020-05-07 07:34:55 UTC (rev 261272)
+++ trunk/Source/WebCore/testing/WebXRTest.idl 2020-05-07 07:49:04 UTC (rev 261273)
@@ -37,7 +37,7 @@
// Simulates a user activation (aka user gesture) for the current scope.
// The activation is only guaranteed to be valid in the provided function and only applies to WebXR
// Device API methods.
- void simulateUserActivation(XRSimulateUserActivationFunction f);
+ [CallWith=Document] void simulateUserActivation(XRSimulateUserActivationFunction f);
// Disconnect all fake devices
Promise<void> disconnectAllDevices();
Modified: trunk/Source/WebCore/testing/XRSimulateUserActivationFunction.h (261272 => 261273)
--- trunk/Source/WebCore/testing/XRSimulateUserActivationFunction.h 2020-05-07 07:34:55 UTC (rev 261272)
+++ trunk/Source/WebCore/testing/XRSimulateUserActivationFunction.h 2020-05-07 07:49:04 UTC (rev 261273)
@@ -39,7 +39,7 @@
public:
using ActiveDOMCallback::ActiveDOMCallback;
- virtual CallbackResult<void> handleEvent(JSC::JSValue) = 0;
+ virtual CallbackResult<void> handleEvent(void) = 0;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/testing/XRSimulateUserActivationFunction.idl (261272 => 261273)
--- trunk/Source/WebCore/testing/XRSimulateUserActivationFunction.idl 2020-05-07 07:34:55 UTC (rev 261272)
+++ trunk/Source/WebCore/testing/XRSimulateUserActivationFunction.idl 2020-05-07 07:49:04 UTC (rev 261273)
@@ -25,4 +25,4 @@
[
Conditional=WEBXR,
EnabledAtRuntime=WebXR
-] callback XRSimulateUserActivationFunction = void (any... arguments);
+] callback XRSimulateUserActivationFunction = void ();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes