mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Fire visibilitychange event appropriately
This commit is contained in:
parent
75c763120f
commit
d90317cfe4
2 changed files with 18 additions and 1 deletions
|
@ -123,6 +123,7 @@ transitionend
|
||||||
unhandledrejection
|
unhandledrejection
|
||||||
unload
|
unload
|
||||||
url
|
url
|
||||||
|
visibilitychange
|
||||||
volumechange
|
volumechange
|
||||||
waiting
|
waiting
|
||||||
webglcontextcreationerror
|
webglcontextcreationerror
|
||||||
|
|
|
@ -49,7 +49,7 @@ use profile_traits::ipc;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use webxr_api::{self, EnvironmentBlendMode, Event as XREvent, Frame, SelectEvent, Session};
|
use webxr_api::{self, EnvironmentBlendMode, Event as XREvent, Frame, SelectEvent, Session, Visibility};
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct XRSession {
|
pub struct XRSession {
|
||||||
|
@ -214,6 +214,22 @@ impl XRSession {
|
||||||
frame.set_active(false);
|
frame.set_active(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
XREvent::VisibilityChange(v) => {
|
||||||
|
let v = match v {
|
||||||
|
Visibility::Visible => XRVisibilityState::Visible,
|
||||||
|
Visibility::VisibleBlurred => XRVisibilityState::Visible_blurred,
|
||||||
|
Visibility::Hidden => XRVisibilityState::Hidden,
|
||||||
|
};
|
||||||
|
self.visibility_state.set(v);
|
||||||
|
let event = XRSessionEvent::new(
|
||||||
|
&self.global(),
|
||||||
|
atom!("visibilitychange"),
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
self,
|
||||||
|
);
|
||||||
|
event.upcast::<Event>().fire(self.upcast());
|
||||||
|
},
|
||||||
_ => (), // XXXManishearth TBD
|
_ => (), // XXXManishearth TBD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue