mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Convert CGTraitInterface to use safe JSContext instead of raw JSContext
This commit is contained in:
parent
808fa65aef
commit
2c5d0a6ebc
43 changed files with 443 additions and 528 deletions
|
@ -15,9 +15,10 @@ use crate::dom::globalscope::GlobalScope;
|
|||
use crate::dom::vrframedata::create_typed_array;
|
||||
use crate::dom::window::Window;
|
||||
use crate::dom::xrsession::ApiRigidTransform;
|
||||
use crate::script_runtime::JSContext;
|
||||
use dom_struct::dom_struct;
|
||||
use euclid::{RigidTransform3D, Rotation3D, Vector3D};
|
||||
use js::jsapi::{Heap, JSContext, JSObject};
|
||||
use js::jsapi::{Heap, JSObject};
|
||||
use std::ptr::NonNull;
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -119,9 +120,9 @@ impl XRRigidTransformMethods for XRRigidTransform {
|
|||
}
|
||||
// https://immersive-web.github.io/webxr/#dom-xrrigidtransform-matrix
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn Matrix(&self, _cx: *mut JSContext) -> NonNull<JSObject> {
|
||||
fn Matrix(&self, _cx: JSContext) -> NonNull<JSObject> {
|
||||
if self.matrix.get().is_null() {
|
||||
let cx = self.global().get_cx();
|
||||
let cx = unsafe { JSContext::from_ptr(self.global().get_cx()) };
|
||||
// According to the spec all matrices are column-major,
|
||||
// however euclid uses row vectors so we use .to_row_major_array()
|
||||
let arr = self.transform.to_transform().to_row_major_array();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue