aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/gamepadpose.rs
diff options
context:
space:
mode:
authorTaym Haddadi <haddadi.taym@gmail.com>2024-01-29 12:57:50 +0100
committerGitHub <noreply@github.com>2024-01-29 11:57:50 +0000
commit742d3ed97f8e439a5807dbbfece6c23935525bce (patch)
treeceb5c9a387a141ff1e91366fdb9cecd15df9af1a /components/script/dom/gamepadpose.rs
parent7d1b19c865855101561dd2030631feed2409a96d (diff)
downloadservo-742d3ed97f8e439a5807dbbfece6c23935525bce.tar.gz
servo-742d3ed97f8e439a5807dbbfece6c23935525bce.zip
Make HeapFloat32Array generic (#31167)
* Make HeapFloat32Array generic Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Define all the methods defaults on the HeapTypedArray trait Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Use generic type instead of trait Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> --------- Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
Diffstat (limited to 'components/script/dom/gamepadpose.rs')
-rw-r--r--components/script/dom/gamepadpose.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/components/script/dom/gamepadpose.rs b/components/script/dom/gamepadpose.rs
index 60b2e4521a7..709c6fd7648 100644
--- a/components/script/dom/gamepadpose.rs
+++ b/components/script/dom/gamepadpose.rs
@@ -3,9 +3,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use dom_struct::dom_struct;
-use js::typedarray::Float32Array;
+use js::typedarray::{Float32, Float32Array};
-use super::bindings::typedarrays::HeapFloat32Array;
+use super::bindings::typedarrays::HeapTypedArray;
use crate::dom::bindings::codegen::Bindings::GamepadPoseBinding::GamepadPoseMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
@@ -16,17 +16,17 @@ use crate::script_runtime::JSContext;
pub struct GamepadPose {
reflector_: Reflector,
#[ignore_malloc_size_of = "mozjs"]
- position: HeapFloat32Array,
+ position: HeapTypedArray<Float32>,
#[ignore_malloc_size_of = "mozjs"]
- orientation: HeapFloat32Array,
+ orientation: HeapTypedArray<Float32>,
#[ignore_malloc_size_of = "mozjs"]
- linear_vel: HeapFloat32Array,
+ linear_vel: HeapTypedArray<Float32>,
#[ignore_malloc_size_of = "mozjs"]
- angular_vel: HeapFloat32Array,
+ angular_vel: HeapTypedArray<Float32>,
#[ignore_malloc_size_of = "mozjs"]
- linear_acc: HeapFloat32Array,
+ linear_acc: HeapTypedArray<Float32>,
#[ignore_malloc_size_of = "mozjs"]
- angular_acc: HeapFloat32Array,
+ angular_acc: HeapTypedArray<Float32>,
}
// TODO: support gamepad discovery
@@ -35,12 +35,12 @@ impl GamepadPose {
fn new_inherited() -> GamepadPose {
GamepadPose {
reflector_: Reflector::new(),
- position: HeapFloat32Array::default(),
- orientation: HeapFloat32Array::default(),
- linear_vel: HeapFloat32Array::default(),
- angular_vel: HeapFloat32Array::default(),
- linear_acc: HeapFloat32Array::default(),
- angular_acc: HeapFloat32Array::default(),
+ position: HeapTypedArray::default(),
+ orientation: HeapTypedArray::default(),
+ linear_vel: HeapTypedArray::default(),
+ angular_vel: HeapTypedArray::default(),
+ linear_acc: HeapTypedArray::default(),
+ angular_acc: HeapTypedArray::default(),
}
}