mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
rustdoc: Fix many rustdoc errors (#31147)
This fixes many rustdoc errors that occur due to raw URLs in rustdoc comments as well as unescaped Rust code that should be in backticks.
This commit is contained in:
parent
d7de206dbd
commit
5c1723c983
185 changed files with 939 additions and 942 deletions
|
@ -129,7 +129,7 @@ impl AnalyserNode {
|
|||
Ok(object)
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-analysernode-analysernode
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-analysernode-analysernode>
|
||||
#[allow(non_snake_case)]
|
||||
pub fn Constructor(
|
||||
window: &Window,
|
||||
|
@ -147,7 +147,7 @@ impl AnalyserNode {
|
|||
|
||||
impl AnalyserNodeMethods for AnalyserNode {
|
||||
#[allow(unsafe_code)]
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-analysernode-getfloatfrequencydata
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-analysernode-getfloatfrequencydata>
|
||||
fn GetFloatFrequencyData(&self, mut array: CustomAutoRooterGuard<Float32Array>) {
|
||||
// Invariant to maintain: No JS code that may touch the array should
|
||||
// run whilst we're writing to it
|
||||
|
@ -156,7 +156,7 @@ impl AnalyserNodeMethods for AnalyserNode {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-analysernode-getbytefrequencydata
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-analysernode-getbytefrequencydata>
|
||||
fn GetByteFrequencyData(&self, mut array: CustomAutoRooterGuard<Uint8Array>) {
|
||||
// Invariant to maintain: No JS code that may touch the array should
|
||||
// run whilst we're writing to it
|
||||
|
@ -165,7 +165,7 @@ impl AnalyserNodeMethods for AnalyserNode {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-analysernode-getfloattimedomaindata
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-analysernode-getfloattimedomaindata>
|
||||
fn GetFloatTimeDomainData(&self, mut array: CustomAutoRooterGuard<Float32Array>) {
|
||||
// Invariant to maintain: No JS code that may touch the array should
|
||||
// run whilst we're writing to it
|
||||
|
@ -174,7 +174,7 @@ impl AnalyserNodeMethods for AnalyserNode {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-analysernode-getbytetimedomaindata
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-analysernode-getbytetimedomaindata>
|
||||
fn GetByteTimeDomainData(&self, mut array: CustomAutoRooterGuard<Uint8Array>) {
|
||||
// Invariant to maintain: No JS code that may touch the array should
|
||||
// run whilst we're writing to it
|
||||
|
@ -182,7 +182,7 @@ impl AnalyserNodeMethods for AnalyserNode {
|
|||
self.engine.borrow().fill_byte_time_domain_data(dest);
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-analysernode-fftsize
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-analysernode-fftsize>
|
||||
fn SetFftSize(&self, value: u32) -> Fallible<()> {
|
||||
if value > 32768 || value < 32 || (value & (value - 1) != 0) {
|
||||
return Err(Error::IndexSize);
|
||||
|
@ -191,22 +191,22 @@ impl AnalyserNodeMethods for AnalyserNode {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-analysernode-fftsize
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-analysernode-fftsize>
|
||||
fn FftSize(&self) -> u32 {
|
||||
self.engine.borrow().get_fft_size() as u32
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-analysernode-frequencybincount
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-analysernode-frequencybincount>
|
||||
fn FrequencyBinCount(&self) -> u32 {
|
||||
self.FftSize() / 2
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-analysernode-mindecibels
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-analysernode-mindecibels>
|
||||
fn MinDecibels(&self) -> Finite<f64> {
|
||||
Finite::wrap(self.engine.borrow().get_min_decibels())
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-analysernode-mindecibels
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-analysernode-mindecibels>
|
||||
fn SetMinDecibels(&self, value: Finite<f64>) -> Fallible<()> {
|
||||
if *value >= self.engine.borrow().get_max_decibels() {
|
||||
return Err(Error::IndexSize);
|
||||
|
@ -215,12 +215,12 @@ impl AnalyserNodeMethods for AnalyserNode {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-analysernode-maxdecibels
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-analysernode-maxdecibels>
|
||||
fn MaxDecibels(&self) -> Finite<f64> {
|
||||
Finite::wrap(self.engine.borrow().get_max_decibels())
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-analysernode-maxdecibels
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-analysernode-maxdecibels>
|
||||
fn SetMaxDecibels(&self, value: Finite<f64>) -> Fallible<()> {
|
||||
if *value <= self.engine.borrow().get_min_decibels() {
|
||||
return Err(Error::IndexSize);
|
||||
|
@ -229,12 +229,12 @@ impl AnalyserNodeMethods for AnalyserNode {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-analysernode-smoothingtimeconstant
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-analysernode-smoothingtimeconstant>
|
||||
fn SmoothingTimeConstant(&self) -> Finite<f64> {
|
||||
Finite::wrap(self.engine.borrow().get_smoothing_constant())
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-analysernode-smoothingtimeconstant
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-analysernode-smoothingtimeconstant>
|
||||
fn SetSmoothingTimeConstant(&self, value: Finite<f64>) -> Fallible<()> {
|
||||
if *value < 0. || *value > 1. {
|
||||
return Err(Error::IndexSize);
|
||||
|
|
|
@ -34,7 +34,7 @@ pub const MAX_SAMPLE_RATE: f32 = 192000.;
|
|||
///
|
||||
/// js_channels buffers are (re)attached right before calling GetChannelData
|
||||
/// and remain attached until its contents are needed by some other API
|
||||
/// implementation. Follow https://webaudio.github.io/web-audio-api/#acquire-the-content
|
||||
/// implementation. Follow <https://webaudio.github.io/web-audio-api/#acquire-the-content>
|
||||
/// to know in which situations js_channels buffers must be detached.
|
||||
///
|
||||
#[dom_struct]
|
||||
|
@ -48,13 +48,13 @@ pub struct AudioBuffer {
|
|||
#[ignore_malloc_size_of = "servo_media"]
|
||||
#[no_trace]
|
||||
shared_channels: DomRefCell<Option<ServoMediaAudioBuffer>>,
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-audiobuffer-samplerate
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-audiobuffer-samplerate>
|
||||
sample_rate: f32,
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-audiobuffer-length
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-audiobuffer-length>
|
||||
length: u32,
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-audiobuffer-duration
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-audiobuffer-duration>
|
||||
duration: f64,
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-audiobuffer-numberofchannels
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-audiobuffer-numberofchannels>
|
||||
number_of_channels: u32,
|
||||
}
|
||||
|
||||
|
|
|
@ -39,9 +39,9 @@ use crate::task_source::TaskSource;
|
|||
pub struct AudioContext {
|
||||
context: BaseAudioContext,
|
||||
latency_hint: AudioContextLatencyCategory,
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-audiocontext-baselatency
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-audiocontext-baselatency>
|
||||
base_latency: f64,
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-audiocontext-outputlatency
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-audiocontext-outputlatency>
|
||||
output_latency: f64,
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ impl AudioContextMethods for AudioContext {
|
|||
promise
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-audiocontext-createmediaelementsource
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-audiocontext-createmediaelementsource>
|
||||
fn CreateMediaElementSource(
|
||||
&self,
|
||||
media_element: &HTMLMediaElement,
|
||||
|
@ -266,7 +266,7 @@ impl AudioContextMethods for AudioContext {
|
|||
MediaElementAudioSourceNode::new(window, self, media_element)
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-audiocontext-createmediastreamsource
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-audiocontext-createmediastreamsource>
|
||||
fn CreateMediaStreamSource(
|
||||
&self,
|
||||
stream: &MediaStream,
|
||||
|
@ -276,7 +276,7 @@ impl AudioContextMethods for AudioContext {
|
|||
MediaStreamAudioSourceNode::new(window, self, stream)
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-audiocontext-createmediastreamtracksource
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-audiocontext-createmediastreamtracksource>
|
||||
fn CreateMediaStreamTrackSource(
|
||||
&self,
|
||||
track: &MediaStreamTrack,
|
||||
|
@ -286,7 +286,7 @@ impl AudioContextMethods for AudioContext {
|
|||
MediaStreamTrackAudioSourceNode::new(window, self, track)
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-audiocontext-createmediastreamdestination
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-audiocontext-createmediastreamdestination>
|
||||
fn CreateMediaStreamDestination(&self) -> Fallible<DomRoot<MediaStreamAudioDestinationNode>> {
|
||||
let global = self.global();
|
||||
let window = global.as_window();
|
||||
|
|
|
@ -86,20 +86,20 @@ pub struct BaseAudioContext {
|
|||
#[ignore_malloc_size_of = "servo_media"]
|
||||
#[no_trace]
|
||||
audio_context_impl: Arc<Mutex<AudioContext>>,
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination>
|
||||
destination: MutNullableDom<AudioDestinationNode>,
|
||||
listener: MutNullableDom<AudioListener>,
|
||||
/// Resume promises which are soon to be fulfilled by a queued task.
|
||||
#[ignore_malloc_size_of = "promises are hard"]
|
||||
in_flight_resume_promises_queue: DomRefCell<VecDeque<(Box<[Rc<Promise>]>, ErrorResult)>>,
|
||||
/// https://webaudio.github.io/web-audio-api/#pendingresumepromises
|
||||
/// <https://webaudio.github.io/web-audio-api/#pendingresumepromises>
|
||||
#[ignore_malloc_size_of = "promises are hard"]
|
||||
pending_resume_promises: DomRefCell<Vec<Rc<Promise>>>,
|
||||
#[ignore_malloc_size_of = "promises are hard"]
|
||||
decode_resolvers: DomRefCell<HashMap<String, DecodeResolver>>,
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-samplerate
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-samplerate>
|
||||
sample_rate: f32,
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state>
|
||||
/// Although servo-media already keeps track of the control thread state,
|
||||
/// we keep a state flag here as well. This is so that we can synchronously
|
||||
/// throw when trying to do things on the context when the context has just
|
||||
|
@ -268,23 +268,23 @@ impl BaseAudioContext {
|
|||
}
|
||||
|
||||
impl BaseAudioContextMethods for BaseAudioContext {
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-samplerate
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-samplerate>
|
||||
fn SampleRate(&self) -> Finite<f32> {
|
||||
Finite::wrap(self.sample_rate)
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-currenttime
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-currenttime>
|
||||
fn CurrentTime(&self) -> Finite<f64> {
|
||||
let current_time = self.audio_context_impl.lock().unwrap().current_time();
|
||||
Finite::wrap(current_time)
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state>
|
||||
fn State(&self) -> AudioContextState {
|
||||
self.state.get()
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-resume
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-resume>
|
||||
fn Resume(&self, comp: InRealm) -> Rc<Promise> {
|
||||
// Step 1.
|
||||
let promise = Promise::new_in_current_realm(comp);
|
||||
|
@ -315,7 +315,7 @@ impl BaseAudioContextMethods for BaseAudioContext {
|
|||
promise
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination>
|
||||
fn Destination(&self) -> DomRoot<AudioDestinationNode> {
|
||||
let global = self.global();
|
||||
self.destination.or_init(|| {
|
||||
|
@ -327,7 +327,7 @@ impl BaseAudioContextMethods for BaseAudioContext {
|
|||
})
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-listener
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-listener>
|
||||
fn Listener(&self) -> DomRoot<AudioListener> {
|
||||
let global = self.global();
|
||||
let window = global.as_window();
|
||||
|
@ -337,7 +337,7 @@ impl BaseAudioContextMethods for BaseAudioContext {
|
|||
// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-onstatechange
|
||||
event_handler!(statechange, GetOnstatechange, SetOnstatechange);
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createoscillator
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createoscillator>
|
||||
fn CreateOscillator(&self) -> Fallible<DomRoot<OscillatorNode>> {
|
||||
OscillatorNode::new(
|
||||
&self.global().as_window(),
|
||||
|
@ -346,22 +346,22 @@ 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>> {
|
||||
GainNode::new(&self.global().as_window(), &self, &GainOptions::empty())
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createpanner
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createpanner>
|
||||
fn CreatePanner(&self) -> Fallible<DomRoot<PannerNode>> {
|
||||
PannerNode::new(&self.global().as_window(), &self, &PannerOptions::empty())
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createanalyser
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createanalyser>
|
||||
fn CreateAnalyser(&self) -> Fallible<DomRoot<AnalyserNode>> {
|
||||
AnalyserNode::new(&self.global().as_window(), &self, &AnalyserOptions::empty())
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createbiquadfilter
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createbiquadfilter>
|
||||
fn CreateBiquadFilter(&self) -> Fallible<DomRoot<BiquadFilterNode>> {
|
||||
BiquadFilterNode::new(
|
||||
&self.global().as_window(),
|
||||
|
@ -370,7 +370,7 @@ impl BaseAudioContextMethods for BaseAudioContext {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createstereopanner
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createstereopanner>
|
||||
fn CreateStereoPanner(&self) -> Fallible<DomRoot<StereoPannerNode>> {
|
||||
StereoPannerNode::new(
|
||||
&self.global().as_window(),
|
||||
|
@ -379,7 +379,7 @@ impl BaseAudioContextMethods for BaseAudioContext {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createconstantsource
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createconstantsource>
|
||||
fn CreateConstantSource(&self) -> Fallible<DomRoot<ConstantSourceNode>> {
|
||||
ConstantSourceNode::new(
|
||||
&self.global().as_window(),
|
||||
|
@ -388,21 +388,21 @@ impl BaseAudioContextMethods for BaseAudioContext {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createchannelmerger
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createchannelmerger>
|
||||
fn CreateChannelMerger(&self, count: u32) -> Fallible<DomRoot<ChannelMergerNode>> {
|
||||
let mut opts = ChannelMergerOptions::empty();
|
||||
opts.numberOfInputs = count;
|
||||
ChannelMergerNode::new(&self.global().as_window(), &self, &opts)
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createchannelsplitter
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createchannelsplitter>
|
||||
fn CreateChannelSplitter(&self, count: u32) -> Fallible<DomRoot<ChannelSplitterNode>> {
|
||||
let mut opts = ChannelSplitterOptions::empty();
|
||||
opts.numberOfOutputs = count;
|
||||
ChannelSplitterNode::new(&self.global().as_window(), &self, &opts)
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createbuffer
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createbuffer>
|
||||
fn CreateBuffer(
|
||||
&self,
|
||||
number_of_channels: u32,
|
||||
|
|
|
@ -224,8 +224,9 @@ where
|
|||
/// A rooting mechanism for reflectors on the stack.
|
||||
/// LIFO is not required.
|
||||
///
|
||||
/// See also [*Exact Stack Rooting - Storing a GCPointer on the CStack*]
|
||||
/// (https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Internals/GC/Exact_Stack_Rooting).
|
||||
/// See also [*Exact Stack Rooting - Storing a GCPointer on the CStack*][cstack].
|
||||
///
|
||||
/// [cstack]: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Internals/GC/Exact_Stack_Rooting
|
||||
pub struct RootCollection {
|
||||
roots: UnsafeCell<Vec<*const dyn JSTraceable>>,
|
||||
}
|
||||
|
@ -340,7 +341,7 @@ impl<T> Dom<T> {
|
|||
}
|
||||
|
||||
impl<T: DomObject> Dom<T> {
|
||||
/// Create a Dom<T> from a &T
|
||||
/// Create a `Dom<T>` from a `&T`
|
||||
#[allow(crown::unrooted_must_root)]
|
||||
pub fn from_ref(obj: &T) -> Dom<T> {
|
||||
assert_in_script();
|
||||
|
@ -758,7 +759,7 @@ where
|
|||
self.value
|
||||
}
|
||||
|
||||
/// Transforms a slice of Dom<T> into a slice of LayoutDom<T>.
|
||||
/// Transforms a slice of `Dom<T>` into a slice of `LayoutDom<T>`.
|
||||
// FIXME(nox): This should probably be done through a ToLayout trait.
|
||||
pub unsafe fn to_layout_slice(slice: &'dom [Dom<T>]) -> &'dom [LayoutDom<'dom, T>] {
|
||||
// This doesn't compile if Dom and LayoutDom don't have the same
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! Trait representing the concept of [serializable objects]
|
||||
//! (https://html.spec.whatwg.org/multipage/#serializable-objects).
|
||||
//! (<https://html.spec.whatwg.org/multipage/#serializable-objects>).
|
||||
|
||||
use crate::dom::bindings::reflector::DomObject;
|
||||
use crate::dom::bindings::structuredclone::StructuredDataHolder;
|
||||
|
|
|
@ -316,12 +316,12 @@ impl DOMString {
|
|||
|
||||
/// A valid date string should be "YYYY-MM-DD"
|
||||
/// YYYY must be four or more digits, MM and DD both must be two digits
|
||||
/// https://html.spec.whatwg.org/multipage/#valid-date-string
|
||||
/// <https://html.spec.whatwg.org/multipage/#valid-date-string>
|
||||
pub fn is_valid_date_string(&self) -> bool {
|
||||
self.parse_date_string().is_ok()
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#parse-a-date-string
|
||||
/// <https://html.spec.whatwg.org/multipage/#parse-a-date-string>
|
||||
pub fn parse_date_string(&self) -> Result<(i32, u32, u32), ()> {
|
||||
let value = &self.0;
|
||||
// Step 1, 2, 3
|
||||
|
@ -336,7 +336,7 @@ impl DOMString {
|
|||
Ok((year_int, month_int, day_int))
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#parse-a-time-string
|
||||
/// <https://html.spec.whatwg.org/multipage/#parse-a-time-string>
|
||||
pub fn parse_time_string(&self) -> Result<(u32, u32, f64), ()> {
|
||||
let value = &self.0;
|
||||
// Step 1, 2, 3
|
||||
|
@ -353,12 +353,12 @@ impl DOMString {
|
|||
|
||||
/// A valid month string should be "YYYY-MM"
|
||||
/// YYYY must be four or more digits, MM both must be two digits
|
||||
/// https://html.spec.whatwg.org/multipage/#valid-month-string
|
||||
/// <https://html.spec.whatwg.org/multipage/#valid-month-string>
|
||||
pub fn is_valid_month_string(&self) -> bool {
|
||||
self.parse_month_string().is_ok()
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#parse-a-month-string
|
||||
/// <https://html.spec.whatwg.org/multipage/#parse-a-month-string>
|
||||
pub fn parse_month_string(&self) -> Result<(i32, u32), ()> {
|
||||
let value = &self;
|
||||
// Step 1, 2, 3
|
||||
|
@ -374,12 +374,12 @@ impl DOMString {
|
|||
|
||||
/// A valid week string should be like {YYYY}-W{WW}, such as "2017-W52"
|
||||
/// YYYY must be four or more digits, WW both must be two digits
|
||||
/// https://html.spec.whatwg.org/multipage/#valid-week-string
|
||||
/// <https://html.spec.whatwg.org/multipage/#valid-week-string>
|
||||
pub fn is_valid_week_string(&self) -> bool {
|
||||
self.parse_week_string().is_ok()
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#parse-a-week-string
|
||||
/// <https://html.spec.whatwg.org/multipage/#parse-a-week-string>
|
||||
pub fn parse_week_string(&self) -> Result<(i32, u32), ()> {
|
||||
let value = &self.0;
|
||||
// Step 1, 2, 3
|
||||
|
@ -422,7 +422,7 @@ impl DOMString {
|
|||
Ok((year_int, week_int))
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#valid-floating-point-number
|
||||
/// <https://html.spec.whatwg.org/multipage/#valid-floating-point-number>
|
||||
pub fn is_valid_floating_point_number_string(&self) -> bool {
|
||||
lazy_static! {
|
||||
static ref RE: Regex =
|
||||
|
@ -431,7 +431,7 @@ impl DOMString {
|
|||
RE.is_match(&self.0) && self.parse_floating_point_number().is_ok()
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#rules-for-parsing-floating-point-number-values
|
||||
/// <https://html.spec.whatwg.org/multipage/#rules-for-parsing-floating-point-number-values>
|
||||
pub fn parse_floating_point_number(&self) -> Result<f64, ()> {
|
||||
// Steps 15-16 are telling us things about IEEE rounding modes
|
||||
// for floating-point significands; this code assumes the Rust
|
||||
|
@ -456,7 +456,7 @@ impl DOMString {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#best-representation-of-the-number-as-a-floating-point-number
|
||||
/// <https://html.spec.whatwg.org/multipage/#best-representation-of-the-number-as-a-floating-point-number>
|
||||
pub fn set_best_representation_of_the_floating_point_number(&mut self) {
|
||||
if let Ok(val) = self.parse_floating_point_number() {
|
||||
self.0 = val.to_string();
|
||||
|
@ -465,7 +465,7 @@ impl DOMString {
|
|||
|
||||
/// A valid normalized local date and time string should be "{date}T{time}"
|
||||
/// where date and time are both valid, and the time string must be as short as possible
|
||||
/// https://html.spec.whatwg.org/multipage/#valid-normalised-local-date-and-time-string
|
||||
/// <https://html.spec.whatwg.org/multipage/#valid-normalised-local-date-and-time-string>
|
||||
pub fn convert_valid_normalized_local_date_and_time_string(&mut self) -> Result<(), ()> {
|
||||
let ((year, month, day), (hour, minute, second)) =
|
||||
self.parse_local_date_and_time_string()?;
|
||||
|
@ -491,7 +491,7 @@ impl DOMString {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#parse-a-local-date-and-time-string
|
||||
/// <https://html.spec.whatwg.org/multipage/#parse-a-local-date-and-time-string>
|
||||
pub fn parse_local_date_and_time_string(
|
||||
&self,
|
||||
) -> Result<((i32, u32, u32), (u32, u32, f64)), ()> {
|
||||
|
@ -520,7 +520,7 @@ impl DOMString {
|
|||
Ok((date_tuple, time_tuple))
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#valid-e-mail-address
|
||||
/// <https://html.spec.whatwg.org/multipage/#valid-e-mail-address>
|
||||
pub fn is_valid_email_address_string(&self) -> bool {
|
||||
lazy_static! {
|
||||
static ref RE: Regex = Regex::new(concat!(
|
||||
|
@ -532,7 +532,7 @@ impl DOMString {
|
|||
RE.is_match(&self.0)
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#valid-simple-colour
|
||||
/// <https://html.spec.whatwg.org/multipage/#valid-simple-colour>
|
||||
pub fn is_valid_simple_color_string(&self) -> bool {
|
||||
let mut chars = self.0.chars();
|
||||
if self.0.len() == 7 && chars.next() == Some('#') {
|
||||
|
@ -669,7 +669,7 @@ impl Extend<char> for DOMString {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#parse-a-month-component
|
||||
/// <https://html.spec.whatwg.org/multipage/#parse-a-month-component>
|
||||
fn parse_month_component(value: &str) -> Result<(i32, u32), ()> {
|
||||
// Step 3
|
||||
let mut iterator = value.split('-');
|
||||
|
@ -692,7 +692,7 @@ fn parse_month_component(value: &str) -> Result<(i32, u32), ()> {
|
|||
Ok((year_int, month_int))
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#parse-a-date-component
|
||||
/// <https://html.spec.whatwg.org/multipage/#parse-a-date-component>
|
||||
fn parse_date_component(value: &str) -> Result<(i32, u32, u32), ()> {
|
||||
// Step 1
|
||||
let (year_int, month_int) = parse_month_component(value)?;
|
||||
|
@ -714,7 +714,7 @@ fn parse_date_component(value: &str) -> Result<(i32, u32, u32), ()> {
|
|||
Ok((year_int, month_int, day_int))
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#parse-a-time-component
|
||||
/// <https://html.spec.whatwg.org/multipage/#parse-a-time-component>
|
||||
fn parse_time_component(value: &str) -> Result<(u32, u32, f64), ()> {
|
||||
// Step 1
|
||||
let mut iterator = value.split(':');
|
||||
|
@ -781,7 +781,7 @@ fn max_day_in_month(year_num: i32, month_num: u32) -> Result<u32, ()> {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#week-number-of-the-last-day
|
||||
/// <https://html.spec.whatwg.org/multipage/#week-number-of-the-last-day>
|
||||
fn max_week_in_year(year: i32) -> u32 {
|
||||
Utc.with_ymd_and_hms(year as i32, 1, 1, 0, 0, 0)
|
||||
.earliest()
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! This module implements structured cloning, as defined by [HTML]
|
||||
//! (https://html.spec.whatwg.org/multipage/#safe-passing-of-structured-data).
|
||||
//! This module implements structured cloning, as defined by [HTML](https://html.spec.whatwg.org/multipage/#safe-passing-of-structured-data).
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::os::raw;
|
||||
|
@ -253,7 +252,7 @@ static STRUCTURED_CLONE_CALLBACKS: JSStructuredCloneCallbacks = JSStructuredClon
|
|||
};
|
||||
|
||||
/// A data holder for results from, and inputs to, structured-data read/write operations.
|
||||
/// https://html.spec.whatwg.org/multipage/#safe-passing-of-structured-data
|
||||
/// <https://html.spec.whatwg.org/multipage/#safe-passing-of-structured-data>
|
||||
pub enum StructuredDataHolder {
|
||||
Read {
|
||||
/// A map of deserialized blobs, stored temporarily here to keep them rooted.
|
||||
|
|
|
@ -579,7 +579,7 @@ impl<'a, T: 'static + JSTraceable> RootedVec<'a, T> {
|
|||
}
|
||||
|
||||
impl<'a, T: 'static + JSTraceable + DomObject> RootedVec<'a, Dom<T>> {
|
||||
/// Create a vector of items of type Dom<T> that is rooted for
|
||||
/// Create a vector of items of type `Dom<T>` that is rooted for
|
||||
/// the lifetime of this struct
|
||||
pub fn from_iter<I>(root: &'a mut RootableVec<Dom<T>>, iter: I) -> Self
|
||||
where
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! Trait representing the concept of [transferable objects]
|
||||
//! (https://html.spec.whatwg.org/multipage/#transferable-objects).
|
||||
//! (<https://html.spec.whatwg.org/multipage/#transferable-objects>).
|
||||
|
||||
use js::jsapi::MutableHandleObject;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use html5ever::{namespace_url, ns, LocalName, Namespace, Prefix};
|
|||
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
|
||||
/// Validate a qualified name. See https://dom.spec.whatwg.org/#validate for details.
|
||||
/// Validate a qualified name. See <https://dom.spec.whatwg.org/#validate> for details.
|
||||
pub fn validate_qualified_name(qualified_name: &str) -> ErrorResult {
|
||||
// Step 2.
|
||||
match xml_name_type(qualified_name) {
|
||||
|
@ -20,7 +20,7 @@ pub fn validate_qualified_name(qualified_name: &str) -> ErrorResult {
|
|||
}
|
||||
|
||||
/// Validate a namespace and qualified name and extract their parts.
|
||||
/// See https://dom.spec.whatwg.org/#validate-and-extract for details.
|
||||
/// See <https://dom.spec.whatwg.org/#validate-and-extract> for details.
|
||||
pub fn validate_and_extract(
|
||||
namespace: Option<DOMString>,
|
||||
qualified_name: &str,
|
||||
|
@ -86,7 +86,7 @@ pub enum XMLName {
|
|||
InvalidXMLName,
|
||||
}
|
||||
|
||||
/// Check if an element name is valid. See http://www.w3.org/TR/xml/#NT-Name
|
||||
/// Check if an element name is valid. See <http://www.w3.org/TR/xml/#NT-Name>
|
||||
/// for details.
|
||||
pub fn xml_name_type(name: &str) -> XMLName {
|
||||
fn is_valid_start(c: char) -> bool {
|
||||
|
|
|
@ -307,7 +307,7 @@ impl BlobMethods for Blob {
|
|||
/// <https://w3c.github.io/FileAPI/#dfn-type>
|
||||
/// XXX: We will relax the restriction here,
|
||||
/// since the spec has some problem over this part.
|
||||
/// see https://github.com/w3c/FileAPI/issues/43
|
||||
/// see <https://github.com/w3c/FileAPI/issues/43>
|
||||
pub fn normalize_type_string(s: &str) -> String {
|
||||
if is_ascii_printable(s) {
|
||||
let s_lower = s.to_ascii_lowercase();
|
||||
|
@ -322,6 +322,6 @@ pub fn normalize_type_string(s: &str) -> String {
|
|||
|
||||
fn is_ascii_printable(string: &str) -> bool {
|
||||
// Step 5.1 in Sec 5.1 of File API spec
|
||||
// https://w3c.github.io/FileAPI/#constructorBlob
|
||||
// <https://w3c.github.io/FileAPI/#constructorBlob>
|
||||
string.chars().all(|c| c >= '\x20' && c <= '\x7E')
|
||||
}
|
||||
|
|
|
@ -464,7 +464,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
|
|||
// Step 6
|
||||
promise
|
||||
}
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-upgrade
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-upgrade>
|
||||
fn Upgrade(&self, node: &Node) {
|
||||
// Spec says to make a list first and then iterate the list, but
|
||||
// try-to-upgrade only queues upgrade reactions and doesn't itself
|
||||
|
@ -540,7 +540,7 @@ impl CustomElementDefinition {
|
|||
self.name == self.local_name
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#concept-create-element Step 6.1
|
||||
/// <https://dom.spec.whatwg.org/#concept-create-element> Step 6.1
|
||||
#[allow(unsafe_code)]
|
||||
pub fn create_element(
|
||||
&self,
|
||||
|
|
|
@ -649,7 +649,7 @@ unsafe extern "C" fn interrupt_callback(cx: *mut JSContext) -> bool {
|
|||
}
|
||||
|
||||
impl DedicatedWorkerGlobalScopeMethods for DedicatedWorkerGlobalScope {
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-dedicatedworkerglobalscope-postmessage
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-dedicatedworkerglobalscope-postmessage>
|
||||
fn PostMessage(
|
||||
&self,
|
||||
cx: SafeJSContext,
|
||||
|
@ -659,7 +659,7 @@ impl DedicatedWorkerGlobalScopeMethods for DedicatedWorkerGlobalScope {
|
|||
self.post_message_impl(cx, message, transfer)
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-dedicatedworkerglobalscope-postmessage
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-dedicatedworkerglobalscope-postmessage>
|
||||
fn PostMessage_(
|
||||
&self,
|
||||
cx: SafeJSContext,
|
||||
|
|
|
@ -135,7 +135,7 @@ impl DissimilarOriginWindowMethods for DissimilarOriginWindow {
|
|||
false
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-window-postmessage
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-window-postmessage>
|
||||
fn PostMessage(
|
||||
&self,
|
||||
cx: JSContext,
|
||||
|
@ -146,7 +146,7 @@ impl DissimilarOriginWindowMethods for DissimilarOriginWindow {
|
|||
self.post_message_impl(&target_origin, cx, message, transfer)
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-window-postmessage-options
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-window-postmessage-options>
|
||||
fn PostMessage_(
|
||||
&self,
|
||||
cx: JSContext,
|
||||
|
@ -195,7 +195,7 @@ impl DissimilarOriginWindowMethods for DissimilarOriginWindow {
|
|||
}
|
||||
|
||||
impl DissimilarOriginWindow {
|
||||
/// https://html.spec.whatwg.org/multipage/#window-post-message-steps
|
||||
/// <https://html.spec.whatwg.org/multipage/#window-post-message-steps>
|
||||
fn post_message_impl(
|
||||
&self,
|
||||
target_origin: &USVString,
|
||||
|
@ -209,7 +209,7 @@ impl DissimilarOriginWindow {
|
|||
self.post_message(target_origin, data)
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#window-post-message-steps
|
||||
/// <https://html.spec.whatwg.org/multipage/#window-post-message-steps>
|
||||
pub fn post_message(
|
||||
&self,
|
||||
target_origin: &USVString,
|
||||
|
|
|
@ -289,7 +289,7 @@ pub struct Document {
|
|||
pending_parsing_blocking_script: DomRefCell<Option<PendingScript>>,
|
||||
/// Number of stylesheets that block executing the next parser-inserted script
|
||||
script_blocking_stylesheets_count: Cell<u32>,
|
||||
/// https://html.spec.whatwg.org/multipage/#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing
|
||||
/// <https://html.spec.whatwg.org/multipage/#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing>
|
||||
deferred_scripts: PendingInOrderScriptVec,
|
||||
/// <https://html.spec.whatwg.org/multipage/#list-of-scripts-that-will-execute-in-order-as-soon-as-possible>
|
||||
asap_in_order_scripts_list: PendingInOrderScriptVec,
|
||||
|
@ -346,7 +346,7 @@ pub struct Document {
|
|||
/// The document's origin.
|
||||
#[no_trace]
|
||||
origin: MutableOrigin,
|
||||
/// https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-states
|
||||
/// <https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-states>
|
||||
#[no_trace]
|
||||
referrer_policy: Cell<Option<ReferrerPolicy>>,
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-document-referrer>
|
||||
|
@ -370,7 +370,7 @@ pub struct Document {
|
|||
/// This is sent to the layout thread every time a reflow is done;
|
||||
/// layout uses this to determine if the gains from parallel layout will be worth the overhead.
|
||||
///
|
||||
/// See also: https://github.com/servo/servo/issues/10110
|
||||
/// See also: <https://github.com/servo/servo/issues/10110>
|
||||
dom_count: Cell<u32>,
|
||||
/// Entry node for fullscreen.
|
||||
fullscreen_element: MutNullableDom<Element>,
|
||||
|
@ -378,7 +378,7 @@ pub struct Document {
|
|||
/// their 'form' content attribute. Used to reset form controls
|
||||
/// whenever any element with the same ID as the form attribute
|
||||
/// is inserted or removed from the document.
|
||||
/// See https://html.spec.whatwg.org/multipage/#form-owner
|
||||
/// See <https://html.spec.whatwg.org/multipage/#form-owner>
|
||||
form_id_listener_map: DomRefCell<HashMapTracedValues<Atom, HashSet<Dom<Element>>>>,
|
||||
#[no_trace]
|
||||
interactive_time: DomRefCell<InteractiveMetrics>,
|
||||
|
@ -386,9 +386,9 @@ pub struct Document {
|
|||
tti_window: DomRefCell<InteractiveWindow>,
|
||||
/// RAII canceller for Fetch
|
||||
canceller: FetchCanceller,
|
||||
/// https://html.spec.whatwg.org/multipage/#throw-on-dynamic-markup-insertion-counter
|
||||
/// <https://html.spec.whatwg.org/multipage/#throw-on-dynamic-markup-insertion-counter>
|
||||
throw_on_dynamic_markup_insertion_counter: Cell<u64>,
|
||||
/// https://html.spec.whatwg.org/multipage/#page-showing
|
||||
/// <https://html.spec.whatwg.org/multipage/#page-showing>
|
||||
page_showing: Cell<bool>,
|
||||
/// Whether the document is salvageable.
|
||||
salvageable: Cell<bool>,
|
||||
|
@ -405,7 +405,7 @@ pub struct Document {
|
|||
/// List of tasks to execute as soon as last script/layout blocker is removed.
|
||||
#[ignore_malloc_size_of = "Measuring trait objects is hard"]
|
||||
delayed_tasks: DomRefCell<Vec<Box<dyn TaskBox>>>,
|
||||
/// https://html.spec.whatwg.org/multipage/#completely-loaded
|
||||
/// <https://html.spec.whatwg.org/multipage/#completely-loaded>
|
||||
completely_loaded: Cell<bool>,
|
||||
/// Set of shadow roots connected to the document tree.
|
||||
shadow_roots: DomRefCell<HashSet<Dom<ShadowRoot>>>,
|
||||
|
@ -422,14 +422,14 @@ pub struct Document {
|
|||
DomRefCell<HashMapTracedValues<WebGLContextId, Dom<WebGLRenderingContext>>>,
|
||||
/// List of all WebGPU context IDs that need flushing.
|
||||
dirty_webgpu_contexts: DomRefCell<HashMap<WebGPUContextId, Dom<GPUCanvasContext>>>,
|
||||
/// https://html.spec.whatwg.org/multipage/#concept-document-csp-list
|
||||
/// <https://html.spec.whatwg.org/multipage/#concept-document-csp-list>
|
||||
#[ignore_malloc_size_of = "Defined in rust-content-security-policy"]
|
||||
#[no_trace]
|
||||
csp_list: DomRefCell<Option<CspList>>,
|
||||
/// https://w3c.github.io/slection-api/#dfn-selection
|
||||
/// <https://w3c.github.io/slection-api/#dfn-selection>
|
||||
selection: MutNullableDom<Selection>,
|
||||
/// A timeline for animations which is used for synchronizing animations.
|
||||
/// https://drafts.csswg.org/web-animations/#timeline
|
||||
/// <https://drafts.csswg.org/web-animations/#timeline>
|
||||
animation_timeline: DomRefCell<AnimationTimeline>,
|
||||
/// Animations for this Document
|
||||
animations: DomRefCell<Animations>,
|
||||
|
@ -2426,7 +2426,7 @@ impl Document {
|
|||
self.pending_parsing_blocking_script.borrow().is_some()
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#prepare-a-script step 22.d.
|
||||
/// <https://html.spec.whatwg.org/multipage/#prepare-a-script> step 22.d.
|
||||
pub fn pending_parsing_blocking_script_loaded(
|
||||
&self,
|
||||
element: &HTMLScriptElement,
|
||||
|
@ -2465,8 +2465,8 @@ impl Document {
|
|||
.push(Dom::from_ref(script));
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#the-end step 5.
|
||||
/// https://html.spec.whatwg.org/multipage/#prepare-a-script step 22.d.
|
||||
/// <https://html.spec.whatwg.org/multipage/#the-end> step 5.
|
||||
/// <https://html.spec.whatwg.org/multipage/#prepare-a-script> step 22.d.
|
||||
pub fn asap_script_loaded(&self, element: &HTMLScriptElement, result: ScriptResult) {
|
||||
{
|
||||
let mut scripts = self.asap_scripts_set.borrow_mut();
|
||||
|
@ -2484,8 +2484,8 @@ impl Document {
|
|||
self.asap_in_order_scripts_list.push(script);
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#the-end step 5.
|
||||
/// https://html.spec.whatwg.org/multipage/#prepare-a-script step 22.c.
|
||||
/// <https://html.spec.whatwg.org/multipage/#the-end> step 5.
|
||||
/// <https://html.spec.whatwg.org/multipage/#prepare-a-script> step> 22.c.
|
||||
pub fn asap_in_order_script_loaded(&self, element: &HTMLScriptElement, result: ScriptResult) {
|
||||
self.asap_in_order_scripts_list.loaded(element, result);
|
||||
while let Some((element, result)) = self
|
||||
|
@ -2501,14 +2501,14 @@ impl Document {
|
|||
self.deferred_scripts.push(script);
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#the-end step 3.
|
||||
/// https://html.spec.whatwg.org/multipage/#prepare-a-script step 22.d.
|
||||
/// <https://html.spec.whatwg.org/multipage/#the-end> step 3.
|
||||
/// <https://html.spec.whatwg.org/multipage/#prepare-a-script> step 22.d.
|
||||
pub fn deferred_script_loaded(&self, element: &HTMLScriptElement, result: ScriptResult) {
|
||||
self.deferred_scripts.loaded(element, result);
|
||||
self.process_deferred_scripts();
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#the-end step 3.
|
||||
/// <https://html.spec.whatwg.org/multipage/#the-end> step 3.
|
||||
fn process_deferred_scripts(&self) {
|
||||
if self.ready_state.get() != DocumentReadyState::Interactive {
|
||||
return;
|
||||
|
@ -3207,7 +3207,7 @@ impl Document {
|
|||
ref_filter_map(self.csp_list.borrow(), Option::as_ref)
|
||||
}
|
||||
|
||||
/// https://www.w3.org/TR/CSP/#should-block-inline
|
||||
/// <https://www.w3.org/TR/CSP/#should-block-inline>
|
||||
pub fn should_elements_inline_type_behavior_be_blocked(
|
||||
&self,
|
||||
el: &Element,
|
||||
|
|
|
@ -491,7 +491,7 @@ impl Element {
|
|||
self.shadow_root().is_some()
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#dom-element-attachshadow
|
||||
/// <https://dom.spec.whatwg.org/#dom-element-attachshadow>
|
||||
/// XXX This is not exposed to web content yet. It is meant to be used
|
||||
/// for UA widgets only.
|
||||
pub fn attach_shadow(&self, is_ua_widget: IsUserAgentWidget) -> Fallible<DomRoot<ShadowRoot>> {
|
||||
|
|
|
@ -29,16 +29,16 @@ use crate::script_runtime::JSContext;
|
|||
#[dom_struct]
|
||||
#[allow(non_snake_case)]
|
||||
pub struct ExtendableMessageEvent {
|
||||
/// https://w3c.github.io/ServiceWorker/#extendableevent
|
||||
/// <https://w3c.github.io/ServiceWorker/#extendableevent>
|
||||
event: ExtendableEvent,
|
||||
/// https://w3c.github.io/ServiceWorker/#dom-extendablemessageevent-data
|
||||
/// <https://w3c.github.io/ServiceWorker/#dom-extendablemessageevent-data>
|
||||
#[ignore_malloc_size_of = "mozjs"]
|
||||
data: Heap<JSVal>,
|
||||
/// <https://w3c.github.io/ServiceWorker/#extendablemessage-event-origin>
|
||||
origin: DOMString,
|
||||
/// https://w3c.github.io/ServiceWorker/#dom-extendablemessageevent-lasteventid
|
||||
/// <https://w3c.github.io/ServiceWorker/#dom-extendablemessageevent-lasteventid>
|
||||
lastEventId: DOMString,
|
||||
/// https://w3c.github.io/ServiceWorker/#dom-extendablemessageevent-ports
|
||||
/// <https://w3c.github.io/ServiceWorker/#dom-extendablemessageevent-ports>
|
||||
ports: Vec<Dom<MessagePort>>,
|
||||
#[ignore_malloc_size_of = "mozjs"]
|
||||
frozen_ports: DomRefCell<Option<Heap<JSVal>>>,
|
||||
|
@ -193,7 +193,7 @@ impl ExtendableMessageEventMethods for ExtendableMessageEvent {
|
|||
self.event.IsTrusted()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/ServiceWorker/#extendablemessage-event-ports
|
||||
/// <https://w3c.github.io/ServiceWorker/#extendablemessage-event-ports>
|
||||
fn Ports(&self, cx: JSContext) -> JSVal {
|
||||
if let Some(ports) = &*self.frozen_ports.borrow() {
|
||||
return ports.get();
|
||||
|
|
|
@ -184,7 +184,7 @@ impl From<FakeXRRegionType> for EntityType {
|
|||
}
|
||||
|
||||
impl FakeXRDeviceMethods for FakeXRDevice {
|
||||
/// https://github.com/immersive-web/webxr-test-api/blob/master/explainer.md
|
||||
/// <https://github.com/immersive-web/webxr-test-api/blob/master/explainer.md>
|
||||
fn SetViews(&self, views: Vec<FakeXRViewInit>) -> Fallible<()> {
|
||||
let _ = self
|
||||
.sender
|
||||
|
@ -192,7 +192,7 @@ impl FakeXRDeviceMethods for FakeXRDevice {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-setviewerorigin
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-setviewerorigin>
|
||||
fn SetViewerOrigin(
|
||||
&self,
|
||||
origin: &FakeXRRigidTransformInit,
|
||||
|
@ -204,17 +204,17 @@ impl FakeXRDeviceMethods for FakeXRDevice {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-clearviewerorigin
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-clearviewerorigin>
|
||||
fn ClearViewerOrigin(&self) {
|
||||
let _ = self.sender.send(MockDeviceMsg::SetViewerOrigin(None));
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-clearfloororigin
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-clearfloororigin>
|
||||
fn ClearFloorOrigin(&self) {
|
||||
let _ = self.sender.send(MockDeviceMsg::SetFloorOrigin(None));
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-setfloororigin
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-setfloororigin>
|
||||
fn SetFloorOrigin(&self, origin: &FakeXRRigidTransformInit) -> Fallible<()> {
|
||||
let _ = self
|
||||
.sender
|
||||
|
@ -222,18 +222,18 @@ impl FakeXRDeviceMethods for FakeXRDevice {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-clearworld
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-clearworld>
|
||||
fn ClearWorld(&self) {
|
||||
let _ = self.sender.send(MockDeviceMsg::ClearWorld);
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-setworld
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-setworld>
|
||||
fn SetWorld(&self, world: &FakeXRWorldInit) -> Fallible<()> {
|
||||
let _ = self.sender.send(MockDeviceMsg::SetWorld(get_world(world)?));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-simulatevisibilitychange
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-simulatevisibilitychange>
|
||||
fn SimulateVisibilityChange(&self, v: XRVisibilityState) {
|
||||
let v = match v {
|
||||
XRVisibilityState::Visible => Visibility::Visible,
|
||||
|
@ -243,7 +243,7 @@ impl FakeXRDeviceMethods for FakeXRDevice {
|
|||
let _ = self.sender.send(MockDeviceMsg::VisibilityChange(v));
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-simulateinputsourceconnection
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-simulateinputsourceconnection>
|
||||
fn SimulateInputSourceConnection(
|
||||
&self,
|
||||
init: &FakeXRInputSourceInit,
|
||||
|
@ -289,7 +289,7 @@ impl FakeXRDeviceMethods for FakeXRDevice {
|
|||
Ok(controller)
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-disconnect
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrdevice-disconnect>
|
||||
fn Disconnect(&self) -> Rc<Promise> {
|
||||
let global = self.global();
|
||||
let p = Promise::new(&global);
|
||||
|
|
|
@ -59,34 +59,34 @@ impl FakeXRInputController {
|
|||
}
|
||||
|
||||
impl FakeXRInputControllerMethods for FakeXRInputController {
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-setpointerorigin
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-setpointerorigin>
|
||||
fn SetPointerOrigin(&self, origin: &FakeXRRigidTransformInit, _emulated: bool) -> Fallible<()> {
|
||||
self.send_message(MockInputMsg::SetPointerOrigin(Some(get_origin(origin)?)));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-setgriporigin
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-setgriporigin>
|
||||
fn SetGripOrigin(&self, origin: &FakeXRRigidTransformInit, _emulated: bool) -> Fallible<()> {
|
||||
self.send_message(MockInputMsg::SetGripOrigin(Some(get_origin(origin)?)));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-cleargriporigin
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-cleargriporigin>
|
||||
fn ClearGripOrigin(&self) {
|
||||
self.send_message(MockInputMsg::SetGripOrigin(None))
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-disconnect
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-disconnect>
|
||||
fn Disconnect(&self) {
|
||||
self.send_message(MockInputMsg::Disconnect)
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-reconnect
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-reconnect>
|
||||
fn Reconnect(&self) {
|
||||
self.send_message(MockInputMsg::Reconnect)
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-startselection
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-startselection>
|
||||
fn StartSelection(&self) {
|
||||
self.send_message(MockInputMsg::TriggerSelect(
|
||||
SelectKind::Select,
|
||||
|
@ -94,7 +94,7 @@ impl FakeXRInputControllerMethods for FakeXRInputController {
|
|||
))
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-endselection
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-endselection>
|
||||
fn EndSelection(&self) {
|
||||
self.send_message(MockInputMsg::TriggerSelect(
|
||||
SelectKind::Select,
|
||||
|
@ -102,7 +102,7 @@ impl FakeXRInputControllerMethods for FakeXRInputController {
|
|||
))
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-simulateselect
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-simulateselect>
|
||||
fn SimulateSelect(&self) {
|
||||
self.send_message(MockInputMsg::TriggerSelect(
|
||||
SelectKind::Select,
|
||||
|
@ -110,7 +110,7 @@ impl FakeXRInputControllerMethods for FakeXRInputController {
|
|||
))
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-sethandedness
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-sethandedness>
|
||||
fn SetHandedness(&self, handedness: XRHandedness) {
|
||||
let h = match handedness {
|
||||
XRHandedness::None => Handedness::None,
|
||||
|
@ -120,7 +120,7 @@ impl FakeXRInputControllerMethods for FakeXRInputController {
|
|||
let _ = self.send_message(MockInputMsg::SetHandedness(h));
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-settargetraymode
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-settargetraymode>
|
||||
fn SetTargetRayMode(&self, target_ray_mode: XRTargetRayMode) {
|
||||
let t = match target_ray_mode {
|
||||
XRTargetRayMode::Gaze => TargetRayMode::Gaze,
|
||||
|
@ -130,7 +130,7 @@ impl FakeXRInputControllerMethods for FakeXRInputController {
|
|||
let _ = self.send_message(MockInputMsg::SetTargetRayMode(t));
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-setprofiles
|
||||
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-setprofiles>
|
||||
fn SetProfiles(&self, profiles: Vec<DOMString>) {
|
||||
let t = profiles.into_iter().map(String::from).collect();
|
||||
let _ = self.send_message(MockInputMsg::SetProfiles(t));
|
||||
|
|
|
@ -131,7 +131,7 @@ use crate::timers::{
|
|||
|
||||
#[derive(JSTraceable)]
|
||||
pub struct AutoCloseWorker {
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-workerglobalscope-closing
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-workerglobalscope-closing>
|
||||
closing: Arc<AtomicBool>,
|
||||
/// A handle to join on the worker thread.
|
||||
join_handle: Option<JoinHandle<()>>,
|
||||
|
@ -207,7 +207,7 @@ pub struct GlobalScope {
|
|||
console_timers: DomRefCell<HashMap<DOMString, Instant>>,
|
||||
|
||||
/// module map is used when importing JavaScript modules
|
||||
/// https://html.spec.whatwg.org/multipage/#concept-settings-object-module-map
|
||||
/// <https://html.spec.whatwg.org/multipage/#concept-settings-object-module-map>
|
||||
#[ignore_malloc_size_of = "mozjs"]
|
||||
module_map: DomRefCell<HashMapTracedValues<ServoUrl, Rc<ModuleTree>>>,
|
||||
|
||||
|
@ -257,7 +257,7 @@ pub struct GlobalScope {
|
|||
#[no_trace]
|
||||
origin: MutableOrigin,
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#concept-environment-creation-url
|
||||
/// <https://html.spec.whatwg.org/multipage/#concept-environment-creation-url>
|
||||
#[no_trace]
|
||||
creation_url: Option<ServoUrl>,
|
||||
|
||||
|
@ -442,7 +442,7 @@ pub struct ManagedMessagePort {
|
|||
pub enum BroadcastChannelState {
|
||||
/// The broadcast-channel router id for this global, and a queue of managed channels.
|
||||
/// Step 9, "sort destinations"
|
||||
/// of https://html.spec.whatwg.org/multipage/#dom-broadcastchannel-postmessage
|
||||
/// of <https://html.spec.whatwg.org/multipage/#dom-broadcastchannel-postmessage>
|
||||
/// requires keeping track of creation order, hence the queue.
|
||||
Managed(
|
||||
#[no_trace] BroadcastChannelRouterId,
|
||||
|
@ -1339,7 +1339,7 @@ impl GlobalScope {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#ports-and-garbage-collection
|
||||
/// <https://html.spec.whatwg.org/multipage/#ports-and-garbage-collection>
|
||||
pub fn perform_a_message_port_garbage_collection_checkpoint(&self) {
|
||||
let is_empty = if let MessagePortState::Managed(_id, message_ports) =
|
||||
&mut *self.message_port_state.borrow_mut()
|
||||
|
@ -1373,7 +1373,7 @@ impl GlobalScope {
|
|||
|
||||
/// Remove broadcast-channels that are closed.
|
||||
/// TODO: Also remove them if they do not have an event-listener.
|
||||
/// see https://github.com/servo/servo/issues/25772
|
||||
/// see <https://github.com/servo/servo/issues/25772>
|
||||
pub fn perform_a_broadcast_channel_garbage_collection_checkpoint(&self) {
|
||||
let is_empty = if let BroadcastChannelState::Managed(router_id, ref mut channels) =
|
||||
&mut *self.broadcast_channel_state.borrow_mut()
|
||||
|
@ -1791,7 +1791,7 @@ impl GlobalScope {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/FileAPI/#dfn-size
|
||||
/// <https://w3c.github.io/FileAPI/#dfn-size>
|
||||
pub fn get_blob_size(&self, blob_id: &BlobId) -> u64 {
|
||||
let blob_state = self.blob_state.borrow();
|
||||
if let BlobState::Managed(blobs_map) = &*blob_state {
|
||||
|
@ -3055,7 +3055,7 @@ impl GlobalScope {
|
|||
false
|
||||
}
|
||||
|
||||
/// https://www.w3.org/TR/CSP/#get-csp-of-object
|
||||
/// <https://www.w3.org/TR/CSP/#get-csp-of-object>
|
||||
pub fn get_csp_list(&self) -> Option<CspList> {
|
||||
if let Some(window) = self.downcast::<Window>() {
|
||||
return window.Document().get_csp_list().map(|c| c.clone());
|
||||
|
|
|
@ -86,7 +86,7 @@ impl GPUAdapter {
|
|||
}
|
||||
|
||||
impl GPUAdapterMethods for GPUAdapter {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuadapter-requestdevice
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuadapter-requestdevice>
|
||||
fn RequestDevice(&self, descriptor: &GPUDeviceDescriptor, comp: InRealm) -> Rc<Promise> {
|
||||
// Step 2
|
||||
let promise = Promise::new_in_current_realm(comp);
|
||||
|
@ -205,13 +205,13 @@ impl GPUAdapterMethods for GPUAdapter {
|
|||
promise
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuadapter-isfallbackadapter
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuadapter-isfallbackadapter>
|
||||
fn IsFallbackAdapter(&self) -> bool {
|
||||
//TODO
|
||||
false
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuadapter-requestadapterinfo
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuadapter-requestadapterinfo>
|
||||
fn RequestAdapterInfo(&self, unmask_hints: Vec<DOMString>, comp: InRealm) -> Rc<Promise> {
|
||||
// XXX: Adapter info should be generated here ...
|
||||
// Step 1
|
||||
|
@ -225,12 +225,12 @@ impl GPUAdapterMethods for GPUAdapter {
|
|||
promise
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuadapter-features
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuadapter-features>
|
||||
fn Features(&self) -> DomRoot<GPUSupportedFeatures> {
|
||||
DomRoot::from_ref(&self.features)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuadapter-limits
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuadapter-limits>
|
||||
fn Limits(&self) -> DomRoot<GPUSupportedLimits> {
|
||||
DomRoot::from_ref(&self.limits)
|
||||
}
|
||||
|
|
|
@ -35,22 +35,22 @@ impl GPUAdapterInfo {
|
|||
|
||||
// TODO: wgpu does not expose right fields right now
|
||||
impl GPUAdapterInfoMethods for GPUAdapterInfo {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuadapterinfo-vendor
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuadapterinfo-vendor>
|
||||
fn Vendor(&self) -> DOMString {
|
||||
DOMString::new()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuadapterinfo-architecture
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuadapterinfo-architecture>
|
||||
fn Architecture(&self) -> DOMString {
|
||||
DOMString::new()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuadapterinfo-device
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuadapterinfo-device>
|
||||
fn Device(&self) -> DOMString {
|
||||
DOMString::new()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuadapterinfo-description
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuadapterinfo-description>
|
||||
fn Description(&self) -> DOMString {
|
||||
DOMString::from_string(self.info.driver_info.clone())
|
||||
}
|
||||
|
|
|
@ -63,12 +63,12 @@ impl GPUBindGroup {
|
|||
}
|
||||
|
||||
impl GPUBindGroupMethods for GPUBindGroup {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
|
|
@ -48,12 +48,12 @@ impl GPUBindGroupLayout {
|
|||
}
|
||||
|
||||
impl GPUBindGroupLayoutMethods for GPUBindGroupLayout {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ impl Drop for GPUBuffer {
|
|||
|
||||
impl GPUBufferMethods for GPUBuffer {
|
||||
#[allow(unsafe_code)]
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpubuffer-unmap
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpubuffer-unmap>
|
||||
fn Unmap(&self) -> Fallible<()> {
|
||||
let cx = GlobalScope::get_cx();
|
||||
// Step 1
|
||||
|
@ -181,7 +181,7 @@ impl GPUBufferMethods for GPUBuffer {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpubuffer-destroy
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpubuffer-destroy>
|
||||
fn Destroy(&self) -> Fallible<()> {
|
||||
let state = self.state.get();
|
||||
match state {
|
||||
|
@ -206,7 +206,7 @@ impl GPUBufferMethods for GPUBuffer {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpubuffer-mapasync-offset-size
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpubuffer-mapasync-offset-size>
|
||||
fn MapAsync(
|
||||
&self,
|
||||
mode: u32,
|
||||
|
@ -278,7 +278,7 @@ impl GPUBufferMethods for GPUBuffer {
|
|||
promise
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpubuffer-getmappedrange
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpubuffer-getmappedrange>
|
||||
#[allow(unsafe_code)]
|
||||
fn GetMappedRange(
|
||||
&self,
|
||||
|
@ -333,12 +333,12 @@ impl GPUBufferMethods for GPUBuffer {
|
|||
Ok(NonNull::new(array_buffer).unwrap())
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
|
|
@ -100,14 +100,14 @@ pub struct GPUCanvasContext {
|
|||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
#[no_trace]
|
||||
channel: WebGPU,
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-canvas
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-canvas>
|
||||
canvas: HTMLCanvasElementOrOffscreenCanvas,
|
||||
// TODO: can we have wgpu surface that is hw accelerated inside wr ...
|
||||
#[ignore_malloc_size_of = "Defined in webrender"]
|
||||
#[no_trace]
|
||||
webrender_image: Cell<Option<webrender_api::ImageKey>>,
|
||||
context_id: WebGPUContextId,
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-currenttexture-slot
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-currenttexture-slot>
|
||||
texture: MutNullableDom<GPUTexture>,
|
||||
}
|
||||
|
||||
|
@ -206,12 +206,12 @@ impl LayoutCanvasRenderingContextHelpers for LayoutDom<'_, GPUCanvasContext> {
|
|||
}
|
||||
|
||||
impl GPUCanvasContextMethods for GPUCanvasContext {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-canvas
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-canvas>
|
||||
fn Canvas(&self) -> HTMLCanvasElementOrOffscreenCanvas {
|
||||
self.canvas.clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-configure
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-configure>
|
||||
fn Configure(&self, descriptor: &GPUCanvasConfiguration) {
|
||||
// Step 1 is let
|
||||
// Step 2
|
||||
|
@ -293,7 +293,7 @@ impl GPUCanvasContextMethods for GPUCanvasContext {
|
|||
self.webrender_image.set(Some(receiver.recv().unwrap()));
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-unconfigure
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-unconfigure>
|
||||
fn Unconfigure(&self) {
|
||||
if let Some(image_key) = self.webrender_image.take() {
|
||||
if let Err(e) = self.channel.0.send((
|
||||
|
@ -312,7 +312,7 @@ impl GPUCanvasContextMethods for GPUCanvasContext {
|
|||
self.texture.take();
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-getcurrenttexture
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-getcurrenttexture>
|
||||
fn GetCurrentTexture(&self) -> Fallible<DomRoot<GPUTexture>> {
|
||||
// Step 5.
|
||||
self.mark_as_dirty();
|
||||
|
|
|
@ -95,12 +95,12 @@ impl GPUCommandBuffer {
|
|||
}
|
||||
|
||||
impl GPUCommandBufferMethods for GPUCommandBuffer {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
|
|
@ -107,17 +107,17 @@ impl GPUCommandEncoder {
|
|||
}
|
||||
|
||||
impl GPUCommandEncoderMethods for GPUCommandEncoder {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-begincomputepass
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-begincomputepass>
|
||||
fn BeginComputePass(
|
||||
&self,
|
||||
descriptor: &GPUComputePassDescriptor,
|
||||
|
@ -152,7 +152,7 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-beginrenderpass
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-beginrenderpass>
|
||||
fn BeginRenderPass(
|
||||
&self,
|
||||
descriptor: &GPURenderPassDescriptor,
|
||||
|
@ -250,7 +250,7 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-copybuffertobuffer
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-copybuffertobuffer>
|
||||
fn CopyBufferToBuffer(
|
||||
&self,
|
||||
source: &GPUBuffer,
|
||||
|
@ -284,7 +284,7 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
|
|||
.expect("Failed to send CopyBufferToBuffer");
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-copybuffertotexture
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-copybuffertotexture>
|
||||
fn CopyBufferToTexture(
|
||||
&self,
|
||||
source: &GPUImageCopyBuffer,
|
||||
|
@ -316,7 +316,7 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
|
|||
.expect("Failed to send CopyBufferToTexture");
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-copybuffertotexture
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-copybuffertotexture>
|
||||
fn CopyTextureToBuffer(
|
||||
&self,
|
||||
source: &GPUImageCopyTexture,
|
||||
|
@ -348,7 +348,7 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
|
|||
.expect("Failed to send CopyTextureToBuffer");
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#GPUCommandEncoder-copyTextureToTexture
|
||||
/// <https://gpuweb.github.io/gpuweb/#GPUCommandEncoder-copyTextureToTexture>
|
||||
fn CopyTextureToTexture(
|
||||
&self,
|
||||
source: &GPUImageCopyTexture,
|
||||
|
@ -376,7 +376,7 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
|
|||
.expect("Failed to send CopyTextureToTexture");
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-finish
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-finish>
|
||||
fn Finish(&self, descriptor: &GPUCommandBufferDescriptor) -> DomRoot<GPUCommandBuffer> {
|
||||
self.channel
|
||||
.0
|
||||
|
|
|
@ -19,7 +19,7 @@ pub struct GPUCompilationInfo {
|
|||
|
||||
// TODO: wgpu does not expose right fields right now
|
||||
impl GPUCompilationInfoMethods for GPUCompilationInfo {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucompilationinfo-messages
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucompilationinfo-messages>
|
||||
fn Messages(&self, _cx: JSContext) -> JSVal {
|
||||
todo!()
|
||||
}
|
||||
|
|
|
@ -65,32 +65,32 @@ impl GPUCompilationMessage {
|
|||
}
|
||||
|
||||
impl GPUCompilationMessageMethods for GPUCompilationMessage {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucompilationmessage-message
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucompilationmessage-message>
|
||||
fn Message(&self) -> DOMString {
|
||||
self.message.to_owned()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucompilationmessage-type
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucompilationmessage-type>
|
||||
fn Type(&self) -> GPUCompilationMessageType {
|
||||
self.mtype
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucompilationmessage-linenum
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucompilationmessage-linenum>
|
||||
fn LineNum(&self) -> u64 {
|
||||
self.line_num
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucompilationmessage-linepos
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucompilationmessage-linepos>
|
||||
fn LinePos(&self) -> u64 {
|
||||
self.line_pos
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucompilationmessage-offset
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucompilationmessage-offset>
|
||||
fn Offset(&self) -> u64 {
|
||||
self.offset
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucompilationmessage-length
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucompilationmessage-length>
|
||||
fn Length(&self) -> u64 {
|
||||
self.length
|
||||
}
|
||||
|
|
|
@ -67,24 +67,24 @@ impl GPUComputePassEncoder {
|
|||
}
|
||||
|
||||
impl GPUComputePassEncoderMethods for GPUComputePassEncoder {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucomputepassencoder-dispatchworkgroups
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucomputepassencoder-dispatchworkgroups>
|
||||
fn DispatchWorkgroups(&self, x: u32, y: u32, z: u32) {
|
||||
if let Some(compute_pass) = self.compute_pass.borrow_mut().as_mut() {
|
||||
wgpu_comp::wgpu_compute_pass_dispatch_workgroups(compute_pass, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucomputepassencoder-dispatchworkgroupsindirect
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucomputepassencoder-dispatchworkgroupsindirect>
|
||||
fn DispatchWorkgroupsIndirect(&self, indirect_buffer: &GPUBuffer, indirect_offset: u64) {
|
||||
if let Some(compute_pass) = self.compute_pass.borrow_mut().as_mut() {
|
||||
wgpu_comp::wgpu_compute_pass_dispatch_workgroups_indirect(
|
||||
|
@ -95,7 +95,7 @@ impl GPUComputePassEncoderMethods for GPUComputePassEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderpassencoder-endpass
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderpassencoder-endpass>
|
||||
fn End(&self) -> Fallible<()> {
|
||||
let compute_pass = self.compute_pass.borrow_mut().take();
|
||||
self.channel
|
||||
|
@ -116,7 +116,7 @@ impl GPUComputePassEncoderMethods for GPUComputePassEncoder {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuprogrammablepassencoder-setbindgroup
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuprogrammablepassencoder-setbindgroup>
|
||||
#[allow(unsafe_code)]
|
||||
fn SetBindGroup(&self, index: u32, bind_group: &GPUBindGroup, dynamic_offsets: Vec<u32>) {
|
||||
if let Some(compute_pass) = self.compute_pass.borrow_mut().as_mut() {
|
||||
|
@ -132,7 +132,7 @@ impl GPUComputePassEncoderMethods for GPUComputePassEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpucomputepassencoder-setpipeline
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucomputepassencoder-setpipeline>
|
||||
fn SetPipeline(&self, pipeline: &GPUComputePipeline) {
|
||||
if let Some(compute_pass) = self.compute_pass.borrow_mut().as_mut() {
|
||||
wgpu_comp::wgpu_compute_pass_set_pipeline(compute_pass, pipeline.id().0);
|
||||
|
|
|
@ -70,17 +70,17 @@ impl GPUComputePipeline {
|
|||
}
|
||||
|
||||
impl GPUComputePipelineMethods for GPUComputePipeline {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpupipelinebase-getbindgrouplayout
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpupipelinebase-getbindgrouplayout>
|
||||
fn GetBindGroupLayout(&self, index: u32) -> Fallible<DomRoot<GPUBindGroupLayout>> {
|
||||
if index > self.bind_group_layouts.len() as u32 {
|
||||
return Err(Error::Range(String::from("Index out of bounds")));
|
||||
|
|
|
@ -311,7 +311,7 @@ impl GPUDevice {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#lose-the-device
|
||||
/// <https://gpuweb.github.io/gpuweb/#lose-the-device>
|
||||
pub fn lose(&self, reason: GPUDeviceLostReason) {
|
||||
if let Some(ref lost_promise) = *self.lost_promise.borrow() {
|
||||
let global = &self.global();
|
||||
|
@ -328,39 +328,39 @@ impl GPUDevice {
|
|||
}
|
||||
|
||||
impl GPUDeviceMethods for GPUDevice {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-features
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-features>
|
||||
fn Features(&self) -> DomRoot<GPUSupportedFeatures> {
|
||||
DomRoot::from_ref(&self.features)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-limits
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-limits>
|
||||
fn Limits(&self) -> DomRoot<GPUSupportedLimits> {
|
||||
DomRoot::from_ref(&self.limits)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-queue
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-queue>
|
||||
fn GetQueue(&self) -> DomRoot<GPUQueue> {
|
||||
DomRoot::from_ref(&self.default_queue)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-lost
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-lost>
|
||||
fn GetLost(&self, comp: InRealm) -> Fallible<Rc<Promise>> {
|
||||
let promise = Promise::new_in_current_realm(comp);
|
||||
*self.lost_promise.borrow_mut() = Some(promise.clone());
|
||||
Ok(promise)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-createbuffer
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createbuffer>
|
||||
fn CreateBuffer(&self, descriptor: &GPUBufferDescriptor) -> Fallible<DomRoot<GPUBuffer>> {
|
||||
let desc =
|
||||
wgt::BufferUsages::from_bits(descriptor.usage).map(|usg| wgpu_res::BufferDescriptor {
|
||||
|
@ -425,7 +425,7 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
))
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#GPUDevice-createBindGroupLayout
|
||||
/// <https://gpuweb.github.io/gpuweb/#GPUDevice-createBindGroupLayout>
|
||||
#[allow(non_snake_case)]
|
||||
fn CreateBindGroupLayout(
|
||||
&self,
|
||||
|
@ -546,7 +546,7 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-createpipelinelayout
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createpipelinelayout>
|
||||
fn CreatePipelineLayout(
|
||||
&self,
|
||||
descriptor: &GPUPipelineLayoutDescriptor,
|
||||
|
@ -596,7 +596,7 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-createbindgroup
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createbindgroup>
|
||||
fn CreateBindGroup(&self, descriptor: &GPUBindGroupDescriptor) -> DomRoot<GPUBindGroup> {
|
||||
let entries = descriptor
|
||||
.entries
|
||||
|
@ -657,7 +657,7 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-createshadermodule
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createshadermodule>
|
||||
fn CreateShaderModule(
|
||||
&self,
|
||||
descriptor: RootedTraceableBox<GPUShaderModuleDescriptor>,
|
||||
|
@ -690,7 +690,7 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-createcomputepipeline
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createcomputepipeline>
|
||||
fn CreateComputePipeline(
|
||||
&self,
|
||||
descriptor: &GPUComputePipelineDescriptor,
|
||||
|
@ -736,7 +736,7 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-createcommandencoder
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createcommandencoder>
|
||||
fn CreateCommandEncoder(
|
||||
&self,
|
||||
descriptor: &GPUCommandEncoderDescriptor,
|
||||
|
@ -770,7 +770,7 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-createtexture
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createtexture>
|
||||
fn CreateTexture(&self, descriptor: &GPUTextureDescriptor) -> DomRoot<GPUTexture> {
|
||||
let size = convert_texture_size_to_dict(&descriptor.size);
|
||||
let desc = wgt::TextureUsages::from_bits(descriptor.usage).map(|usg| {
|
||||
|
@ -836,7 +836,7 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-createsampler
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createsampler>
|
||||
fn CreateSampler(&self, descriptor: &GPUSamplerDescriptor) -> DomRoot<GPUSampler> {
|
||||
let sampler_id = self
|
||||
.global()
|
||||
|
@ -885,7 +885,7 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-createrenderpipeline
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createrenderpipeline>
|
||||
fn CreateRenderPipeline(
|
||||
&self,
|
||||
descriptor: &GPURenderPipelineDescriptor,
|
||||
|
@ -1039,7 +1039,7 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-createrenderbundleencoder
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createrenderbundleencoder>
|
||||
fn CreateRenderBundleEncoder(
|
||||
&self,
|
||||
descriptor: &GPURenderBundleEncoderDescriptor,
|
||||
|
@ -1078,7 +1078,7 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-pusherrorscope
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-pusherrorscope>
|
||||
fn PushErrorScope(&self, filter: GPUErrorFilter) {
|
||||
let mut context = self.scope_context.borrow_mut();
|
||||
let scope_id = context.next_scope_id;
|
||||
|
@ -1097,7 +1097,7 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
assert!(res.is_none());
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-poperrorscope
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-poperrorscope>
|
||||
fn PopErrorScope(&self, comp: InRealm) -> Rc<Promise> {
|
||||
let mut context = self.scope_context.borrow_mut();
|
||||
let promise = Promise::new_in_current_realm(comp);
|
||||
|
@ -1131,7 +1131,7 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
// https://gpuweb.github.io/gpuweb/#dom-gpudevice-onuncapturederror
|
||||
event_handler!(uncapturederror, GetOnuncapturederror, SetOnuncapturederror);
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-destroy
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-destroy>
|
||||
fn Destroy(&self) {
|
||||
if self.valid.get() {
|
||||
self.valid.set(false);
|
||||
|
@ -1148,7 +1148,7 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-createcomputepipelineasync
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createcomputepipelineasync>
|
||||
fn CreateComputePipelineAsync(
|
||||
&self,
|
||||
_descriptor: &GPUComputePipelineDescriptor,
|
||||
|
@ -1156,7 +1156,7 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
todo!()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-createrenderpipelineasync
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createrenderpipelineasync>
|
||||
fn CreateRenderPipelineAsync(&self, _descriptor: &GPURenderPipelineDescriptor) -> Rc<Promise> {
|
||||
todo!()
|
||||
}
|
||||
|
|
|
@ -42,12 +42,12 @@ impl GPUDeviceLostInfo {
|
|||
}
|
||||
|
||||
impl GPUDeviceLostInfoMethods for GPUDeviceLostInfo {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevicelostinfo-message
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevicelostinfo-message>
|
||||
fn Message(&self) -> DOMString {
|
||||
self.message.clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevicelostinfo-reason
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevicelostinfo-reason>
|
||||
fn Reason(&self) -> GPUDeviceLostReason {
|
||||
self.reason
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ impl GPUOutOfMemoryError {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuoutofmemoryerror-gpuoutofmemoryerror
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuoutofmemoryerror-gpuoutofmemoryerror>
|
||||
#[allow(non_snake_case)]
|
||||
pub fn Constructor(global: &GlobalScope, proto: Option<HandleObject>) -> DomRoot<Self> {
|
||||
GPUOutOfMemoryError::new_with_proto(global, proto)
|
||||
|
|
|
@ -64,12 +64,12 @@ impl GPUPipelineLayout {
|
|||
}
|
||||
|
||||
impl GPUPipelineLayoutMethods for GPUPipelineLayout {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
|
|
@ -18,17 +18,17 @@ pub struct GPUQuerySet {
|
|||
|
||||
// TODO: wgpu does not expose right fields right now
|
||||
impl GPUQuerySetMethods for GPUQuerySet {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuqueryset-destroy
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuqueryset-destroy>
|
||||
fn Destroy(&self) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, _value: USVString) {
|
||||
todo!()
|
||||
}
|
||||
|
|
|
@ -58,17 +58,17 @@ impl GPUQueue {
|
|||
}
|
||||
|
||||
impl GPUQueueMethods for GPUQueue {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuqueue-submit
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuqueue-submit>
|
||||
fn Submit(&self, command_buffers: Vec<DomRoot<GPUCommandBuffer>>) {
|
||||
let valid = command_buffers.iter().all(|cb| {
|
||||
cb.buffers().iter().all(|b| match b.state() {
|
||||
|
@ -99,7 +99,7 @@ impl GPUQueueMethods for GPUQueue {
|
|||
.unwrap();
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuqueue-writebuffer
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuqueue-writebuffer>
|
||||
#[allow(unsafe_code)]
|
||||
fn WriteBuffer(
|
||||
&self,
|
||||
|
@ -146,7 +146,7 @@ impl GPUQueueMethods for GPUQueue {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuqueue-writetexture
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuqueue-writetexture>
|
||||
fn WriteTexture(
|
||||
&self,
|
||||
destination: &GPUImageCopyTexture,
|
||||
|
|
|
@ -67,12 +67,12 @@ impl GPURenderBundle {
|
|||
}
|
||||
|
||||
impl GPURenderBundleMethods for GPURenderBundle {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
|
|
@ -70,17 +70,17 @@ impl GPURenderBundleEncoder {
|
|||
}
|
||||
|
||||
impl GPURenderBundleEncoderMethods for GPURenderBundleEncoder {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuprogrammablepassencoder-setbindgroup
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuprogrammablepassencoder-setbindgroup>
|
||||
#[allow(unsafe_code)]
|
||||
fn SetBindGroup(&self, index: u32, bind_group: &GPUBindGroup, dynamic_offsets: Vec<u32>) {
|
||||
if let Some(encoder) = self.render_bundle_encoder.borrow_mut().as_mut() {
|
||||
|
@ -96,14 +96,14 @@ impl GPURenderBundleEncoderMethods for GPURenderBundleEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-setpipeline
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-setpipeline>
|
||||
fn SetPipeline(&self, pipeline: &GPURenderPipeline) {
|
||||
if let Some(encoder) = self.render_bundle_encoder.borrow_mut().as_mut() {
|
||||
wgpu_bundle::wgpu_render_bundle_set_pipeline(encoder, pipeline.id().0);
|
||||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-setindexbuffer
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-setindexbuffer>
|
||||
fn SetIndexBuffer(
|
||||
&self,
|
||||
buffer: &GPUBuffer,
|
||||
|
@ -125,7 +125,7 @@ impl GPURenderBundleEncoderMethods for GPURenderBundleEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-setvertexbuffer
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-setvertexbuffer>
|
||||
fn SetVertexBuffer(&self, slot: u32, buffer: &GPUBuffer, offset: u64, size: u64) {
|
||||
if let Some(encoder) = self.render_bundle_encoder.borrow_mut().as_mut() {
|
||||
wgpu_bundle::wgpu_render_bundle_set_vertex_buffer(
|
||||
|
@ -138,7 +138,7 @@ impl GPURenderBundleEncoderMethods for GPURenderBundleEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-draw
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-draw>
|
||||
fn Draw(&self, vertex_count: u32, instance_count: u32, first_vertex: u32, first_instance: u32) {
|
||||
if let Some(encoder) = self.render_bundle_encoder.borrow_mut().as_mut() {
|
||||
wgpu_bundle::wgpu_render_bundle_draw(
|
||||
|
@ -151,7 +151,7 @@ impl GPURenderBundleEncoderMethods for GPURenderBundleEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-drawindexed
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-drawindexed>
|
||||
fn DrawIndexed(
|
||||
&self,
|
||||
index_count: u32,
|
||||
|
@ -172,7 +172,7 @@ impl GPURenderBundleEncoderMethods for GPURenderBundleEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-drawindirect
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-drawindirect>
|
||||
fn DrawIndirect(&self, indirect_buffer: &GPUBuffer, indirect_offset: u64) {
|
||||
if let Some(encoder) = self.render_bundle_encoder.borrow_mut().as_mut() {
|
||||
wgpu_bundle::wgpu_render_bundle_draw_indirect(
|
||||
|
@ -183,7 +183,7 @@ impl GPURenderBundleEncoderMethods for GPURenderBundleEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-drawindexedindirect
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-drawindexedindirect>
|
||||
fn DrawIndexedIndirect(&self, indirect_buffer: &GPUBuffer, indirect_offset: u64) {
|
||||
if let Some(encoder) = self.render_bundle_encoder.borrow_mut().as_mut() {
|
||||
wgpu_bundle::wgpu_render_bundle_draw_indexed_indirect(
|
||||
|
@ -194,7 +194,7 @@ impl GPURenderBundleEncoderMethods for GPURenderBundleEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderbundleencoder-finish
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderbundleencoder-finish>
|
||||
fn Finish(&self, descriptor: &GPURenderBundleDescriptor) -> DomRoot<GPURenderBundle> {
|
||||
let desc = wgt::RenderBundleDescriptor {
|
||||
label: convert_label(&descriptor.parent),
|
||||
|
|
|
@ -72,17 +72,17 @@ impl GPURenderPassEncoder {
|
|||
}
|
||||
|
||||
impl GPURenderPassEncoderMethods for GPURenderPassEncoder {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuprogrammablepassencoder-setbindgroup
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuprogrammablepassencoder-setbindgroup>
|
||||
#[allow(unsafe_code)]
|
||||
fn SetBindGroup(&self, index: u32, bind_group: &GPUBindGroup, dynamic_offsets: Vec<u32>) {
|
||||
if let Some(render_pass) = self.render_pass.borrow_mut().as_mut() {
|
||||
|
@ -98,7 +98,7 @@ impl GPURenderPassEncoderMethods for GPURenderPassEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderpassencoder-setviewport
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderpassencoder-setviewport>
|
||||
fn SetViewport(
|
||||
&self,
|
||||
x: Finite<f32>,
|
||||
|
@ -121,14 +121,14 @@ impl GPURenderPassEncoderMethods for GPURenderPassEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderpassencoder-setscissorrect
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderpassencoder-setscissorrect>
|
||||
fn SetScissorRect(&self, x: u32, y: u32, width: u32, height: u32) {
|
||||
if let Some(render_pass) = self.render_pass.borrow_mut().as_mut() {
|
||||
wgpu_render::wgpu_render_pass_set_scissor_rect(render_pass, x, y, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderpassencoder-setblendcolor
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderpassencoder-setblendcolor>
|
||||
fn SetBlendConstant(&self, color: GPUColor) {
|
||||
if let Some(render_pass) = self.render_pass.borrow_mut().as_mut() {
|
||||
let colors = match color {
|
||||
|
@ -155,14 +155,14 @@ impl GPURenderPassEncoderMethods for GPURenderPassEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderpassencoder-setstencilreference
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderpassencoder-setstencilreference>
|
||||
fn SetStencilReference(&self, reference: u32) {
|
||||
if let Some(render_pass) = self.render_pass.borrow_mut().as_mut() {
|
||||
wgpu_render::wgpu_render_pass_set_stencil_reference(render_pass, reference);
|
||||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderpassencoder-end
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderpassencoder-end>
|
||||
fn End(&self) -> Fallible<()> {
|
||||
let render_pass = self.render_pass.borrow_mut().take();
|
||||
self.channel
|
||||
|
@ -183,14 +183,14 @@ impl GPURenderPassEncoderMethods for GPURenderPassEncoder {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-setpipeline
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-setpipeline>
|
||||
fn SetPipeline(&self, pipeline: &GPURenderPipeline) {
|
||||
if let Some(render_pass) = self.render_pass.borrow_mut().as_mut() {
|
||||
wgpu_render::wgpu_render_pass_set_pipeline(render_pass, pipeline.id().0);
|
||||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurendercommandsmixin-setindexbuffer
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurendercommandsmixin-setindexbuffer>
|
||||
fn SetIndexBuffer(
|
||||
&self,
|
||||
buffer: &GPUBuffer,
|
||||
|
@ -212,7 +212,7 @@ impl GPURenderPassEncoderMethods for GPURenderPassEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-setvertexbuffer
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-setvertexbuffer>
|
||||
fn SetVertexBuffer(&self, slot: u32, buffer: &GPUBuffer, offset: u64, size: u64) {
|
||||
if let Some(render_pass) = self.render_pass.borrow_mut().as_mut() {
|
||||
wgpu_render::wgpu_render_pass_set_vertex_buffer(
|
||||
|
@ -225,7 +225,7 @@ impl GPURenderPassEncoderMethods for GPURenderPassEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-draw
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-draw>
|
||||
fn Draw(&self, vertex_count: u32, instance_count: u32, first_vertex: u32, first_instance: u32) {
|
||||
if let Some(render_pass) = self.render_pass.borrow_mut().as_mut() {
|
||||
wgpu_render::wgpu_render_pass_draw(
|
||||
|
@ -238,7 +238,7 @@ impl GPURenderPassEncoderMethods for GPURenderPassEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-drawindexed
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-drawindexed>
|
||||
fn DrawIndexed(
|
||||
&self,
|
||||
index_count: u32,
|
||||
|
@ -259,7 +259,7 @@ impl GPURenderPassEncoderMethods for GPURenderPassEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-drawindirect
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-drawindirect>
|
||||
fn DrawIndirect(&self, indirect_buffer: &GPUBuffer, indirect_offset: u64) {
|
||||
if let Some(render_pass) = self.render_pass.borrow_mut().as_mut() {
|
||||
wgpu_render::wgpu_render_pass_draw_indirect(
|
||||
|
@ -270,7 +270,7 @@ impl GPURenderPassEncoderMethods for GPURenderPassEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-drawindexedindirect
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderencoderbase-drawindexedindirect>
|
||||
fn DrawIndexedIndirect(&self, indirect_buffer: &GPUBuffer, indirect_offset: u64) {
|
||||
if let Some(render_pass) = self.render_pass.borrow_mut().as_mut() {
|
||||
wgpu_render::wgpu_render_pass_draw_indexed_indirect(
|
||||
|
@ -281,7 +281,7 @@ impl GPURenderPassEncoderMethods for GPURenderPassEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpurenderpassencoder-executebundles
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderpassencoder-executebundles>
|
||||
#[allow(unsafe_code)]
|
||||
fn ExecuteBundles(&self, bundles: Vec<DomRoot<GPURenderBundle>>) {
|
||||
let bundle_ids = bundles.iter().map(|b| b.id().0).collect::<Vec<_>>();
|
||||
|
|
|
@ -70,17 +70,17 @@ impl GPURenderPipeline {
|
|||
}
|
||||
|
||||
impl GPURenderPipelineMethods for GPURenderPipeline {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpupipelinebase-getbindgrouplayout
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpupipelinebase-getbindgrouplayout>
|
||||
fn GetBindGroupLayout(&self, index: u32) -> Fallible<DomRoot<GPUBindGroupLayout>> {
|
||||
if index > self.bind_group_layouts.len() as u32 {
|
||||
return Err(Error::Range(String::from("Index out of bounds")));
|
||||
|
|
|
@ -65,12 +65,12 @@ impl GPUSampler {
|
|||
}
|
||||
|
||||
impl GPUSamplerMethods for GPUSampler {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
|
|
@ -52,17 +52,17 @@ impl GPUShaderModule {
|
|||
}
|
||||
|
||||
impl GPUShaderModuleMethods for GPUShaderModule {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpushadermodule-getcompilationinfo
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpushadermodule-getcompilationinfo>
|
||||
fn GetCompilationInfo(&self) -> Fallible<Rc<Promise>> {
|
||||
todo!("Missing in wgpu: https://github.com/gfx-rs/wgpu/issues/2170")
|
||||
}
|
||||
|
|
|
@ -34,142 +34,142 @@ impl GPUSupportedLimits {
|
|||
}
|
||||
|
||||
impl GPUSupportedLimitsMethods for GPUSupportedLimits {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxtexturedimension1d
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxtexturedimension1d>
|
||||
fn MaxTextureDimension1D(&self) -> u32 {
|
||||
self.limits.max_texture_dimension_1d
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxtexturedimension2d
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxtexturedimension2d>
|
||||
fn MaxTextureDimension2D(&self) -> u32 {
|
||||
self.limits.max_texture_dimension_2d
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxtexturedimension3d
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxtexturedimension3d>
|
||||
fn MaxTextureDimension3D(&self) -> u32 {
|
||||
self.limits.max_texture_dimension_3d
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxtexturearraylayers
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxtexturearraylayers>
|
||||
fn MaxTextureArrayLayers(&self) -> u32 {
|
||||
self.limits.max_texture_array_layers
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxbindgroups
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxbindgroups>
|
||||
fn MaxBindGroups(&self) -> u32 {
|
||||
self.limits.max_bind_groups
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxbindingsperbindgroup
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxbindingsperbindgroup>
|
||||
fn MaxBindingsPerBindGroup(&self) -> u32 {
|
||||
self.limits.max_bindings_per_bind_group
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxdynamicuniformbuffersperpipelinelayout
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxdynamicuniformbuffersperpipelinelayout>
|
||||
fn MaxDynamicUniformBuffersPerPipelineLayout(&self) -> u32 {
|
||||
self.limits.max_dynamic_uniform_buffers_per_pipeline_layout
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxdynamicstoragebuffersperpipelinelayout
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxdynamicstoragebuffersperpipelinelayout>
|
||||
fn MaxDynamicStorageBuffersPerPipelineLayout(&self) -> u32 {
|
||||
self.limits.max_dynamic_storage_buffers_per_pipeline_layout
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxsampledtexturespershaderstage
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxsampledtexturespershaderstage>
|
||||
fn MaxSampledTexturesPerShaderStage(&self) -> u32 {
|
||||
self.limits.max_sampled_textures_per_shader_stage
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxsamplerspershaderstage
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxsamplerspershaderstage>
|
||||
fn MaxSamplersPerShaderStage(&self) -> u32 {
|
||||
self.limits.max_samplers_per_shader_stage
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxstoragebufferspershaderstage
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxstoragebufferspershaderstage>
|
||||
fn MaxStorageBuffersPerShaderStage(&self) -> u32 {
|
||||
self.limits.max_storage_buffers_per_shader_stage
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxstoragetexturespershaderstage
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxstoragetexturespershaderstage>
|
||||
fn MaxStorageTexturesPerShaderStage(&self) -> u32 {
|
||||
self.limits.max_storage_textures_per_shader_stage
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxuniformbufferspershaderstage
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxuniformbufferspershaderstage>
|
||||
fn MaxUniformBuffersPerShaderStage(&self) -> u32 {
|
||||
self.limits.max_uniform_buffers_per_shader_stage
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxuniformbufferbindingsize
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxuniformbufferbindingsize>
|
||||
fn MaxUniformBufferBindingSize(&self) -> u64 {
|
||||
self.limits.max_uniform_buffer_binding_size as u64
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxstoragebufferbindingsize
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxstoragebufferbindingsize>
|
||||
fn MaxStorageBufferBindingSize(&self) -> u64 {
|
||||
self.limits.max_storage_buffer_binding_size as u64
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-minuniformbufferoffsetalignment
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-minuniformbufferoffsetalignment>
|
||||
fn MinUniformBufferOffsetAlignment(&self) -> u32 {
|
||||
self.limits.min_uniform_buffer_offset_alignment
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-minstoragebufferoffsetalignment
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-minstoragebufferoffsetalignment>
|
||||
fn MinStorageBufferOffsetAlignment(&self) -> u32 {
|
||||
self.limits.min_storage_buffer_offset_alignment
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxvertexbuffers
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxvertexbuffers>
|
||||
fn MaxVertexBuffers(&self) -> u32 {
|
||||
self.limits.max_vertex_buffers
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxbuffersize
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxbuffersize>
|
||||
fn MaxBufferSize(&self) -> u64 {
|
||||
self.limits.max_buffer_size
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxvertexattributes
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxvertexattributes>
|
||||
fn MaxVertexAttributes(&self) -> u32 {
|
||||
self.limits.max_vertex_attributes
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxvertexbufferarraystride
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxvertexbufferarraystride>
|
||||
fn MaxVertexBufferArrayStride(&self) -> u32 {
|
||||
self.limits.max_vertex_buffer_array_stride
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxinterstageshadercomponents
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxinterstageshadercomponents>
|
||||
fn MaxInterStageShaderComponents(&self) -> u32 {
|
||||
self.limits.max_inter_stage_shader_components
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxcomputeworkgroupstoragesize
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxcomputeworkgroupstoragesize>
|
||||
fn MaxComputeWorkgroupStorageSize(&self) -> u32 {
|
||||
self.limits.max_compute_workgroup_storage_size
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxcomputeinvocationsperworkgroup
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxcomputeinvocationsperworkgroup>
|
||||
fn MaxComputeInvocationsPerWorkgroup(&self) -> u32 {
|
||||
self.limits.max_compute_invocations_per_workgroup
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxcomputeworkgroupsizex
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxcomputeworkgroupsizex>
|
||||
fn MaxComputeWorkgroupSizeX(&self) -> u32 {
|
||||
self.limits.max_compute_workgroup_size_x
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxcomputeworkgroupsizey
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxcomputeworkgroupsizey>
|
||||
fn MaxComputeWorkgroupSizeY(&self) -> u32 {
|
||||
self.limits.max_compute_workgroup_size_y
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxcomputeworkgroupsizez
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxcomputeworkgroupsizez>
|
||||
fn MaxComputeWorkgroupSizeZ(&self) -> u32 {
|
||||
self.limits.max_compute_workgroup_size_z
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxcomputeworkgroupsperdimension
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpusupportedlimits-maxcomputeworkgroupsperdimension>
|
||||
fn MaxComputeWorkgroupsPerDimension(&self) -> u32 {
|
||||
self.limits.max_compute_workgroups_per_dimension
|
||||
}
|
||||
|
|
|
@ -117,17 +117,17 @@ impl GPUTexture {
|
|||
}
|
||||
|
||||
impl GPUTextureMethods for GPUTexture {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gputexture-createview
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gputexture-createview>
|
||||
fn CreateView(&self, descriptor: &GPUTextureViewDescriptor) -> DomRoot<GPUTextureView> {
|
||||
let scope_id = self.device.use_current_scope();
|
||||
|
||||
|
@ -189,7 +189,7 @@ impl GPUTextureMethods for GPUTexture {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gputexture-destroy
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gputexture-destroy>
|
||||
fn Destroy(&self) {
|
||||
if self.destroyed.get() {
|
||||
return;
|
||||
|
|
|
@ -56,12 +56,12 @@ impl GPUTextureView {
|
|||
}
|
||||
|
||||
impl GPUTextureViewMethods for GPUTextureView {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn Label(&self) -> USVString {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label>
|
||||
fn SetLabel(&self, value: USVString) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ impl GPUUncapturedErrorEvent {
|
|||
ev
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuuncapturederrorevent-gpuuncapturederrorevent
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuuncapturederrorevent-gpuuncapturederrorevent>
|
||||
#[allow(non_snake_case)]
|
||||
pub fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
@ -77,12 +77,12 @@ impl GPUUncapturedErrorEvent {
|
|||
}
|
||||
|
||||
impl GPUUncapturedErrorEventMethods for GPUUncapturedErrorEvent {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuuncapturederrorevent-error
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuuncapturederrorevent-error>
|
||||
fn Error(&self) -> GPUError {
|
||||
clone_gpu_error(&self.gpu_error)
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#dom-event-istrusted
|
||||
/// <https://dom.spec.whatwg.org/#dom-event-istrusted>
|
||||
fn IsTrusted(&self) -> bool {
|
||||
self.event.IsTrusted()
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ impl GPUValidationError {
|
|||
)
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuvalidationerror-gpuvalidationerror
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuvalidationerror-gpuvalidationerror>
|
||||
#[allow(non_snake_case)]
|
||||
pub fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
@ -54,7 +54,7 @@ impl GPUValidationError {
|
|||
}
|
||||
|
||||
impl GPUValidationErrorMethods for GPUValidationError {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuvalidationerror-message
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuvalidationerror-message>
|
||||
fn Message(&self) -> DOMString {
|
||||
self.message.clone()
|
||||
}
|
||||
|
|
|
@ -610,7 +610,7 @@ pub fn get_element_target(subject: &Element) -> Option<DOMString> {
|
|||
};
|
||||
}
|
||||
|
||||
/// < https://html.spec.whatwg.org/multipage/#get-an-element's-noopener>
|
||||
/// <https://html.spec.whatwg.org/multipage/#get-an-element's-noopener>
|
||||
pub fn get_element_noopener(subject: &Element, target_attribute_value: Option<DOMString>) -> bool {
|
||||
if !(subject.is::<HTMLAreaElement>() ||
|
||||
subject.is::<HTMLAnchorElement>() ||
|
||||
|
|
|
@ -442,7 +442,7 @@ impl HTMLCanvasElementMethods for HTMLCanvasElement {
|
|||
Ok(USVString(url))
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediacapture-fromelement/#dom-htmlcanvaselement-capturestream
|
||||
/// <https://w3c.github.io/mediacapture-fromelement/#dom-htmlcanvaselement-capturestream>
|
||||
fn CaptureStream(&self, _frame_request_rate: Option<Finite<f64>>) -> DomRoot<MediaStream> {
|
||||
let global = self.global();
|
||||
let stream = MediaStream::new(&*global);
|
||||
|
|
|
@ -89,7 +89,7 @@ pub struct GenerationId(u32);
|
|||
pub struct HTMLFormElement {
|
||||
htmlelement: HTMLElement,
|
||||
marked_for_reset: Cell<bool>,
|
||||
/// https://html.spec.whatwg.org/multipage/#constructing-entry-list
|
||||
/// <https://html.spec.whatwg.org/multipage/#constructing-entry-list>
|
||||
constructing_entry_list: Cell<bool>,
|
||||
elements: DomOnceCell<HTMLFormControlsCollection>,
|
||||
generation_id: Cell<GenerationId>,
|
||||
|
@ -615,12 +615,12 @@ impl HTMLFormElementMethods for HTMLFormElement {
|
|||
return names_vec;
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-form-checkvalidity
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-form-checkvalidity>
|
||||
fn CheckValidity(&self) -> bool {
|
||||
self.static_validation().is_ok()
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-form-reportvalidity
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-form-reportvalidity>
|
||||
fn ReportValidity(&self) -> bool {
|
||||
self.interactive_validation().is_ok()
|
||||
}
|
||||
|
|
|
@ -483,7 +483,7 @@ impl HTMLIFrameElement {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#iframe-load-event-steps steps 1-4
|
||||
/// <https://html.spec.whatwg.org/multipage/#iframe-load-event-steps> steps 1-4
|
||||
pub fn iframe_load_event_steps(&self, loaded_pipeline: PipelineId) {
|
||||
// TODO(#9592): assert that the load blocker is present at all times when we
|
||||
// can guarantee that it's created for the case of iframe.reload().
|
||||
|
|
|
@ -425,7 +425,7 @@ impl HTMLImageElement {
|
|||
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
||||
}
|
||||
|
||||
/// Step 24 of https://html.spec.whatwg.org/multipage/#update-the-image-data
|
||||
/// Step 24 of <https://html.spec.whatwg.org/multipage/#update-the-image-data>
|
||||
fn process_image_response(&self, image: ImageResponse) {
|
||||
// TODO: Handle multipart/x-mixed-replace
|
||||
let (trigger_image_load, trigger_image_error) = match (image, self.image_request.get()) {
|
||||
|
@ -674,7 +674,7 @@ impl HTMLImageElement {
|
|||
source_size_list.evaluate(&device, quirks_mode)
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#matches-the-environment
|
||||
/// <https://html.spec.whatwg.org/multipage/#matches-the-environment>
|
||||
fn matches_environment(&self, media_query: String) -> bool {
|
||||
let document = document_from_node(self);
|
||||
let quirks_mode = document.quirks_mode();
|
||||
|
@ -1019,7 +1019,7 @@ impl HTMLImageElement {
|
|||
ScriptThread::await_stable_state(Microtask::ImageElement(task));
|
||||
}
|
||||
|
||||
/// Step 2-12 of https://html.spec.whatwg.org/multipage/#img-environment-changes
|
||||
/// Step 2-12 of <https://html.spec.whatwg.org/multipage/#img-environment-changes>
|
||||
fn react_to_environment_changes_sync_steps(&self, generation: u32) {
|
||||
// TODO reduce duplicacy of this code
|
||||
|
||||
|
@ -1814,7 +1814,8 @@ where
|
|||
return (s, "");
|
||||
}
|
||||
|
||||
/// Parse an `srcset` attribute - https://html.spec.whatwg.org/multipage/#parsing-a-srcset-attribute.
|
||||
/// Parse an `srcset` attribute:
|
||||
/// <https://html.spec.whatwg.org/multipage/#parsing-a-srcset-attribute>.
|
||||
pub fn parse_a_srcset_attribute(input: &str) -> Vec<ImageSource> {
|
||||
let mut url_len = 0;
|
||||
let mut candidates: Vec<ImageSource> = vec![];
|
||||
|
|
|
@ -346,19 +346,19 @@ pub struct HTMLMediaElement {
|
|||
#[ignore_malloc_size_of = "Arc"]
|
||||
#[no_trace]
|
||||
audio_renderer: DomRefCell<Option<Arc<Mutex<dyn AudioRenderer>>>>,
|
||||
/// https://html.spec.whatwg.org/multipage/#show-poster-flag
|
||||
/// <https://html.spec.whatwg.org/multipage/#show-poster-flag>
|
||||
show_poster: Cell<bool>,
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-duration
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-duration>
|
||||
duration: Cell<f64>,
|
||||
/// https://html.spec.whatwg.org/multipage/#official-playback-position
|
||||
/// <https://html.spec.whatwg.org/multipage/#official-playback-position>
|
||||
playback_position: Cell<f64>,
|
||||
/// https://html.spec.whatwg.org/multipage/#default-playback-start-position
|
||||
/// <https://html.spec.whatwg.org/multipage/#default-playback-start-position>
|
||||
default_playback_start_position: Cell<f64>,
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-volume
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-volume>
|
||||
volume: Cell<f64>,
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-seeking
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-seeking>
|
||||
seeking: Cell<bool>,
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-muted
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-muted>
|
||||
muted: Cell<bool>,
|
||||
/// URL of the media resource, if any.
|
||||
#[no_trace]
|
||||
|
@ -367,14 +367,14 @@ pub struct HTMLMediaElement {
|
|||
/// is a blob.
|
||||
#[no_trace]
|
||||
blob_url: DomRefCell<Option<ServoUrl>>,
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-played
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-played>
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
played: DomRefCell<TimeRangesContainer>,
|
||||
// https://html.spec.whatwg.org/multipage/#dom-media-audiotracks
|
||||
audio_tracks_list: MutNullableDom<AudioTrackList>,
|
||||
// https://html.spec.whatwg.org/multipage/#dom-media-videotracks
|
||||
video_tracks_list: MutNullableDom<VideoTrackList>,
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-texttracks
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-texttracks>
|
||||
text_tracks_list: MutNullableDom<TextTrackList>,
|
||||
/// Time of last timeupdate notification.
|
||||
#[ignore_malloc_size_of = "Defined in std::time"]
|
||||
|
@ -498,7 +498,7 @@ impl HTMLMediaElement {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#time-marches-on
|
||||
/// <https://html.spec.whatwg.org/multipage/#time-marches-on>
|
||||
fn time_marches_on(&self) {
|
||||
// Step 6.
|
||||
if Instant::now() > self.next_timeupdate_event.get() {
|
||||
|
@ -1316,7 +1316,7 @@ impl HTMLMediaElement {
|
|||
task_source.queue_simple_event(self.upcast(), atom!("seeked"), &window);
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#poster-frame
|
||||
/// <https://html.spec.whatwg.org/multipage/#poster-frame>
|
||||
pub fn process_poster_image_loaded(&self, image: Arc<Image>) {
|
||||
if !self.show_poster.get() {
|
||||
return;
|
||||
|
@ -2230,12 +2230,12 @@ impl HTMLMediaElementMethods for HTMLMediaElement {
|
|||
self.paused.get()
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-defaultplaybackrate
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-defaultplaybackrate>
|
||||
fn GetDefaultPlaybackRate(&self) -> Fallible<Finite<f64>> {
|
||||
Ok(Finite::wrap(self.defaultPlaybackRate.get()))
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-defaultplaybackrate
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-defaultplaybackrate>
|
||||
fn SetDefaultPlaybackRate(&self, value: Finite<f64>) -> ErrorResult {
|
||||
let min_allowed = -64.0;
|
||||
let max_allowed = 64.0;
|
||||
|
@ -2251,12 +2251,12 @@ impl HTMLMediaElementMethods for HTMLMediaElement {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-playbackrate
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-playbackrate>
|
||||
fn GetPlaybackRate(&self) -> Fallible<Finite<f64>> {
|
||||
Ok(Finite::wrap(self.playbackRate.get()))
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-playbackrate
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-playbackrate>
|
||||
fn SetPlaybackRate(&self, value: Finite<f64>) -> ErrorResult {
|
||||
let min_allowed = -64.0;
|
||||
let max_allowed = 64.0;
|
||||
|
|
|
@ -1073,7 +1073,7 @@ impl HTMLScriptElement {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
/// https://html.spec.whatwg.org/multipage/#run-a-module-script
|
||||
/// <https://html.spec.whatwg.org/multipage/#run-a-module-script>
|
||||
pub fn run_a_module_script(&self, script: &ScriptOrigin, _rethrow_errors: bool) {
|
||||
// TODO use a settings object rather than this element's document/window
|
||||
// Step 2
|
||||
|
|
|
@ -49,9 +49,9 @@ const DEFAULT_HEIGHT: u32 = 150;
|
|||
#[dom_struct]
|
||||
pub struct HTMLVideoElement {
|
||||
htmlmediaelement: HTMLMediaElement,
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-video-videowidth
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-video-videowidth>
|
||||
video_width: Cell<u32>,
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-video-videoheight
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-video-videoheight>
|
||||
video_height: Cell<u32>,
|
||||
/// Incremented whenever tasks associated with this element are cancelled.
|
||||
generation_id: Cell<u32>,
|
||||
|
@ -136,7 +136,7 @@ impl HTMLVideoElement {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#poster-frame
|
||||
/// <https://html.spec.whatwg.org/multipage/#poster-frame>
|
||||
fn fetch_poster_frame(&self, poster_url: &str) {
|
||||
// Step 1.
|
||||
let cancel_receiver = self.poster_frame_canceller.borrow_mut().initialize();
|
||||
|
@ -182,7 +182,7 @@ impl HTMLVideoElement {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#poster-frame
|
||||
/// <https://html.spec.whatwg.org/multipage/#poster-frame>
|
||||
fn do_fetch_poster_frame(
|
||||
&self,
|
||||
poster_url: ServoUrl,
|
||||
|
|
|
@ -55,22 +55,22 @@ impl MediaDeviceInfo {
|
|||
}
|
||||
|
||||
impl MediaDeviceInfoMethods for MediaDeviceInfo {
|
||||
/// https://w3c.github.io/mediacapture-main/#dom-mediadeviceinfo-deviceid
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediadeviceinfo-deviceid>
|
||||
fn DeviceId(&self) -> DOMString {
|
||||
self.device_id.clone()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediacapture-main/#dom-mediadeviceinfo-kind
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediadeviceinfo-kind>
|
||||
fn Kind(&self) -> MediaDeviceKind {
|
||||
self.kind
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediacapture-main/#dom-mediadeviceinfo-label
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediadeviceinfo-label>
|
||||
fn Label(&self) -> DOMString {
|
||||
self.label.clone()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediacapture-main/#dom-mediadeviceinfo-groupid
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediadeviceinfo-groupid>
|
||||
fn GroupId(&self) -> DOMString {
|
||||
self.group_id.clone()
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ impl MediaDevices {
|
|||
}
|
||||
|
||||
impl MediaDevicesMethods for MediaDevices {
|
||||
/// https://w3c.github.io/mediacapture-main/#dom-mediadevices-getusermedia
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediadevices-getusermedia>
|
||||
#[allow(unsafe_code)]
|
||||
fn GetUserMedia(&self, constraints: &MediaStreamConstraints, comp: InRealm) -> Rc<Promise> {
|
||||
let p = Promise::new_in_current_realm(comp);
|
||||
|
@ -67,7 +67,7 @@ impl MediaDevicesMethods for MediaDevices {
|
|||
p
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediacapture-main/#dom-mediadevices-enumeratedevices
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediadevices-enumeratedevices>
|
||||
fn EnumerateDevices(&self) -> Rc<Promise> {
|
||||
// Step 1.
|
||||
let in_realm_proof = AlreadyInRealm::assert();
|
||||
|
|
|
@ -83,7 +83,7 @@ impl MediaElementAudioSourceNode {
|
|||
}
|
||||
|
||||
impl MediaElementAudioSourceNodeMethods for MediaElementAudioSourceNode {
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-mediaelementaudiosourcenode-mediaelement
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-mediaelementaudiosourcenode-mediaelement>
|
||||
fn MediaElement(&self) -> DomRoot<HTMLMediaElement> {
|
||||
DomRoot::from_ref(&*self.media_element)
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ impl MediaMetadata {
|
|||
reflect_dom_object_with_proto(Box::new(MediaMetadata::new_inherited(init)), global, proto)
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediasession/#dom-mediametadata-mediametadata
|
||||
/// <https://w3c.github.io/mediasession/#dom-mediametadata-mediametadata>
|
||||
#[allow(non_snake_case)]
|
||||
pub fn Constructor(
|
||||
window: &Window,
|
||||
|
@ -70,34 +70,34 @@ impl MediaMetadata {
|
|||
}
|
||||
|
||||
impl MediaMetadataMethods for MediaMetadata {
|
||||
/// https://w3c.github.io/mediasession/#dom-mediametadata-title
|
||||
/// <https://w3c.github.io/mediasession/#dom-mediametadata-title>
|
||||
fn Title(&self) -> DOMString {
|
||||
self.title.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediasession/#dom-mediametadata-title
|
||||
/// <https://w3c.github.io/mediasession/#dom-mediametadata-title>
|
||||
fn SetTitle(&self, value: DOMString) {
|
||||
*self.title.borrow_mut() = value;
|
||||
self.queue_update_metadata_algorithm();
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediasession/#dom-mediametadata-artist
|
||||
/// <https://w3c.github.io/mediasession/#dom-mediametadata-artist>
|
||||
fn Artist(&self) -> DOMString {
|
||||
self.artist.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediasession/#dom-mediametadata-artist
|
||||
/// <https://w3c.github.io/mediasession/#dom-mediametadata-artist>
|
||||
fn SetArtist(&self, value: DOMString) {
|
||||
*self.artist.borrow_mut() = value;
|
||||
self.queue_update_metadata_algorithm();
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediasession/#dom-mediametadata-album
|
||||
/// <https://w3c.github.io/mediasession/#dom-mediametadata-album>
|
||||
fn Album(&self) -> DOMString {
|
||||
self.album.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediasession/#dom-mediametadata-album
|
||||
/// <https://w3c.github.io/mediasession/#dom-mediametadata-album>
|
||||
fn SetAlbum(&self, value: DOMString) {
|
||||
*self.album.borrow_mut() = value;
|
||||
self.queue_update_metadata_algorithm();
|
||||
|
|
|
@ -32,13 +32,13 @@ use crate::realms::{enter_realm, InRealm};
|
|||
#[dom_struct]
|
||||
pub struct MediaSession {
|
||||
reflector_: Reflector,
|
||||
/// https://w3c.github.io/mediasession/#dom-mediasession-metadata
|
||||
/// <https://w3c.github.io/mediasession/#dom-mediasession-metadata>
|
||||
#[ignore_malloc_size_of = "defined in embedder_traits"]
|
||||
#[no_trace]
|
||||
metadata: DomRefCell<Option<EmbedderMediaMetadata>>,
|
||||
/// https://w3c.github.io/mediasession/#dom-mediasession-playbackstate
|
||||
/// <https://w3c.github.io/mediasession/#dom-mediasession-playbackstate>
|
||||
playback_state: DomRefCell<MediaSessionPlaybackState>,
|
||||
/// https://w3c.github.io/mediasession/#supported-media-session-actions
|
||||
/// <https://w3c.github.io/mediasession/#supported-media-session-actions>
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
action_handlers:
|
||||
DomRefCell<HashMapTracedValues<MediaSessionActionType, Rc<MediaSessionActionHandler>>>,
|
||||
|
@ -125,7 +125,7 @@ impl 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>> {
|
||||
if let Some(ref metadata) = *self.metadata.borrow() {
|
||||
let mut init = MediaMetadataInit::empty();
|
||||
|
@ -139,7 +139,7 @@ impl MediaSessionMethods for MediaSession {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediasession/#dom-mediasession-metadata
|
||||
/// <https://w3c.github.io/mediasession/#dom-mediasession-metadata>
|
||||
fn SetMetadata(&self, metadata: Option<&MediaMetadata>) {
|
||||
if let Some(ref metadata) = metadata {
|
||||
metadata.set_session(self);
|
||||
|
@ -168,17 +168,17 @@ impl MediaSessionMethods for MediaSession {
|
|||
self.send_event(MediaSessionEvent::SetMetadata(_metadata));
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediasession/#dom-mediasession-playbackstate
|
||||
/// <https://w3c.github.io/mediasession/#dom-mediasession-playbackstate>
|
||||
fn PlaybackState(&self) -> MediaSessionPlaybackState {
|
||||
*self.playback_state.borrow()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediasession/#dom-mediasession-playbackstate
|
||||
/// <https://w3c.github.io/mediasession/#dom-mediasession-playbackstate>
|
||||
fn SetPlaybackState(&self, state: MediaSessionPlaybackState) {
|
||||
*self.playback_state.borrow_mut() = state;
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediasession/#update-action-handler-algorithm
|
||||
/// <https://w3c.github.io/mediasession/#update-action-handler-algorithm>
|
||||
fn SetActionHandler(
|
||||
&self,
|
||||
action: MediaSessionAction,
|
||||
|
@ -193,7 +193,7 @@ impl MediaSessionMethods for MediaSession {
|
|||
};
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediasession/#dom-mediasession-setpositionstate
|
||||
/// <https://w3c.github.io/mediasession/#dom-mediasession-setpositionstate>
|
||||
fn SetPositionState(&self, state: &MediaPositionState) -> Fallible<()> {
|
||||
// If the state is an empty dictionary then clear the position state.
|
||||
if state.duration.is_none() && state.position.is_none() && state.playbackRate.is_none() {
|
||||
|
|
|
@ -91,7 +91,7 @@ impl MediaStream {
|
|||
}
|
||||
|
||||
impl MediaStreamMethods for MediaStream {
|
||||
/// https://w3c.github.io/mediacapture-main/#dom-mediastream-gettracks
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediastream-gettracks>
|
||||
fn GetTracks(&self) -> Vec<DomRoot<MediaStreamTrack>> {
|
||||
self.tracks
|
||||
.borrow()
|
||||
|
@ -100,7 +100,7 @@ impl MediaStreamMethods for MediaStream {
|
|||
.collect()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediacapture-main/#dom-mediastream-getaudiotracks
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediastream-getaudiotracks>
|
||||
fn GetAudioTracks(&self) -> Vec<DomRoot<MediaStreamTrack>> {
|
||||
self.tracks
|
||||
.borrow()
|
||||
|
@ -110,7 +110,7 @@ impl MediaStreamMethods for MediaStream {
|
|||
.collect()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediacapture-main/#dom-mediastream-getvideotracks
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediastream-getvideotracks>
|
||||
fn GetVideoTracks(&self) -> Vec<DomRoot<MediaStreamTrack>> {
|
||||
self.tracks
|
||||
.borrow()
|
||||
|
@ -120,7 +120,7 @@ impl MediaStreamMethods for MediaStream {
|
|||
.collect()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediacapture-main/#dom-mediastream-gettrackbyid
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediastream-gettrackbyid>
|
||||
fn GetTrackById(&self, id: DOMString) -> Option<DomRoot<MediaStreamTrack>> {
|
||||
self.tracks
|
||||
.borrow()
|
||||
|
@ -129,7 +129,7 @@ impl MediaStreamMethods for MediaStream {
|
|||
.map(|x| DomRoot::from_ref(&**x))
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediacapture-main/#dom-mediastream-addtrack
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediastream-addtrack>
|
||||
fn AddTrack(&self, track: &MediaStreamTrack) {
|
||||
let existing = self.tracks.borrow().iter().find(|x| *x == &track).is_some();
|
||||
|
||||
|
@ -139,12 +139,12 @@ impl MediaStreamMethods for MediaStream {
|
|||
self.add_track(track)
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediacapture-main/#dom-mediastream-removetrack
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediastream-removetrack>
|
||||
fn RemoveTrack(&self, track: &MediaStreamTrack) {
|
||||
self.tracks.borrow_mut().retain(|x| *x != track);
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediacapture-main/#dom-mediastream-clone
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediastream-clone>
|
||||
fn Clone(&self) -> DomRoot<MediaStream> {
|
||||
self.clone_with_proto(None)
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ impl MediaStreamAudioDestinationNode {
|
|||
}
|
||||
|
||||
impl MediaStreamAudioDestinationNodeMethods for MediaStreamAudioDestinationNode {
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-mediastreamaudiodestinationnode-stream
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-mediastreamaudiodestinationnode-stream>
|
||||
fn Stream(&self) -> DomRoot<MediaStream> {
|
||||
DomRoot::from_ref(&self.stream)
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ impl MediaStreamAudioSourceNode {
|
|||
}
|
||||
|
||||
impl MediaStreamAudioSourceNodeMethods for MediaStreamAudioSourceNode {
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-MediaStreamAudioSourceNode-stream
|
||||
/// <https://webaudio.github.io/web-audio-api/#dom-MediaStreamAudioSourceNode-stream>
|
||||
fn MediaStream(&self) -> DomRoot<MediaStream> {
|
||||
DomRoot::from_ref(&self.stream)
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ impl MediaStreamTrack {
|
|||
}
|
||||
|
||||
impl MediaStreamTrackMethods for MediaStreamTrack {
|
||||
/// https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack-kind
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack-kind>
|
||||
fn Kind(&self) -> DOMString {
|
||||
match self.ty {
|
||||
MediaStreamType::Video => "video".into(),
|
||||
|
@ -59,12 +59,12 @@ impl MediaStreamTrackMethods for MediaStreamTrack {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack-id
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack-id>
|
||||
fn Id(&self) -> DOMString {
|
||||
self.id.id().to_string().into()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack-clone
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack-clone>
|
||||
fn Clone(&self) -> DomRoot<MediaStreamTrack> {
|
||||
MediaStreamTrack::new(&self.global(), self.id, self.ty)
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ impl Transferable for MessagePort {
|
|||
Ok(u64::from_ne_bytes(big))
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#message-ports:transfer-receiving-steps
|
||||
/// <https://html.spec.whatwg.org/multipage/#message-ports:transfer-receiving-steps>
|
||||
fn transfer_receive(
|
||||
owner: &GlobalScope,
|
||||
sc_holder: &mut StructuredDataHolder,
|
||||
|
|
|
@ -351,14 +351,14 @@ impl MutationObserverMethods for MutationObserver {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#dom-mutationobserver-takerecords
|
||||
/// <https://dom.spec.whatwg.org/#dom-mutationobserver-takerecords>
|
||||
fn TakeRecords(&self) -> Vec<DomRoot<MutationRecord>> {
|
||||
let records: Vec<DomRoot<MutationRecord>> = self.record_queue.borrow().clone();
|
||||
self.record_queue.borrow_mut().clear();
|
||||
records
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#dom-mutationobserver-disconnect
|
||||
/// <https://dom.spec.whatwg.org/#dom-mutationobserver-disconnect>
|
||||
fn Disconnect(&self) {
|
||||
// Step 1
|
||||
let mut nodes = self.node_list.borrow_mut();
|
||||
|
|
|
@ -174,19 +174,19 @@ impl NavigatorMethods for Navigator {
|
|||
.or_init(|| Permissions::new(&self.global()))
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-navigator-xr
|
||||
/// <https://immersive-web.github.io/webxr/#dom-navigator-xr>
|
||||
fn Xr(&self) -> DomRoot<XRSystem> {
|
||||
self.xr
|
||||
.or_init(|| XRSystem::new(&self.global().as_window()))
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediacapture-main/#dom-navigator-mediadevices
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-navigator-mediadevices>
|
||||
fn MediaDevices(&self) -> DomRoot<MediaDevices> {
|
||||
self.mediadevices
|
||||
.or_init(|| MediaDevices::new(&self.global()))
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediasession/#dom-navigator-mediasession
|
||||
/// <https://w3c.github.io/mediasession/#dom-navigator-mediasession>
|
||||
fn MediaSession(&self) -> DomRoot<MediaSession> {
|
||||
self.mediasession.or_init(|| {
|
||||
// There is a single MediaSession instance per Pipeline
|
||||
|
|
|
@ -1017,7 +1017,7 @@ impl Node {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-ancestor
|
||||
/// <https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-ancestor>
|
||||
pub fn inclusive_ancestors(
|
||||
&self,
|
||||
shadow_including: ShadowIncluding,
|
||||
|
@ -1231,7 +1231,7 @@ impl Node {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#retarget
|
||||
/// <https://dom.spec.whatwg.org/#retarget>
|
||||
pub fn retarget(&self, b: &Node) -> DomRoot<Node> {
|
||||
let mut a = DomRoot::from_ref(&*self);
|
||||
loop {
|
||||
|
|
|
@ -57,7 +57,7 @@ const INVALID_ENTRY_NAMES: &'static [&'static str] = &[
|
|||
/// Performance and PerformanceObserverEntryList interfaces implementations.
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub struct PerformanceEntryList {
|
||||
/// https://w3c.github.io/performance-timeline/#dfn-performance-entry-buffer
|
||||
/// <https://w3c.github.io/performance-timeline/#dfn-performance-entry-buffer>
|
||||
entries: DOMPerformanceEntryList,
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ pub struct Performance {
|
|||
observers: DomRefCell<Vec<PerformanceObserver>>,
|
||||
pending_notification_observers_task: Cell<bool>,
|
||||
navigation_start_precise: u64,
|
||||
/// https://w3c.github.io/performance-timeline/#dfn-maxbuffersize
|
||||
/// <https://w3c.github.io/performance-timeline/#dfn-maxbuffersize>
|
||||
/// The max-size of the buffer, set to 0 once the pipeline exits.
|
||||
/// TODO: have one max-size per entry type.
|
||||
resource_timing_buffer_size_limit: Cell<usize>,
|
||||
|
@ -372,7 +372,7 @@ impl Performance {
|
|||
self.resource_timing_buffer_pending_full_event.set(false);
|
||||
}
|
||||
/// `add a PerformanceResourceTiming entry` paragraph of
|
||||
/// https://w3c.github.io/resource-timing/#sec-extensions-performance-interface
|
||||
/// <https://w3c.github.io/resource-timing/#sec-extensions-performance-interface>
|
||||
fn should_queue_resource_entry(&self, entry: &PerformanceEntry) -> bool {
|
||||
// Step 1 is done in the args list.
|
||||
if !self.resource_timing_buffer_pending_full_event.get() {
|
||||
|
|
|
@ -35,7 +35,7 @@ pub struct NodeRareData {
|
|||
#[derive(Default, JSTraceable, MallocSizeOf)]
|
||||
#[crown::unrooted_must_root_lint::must_root]
|
||||
pub struct ElementRareData {
|
||||
/// https://dom.spec.whatwg.org/#dom-element-shadowroot
|
||||
/// <https://dom.spec.whatwg.org/#dom-element-shadowroot>
|
||||
/// The ShadowRoot this element is host of.
|
||||
/// XXX This is currently not exposed to web content. Only for
|
||||
/// internal use.
|
||||
|
|
|
@ -47,7 +47,7 @@ pub struct Response {
|
|||
url: DomRefCell<Option<ServoUrl>>,
|
||||
#[no_trace]
|
||||
url_list: DomRefCell<Vec<ServoUrl>>,
|
||||
/// The stream of https://fetch.spec.whatwg.org/#body.
|
||||
/// The stream of <https://fetch.spec.whatwg.org/#body>.
|
||||
body_stream: MutNullableDom<ReadableStream>,
|
||||
#[ignore_malloc_size_of = "StreamConsumer"]
|
||||
stream_consumer: DomRefCell<Option<StreamConsumer>>,
|
||||
|
|
|
@ -100,27 +100,27 @@ impl RTCIceCandidate {
|
|||
}
|
||||
|
||||
impl RTCIceCandidateMethods for RTCIceCandidate {
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-candidate
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-candidate>
|
||||
fn Candidate(&self) -> DOMString {
|
||||
self.candidate.clone()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-sdpmid
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-sdpmid>
|
||||
fn GetSdpMid(&self) -> Option<DOMString> {
|
||||
self.sdp_m_id.clone()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-sdpmlineindex
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-sdpmlineindex>
|
||||
fn GetSdpMLineIndex(&self) -> Option<u16> {
|
||||
self.sdp_m_line_index.clone()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-usernamefragment
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-usernamefragment>
|
||||
fn GetUsernameFragment(&self) -> Option<DOMString> {
|
||||
self.username_fragment.clone()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-tojson
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-tojson>
|
||||
fn ToJSON(&self) -> RTCIceCandidateInit {
|
||||
RTCIceCandidateInit {
|
||||
candidate: self.candidate.clone(),
|
||||
|
|
|
@ -360,7 +360,7 @@ impl RTCPeerConnection {
|
|||
self.data_channels.borrow_mut().remove(&id);
|
||||
}
|
||||
|
||||
/// https://www.w3.org/TR/webrtc/#update-ice-gathering-state
|
||||
/// <https://www.w3.org/TR/webrtc/#update-ice-gathering-state>
|
||||
fn update_gathering_state(&self, state: GatheringState) {
|
||||
// step 1
|
||||
if self.closed.get() {
|
||||
|
@ -400,7 +400,7 @@ impl RTCPeerConnection {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://www.w3.org/TR/webrtc/#update-ice-connection-state
|
||||
/// <https://www.w3.org/TR/webrtc/#update-ice-connection-state>
|
||||
fn update_ice_connection_state(&self, state: IceConnectionState) {
|
||||
// step 1
|
||||
if self.closed.get() {
|
||||
|
@ -553,7 +553,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
|
|||
// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-ondatachannel
|
||||
event_handler!(datachannel, GetOndatachannel, SetOndatachannel);
|
||||
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addicecandidate
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addicecandidate>
|
||||
fn AddIceCandidate(&self, candidate: &RTCIceCandidateInit, comp: InRealm) -> Rc<Promise> {
|
||||
let p = Promise::new_in_current_realm(comp);
|
||||
if candidate.sdpMid.is_none() && candidate.sdpMLineIndex.is_none() {
|
||||
|
@ -588,7 +588,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
|
|||
p
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-createoffer
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-createoffer>
|
||||
fn CreateOffer(&self, _options: &RTCOfferOptions, comp: InRealm) -> Rc<Promise> {
|
||||
let p = Promise::new_in_current_realm(comp);
|
||||
if self.closed.get() {
|
||||
|
@ -600,7 +600,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
|
|||
p
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-createoffer
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-createoffer>
|
||||
fn CreateAnswer(&self, _options: &RTCAnswerOptions, comp: InRealm) -> Rc<Promise> {
|
||||
let p = Promise::new_in_current_realm(comp);
|
||||
if self.closed.get() {
|
||||
|
@ -612,17 +612,17 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
|
|||
p
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-localdescription
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-localdescription>
|
||||
fn GetLocalDescription(&self) -> Option<DomRoot<RTCSessionDescription>> {
|
||||
self.local_description.get()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-remotedescription
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-remotedescription>
|
||||
fn GetRemoteDescription(&self) -> Option<DomRoot<RTCSessionDescription>> {
|
||||
self.remote_description.get()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-setlocaldescription
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-setlocaldescription>
|
||||
fn SetLocalDescription(&self, desc: &RTCSessionDescriptionInit, comp: InRealm) -> Rc<Promise> {
|
||||
// XXXManishearth validate the current state
|
||||
let p = Promise::new_in_current_realm(comp);
|
||||
|
@ -662,7 +662,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
|
|||
p
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-setremotedescription
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-setremotedescription>
|
||||
fn SetRemoteDescription(&self, desc: &RTCSessionDescriptionInit, comp: InRealm) -> Rc<Promise> {
|
||||
// XXXManishearth validate the current state
|
||||
let p = Promise::new_in_current_realm(comp);
|
||||
|
@ -713,22 +713,22 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-icegatheringstate
|
||||
/// <https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-icegatheringstate>
|
||||
fn IceGatheringState(&self) -> RTCIceGatheringState {
|
||||
self.gathering_state.get()
|
||||
}
|
||||
|
||||
/// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-iceconnectionstate
|
||||
/// <https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-iceconnectionstate>
|
||||
fn IceConnectionState(&self) -> RTCIceConnectionState {
|
||||
self.ice_connection_state.get()
|
||||
}
|
||||
|
||||
/// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-signalingstate
|
||||
/// <https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-signalingstate>
|
||||
fn SignalingState(&self) -> RTCSignalingState {
|
||||
self.signaling_state.get()
|
||||
}
|
||||
|
||||
/// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-close
|
||||
/// <https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-close>
|
||||
fn Close(&self) {
|
||||
// Step 1
|
||||
if self.closed.get() {
|
||||
|
@ -758,7 +758,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
|
|||
// (no current support for connection state)
|
||||
}
|
||||
|
||||
/// https://www.w3.org/TR/webrtc/#dom-peerconnection-createdatachannel
|
||||
/// <https://www.w3.org/TR/webrtc/#dom-peerconnection-createdatachannel>
|
||||
fn CreateDataChannel(
|
||||
&self,
|
||||
label: USVString,
|
||||
|
@ -767,7 +767,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
|
|||
RTCDataChannel::new(&self.global(), &self, label, init, None)
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addtransceiver
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addtransceiver>
|
||||
fn AddTransceiver(
|
||||
&self,
|
||||
_track_or_kind: MediaStreamTrackOrString,
|
||||
|
|
|
@ -90,17 +90,17 @@ impl RTCPeerConnectionIceEvent {
|
|||
}
|
||||
|
||||
impl RTCPeerConnectionIceEventMethods for RTCPeerConnectionIceEvent {
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnectioniceevent-candidate
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnectioniceevent-candidate>
|
||||
fn GetCandidate(&self) -> Option<DomRoot<RTCIceCandidate>> {
|
||||
self.candidate.as_ref().map(|x| DomRoot::from_ref(&**x))
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnectioniceevent-url
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnectioniceevent-url>
|
||||
fn GetUrl(&self) -> Option<DOMString> {
|
||||
self.url.clone()
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#dom-event-istrusted
|
||||
/// <https://dom.spec.whatwg.org/#dom-event-istrusted>
|
||||
fn IsTrusted(&self) -> bool {
|
||||
self.event.IsTrusted()
|
||||
}
|
||||
|
|
|
@ -40,17 +40,17 @@ impl RTCRtpTransceiver {
|
|||
}
|
||||
|
||||
impl RTCRtpTransceiverMethods for RTCRtpTransceiver {
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction>
|
||||
fn Direction(&self) -> RTCRtpTransceiverDirection {
|
||||
self.direction.get()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction>
|
||||
fn SetDirection(&self, direction: RTCRtpTransceiverDirection) {
|
||||
self.direction.set(direction);
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-sender
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-sender>
|
||||
fn Sender(&self) -> DomRoot<RTCRtpSender> {
|
||||
DomRoot::from_ref(&*self.sender)
|
||||
}
|
||||
|
|
|
@ -60,12 +60,12 @@ impl RTCSessionDescription {
|
|||
}
|
||||
|
||||
impl RTCSessionDescriptionMethods for RTCSessionDescription {
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcsessiondescription-type
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcsessiondescription-type>
|
||||
fn Type(&self) -> RTCSdpType {
|
||||
self.ty
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/webrtc-pc/#dom-rtcsessiondescription-sdp
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcsessiondescription-sdp>
|
||||
fn Sdp(&self) -> DOMString {
|
||||
self.sdp.clone()
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ impl ServiceWorker {
|
|||
ServoUrl::parse(&self.script_url.borrow().clone()).unwrap()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/ServiceWorker/#service-worker-postmessage
|
||||
/// <https://w3c.github.io/ServiceWorker/#service-worker-postmessage>
|
||||
fn post_message_impl(
|
||||
&self,
|
||||
cx: JSContext,
|
||||
|
@ -129,7 +129,7 @@ impl ServiceWorkerMethods for ServiceWorker {
|
|||
USVString(self.script_url.borrow().clone())
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/ServiceWorker/#service-worker-postmessage
|
||||
/// <https://w3c.github.io/ServiceWorker/#service-worker-postmessage>
|
||||
fn PostMessage(
|
||||
&self,
|
||||
cx: JSContext,
|
||||
|
@ -139,7 +139,7 @@ impl ServiceWorkerMethods for ServiceWorker {
|
|||
self.post_message_impl(cx, message, transfer)
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/ServiceWorker/#service-worker-postmessage
|
||||
/// <https://w3c.github.io/ServiceWorker/#service-worker-postmessage>
|
||||
fn PostMessage_(
|
||||
&self,
|
||||
cx: JSContext,
|
||||
|
|
|
@ -59,8 +59,8 @@ impl ServiceWorkerContainerMethods for ServiceWorkerContainer {
|
|||
self.client.get_controller()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/ServiceWorker/#dom-serviceworkercontainer-register - A
|
||||
/// and https://w3c.github.io/ServiceWorker/#start-register - B
|
||||
/// <https://w3c.github.io/ServiceWorker/#dom-serviceworkercontainer-register> - A
|
||||
/// and <https://w3c.github.io/ServiceWorker/#start-register> - B
|
||||
fn Register(
|
||||
&self,
|
||||
script_url: USVString,
|
||||
|
|
|
@ -880,7 +880,7 @@ impl TreeSink for Sink {
|
|||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#html-integration-point>
|
||||
/// Specifically, the <annotation-xml> cases.
|
||||
/// Specifically, the `<annotation-xml>` cases.
|
||||
fn is_mathml_annotation_xml_integration_point(&self, handle: &Self::Handle) -> bool {
|
||||
let node_data = self.get_parse_node_data(&handle.id);
|
||||
node_data.is_integration_point
|
||||
|
|
|
@ -339,7 +339,7 @@ impl ServoParser {
|
|||
self.script_created_parser || self.script_nesting_level.get() > 0
|
||||
}
|
||||
|
||||
/// Steps 6-8 of https://html.spec.whatwg.org/multipage/#document.write()
|
||||
/// Steps 6-8 of <https://html.spec.whatwg.org/multipage/#document.write()>
|
||||
pub fn write(&self, text: Vec<DOMString>) {
|
||||
assert!(self.can_write());
|
||||
|
||||
|
@ -1301,7 +1301,7 @@ impl TreeSink for Sink {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#create-an-element-for-the-token
|
||||
/// <https://html.spec.whatwg.org/multipage/#create-an-element-for-the-token>
|
||||
fn create_element_for_token(
|
||||
name: QualName,
|
||||
attrs: Vec<ElementAttribute>,
|
||||
|
|
|
@ -217,12 +217,12 @@ impl ShadowRootMethods for ShadowRoot {
|
|||
elements
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#dom-shadowroot-mode
|
||||
/// <https://dom.spec.whatwg.org/#dom-shadowroot-mode>
|
||||
fn Mode(&self) -> ShadowRootMode {
|
||||
ShadowRootMode::Closed
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#dom-shadowroot-host
|
||||
/// <https://dom.spec.whatwg.org/#dom-shadowroot-host>
|
||||
fn Host(&self) -> DomRoot<Element> {
|
||||
let host = self.host.get();
|
||||
host.expect("Trying to get host from a detached shadow root")
|
||||
|
|
|
@ -87,7 +87,7 @@ impl SubmitEventMethods for SubmitEvent {
|
|||
self.event.IsTrusted()
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-submitevent-submitter
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-submitevent-submitter>
|
||||
fn GetSubmitter(&self) -> Option<DomRoot<HTMLElement>> {
|
||||
self.submitter.as_ref().map(|s| DomRoot::from_ref(&**s))
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//! This is an abstraction used by `HTMLInputElement` and `HTMLTextAreaElement` to implement the
|
||||
//! text control selection DOM API.
|
||||
//!
|
||||
//! https://html.spec.whatwg.org/multipage/#textFieldSelection
|
||||
//! <https://html.spec.whatwg.org/multipage/#textFieldSelection>
|
||||
|
||||
use script_traits::ScriptToConstellationChan;
|
||||
|
||||
|
|
|
@ -97,62 +97,62 @@ impl TextMetrics {
|
|||
}
|
||||
|
||||
impl TextMetricsMethods for TextMetrics {
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-textmetrics-width
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-textmetrics-width>
|
||||
fn Width(&self) -> Finite<f64> {
|
||||
self.width
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-textmetrics-actualboundingboxleft
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-textmetrics-actualboundingboxleft>
|
||||
fn ActualBoundingBoxLeft(&self) -> Finite<f64> {
|
||||
self.actualBoundingBoxLeft
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-textmetrics-actualboundingboxright
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-textmetrics-actualboundingboxright>
|
||||
fn ActualBoundingBoxRight(&self) -> Finite<f64> {
|
||||
self.actualBoundingBoxRight
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-textmetrics-fontboundingboxascent
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-textmetrics-fontboundingboxascent>
|
||||
fn FontBoundingBoxAscent(&self) -> Finite<f64> {
|
||||
self.fontBoundingBoxAscent
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-textmetrics-fontboundingboxascent
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-textmetrics-fontboundingboxascent>
|
||||
fn FontBoundingBoxDescent(&self) -> Finite<f64> {
|
||||
self.fontBoundingBoxDescent
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-textmetrics-actualboundingboxascent
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-textmetrics-actualboundingboxascent>
|
||||
fn ActualBoundingBoxAscent(&self) -> Finite<f64> {
|
||||
self.actualBoundingBoxAscent
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-textmetrics-actualboundingboxdescent
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-textmetrics-actualboundingboxdescent>
|
||||
fn ActualBoundingBoxDescent(&self) -> Finite<f64> {
|
||||
self.actualBoundingBoxDescent
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-textmetrics-emheightascent
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-textmetrics-emheightascent>
|
||||
fn EmHeightAscent(&self) -> Finite<f64> {
|
||||
self.emHeightAscent
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-textmetrics-emheightdescent
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-textmetrics-emheightdescent>
|
||||
fn EmHeightDescent(&self) -> Finite<f64> {
|
||||
self.emHeightDescent
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-textmetrics-hangingbaseline
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-textmetrics-hangingbaseline>
|
||||
fn HangingBaseline(&self) -> Finite<f64> {
|
||||
self.hangingBaseline
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-textmetrics-alphabeticbaseline
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-textmetrics-alphabeticbaseline>
|
||||
fn AlphabeticBaseline(&self) -> Finite<f64> {
|
||||
self.alphabeticBaseline
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-textmetrics-ideographicbaseline
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-textmetrics-ideographicbaseline>
|
||||
fn IdeographicBaseline(&self) -> Finite<f64> {
|
||||
self.ideographicBaseline
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -37,7 +37,7 @@ pub struct TypedWebGLExtensionWrapper<T: WebGLExtension> {
|
|||
}
|
||||
|
||||
/// Typed WebGL Extension implementation.
|
||||
/// Exposes the exact MutNullableDom<DOMObject> type defined by the extension.
|
||||
/// Exposes the exact `MutNullableDom<DOMObject>` type defined by the extension.
|
||||
impl<T: WebGLExtension> TypedWebGLExtensionWrapper<T> {
|
||||
pub fn new() -> TypedWebGLExtensionWrapper<T> {
|
||||
TypedWebGLExtensionWrapper {
|
||||
|
|
|
@ -32,7 +32,7 @@ pub struct WebGLBuffer {
|
|||
capacity: Cell<usize>,
|
||||
marked_for_deletion: Cell<bool>,
|
||||
attached_counter: Cell<u32>,
|
||||
/// https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glGetBufferParameteriv.xml
|
||||
/// <https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glGetBufferParameteriv.xml>
|
||||
usage: Cell<u32>,
|
||||
}
|
||||
|
||||
|
|
|
@ -4656,13 +4656,13 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
};
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
||||
/// <https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9>
|
||||
fn GetAttachedShaders(&self, program: &WebGLProgram) -> Option<Vec<DomRoot<WebGLShader>>> {
|
||||
handle_potential_webgl_error!(self, self.validate_ownership(program), return None);
|
||||
handle_potential_webgl_error!(self, program.attached_shaders().map(Some), None)
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-webglrenderingcontextbase-makexrcompatible
|
||||
/// <https://immersive-web.github.io/webxr/#dom-webglrenderingcontextbase-makexrcompatible>
|
||||
fn MakeXRCompatible(&self) -> Rc<Promise> {
|
||||
// XXXManishearth Fill in with compatibility checks when rust-webxr supports this
|
||||
let p = Promise::new(&self.global());
|
||||
|
|
|
@ -280,8 +280,7 @@ impl WebGLTexture {
|
|||
}
|
||||
|
||||
/// We have to follow the conversion rules for GLES 2.0. See:
|
||||
/// https://www.khronos.org/webgl/public-mailing-list/archives/1008/msg00014.html
|
||||
///
|
||||
/// <https://www.khronos.org/webgl/public-mailing-list/archives/1008/msg00014.html>
|
||||
pub fn tex_parameter(&self, param: u32, value: TexParameterValue) -> WebGLResult<()> {
|
||||
let target = self.target().unwrap();
|
||||
|
||||
|
|
|
@ -374,7 +374,7 @@ pub struct Window {
|
|||
#[ignore_malloc_size_of = "Rc is hard"]
|
||||
layout_marker: DomRefCell<Rc<Cell<bool>>>,
|
||||
|
||||
/// https://dom.spec.whatwg.org/#window-current-event
|
||||
/// <https://dom.spec.whatwg.org/#window-current-event>
|
||||
current_event: DomRefCell<Option<Dom<Event>>>,
|
||||
}
|
||||
|
||||
|
@ -404,7 +404,7 @@ impl Window {
|
|||
}
|
||||
|
||||
/// A convenience method for
|
||||
/// https://html.spec.whatwg.org/multipage/#a-browsing-context-is-discarded
|
||||
/// <https://html.spec.whatwg.org/multipage/#a-browsing-context-is-discarded>
|
||||
pub fn discard_browsing_context(&self) {
|
||||
let proxy = match self.window_proxy.get() {
|
||||
Some(proxy) => proxy,
|
||||
|
@ -1593,7 +1593,7 @@ impl Window {
|
|||
current
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#window-post-message-steps
|
||||
/// <https://html.spec.whatwg.org/multipage/#window-post-message-steps>
|
||||
fn post_message_impl(
|
||||
&self,
|
||||
target_origin: &USVString,
|
||||
|
@ -2212,7 +2212,7 @@ impl Window {
|
|||
|
||||
/// Commence a new URL load which will either replace this window or scroll to a fragment.
|
||||
///
|
||||
/// https://html.spec.whatwg.org/multipage/#navigating-across-documents
|
||||
/// <https://html.spec.whatwg.org/multipage/#navigating-across-documents>
|
||||
pub fn load_url(
|
||||
&self,
|
||||
replace: HistoryEntryReplacement,
|
||||
|
|
|
@ -100,7 +100,7 @@ pub struct WindowProxy {
|
|||
/// Has the browsing context been disowned?
|
||||
disowned: Cell<bool>,
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#is-closing
|
||||
/// <https://html.spec.whatwg.org/multipage/#is-closing>
|
||||
is_closing: Cell<bool>,
|
||||
|
||||
/// The containing iframe element, if this is a same-origin iframe
|
||||
|
@ -109,7 +109,7 @@ pub struct WindowProxy {
|
|||
/// The parent browsing context's window proxy, if this is a nested browsing context
|
||||
parent: Option<Dom<WindowProxy>>,
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#delaying-load-events-mode
|
||||
/// <https://html.spec.whatwg.org/multipage/#delaying-load-events-mode>
|
||||
delaying_load_events_mode: Cell<bool>,
|
||||
|
||||
/// The creator browsing context's base url.
|
||||
|
@ -356,17 +356,17 @@ impl WindowProxy {
|
|||
None
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#delaying-load-events-mode
|
||||
/// <https://html.spec.whatwg.org/multipage/#delaying-load-events-mode>
|
||||
pub fn is_delaying_load_events_mode(&self) -> bool {
|
||||
self.delaying_load_events_mode.get()
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#delaying-load-events-mode
|
||||
/// <https://html.spec.whatwg.org/multipage/#delaying-load-events-mode>
|
||||
pub fn start_delaying_load_events_mode(&self) {
|
||||
self.delaying_load_events_mode.set(true);
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#delaying-load-events-mode
|
||||
/// <https://html.spec.whatwg.org/multipage/#delaying-load-events-mode>
|
||||
pub fn stop_delaying_load_events_mode(&self) {
|
||||
self.delaying_load_events_mode.set(false);
|
||||
if let Some(document) = self.document() {
|
||||
|
@ -381,18 +381,18 @@ impl WindowProxy {
|
|||
self.disowned.set(true);
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-window-close
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-window-close>
|
||||
/// Step 3.1, set BCs `is_closing` to true.
|
||||
pub fn close(&self) {
|
||||
self.is_closing.set(true);
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#is-closing
|
||||
/// <https://html.spec.whatwg.org/multipage/#is-closing>
|
||||
pub fn is_closing(&self) -> bool {
|
||||
self.is_closing.get()
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#creator-base-url
|
||||
/// <https://html.spec.whatwg.org/multipage/#creator-base-url>
|
||||
pub fn creator_base_url(&self) -> Option<ServoUrl> {
|
||||
self.creator_base_url.clone()
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ impl WindowProxy {
|
|||
self.creator_base_url.is_some()
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#creator-url
|
||||
/// <https://html.spec.whatwg.org/multipage/#creator-url>
|
||||
pub fn creator_url(&self) -> Option<ServoUrl> {
|
||||
self.creator_url.clone()
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ impl WindowProxy {
|
|||
self.creator_base_url.is_some()
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#creator-origin
|
||||
/// <https://html.spec.whatwg.org/multipage/#creator-origin>
|
||||
pub fn creator_origin(&self) -> Option<ImmutableOrigin> {
|
||||
self.creator_origin.clone()
|
||||
}
|
||||
|
@ -720,7 +720,7 @@ impl WindowProxy {
|
|||
/// active document of that creator browsing context at the time A was created is the creator
|
||||
/// Document.
|
||||
///
|
||||
/// See: https://html.spec.whatwg.org/multipage/#creating-browsing-contexts
|
||||
/// See: <https://html.spec.whatwg.org/multipage/#creating-browsing-contexts>
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct CreatorBrowsingContextInfo {
|
||||
/// Creator document URL.
|
||||
|
|
|
@ -204,7 +204,7 @@ impl Worker {
|
|||
worker.upcast().fire_event(atom!("error"));
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-dedicatedworkerglobalscope-postmessage
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-dedicatedworkerglobalscope-postmessage>
|
||||
fn post_message_impl(
|
||||
&self,
|
||||
cx: JSContext,
|
||||
|
@ -228,7 +228,7 @@ impl Worker {
|
|||
}
|
||||
|
||||
impl WorkerMethods for Worker {
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-worker-postmessage
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-worker-postmessage>
|
||||
fn PostMessage(
|
||||
&self,
|
||||
cx: JSContext,
|
||||
|
@ -238,7 +238,7 @@ impl WorkerMethods for Worker {
|
|||
self.post_message_impl(cx, message, transfer)
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-worker-postmessage
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-worker-postmessage>
|
||||
fn PostMessage_(
|
||||
&self,
|
||||
cx: JSContext,
|
||||
|
|
|
@ -49,12 +49,12 @@ impl XRFrame {
|
|||
reflect_dom_object(Box::new(XRFrame::new_inherited(session, data)), global)
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#xrframe-active
|
||||
/// <https://immersive-web.github.io/webxr/#xrframe-active>
|
||||
pub fn set_active(&self, active: bool) {
|
||||
self.active.set(active);
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#xrframe-animationframe
|
||||
/// <https://immersive-web.github.io/webxr/#xrframe-animationframe>
|
||||
pub fn set_animation_frame(&self, animation_frame: bool) {
|
||||
self.animation_frame.set(animation_frame);
|
||||
}
|
||||
|
@ -73,12 +73,12 @@ impl XRFrame {
|
|||
}
|
||||
|
||||
impl XRFrameMethods for XRFrame {
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrframe-session
|
||||
/// <https://immersive-web.github.io/webxr/#dom-xrframe-session>
|
||||
fn Session(&self) -> DomRoot<XRSession> {
|
||||
DomRoot::from_ref(&self.session)
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrframe-getviewerpose
|
||||
/// <https://immersive-web.github.io/webxr/#dom-xrframe-getviewerpose>
|
||||
fn GetViewerPose(
|
||||
&self,
|
||||
reference: &XRReferenceSpace,
|
||||
|
@ -109,7 +109,7 @@ impl XRFrameMethods for XRFrame {
|
|||
)))
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrframe-getpose
|
||||
/// <https://immersive-web.github.io/webxr/#dom-xrframe-getpose>
|
||||
fn GetPose(
|
||||
&self,
|
||||
space: &XRSpace,
|
||||
|
@ -135,7 +135,7 @@ impl XRFrameMethods for XRFrame {
|
|||
Ok(Some(XRPose::new(&self.global(), pose)))
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrframe-getpose
|
||||
/// <https://immersive-web.github.io/webxr/#dom-xrframe-getpose>
|
||||
fn GetJointPose(
|
||||
&self,
|
||||
space: &XRJointSpace,
|
||||
|
@ -167,7 +167,7 @@ impl XRFrameMethods for XRFrame {
|
|||
)))
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/hit-test/#dom-xrframe-gethittestresults
|
||||
/// <https://immersive-web.github.io/hit-test/#dom-xrframe-gethittestresults>
|
||||
fn GetHitTestResults(&self, source: &XRHitTestSource) -> Vec<DomRoot<XRHitTestResult>> {
|
||||
self.data
|
||||
.hit_test_results
|
||||
|
|
|
@ -41,12 +41,12 @@ impl XRHand {
|
|||
}
|
||||
|
||||
impl XRHandMethods for XRHand {
|
||||
/// https://github.com/immersive-web/webxr-hands-input/blob/master/explainer.md
|
||||
/// <https://github.com/immersive-web/webxr-hands-input/blob/master/explainer.md>
|
||||
fn Length(&self) -> i32 {
|
||||
XRHandConstants::LITTLE_PHALANX_TIP as i32 + 1
|
||||
}
|
||||
|
||||
/// https://github.com/immersive-web/webxr-hands-input/blob/master/explainer.md
|
||||
/// <https://github.com/immersive-web/webxr-hands-input/blob/master/explainer.md>
|
||||
fn IndexedGetter(&self, joint_index: u32) -> Option<DomRoot<XRJointSpace>> {
|
||||
let joint = match joint_index {
|
||||
XRHandConstants::WRIST => Joint::Wrist,
|
||||
|
|
|
@ -78,7 +78,7 @@ impl XRInputSource {
|
|||
}
|
||||
|
||||
impl XRInputSourceMethods for XRInputSource {
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrinputsource-handedness
|
||||
/// <https://immersive-web.github.io/webxr/#dom-xrinputsource-handedness>
|
||||
fn Handedness(&self) -> XRHandedness {
|
||||
match self.info.handedness {
|
||||
Handedness::None => XRHandedness::None,
|
||||
|
@ -87,7 +87,7 @@ impl XRInputSourceMethods for XRInputSource {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrinputsource-targetraymode
|
||||
/// <https://immersive-web.github.io/webxr/#dom-xrinputsource-targetraymode>
|
||||
fn TargetRayMode(&self) -> XRTargetRayMode {
|
||||
match self.info.target_ray_mode {
|
||||
TargetRayMode::Gaze => XRTargetRayMode::Gaze,
|
||||
|
@ -96,7 +96,7 @@ impl XRInputSourceMethods for XRInputSource {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrinputsource-targetrayspace
|
||||
/// <https://immersive-web.github.io/webxr/#dom-xrinputsource-targetrayspace>
|
||||
fn TargetRaySpace(&self) -> DomRoot<XRSpace> {
|
||||
self.target_ray_space.or_init(|| {
|
||||
let global = self.global();
|
||||
|
@ -104,7 +104,7 @@ impl XRInputSourceMethods for XRInputSource {
|
|||
})
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrinputsource-gripspace
|
||||
/// <https://immersive-web.github.io/webxr/#dom-xrinputsource-gripspace>
|
||||
fn GetGripSpace(&self) -> Option<DomRoot<XRSpace>> {
|
||||
if self.info.supports_grip {
|
||||
Some(self.grip_space.or_init(|| {
|
||||
|
|
|
@ -130,12 +130,12 @@ impl XRInputSourceArray {
|
|||
}
|
||||
|
||||
impl XRInputSourceArrayMethods for XRInputSourceArray {
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrinputsourcearray-length
|
||||
/// <https://immersive-web.github.io/webxr/#dom-xrinputsourcearray-length>
|
||||
fn Length(&self) -> u32 {
|
||||
self.input_sources.borrow().len() as u32
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#xrinputsourcearray
|
||||
/// <https://immersive-web.github.io/webxr/#xrinputsourcearray>
|
||||
fn IndexedGetter(&self, n: u32) -> Option<DomRoot<XRInputSource>> {
|
||||
self.input_sources
|
||||
.borrow()
|
||||
|
|
|
@ -42,7 +42,7 @@ impl XRJointPose {
|
|||
}
|
||||
|
||||
impl XRJointPoseMethods for XRJointPose {
|
||||
/// https://immersive-web.github.io/webxr/#dom-XRJointPose-views
|
||||
/// <https://immersive-web.github.io/webxr/#dom-XRJointPose-views>
|
||||
fn GetRadius(&self) -> Option<Finite<f32>> {
|
||||
self.radius.map(Finite::wrap)
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue