mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
parent
5b8fbb023d
commit
a2f81d69c1
20 changed files with 92 additions and 63 deletions
|
@ -265,10 +265,11 @@ impl AudioContextMethods for AudioContext {
|
||||||
fn CreateMediaElementSource(
|
fn CreateMediaElementSource(
|
||||||
&self,
|
&self,
|
||||||
media_element: &HTMLMediaElement,
|
media_element: &HTMLMediaElement,
|
||||||
|
can_gc: CanGc,
|
||||||
) -> Fallible<DomRoot<MediaElementAudioSourceNode>> {
|
) -> Fallible<DomRoot<MediaElementAudioSourceNode>> {
|
||||||
let global = self.global();
|
let global = self.global();
|
||||||
let window = global.as_window();
|
let window = global.as_window();
|
||||||
MediaElementAudioSourceNode::new(window, self, media_element)
|
MediaElementAudioSourceNode::new(window, self, media_element, can_gc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://webaudio.github.io/web-audio-api/#dom-audiocontext-createmediastreamsource>
|
/// <https://webaudio.github.io/web-audio-api/#dom-audiocontext-createmediastreamsource>
|
||||||
|
|
|
@ -357,8 +357,13 @@ impl BaseAudioContextMethods for BaseAudioContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-creategain>
|
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-creategain>
|
||||||
fn CreateGain(&self) -> Fallible<DomRoot<GainNode>> {
|
fn CreateGain(&self, can_gc: CanGc) -> Fallible<DomRoot<GainNode>> {
|
||||||
GainNode::new(self.global().as_window(), self, &GainOptions::empty())
|
GainNode::new(
|
||||||
|
self.global().as_window(),
|
||||||
|
self,
|
||||||
|
&GainOptions::empty(),
|
||||||
|
can_gc,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createpanner>
|
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createpanner>
|
||||||
|
|
|
@ -20,12 +20,12 @@ DOMInterfaces = {
|
||||||
|
|
||||||
'AudioContext': {
|
'AudioContext': {
|
||||||
'inRealms': ['Close', 'Suspend'],
|
'inRealms': ['Close', 'Suspend'],
|
||||||
'canGc':['CreateMediaStreamDestination'],
|
'canGc':['CreateMediaStreamDestination', 'CreateMediaElementSource'],
|
||||||
},
|
},
|
||||||
|
|
||||||
'BaseAudioContext': {
|
'BaseAudioContext': {
|
||||||
'inRealms': ['DecodeAudioData', 'Resume', 'ParseFromString', 'GetBounds', 'GetClientRects'],
|
'inRealms': ['DecodeAudioData', 'Resume', 'ParseFromString', 'GetBounds', 'GetClientRects'],
|
||||||
'canGc': ['CreateOscillator', 'CreateStereoPanner'],
|
'canGc': ['CreateOscillator', 'CreateStereoPanner', 'CreateGain'],
|
||||||
},
|
},
|
||||||
|
|
||||||
'Blob': {
|
'Blob': {
|
||||||
|
@ -73,6 +73,15 @@ DOMInterfaces = {
|
||||||
'canGc': ['FromMatrix', 'FromFloat32Array', 'FromFloat64Array'],
|
'canGc': ['FromMatrix', 'FromFloat32Array', 'FromFloat64Array'],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'DOMQuad': {
|
||||||
|
'canGc': ['FromRect', 'FromQuad'],
|
||||||
|
},
|
||||||
|
|
||||||
|
'DOMPoint': {
|
||||||
|
'canGc': ['FromPoint'],
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
'DOMMatrixReadOnly': {
|
'DOMMatrixReadOnly': {
|
||||||
'canGc': ['Multiply', 'Inverse', 'Scale', 'Translate', 'Rotate', 'RotateFromVector','FlipY', 'ScaleNonUniform', 'Scale3d', 'RotateAxisAngle', 'SkewX', 'SkewY', 'FlipX', 'TransformPoint', 'FromFloat32Array', 'FromFloat64Array','FromMatrix'],
|
'canGc': ['Multiply', 'Inverse', 'Scale', 'Translate', 'Rotate', 'RotateFromVector','FlipY', 'ScaleNonUniform', 'Scale3d', 'RotateAxisAngle', 'SkewX', 'SkewY', 'FlipX', 'TransformPoint', 'FromFloat32Array', 'FromFloat64Array','FromMatrix'],
|
||||||
},
|
},
|
||||||
|
@ -145,6 +154,11 @@ DOMInterfaces = {
|
||||||
'canGc': ['Clone'],
|
'canGc': ['Clone'],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'MediaSession': {
|
||||||
|
'canGc': ['GetMetadata'],
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
'MediaQueryList': {
|
'MediaQueryList': {
|
||||||
'weakReferenceable': True,
|
'weakReferenceable': True,
|
||||||
},
|
},
|
||||||
|
@ -251,6 +265,7 @@ DOMInterfaces = {
|
||||||
|
|
||||||
'XRSession': {
|
'XRSession': {
|
||||||
'inRealms': ['RequestReferenceSpace', 'UpdateRenderState', 'UpdateTargetFrameRate'],
|
'inRealms': ['RequestReferenceSpace', 'UpdateRenderState', 'UpdateTargetFrameRate'],
|
||||||
|
'canGc': ['End'],
|
||||||
},
|
},
|
||||||
|
|
||||||
'XRSystem': {
|
'XRSystem': {
|
||||||
|
|
|
@ -4641,9 +4641,10 @@ impl DocumentMethods for Document {
|
||||||
"messageevent" => Ok(DomRoot::upcast(MessageEvent::new_uninitialized(
|
"messageevent" => Ok(DomRoot::upcast(MessageEvent::new_uninitialized(
|
||||||
self.window.upcast(),
|
self.window.upcast(),
|
||||||
))),
|
))),
|
||||||
"mouseevent" | "mouseevents" => {
|
"mouseevent" | "mouseevents" => Ok(DomRoot::upcast(MouseEvent::new_uninitialized(
|
||||||
Ok(DomRoot::upcast(MouseEvent::new_uninitialized(&self.window)))
|
&self.window,
|
||||||
},
|
can_gc,
|
||||||
|
))),
|
||||||
"storageevent" => Ok(DomRoot::upcast(StorageEvent::new_uninitialized(
|
"storageevent" => Ok(DomRoot::upcast(StorageEvent::new_uninitialized(
|
||||||
&self.window,
|
&self.window,
|
||||||
"".into(),
|
"".into(),
|
||||||
|
|
|
@ -759,7 +759,7 @@ impl DOMMatrixReadOnlyMethods for DOMMatrixReadOnly {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-transformpoint
|
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-transformpoint
|
||||||
fn TransformPoint(&self, point: &DOMPointInit, _can_gc: CanGc) -> DomRoot<DOMPoint> {
|
fn TransformPoint(&self, point: &DOMPointInit, can_gc: CanGc) -> DomRoot<DOMPoint> {
|
||||||
// Euclid always normalizes the homogeneous coordinate which is usually the right
|
// Euclid always normalizes the homogeneous coordinate which is usually the right
|
||||||
// thing but may (?) not be compliant with the CSS matrix spec (or at least is
|
// thing but may (?) not be compliant with the CSS matrix spec (or at least is
|
||||||
// probably not the behavior web authors will expect even if it is mathematically
|
// probably not the behavior web authors will expect even if it is mathematically
|
||||||
|
@ -772,7 +772,7 @@ impl DOMMatrixReadOnlyMethods for DOMMatrixReadOnly {
|
||||||
let z = point.x * mat.m13 + point.y * mat.m23 + point.z * mat.m33 + point.w * mat.m43;
|
let z = point.x * mat.m13 + point.y * mat.m23 + point.z * mat.m33 + point.w * mat.m43;
|
||||||
let w = point.x * mat.m14 + point.y * mat.m24 + point.z * mat.m34 + point.w * mat.m44;
|
let w = point.x * mat.m14 + point.y * mat.m24 + point.z * mat.m34 + point.w * mat.m44;
|
||||||
|
|
||||||
DOMPoint::new(&self.global(), x, y, z, w)
|
DOMPoint::new(&self.global(), x, y, z, w, can_gc)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-tofloat32array
|
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-tofloat32array
|
||||||
|
|
|
@ -28,8 +28,15 @@ impl DOMPoint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(global: &GlobalScope, x: f64, y: f64, z: f64, w: f64) -> DomRoot<DOMPoint> {
|
pub fn new(
|
||||||
Self::new_with_proto(global, None, x, y, z, w, CanGc::note())
|
global: &GlobalScope,
|
||||||
|
x: f64,
|
||||||
|
y: f64,
|
||||||
|
z: f64,
|
||||||
|
w: f64,
|
||||||
|
can_gc: CanGc,
|
||||||
|
) -> DomRoot<DOMPoint> {
|
||||||
|
Self::new_with_proto(global, None, x, y, z, w, can_gc)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_with_proto(
|
fn new_with_proto(
|
||||||
|
@ -49,8 +56,12 @@ impl DOMPoint {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_from_init(global: &GlobalScope, p: &DOMPointInit) -> DomRoot<DOMPoint> {
|
pub fn new_from_init(
|
||||||
DOMPoint::new(global, p.x, p.y, p.z, p.w)
|
global: &GlobalScope,
|
||||||
|
p: &DOMPointInit,
|
||||||
|
can_gc: CanGc,
|
||||||
|
) -> DomRoot<DOMPoint> {
|
||||||
|
DOMPoint::new(global, p.x, p.y, p.z, p.w, can_gc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,8 +80,8 @@ impl DOMPointMethods for DOMPoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.fxtf.org/geometry/#dom-dompoint-frompoint
|
// https://drafts.fxtf.org/geometry/#dom-dompoint-frompoint
|
||||||
fn FromPoint(global: &GlobalScope, init: &DOMPointInit) -> DomRoot<Self> {
|
fn FromPoint(global: &GlobalScope, init: &DOMPointInit, can_gc: CanGc) -> DomRoot<Self> {
|
||||||
Self::new_from_init(global, init)
|
Self::new_from_init(global, init, can_gc)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-x
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-x
|
||||||
|
|
|
@ -79,39 +79,40 @@ impl DOMQuadMethods for DOMQuad {
|
||||||
Ok(DOMQuad::new_with_proto(
|
Ok(DOMQuad::new_with_proto(
|
||||||
global,
|
global,
|
||||||
proto,
|
proto,
|
||||||
&DOMPoint::new_from_init(global, p1),
|
&DOMPoint::new_from_init(global, p1, can_gc),
|
||||||
&DOMPoint::new_from_init(global, p2),
|
&DOMPoint::new_from_init(global, p2, can_gc),
|
||||||
&DOMPoint::new_from_init(global, p3),
|
&DOMPoint::new_from_init(global, p3, can_gc),
|
||||||
&DOMPoint::new_from_init(global, p4),
|
&DOMPoint::new_from_init(global, p4, can_gc),
|
||||||
can_gc,
|
can_gc,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.fxtf.org/geometry/#dom-domquad-fromrect
|
// https://drafts.fxtf.org/geometry/#dom-domquad-fromrect
|
||||||
fn FromRect(global: &GlobalScope, other: &DOMRectInit) -> DomRoot<DOMQuad> {
|
fn FromRect(global: &GlobalScope, other: &DOMRectInit, can_gc: CanGc) -> DomRoot<DOMQuad> {
|
||||||
DOMQuad::new(
|
DOMQuad::new(
|
||||||
global,
|
global,
|
||||||
&DOMPoint::new(global, other.x, other.y, 0f64, 1f64),
|
&DOMPoint::new(global, other.x, other.y, 0f64, 1f64, can_gc),
|
||||||
&DOMPoint::new(global, other.x + other.width, other.y, 0f64, 1f64),
|
&DOMPoint::new(global, other.x + other.width, other.y, 0f64, 1f64, can_gc),
|
||||||
&DOMPoint::new(
|
&DOMPoint::new(
|
||||||
global,
|
global,
|
||||||
other.x + other.width,
|
other.x + other.width,
|
||||||
other.y + other.height,
|
other.y + other.height,
|
||||||
0f64,
|
0f64,
|
||||||
1f64,
|
1f64,
|
||||||
|
can_gc,
|
||||||
),
|
),
|
||||||
&DOMPoint::new(global, other.x, other.y + other.height, 0f64, 1f64),
|
&DOMPoint::new(global, other.x, other.y + other.height, 0f64, 1f64, can_gc),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.fxtf.org/geometry/#dom-domquad-fromquad
|
// https://drafts.fxtf.org/geometry/#dom-domquad-fromquad
|
||||||
fn FromQuad(global: &GlobalScope, other: &DOMQuadInit) -> DomRoot<DOMQuad> {
|
fn FromQuad(global: &GlobalScope, other: &DOMQuadInit, can_gc: CanGc) -> DomRoot<DOMQuad> {
|
||||||
DOMQuad::new(
|
DOMQuad::new(
|
||||||
global,
|
global,
|
||||||
&DOMPoint::new_from_init(global, &other.p1),
|
&DOMPoint::new_from_init(global, &other.p1, can_gc),
|
||||||
&DOMPoint::new_from_init(global, &other.p2),
|
&DOMPoint::new_from_init(global, &other.p2, can_gc),
|
||||||
&DOMPoint::new_from_init(global, &other.p3),
|
&DOMPoint::new_from_init(global, &other.p3, can_gc),
|
||||||
&DOMPoint::new_from_init(global, &other.p4),
|
&DOMPoint::new_from_init(global, &other.p4, can_gc),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,8 +69,9 @@ impl GainNode {
|
||||||
window: &Window,
|
window: &Window,
|
||||||
context: &BaseAudioContext,
|
context: &BaseAudioContext,
|
||||||
options: &GainOptions,
|
options: &GainOptions,
|
||||||
|
can_gc: CanGc,
|
||||||
) -> Fallible<DomRoot<GainNode>> {
|
) -> Fallible<DomRoot<GainNode>> {
|
||||||
Self::new_with_proto(window, None, context, options, CanGc::note())
|
Self::new_with_proto(window, None, context, options, can_gc)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(crown::unrooted_must_root)]
|
#[allow(crown::unrooted_must_root)]
|
||||||
|
|
|
@ -132,7 +132,7 @@ impl Gamepad {
|
||||||
) -> DomRoot<Gamepad> {
|
) -> DomRoot<Gamepad> {
|
||||||
let button_list = GamepadButtonList::init_buttons(global);
|
let button_list = GamepadButtonList::init_buttons(global);
|
||||||
let vibration_actuator =
|
let vibration_actuator =
|
||||||
GamepadHapticActuator::new(global, gamepad_id, supported_haptic_effects);
|
GamepadHapticActuator::new(global, gamepad_id, supported_haptic_effects, can_gc);
|
||||||
let index = if xr { -1 } else { 0 };
|
let index = if xr { -1 } else { 0 };
|
||||||
let gamepad = reflect_dom_object_with_proto(
|
let gamepad = reflect_dom_object_with_proto(
|
||||||
Box::new(Gamepad::new_inherited(
|
Box::new(Gamepad::new_inherited(
|
||||||
|
|
|
@ -109,14 +109,16 @@ impl GamepadHapticActuator {
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
gamepad_index: u32,
|
gamepad_index: u32,
|
||||||
supported_haptic_effects: GamepadSupportedHapticEffects,
|
supported_haptic_effects: GamepadSupportedHapticEffects,
|
||||||
|
can_gc: CanGc,
|
||||||
) -> DomRoot<GamepadHapticActuator> {
|
) -> DomRoot<GamepadHapticActuator> {
|
||||||
Self::new_with_proto(global, gamepad_index, supported_haptic_effects)
|
Self::new_with_proto(global, gamepad_index, supported_haptic_effects, can_gc)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_with_proto(
|
fn new_with_proto(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
gamepad_index: u32,
|
gamepad_index: u32,
|
||||||
supported_haptic_effects: GamepadSupportedHapticEffects,
|
supported_haptic_effects: GamepadSupportedHapticEffects,
|
||||||
|
can_gc: CanGc,
|
||||||
) -> DomRoot<GamepadHapticActuator> {
|
) -> DomRoot<GamepadHapticActuator> {
|
||||||
reflect_dom_object_with_proto(
|
reflect_dom_object_with_proto(
|
||||||
Box::new(GamepadHapticActuator::new_inherited(
|
Box::new(GamepadHapticActuator::new_inherited(
|
||||||
|
@ -125,7 +127,7 @@ impl GamepadHapticActuator {
|
||||||
)),
|
)),
|
||||||
global,
|
global,
|
||||||
None,
|
None,
|
||||||
CanGc::note(),
|
can_gc,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,8 +58,9 @@ impl MediaElementAudioSourceNode {
|
||||||
window: &Window,
|
window: &Window,
|
||||||
context: &AudioContext,
|
context: &AudioContext,
|
||||||
media_element: &HTMLMediaElement,
|
media_element: &HTMLMediaElement,
|
||||||
|
can_gc: CanGc,
|
||||||
) -> Fallible<DomRoot<MediaElementAudioSourceNode>> {
|
) -> Fallible<DomRoot<MediaElementAudioSourceNode>> {
|
||||||
Self::new_with_proto(window, None, context, media_element, CanGc::note())
|
Self::new_with_proto(window, None, context, media_element, can_gc)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(crown::unrooted_must_root)]
|
#[allow(crown::unrooted_must_root)]
|
||||||
|
|
|
@ -37,8 +37,8 @@ impl MediaMetadata {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(global: &Window, init: &MediaMetadataInit) -> DomRoot<MediaMetadata> {
|
pub fn new(global: &Window, init: &MediaMetadataInit, can_gc: CanGc) -> DomRoot<MediaMetadata> {
|
||||||
Self::new_with_proto(global, None, init, CanGc::note())
|
Self::new_with_proto(global, None, init, can_gc)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_with_proto(
|
fn new_with_proto(
|
||||||
|
|
|
@ -53,16 +53,10 @@ impl MediaQueryListEvent {
|
||||||
cancelable: bool,
|
cancelable: bool,
|
||||||
media: DOMString,
|
media: DOMString,
|
||||||
matches: bool,
|
matches: bool,
|
||||||
|
can_gc: CanGc,
|
||||||
) -> DomRoot<MediaQueryListEvent> {
|
) -> DomRoot<MediaQueryListEvent> {
|
||||||
Self::new_with_proto(
|
Self::new_with_proto(
|
||||||
global,
|
global, None, type_, bubbles, cancelable, media, matches, can_gc,
|
||||||
None,
|
|
||||||
type_,
|
|
||||||
bubbles,
|
|
||||||
cancelable,
|
|
||||||
media,
|
|
||||||
matches,
|
|
||||||
CanGc::note(),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,14 +126,14 @@ impl MediaSession {
|
||||||
|
|
||||||
impl MediaSessionMethods for MediaSession {
|
impl MediaSessionMethods for MediaSession {
|
||||||
/// <https://w3c.github.io/mediasession/#dom-mediasession-metadata>
|
/// <https://w3c.github.io/mediasession/#dom-mediasession-metadata>
|
||||||
fn GetMetadata(&self) -> Option<DomRoot<MediaMetadata>> {
|
fn GetMetadata(&self, can_gc: CanGc) -> Option<DomRoot<MediaMetadata>> {
|
||||||
if let Some(ref metadata) = *self.metadata.borrow() {
|
if let Some(ref metadata) = *self.metadata.borrow() {
|
||||||
let mut init = MediaMetadataInit::empty();
|
let mut init = MediaMetadataInit::empty();
|
||||||
init.title = DOMString::from_string(metadata.title.clone());
|
init.title = DOMString::from_string(metadata.title.clone());
|
||||||
init.artist = DOMString::from_string(metadata.artist.clone());
|
init.artist = DOMString::from_string(metadata.artist.clone());
|
||||||
init.album = DOMString::from_string(metadata.album.clone());
|
init.album = DOMString::from_string(metadata.album.clone());
|
||||||
let global = self.global();
|
let global = self.global();
|
||||||
Some(MediaMetadata::new(global.as_window(), &init))
|
Some(MediaMetadata::new(global.as_window(), &init, can_gc))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,8 +75,8 @@ impl MouseEvent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_uninitialized(window: &Window) -> DomRoot<MouseEvent> {
|
pub fn new_uninitialized(window: &Window, can_gc: CanGc) -> DomRoot<MouseEvent> {
|
||||||
Self::new_uninitialized_with_proto(window, None, CanGc::note())
|
Self::new_uninitialized_with_proto(window, None, can_gc)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_uninitialized_with_proto(
|
fn new_uninitialized_with_proto(
|
||||||
|
|
|
@ -2446,7 +2446,7 @@ impl Window {
|
||||||
|
|
||||||
/// Evaluate media query lists and report changes
|
/// Evaluate media query lists and report changes
|
||||||
/// <https://drafts.csswg.org/cssom-view/#evaluate-media-queries-and-report-changes>
|
/// <https://drafts.csswg.org/cssom-view/#evaluate-media-queries-and-report-changes>
|
||||||
pub fn evaluate_media_queries_and_report_changes(&self) {
|
pub fn evaluate_media_queries_and_report_changes(&self, can_gc: CanGc) {
|
||||||
rooted_vec!(let mut mql_list);
|
rooted_vec!(let mut mql_list);
|
||||||
self.media_query_lists.for_each(|mql| {
|
self.media_query_lists.for_each(|mql| {
|
||||||
if let MediaQueryListMatchState::Changed = mql.evaluate_changes() {
|
if let MediaQueryListMatchState::Changed = mql.evaluate_changes() {
|
||||||
|
@ -2463,6 +2463,7 @@ impl Window {
|
||||||
false,
|
false,
|
||||||
mql.Media(),
|
mql.Media(),
|
||||||
mql.Matches(),
|
mql.Matches(),
|
||||||
|
can_gc,
|
||||||
);
|
);
|
||||||
event.upcast::<Event>().fire(mql.upcast::<EventTarget>());
|
event.upcast::<Event>().fire(mql.upcast::<EventTarget>());
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,13 +60,14 @@ impl XRInputSourceArray {
|
||||||
session,
|
session,
|
||||||
&added,
|
&added,
|
||||||
&[],
|
&[],
|
||||||
|
can_gc,
|
||||||
);
|
);
|
||||||
// Release the refcell guard
|
// Release the refcell guard
|
||||||
drop(input_sources);
|
drop(input_sources);
|
||||||
event.upcast::<Event>().fire(session.upcast());
|
event.upcast::<Event>().fire(session.upcast());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove_input_source(&self, session: &XRSession, id: InputId) {
|
pub fn remove_input_source(&self, session: &XRSession, id: InputId, can_gc: CanGc) {
|
||||||
let mut input_sources = self.input_sources.borrow_mut();
|
let mut input_sources = self.input_sources.borrow_mut();
|
||||||
let global = self.global();
|
let global = self.global();
|
||||||
let removed = if let Some(i) = input_sources.iter().find(|i| i.id() == id) {
|
let removed = if let Some(i) = input_sources.iter().find(|i| i.id() == id) {
|
||||||
|
@ -84,6 +85,7 @@ impl XRInputSourceArray {
|
||||||
session,
|
session,
|
||||||
&[],
|
&[],
|
||||||
&removed,
|
&removed,
|
||||||
|
can_gc,
|
||||||
);
|
);
|
||||||
input_sources.retain(|i| i.id() != id);
|
input_sources.retain(|i| i.id() != id);
|
||||||
// release the refcell guard
|
// release the refcell guard
|
||||||
|
@ -123,6 +125,7 @@ impl XRInputSourceArray {
|
||||||
session,
|
session,
|
||||||
&added,
|
&added,
|
||||||
removed,
|
removed,
|
||||||
|
can_gc,
|
||||||
);
|
);
|
||||||
// release the refcell guard
|
// release the refcell guard
|
||||||
drop(input_sources);
|
drop(input_sources);
|
||||||
|
|
|
@ -54,17 +54,10 @@ impl XRInputSourcesChangeEvent {
|
||||||
session: &XRSession,
|
session: &XRSession,
|
||||||
added: &[DomRoot<XRInputSource>],
|
added: &[DomRoot<XRInputSource>],
|
||||||
removed: &[DomRoot<XRInputSource>],
|
removed: &[DomRoot<XRInputSource>],
|
||||||
|
can_gc: CanGc,
|
||||||
) -> DomRoot<XRInputSourcesChangeEvent> {
|
) -> DomRoot<XRInputSourcesChangeEvent> {
|
||||||
Self::new_with_proto(
|
Self::new_with_proto(
|
||||||
global,
|
global, None, type_, bubbles, cancelable, session, added, removed, can_gc,
|
||||||
None,
|
|
||||||
type_,
|
|
||||||
bubbles,
|
|
||||||
cancelable,
|
|
||||||
session,
|
|
||||||
added,
|
|
||||||
removed,
|
|
||||||
CanGc::note(),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -370,7 +370,7 @@ impl XRSession {
|
||||||
self.input_sources.add_input_sources(self, &[info], can_gc);
|
self.input_sources.add_input_sources(self, &[info], can_gc);
|
||||||
},
|
},
|
||||||
XREvent::RemoveInput(id) => {
|
XREvent::RemoveInput(id) => {
|
||||||
self.input_sources.remove_input_source(self, id);
|
self.input_sources.remove_input_source(self, id, can_gc);
|
||||||
},
|
},
|
||||||
XREvent::UpdateInput(id, source) => {
|
XREvent::UpdateInput(id, source) => {
|
||||||
self.input_sources
|
self.input_sources
|
||||||
|
@ -878,7 +878,7 @@ impl XRSessionMethods for XRSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://immersive-web.github.io/webxr/#dom-xrsession-end>
|
/// <https://immersive-web.github.io/webxr/#dom-xrsession-end>
|
||||||
fn End(&self) -> Rc<Promise> {
|
fn End(&self, can_gc: CanGc) -> Rc<Promise> {
|
||||||
let global = self.global();
|
let global = self.global();
|
||||||
let p = Promise::new(&global);
|
let p = Promise::new(&global);
|
||||||
if self.ended.get() && self.end_promises.borrow().is_empty() {
|
if self.ended.get() && self.end_promises.borrow().is_empty() {
|
||||||
|
@ -904,7 +904,7 @@ impl XRSessionMethods for XRSession {
|
||||||
// Disconnect any still-attached XRInputSources
|
// Disconnect any still-attached XRInputSources
|
||||||
for source in 0..self.input_sources.Length() {
|
for source in 0..self.input_sources.Length() {
|
||||||
self.input_sources
|
self.input_sources
|
||||||
.remove_input_source(self, InputId(source));
|
.remove_input_source(self, InputId(source), can_gc);
|
||||||
}
|
}
|
||||||
p
|
p
|
||||||
}
|
}
|
||||||
|
|
|
@ -1700,7 +1700,7 @@ impl ScriptThread {
|
||||||
// Evaluate media queries and report changes.
|
// Evaluate media queries and report changes.
|
||||||
document
|
document
|
||||||
.window()
|
.window()
|
||||||
.evaluate_media_queries_and_report_changes();
|
.evaluate_media_queries_and_report_changes(can_gc);
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#img-environment-changes
|
// https://html.spec.whatwg.org/multipage/#img-environment-changes
|
||||||
// As per the spec, this can be run at any time.
|
// As per the spec, this can be run at any time.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue