Bug 1861467 - [wpt-sync] Update web-platform-tests to eedf737ce39c512d0ca3471f988972e...
[gecko.git] / dom / webidl / DeviceMotionEvent.webidl
blob4d8ae105c7228503422f1f07adbb7483d15a3aa5
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4  * You can obtain one at http://mozilla.org/MPL/2.0/.
5  *
6  * https://w3c.github.io/deviceorientation/
7  */
9 [LegacyNoInterfaceObject,
10   Exposed=Window]
11 interface DeviceAcceleration {
12   readonly attribute double? x;
13   readonly attribute double? y;
14   readonly attribute double? z;
17 [LegacyNoInterfaceObject,
18  Exposed=Window]
19 interface DeviceRotationRate {
20   readonly attribute double? alpha;
21   readonly attribute double? beta;
22   readonly attribute double? gamma;
25 [Pref="device.sensors.motion.enabled", Func="nsGlobalWindowInner::DeviceSensorsEnabled",
26  Exposed=Window]
27 interface DeviceMotionEvent : Event {
28   constructor(DOMString type,
29               optional DeviceMotionEventInit eventInitDict = {});
31   readonly attribute DeviceAcceleration? acceleration;
32   readonly attribute DeviceAcceleration? accelerationIncludingGravity;
33   readonly attribute DeviceRotationRate? rotationRate;
34   readonly attribute double? interval;
37 dictionary DeviceAccelerationInit {
38   double? x = null;
39   double? y = null;
40   double? z = null;
43 dictionary DeviceRotationRateInit {
44   double? alpha = null;
45   double? beta = null;
46   double? gamma = null;
49 dictionary DeviceMotionEventInit : EventInit {
50   // FIXME: bug 1493860: should this "= {}" be here?
51   DeviceAccelerationInit acceleration = {};
52   // FIXME: bug 1493860: should this "= {}" be here?
53   DeviceAccelerationInit accelerationIncludingGravity = {};
54   // FIXME: bug 1493860: should this "= {}" be here?
55   DeviceRotationRateInit rotationRate = {};
56   double? interval = null;
59 // Mozilla extensions.
60 partial interface DeviceMotionEvent {
61   undefined initDeviceMotionEvent(DOMString type,
62                                   optional boolean canBubble = false,
63                                   optional boolean cancelable = false,
64                                   optional DeviceAccelerationInit acceleration = {},
65                                   optional DeviceAccelerationInit accelerationIncludingGravity = {},
66                                   optional DeviceRotationRateInit rotationRate = {},
67                                   optional double? interval = null);