mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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
|
@ -2499,7 +2499,7 @@ impl WebGLImpl {
|
|||
|
||||
/// ANGLE adds a `_u` prefix to variable names:
|
||||
///
|
||||
/// https://chromium.googlesource.com/angle/angle/+/855d964bd0d05f6b2cb303f625506cf53d37e94f
|
||||
/// <https://chromium.googlesource.com/angle/angle/+/855d964bd0d05f6b2cb303f625506cf53d37e94f>
|
||||
///
|
||||
/// To avoid hard-coding this we would need to use the `sh::GetAttributes` and `sh::GetUniforms`
|
||||
/// API to look up the `x.name` and `x.mappedName` members.
|
||||
|
|
|
@ -120,7 +120,7 @@ pub struct Opts {
|
|||
|
||||
/// Whether or not to completely ignore SSL certificate validation errors.
|
||||
/// TODO: We should see if we can eliminate the need for this by fixing
|
||||
/// https://github.com/servo/servo/issues/30080.
|
||||
/// <https://github.com/servo/servo/issues/30080>.
|
||||
pub ignore_certificate_errors: bool,
|
||||
|
||||
/// Unminify Javascript.
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
//!
|
||||
//! * Anything (other than a routing thread) can block on a routing thread
|
||||
//!
|
||||
//! See https://github.com/servo/servo/issues/14704
|
||||
//! See <https://github.com/servo/servo/issues/14704>
|
||||
|
||||
use std::borrow::{Cow, ToOwned};
|
||||
use std::collections::hash_map::Entry;
|
||||
|
@ -237,7 +237,7 @@ struct Browser {
|
|||
|
||||
/// A browsing context group.
|
||||
///
|
||||
/// https://html.spec.whatwg.org/multipage/#browsing-context-group
|
||||
/// <https://html.spec.whatwg.org/multipage/#browsing-context-group>
|
||||
#[derive(Clone, Default)]
|
||||
struct BrowsingContextGroup {
|
||||
/// A browsing context group holds a set of top-level browsing contexts.
|
||||
|
@ -421,7 +421,7 @@ pub struct Constellation<Message, LTF, STF, SWF> {
|
|||
|
||||
/// A user agent holds a a set of browsing context groups.
|
||||
///
|
||||
/// https://html.spec.whatwg.org/multipage/#browsing-context-group-set
|
||||
/// <https://html.spec.whatwg.org/multipage/#browsing-context-group-set>
|
||||
browsing_context_group_set: HashMap<BrowsingContextGroupId, BrowsingContextGroup>,
|
||||
|
||||
/// The Id counter for BrowsingContextGroup.
|
||||
|
@ -1854,7 +1854,7 @@ where
|
|||
|
||||
/// Check the origin of a message against that of the pipeline it came from.
|
||||
/// Note: this is still limited as a security check,
|
||||
/// see https://github.com/servo/servo/issues/11722
|
||||
/// see <https://github.com/servo/servo/issues/11722>
|
||||
fn check_origin_against_pipeline(
|
||||
&self,
|
||||
pipeline_id: &PipelineId,
|
||||
|
|
|
@ -17,7 +17,7 @@ use style_traits::CSSPixel;
|
|||
use crate::browsingcontext::NewBrowsingContextInfo;
|
||||
|
||||
/// Represents the joint session history
|
||||
/// https://html.spec.whatwg.org/multipage/#joint-session-history
|
||||
/// <https://html.spec.whatwg.org/multipage/#joint-session-history>
|
||||
#[derive(Debug)]
|
||||
pub struct JointSessionHistory {
|
||||
/// Diffs used to traverse to past entries. Oldest entries are at the back,
|
||||
|
|
|
@ -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/. */
|
||||
|
||||
//! Liberally derived from the [Firefox JS implementation]
|
||||
//! (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webbrowser.js).
|
||||
//! Liberally derived from the [Firefox JS implementation](http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webbrowser.js).
|
||||
//! Connection point for remote devtools that wish to investigate a particular Browsing Context's contents.
|
||||
//! Supports dynamic attaching and detaching which control notifications of navigation, etc.
|
||||
|
||||
|
|
|
@ -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/. */
|
||||
|
||||
//! Liberally derived from the [Firefox JS implementation]
|
||||
//! (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webconsole.js).
|
||||
//! Liberally derived from the [Firefox JS implementation](http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webconsole.js).
|
||||
//! Mediates interaction between the remote web console and equivalent functionality (object
|
||||
//! inspection, JS evaluation, autocompletion) in Servo.
|
||||
|
||||
|
|
|
@ -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/. */
|
||||
|
||||
//! Liberally derived from the [Firefox JS implementation]
|
||||
//! (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/inspector.js).
|
||||
//! Liberally derived from the [Firefox JS implementation](http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/inspector.js).
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::net::TcpStream;
|
||||
|
|
|
@ -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/. */
|
||||
|
||||
//! Liberally derived from the [Firefox JS implementation]
|
||||
//! (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webconsole.js).
|
||||
//! Liberally derived from the [Firefox JS implementation](http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webconsole.js).
|
||||
//! Handles interaction with the remote web console on network events (HTTP requests, responses) in Servo.
|
||||
|
||||
use std::net::TcpStream;
|
||||
|
|
|
@ -101,7 +101,7 @@ struct FramerateEmitterReply {
|
|||
/// HighResolutionStamp is struct that contains duration in milliseconds
|
||||
/// with accuracy to microsecond that shows how much time has passed since
|
||||
/// actor registry inited
|
||||
/// analog https://w3c.github.io/hr-time/#sec-DOMHighResTimeStamp
|
||||
/// analog <https://w3c.github.io/hr-time/#sec-DOMHighResTimeStamp>
|
||||
pub struct HighResolutionStamp(f64);
|
||||
|
||||
impl HighResolutionStamp {
|
||||
|
|
|
@ -48,7 +48,7 @@ use crate::actors::worker::{WorkerActor, WorkerType};
|
|||
use crate::protocol::JsonPacketStream;
|
||||
|
||||
mod actor;
|
||||
/// Corresponds to http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/
|
||||
/// Corresponds to <http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/>
|
||||
mod actors {
|
||||
pub mod browsing_context;
|
||||
pub mod console;
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! Low-level wire protocol implementation. Currently only supports
|
||||
//! [JSON packets]
|
||||
//! (https://wiki.mozilla.org/Remote_Debugging_Protocol_Stream_Transport#JSON_Packets).
|
||||
//! [JSON packets](https://wiki.mozilla.org/Remote_Debugging_Protocol_Stream_Transport#JSON_Packets).
|
||||
|
||||
use std::error::Error;
|
||||
use std::io::{Read, Write};
|
||||
|
|
|
@ -59,7 +59,7 @@ impl FontTableMethods for FontTable {
|
|||
}
|
||||
|
||||
/// Data from the OS/2 table of an OpenType font.
|
||||
/// See https://www.microsoft.com/typography/otspec/os2.htm
|
||||
/// See <https://www.microsoft.com/typography/otspec/os2.htm>
|
||||
#[derive(Debug)]
|
||||
struct OS2Table {
|
||||
us_weight_class: u16,
|
||||
|
|
|
@ -117,7 +117,7 @@ impl GlyphEntry {
|
|||
/// non-exhaustively listed in the specification. Other characters may map to the same
|
||||
/// glyphs, but this function does not take mapping into account.
|
||||
///
|
||||
/// See https://drafts.csswg.org/css-text/#word-separator.
|
||||
/// See <https://drafts.csswg.org/css-text/#word-separator>.
|
||||
fn char_is_word_separator(&self) -> bool {
|
||||
self.has_flag(FLAG_CHAR_IS_WORD_SEPARATOR)
|
||||
}
|
||||
|
@ -433,7 +433,7 @@ pub struct GlyphStore {
|
|||
total_advance: Au,
|
||||
|
||||
/// A cache of the number of word separators in the entire glyph store.
|
||||
/// See https://drafts.csswg.org/css-text/#word-separator.
|
||||
/// See <https://drafts.csswg.org/css-text/#word-separator>.
|
||||
total_word_separators: i32,
|
||||
|
||||
/// Used to check if fast path should be used in glyph iteration.
|
||||
|
|
|
@ -13,17 +13,17 @@
|
|||
//! "CSS 2.1" or "CSS 2.2" refers to the editor's draft of the W3C "Cascading Style Sheets Level 2
|
||||
//! Revision 2 (CSS 2.2) Specification" available here:
|
||||
//!
|
||||
//! http://dev.w3.org/csswg/css2/
|
||||
//! <http://dev.w3.org/csswg/css2/>
|
||||
//!
|
||||
//! "INTRINSIC" refers to L. David Baron's "More Precise Definitions of Inline Layout and Table
|
||||
//! Layout" available here:
|
||||
//!
|
||||
//! http://dbaron.org/css/intrinsic/
|
||||
//! <http://dbaron.org/css/intrinsic/>
|
||||
//!
|
||||
//! "CSS-SIZING" refers to the W3C "CSS Intrinsic & Extrinsic Sizing Module Level 3" document
|
||||
//! available here:
|
||||
//!
|
||||
//! http://dev.w3.org/csswg/css-sizing/
|
||||
//! <http://dev.w3.org/csswg/css-sizing/>
|
||||
|
||||
use std::cmp::{max, min};
|
||||
use std::fmt;
|
||||
|
|
|
@ -40,7 +40,7 @@ pub struct BackgroundPlacement {
|
|||
/// Obviously it does not work with empty arrays.
|
||||
///
|
||||
/// This is used for multiple layered background images.
|
||||
/// See: https://drafts.csswg.org/css-backgrounds-3/#layering
|
||||
/// See: <https://drafts.csswg.org/css-backgrounds-3/#layering>
|
||||
pub fn get_cyclic<T>(arr: &[T], index: usize) -> &T {
|
||||
&arr[index % arr.len()]
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ impl<'a> ClipScrollState<'a> {
|
|||
}
|
||||
|
||||
/// Contentful paint, for the purpose of
|
||||
/// https://w3c.github.io/paint-timing/#first-contentful-paint
|
||||
/// <https://w3c.github.io/paint-timing/#first-contentful-paint>
|
||||
/// (i.e. the display list contains items of type text,
|
||||
/// image, non-white canvas or SVG). Used by metrics.
|
||||
pub struct IsContentful(pub bool);
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
//! Reference-counted pointers to flows.
|
||||
//!
|
||||
//! Eventually, with dynamically sized types in Rust, much of this code will
|
||||
//! be superfluous. This design is largely duplicating logic of Arc<T> and
|
||||
//! Weak<T>; please see comments there for details.
|
||||
//! be superfluous. This design is largely duplicating logic of `Arc<T>` and
|
||||
//! `Weak<T>`; please see comments there for details.
|
||||
|
||||
use std::ops::Deref;
|
||||
use std::sync::{Arc, Weak};
|
||||
|
@ -25,7 +25,7 @@ impl Deref for FlowRef {
|
|||
|
||||
impl FlowRef {
|
||||
/// `FlowRef`s can only be made available to the traversal code.
|
||||
/// See https://github.com/servo/servo/issues/14014 for more details.
|
||||
/// See <https://github.com/servo/servo/issues/14014> for more details.
|
||||
pub fn new(mut r: Arc<dyn Flow>) -> Self {
|
||||
// This assertion checks that this `FlowRef` does not alias normal `Arc`s.
|
||||
// If that happens, we're in trouble.
|
||||
|
@ -46,7 +46,7 @@ impl FlowRef {
|
|||
}
|
||||
/// WARNING: This should only be used when there is no aliasing:
|
||||
/// when the traversal ensures that no other threads accesses the same flow at the same time.
|
||||
/// See https://github.com/servo/servo/issues/6503
|
||||
/// See <https://github.com/servo/servo/issues/6503>.
|
||||
/// Use Arc::get_mut instead when possible (e.g. on an Arc that was just created).
|
||||
#[allow(unsafe_code)]
|
||||
pub fn deref_mut(this: &mut FlowRef) -> &mut dyn Flow {
|
||||
|
|
|
@ -2,7 +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/. */
|
||||
|
||||
//! CSS Multi-column layout http://dev.w3.org/csswg/css-multicol/
|
||||
//! CSS Multi-column layout <http://dev.w3.org/csswg/css-multicol/>
|
||||
|
||||
use std::cmp::{max, min};
|
||||
use std::fmt;
|
||||
|
|
|
@ -726,7 +726,7 @@ pub fn process_node_scroll_id_request<'dom>(
|
|||
layout_node.generate_scroll_id(id)
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/cssom-view/#scrolling-area
|
||||
/// <https://drafts.csswg.org/cssom-view/#scrolling-area>
|
||||
pub fn process_scrolling_area_request(
|
||||
requested_node: Option<OpaqueNode>,
|
||||
layout_root: &mut dyn Flow,
|
||||
|
|
|
@ -1167,7 +1167,7 @@ impl<'a> Iterator for TableRowIterator<'a> {
|
|||
/// for each cell
|
||||
///
|
||||
/// Used for correctly handling table layers from
|
||||
/// https://drafts.csswg.org/css2/tables.html#table-layers
|
||||
/// <https://drafts.csswg.org/css2/tables.html#table-layers>
|
||||
struct TableCellStyleIterator<'table> {
|
||||
column_styles: Vec<ColumnStyle<'table>>,
|
||||
row_iterator: TableRowAndGroupIterator<'table>,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
//! This follows the "More Precise Definitions of Inline Layout and Table Layout" proposal written
|
||||
//! by L. David Baron (Mozilla) here:
|
||||
//!
|
||||
//! http://dbaron.org/css/intrinsic/
|
||||
//! <http://dbaron.org/css/intrinsic/>
|
||||
//!
|
||||
//! Hereafter this document is referred to as INTRINSIC.
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ pub(super) fn build(
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-images-3/#linear-gradients
|
||||
/// <https://drafts.csswg.org/css-images-3/#linear-gradients>
|
||||
pub(super) fn build_linear(
|
||||
style: &ComputedValues,
|
||||
items: &[GradientItem<Color, LengthPercentage>],
|
||||
|
@ -155,7 +155,7 @@ pub(super) fn build_linear(
|
|||
)
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-images-3/#radial-gradients
|
||||
/// <https://drafts.csswg.org/css-images-3/#radial-gradients>
|
||||
pub(super) fn build_radial(
|
||||
style: &ComputedValues,
|
||||
items: &[GradientItem<Color, LengthPercentage>],
|
||||
|
@ -255,7 +255,7 @@ pub(super) fn build_radial(
|
|||
)
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-images-4/#color-stop-fixup
|
||||
/// <https://drafts.csswg.org/css-images-4/#color-stop-fixup>
|
||||
fn fixup_stops(
|
||||
style: &ComputedValues,
|
||||
items: &[GradientItem<Color, LengthPercentage>],
|
||||
|
|
|
@ -118,7 +118,7 @@ pub(crate) struct DisplayListBuilder<'a> {
|
|||
|
||||
/// Contentful paint i.e. whether the display list contains items of type
|
||||
/// text, image, non-white canvas or SVG). Used by metrics.
|
||||
/// See https://w3c.github.io/paint-timing/#first-contentful-paint.
|
||||
/// See <https://w3c.github.io/paint-timing/#first-contentful-paint>.
|
||||
is_contentful: bool,
|
||||
}
|
||||
|
||||
|
|
|
@ -511,7 +511,7 @@ impl StackingContext {
|
|||
true
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-backgrounds/#special-backgrounds
|
||||
/// <https://drafts.csswg.org/css-backgrounds/#special-backgrounds>
|
||||
///
|
||||
/// This is only called for the root `StackingContext`
|
||||
pub(crate) fn build_canvas_background_display_list(
|
||||
|
|
|
@ -327,7 +327,7 @@ where
|
|||
})
|
||||
}
|
||||
|
||||
/// https://www.w3.org/TR/CSS2/generate.html#propdef-content
|
||||
/// <https://www.w3.org/TR/CSS2/generate.html#propdef-content>
|
||||
fn generate_pseudo_element_content<'dom, Node>(
|
||||
pseudo_element_style: &ComputedValues,
|
||||
element: Node,
|
||||
|
|
|
@ -38,7 +38,7 @@ impl FlexContainer {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-flexbox/#flex-items
|
||||
/// <https://drafts.csswg.org/css-flexbox/#flex-items>
|
||||
struct FlexContainerBuilder<'a, 'dom, Node> {
|
||||
context: &'a LayoutContext<'a>,
|
||||
info: &'a NodeAndStyleInfo<Node>,
|
||||
|
@ -98,7 +98,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-text/#white-space
|
||||
/// <https://drafts.csswg.org/css-text/#white-space>
|
||||
fn is_only_document_white_space<Node>(run: &TextRun<'_, Node>) -> bool {
|
||||
// FIXME: is this the right definition? See
|
||||
// https://github.com/w3c/csswg-drafts/issues/5146
|
||||
|
|
|
@ -2,7 +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/. */
|
||||
|
||||
//! https://drafts.csswg.org/css-flexbox/#box-model
|
||||
//! <https://drafts.csswg.org/css-flexbox/#box-model>
|
||||
|
||||
use style::properties::longhands::flex_direction::computed_value::T as FlexDirection;
|
||||
|
||||
|
@ -87,7 +87,7 @@ pub(super) enum FlexAxis {
|
|||
}
|
||||
|
||||
/// Which flow-relative sides map to the main-start and cross-start sides, respectively.
|
||||
/// See https://drafts.csswg.org/css-flexbox/#box-model
|
||||
/// See <https://drafts.csswg.org/css-flexbox/#box-model>
|
||||
#[derive(Clone, Copy)]
|
||||
pub(super) enum MainStartCrossStart {
|
||||
InlineStartBlockStart,
|
||||
|
|
|
@ -69,10 +69,10 @@ struct FlexItem<'a> {
|
|||
/// This is the difference between an outer and inner size.
|
||||
pbm_auto_is_zero: FlexRelativeVec2<Length>,
|
||||
|
||||
/// https://drafts.csswg.org/css-flexbox/#algo-main-item
|
||||
/// <https://drafts.csswg.org/css-flexbox/#algo-main-item>
|
||||
flex_base_size: Length,
|
||||
|
||||
/// https://drafts.csswg.org/css-flexbox/#algo-main-item
|
||||
/// <https://drafts.csswg.org/css-flexbox/#algo-main-item>
|
||||
hypothetical_main_size: Length,
|
||||
/// This is `align-self`, defaulting to `align-items` if `auto`
|
||||
align_self: AlignItems,
|
||||
|
@ -153,7 +153,7 @@ impl FlexContainer {
|
|||
ContentSizes::zero() // Return an incorrect result rather than panic
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-flexbox/#layout-algorithm
|
||||
/// <https://drafts.csswg.org/css-flexbox/#layout-algorithm>
|
||||
pub(crate) fn layout(
|
||||
&self,
|
||||
layout_context: &LayoutContext,
|
||||
|
@ -552,7 +552,7 @@ impl<'a> FlexItem<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-flexbox/#algo-main-item
|
||||
/// <https://drafts.csswg.org/css-flexbox/#algo-main-item>
|
||||
fn flex_base_size(
|
||||
flex_context: &FlexContext,
|
||||
flex_item: &mut IndependentFormattingContext,
|
||||
|
@ -872,7 +872,7 @@ impl FlexLine<'_> {
|
|||
}
|
||||
|
||||
/// Return the *main size* of each item, and the line’s remainaing free space
|
||||
/// https://drafts.csswg.org/css-flexbox/#resolve-flexible-lengths
|
||||
/// <https://drafts.csswg.org/css-flexbox/#resolve-flexible-lengths>
|
||||
fn resolve_flexible_lengths(&self, container_main_size: Length) -> (Vec<Length>, Length) {
|
||||
let mut frozen = vec![false; self.items.len()];
|
||||
let mut target_main_sizes_vec = self
|
||||
|
@ -1135,7 +1135,7 @@ impl<'a> FlexItem<'a> {
|
|||
}
|
||||
|
||||
impl<'items> FlexLine<'items> {
|
||||
/// https://drafts.csswg.org/css-flexbox/#algo-cross-line
|
||||
/// <https://drafts.csswg.org/css-flexbox/#algo-cross-line>
|
||||
fn cross_size(
|
||||
&self,
|
||||
item_layout_results: &[FlexItemLayoutResult],
|
||||
|
@ -1238,7 +1238,7 @@ impl<'items> FlexLine<'items> {
|
|||
|
||||
impl FlexItem<'_> {
|
||||
/// Return the cross-start and cross-end margin, with `auto` values resolved.
|
||||
/// https://drafts.csswg.org/css-flexbox/#algo-cross-margins
|
||||
/// <https://drafts.csswg.org/css-flexbox/#algo-cross-margins>
|
||||
fn resolve_auto_cross_margins(
|
||||
&self,
|
||||
flex_context: &FlexContext,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! Float layout.
|
||||
//!
|
||||
//! See CSS 2.1 § 9.5.1: https://www.w3.org/TR/CSS2/visuren.html#float-position
|
||||
//! See CSS 2.1 § 9.5.1: <https://www.w3.org/TR/CSS2/visuren.html#float-position>
|
||||
|
||||
use std::collections::VecDeque;
|
||||
use std::fmt::{Debug, Formatter, Result as FmtResult};
|
||||
|
@ -506,7 +506,7 @@ pub struct PlacementInfo {
|
|||
|
||||
/// Whether the float is left or right.
|
||||
///
|
||||
/// See CSS 2.1 § 9.5.1: https://www.w3.org/TR/CSS2/visuren.html#float-position
|
||||
/// See CSS 2.1 § 9.5.1: <https://www.w3.org/TR/CSS2/visuren.html#float-position>
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum FloatSide {
|
||||
Left,
|
||||
|
@ -600,8 +600,8 @@ impl FloatBand {
|
|||
///
|
||||
/// AA trees were chosen for simplicity.
|
||||
///
|
||||
/// See: https://en.wikipedia.org/wiki/AA_tree
|
||||
/// https://arxiv.org/pdf/1412.4882.pdf
|
||||
/// See: <https://en.wikipedia.org/wiki/AA_tree>
|
||||
/// <https://arxiv.org/pdf/1412.4882.pdf>
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct FloatBandTree {
|
||||
pub root: FloatBandLink,
|
||||
|
@ -787,12 +787,13 @@ impl FloatBandLink {
|
|||
}
|
||||
|
||||
/// Corrects tree balance:
|
||||
///
|
||||
///```text
|
||||
/// T L
|
||||
/// / \ / \
|
||||
/// L R → A T if level(T) = level(L)
|
||||
/// / \ / \
|
||||
/// A B B R
|
||||
/// ```
|
||||
fn skew(&self) -> FloatBandLink {
|
||||
if let Some(ref this) = self.0 {
|
||||
if let Some(ref left) = this.left.0 {
|
||||
|
@ -816,12 +817,13 @@ impl FloatBandLink {
|
|||
}
|
||||
|
||||
/// Corrects tree balance:
|
||||
///
|
||||
///```text
|
||||
/// T R
|
||||
/// / \ / \
|
||||
/// A R → T X if level(T) = level(X)
|
||||
/// / \ / \
|
||||
/// B X A B
|
||||
/// ```
|
||||
fn split(&self) -> FloatBandLink {
|
||||
if let Some(ref this) = self.0 {
|
||||
if let Some(ref right) = this.right.0 {
|
||||
|
|
|
@ -93,7 +93,7 @@ pub(crate) struct InlineBox {
|
|||
pub children: Vec<ArcRefCell<InlineLevelBox>>,
|
||||
}
|
||||
|
||||
/// https://www.w3.org/TR/css-display-3/#css-text-run
|
||||
/// <https://www.w3.org/TR/css-display-3/#css-text-run>
|
||||
#[derive(Debug, Serialize)]
|
||||
pub(crate) struct TextRun {
|
||||
pub base_fragment_info: BaseFragmentInfo,
|
||||
|
@ -296,7 +296,7 @@ impl LineBlockSizes {
|
|||
.adjust_for_nested_baseline_offset(baseline_offset);
|
||||
}
|
||||
|
||||
/// From https://drafts.csswg.org/css2/visudet.html#line-height:
|
||||
/// From <https://drafts.csswg.org/css2/visudet.html#line-height>:
|
||||
/// > The inline-level boxes are aligned vertically according to their 'vertical-align'
|
||||
/// > property. In case they are aligned 'top' or 'bottom', they must be aligned so as
|
||||
/// > to minimize the line box height. If such boxes are tall enough, there are multiple
|
||||
|
@ -475,7 +475,7 @@ struct InlineContainerState {
|
|||
has_content: bool,
|
||||
|
||||
/// Indicates whether this nesting level have text decorations in effect.
|
||||
/// From https://drafts.csswg.org/css-text-decor/#line-decoration
|
||||
/// From <https://drafts.csswg.org/css-text-decor/#line-decoration>
|
||||
// "When specified on or propagated to a block container that establishes
|
||||
// an IFC..."
|
||||
text_decoration_line: TextDecorationLine,
|
||||
|
@ -483,7 +483,7 @@ struct InlineContainerState {
|
|||
/// The block size contribution of this container's default font ie the size of the
|
||||
/// "strut." Whether this is integrated into the [`Self::nested_strut_block_sizes`]
|
||||
/// depends on the line-height quirk described in
|
||||
/// https://quirks.spec.whatwg.org/#the-line-height-calculation-quirk.
|
||||
/// <https://quirks.spec.whatwg.org/#the-line-height-calculation-quirk>.
|
||||
strut_block_sizes: LineBlockSizes,
|
||||
|
||||
/// The strut block size of this inline container maxed with the strut block
|
||||
|
@ -527,7 +527,7 @@ struct InlineFormattingContextState<'a, 'b> {
|
|||
|
||||
/// The [`InlineContainerState`] for the container formed by the root of the
|
||||
/// [`InlineFormattingContext`]. This is effectively the "root inline box" described
|
||||
/// by https://drafts.csswg.org/css-inline/#model:
|
||||
/// by <https://drafts.csswg.org/css-inline/#model>:
|
||||
///
|
||||
/// > The block container also generates a root inline box, which is an anonymous
|
||||
/// > inline box that holds all of its inline-level contents. (Thus, all text in an
|
||||
|
@ -546,10 +546,10 @@ struct InlineFormattingContextState<'a, 'b> {
|
|||
/// are currently laid out at the top-level of each [`InlineFormattingContext`].
|
||||
fragments: Vec<Fragment>,
|
||||
|
||||
/// Information about the line currently being laid out into [`LineItems`]s.
|
||||
/// Information about the line currently being laid out into [`LineItem`]s.
|
||||
current_line: LineUnderConstruction,
|
||||
|
||||
/// Information about the unbreakable line segment currently being laid out into [`LineItems`]s.
|
||||
/// Information about the unbreakable line segment currently being laid out into [`LineItem`]s.
|
||||
current_line_segment: UnbreakableSegmentUnderConstruction,
|
||||
|
||||
/// The line breaking state for this inline formatting context.
|
||||
|
@ -2183,7 +2183,7 @@ fn font_metrics_from_style(layout_context: &LayoutContext, style: &ComputedValue
|
|||
|
||||
/// comes before or after an atomic inline element.
|
||||
///
|
||||
/// From https://www.w3.org/TR/css-text-3/#line-break-details:
|
||||
/// From <https://www.w3.org/TR/css-text-3/#line-break-details>:
|
||||
///
|
||||
/// > For Web-compatibility there is a soft wrap opportunity before and after each
|
||||
/// > replaced element or other atomic inline, even when adjacent to a character that
|
||||
|
@ -2213,7 +2213,7 @@ fn is_baseline_relative(vertical_align: GenericVerticalAlign<LengthPercentage>)
|
|||
/// all inline containers get struts. In quirks mode this isn't always the case
|
||||
/// though.
|
||||
///
|
||||
/// From https://quirks.spec.whatwg.org/#the-line-height-calculation-quirk
|
||||
/// From <https://quirks.spec.whatwg.org/#the-line-height-calculation-quirk>
|
||||
///
|
||||
/// > ### § 3.3. The line height calculation quirk
|
||||
/// > In quirks mode and limited-quirks mode, an inline box that matches the following
|
||||
|
|
|
@ -622,8 +622,8 @@ impl BlockLevelBox {
|
|||
/// Lay out a normal flow non-replaced block that does not establish a new formatting
|
||||
/// context.
|
||||
///
|
||||
/// - https://drafts.csswg.org/css2/visudet.html#blockwidth
|
||||
/// - https://drafts.csswg.org/css2/visudet.html#normal-block
|
||||
/// - <https://drafts.csswg.org/css2/visudet.html#blockwidth>
|
||||
/// - <https://drafts.csswg.org/css2/visudet.html#normal-block>
|
||||
fn layout_in_flow_non_replaced_block_level_same_formatting_context(
|
||||
layout_context: &LayoutContext,
|
||||
positioning_context: &mut PositioningContext,
|
||||
|
@ -826,8 +826,8 @@ impl NonReplacedFormattingContext {
|
|||
/// Lay out a normal in flow non-replaced block that establishes an independent
|
||||
/// formatting context in its containing formatting context.
|
||||
///
|
||||
/// - https://drafts.csswg.org/css2/visudet.html#blockwidth
|
||||
/// - https://drafts.csswg.org/css2/visudet.html#normal-block
|
||||
/// - <https://drafts.csswg.org/css2/visudet.html#blockwidth>
|
||||
/// - <https://drafts.csswg.org/css2/visudet.html#normal-block>
|
||||
fn layout_in_flow_block_level(
|
||||
&self,
|
||||
layout_context: &LayoutContext,
|
||||
|
@ -1119,9 +1119,9 @@ impl NonReplacedFormattingContext {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css2/visudet.html#block-replaced-width
|
||||
/// https://drafts.csswg.org/css2/visudet.html#inline-replaced-width
|
||||
/// https://drafts.csswg.org/css2/visudet.html#inline-replaced-height
|
||||
/// <https://drafts.csswg.org/css2/visudet.html#block-replaced-width>
|
||||
/// <https://drafts.csswg.org/css2/visudet.html#inline-replaced-width>
|
||||
/// <https://drafts.csswg.org/css2/visudet.html#inline-replaced-height>
|
||||
fn layout_in_flow_replaced_block_level<'a>(
|
||||
containing_block: &ContainingBlock,
|
||||
base_fragment_info: BaseFragmentInfo,
|
||||
|
|
|
@ -34,7 +34,7 @@ pub struct BoxTree {
|
|||
/// There may be zero if that element has `display: none`.
|
||||
root: BlockFormattingContext,
|
||||
|
||||
/// https://drafts.csswg.org/css-backgrounds/#special-backgrounds
|
||||
/// <https://drafts.csswg.org/css-backgrounds/#special-backgrounds>
|
||||
canvas_background: CanvasBackground,
|
||||
}
|
||||
|
||||
|
@ -338,7 +338,7 @@ impl BoxTree {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-backgrounds/#root-background
|
||||
/// <https://drafts.csswg.org/css-backgrounds/#root-background>
|
||||
#[derive(Clone, Serialize)]
|
||||
pub struct CanvasBackground {
|
||||
/// DOM node for the root element
|
||||
|
@ -346,7 +346,7 @@ pub struct CanvasBackground {
|
|||
|
||||
/// The element whose style the canvas takes background properties from (see next field).
|
||||
/// This can be the root element (same as the previous field), or the HTML `<body>` element.
|
||||
/// See https://drafts.csswg.org/css-backgrounds/#body-background
|
||||
/// See <https://drafts.csswg.org/css-backgrounds/#body-background>
|
||||
pub from_element: OpaqueNode,
|
||||
|
||||
/// The computed styles to take background properties from.
|
||||
|
|
|
@ -24,7 +24,7 @@ use crate::style_ext::DisplayInside;
|
|||
use crate::table::Table;
|
||||
use crate::ContainingBlock;
|
||||
|
||||
/// https://drafts.csswg.org/css-display/#independent-formatting-context
|
||||
/// <https://drafts.csswg.org/css-display/#independent-formatting-context>
|
||||
#[derive(Debug, Serialize)]
|
||||
pub(crate) enum IndependentFormattingContext {
|
||||
NonReplaced(NonReplacedFormattingContext),
|
||||
|
@ -62,7 +62,7 @@ pub(crate) enum NonReplacedFormattingContextContents {
|
|||
pub(crate) struct IndependentLayout {
|
||||
pub fragments: Vec<Fragment>,
|
||||
|
||||
/// https://drafts.csswg.org/css2/visudet.html#root-height
|
||||
/// <https://drafts.csswg.org/css2/visudet.html#root-height>
|
||||
pub content_block_size: Au,
|
||||
|
||||
/// The offset of the last inflow baseline of this layout in the content area, if
|
||||
|
|
|
@ -29,7 +29,7 @@ pub(crate) struct BoxFragment {
|
|||
|
||||
/// From the containing block’s start corner…?
|
||||
/// This might be broken when the containing block is in a different writing mode:
|
||||
/// https://drafts.csswg.org/css-writing-modes/#orthogonal-flows
|
||||
/// <https://drafts.csswg.org/css-writing-modes/#orthogonal-flows>
|
||||
pub content_rect: LogicalRect<Length>,
|
||||
|
||||
pub padding: LogicalSides<Length>,
|
||||
|
@ -41,7 +41,7 @@ pub(crate) struct BoxFragment {
|
|||
/// so that the element doesn't overlap earlier floats in the same BFC.
|
||||
/// The presence of clearance prevents the top margin from collapsing with
|
||||
/// earlier margins or with the bottom margin of the parent block.
|
||||
/// https://drafts.csswg.org/css2/#clearance
|
||||
/// <https://drafts.csswg.org/css2/#clearance>
|
||||
pub clearance: Option<Length>,
|
||||
|
||||
/// When this box contains an inline formatting context, this tracks the baseline
|
||||
|
|
|
@ -15,7 +15,7 @@ pub(crate) struct ContainingBlockManager<'a, T> {
|
|||
/// position is 'relative' or 'static', the containing block is formed by the
|
||||
/// content edge of the nearest block container ancestor box." This is also
|
||||
/// the case for 'position: sticky' elements.
|
||||
/// https://www.w3.org/TR/CSS2/visudet.html#containing-block-details
|
||||
/// <https://www.w3.org/TR/CSS2/visudet.html#containing-block-details>
|
||||
pub for_non_absolute_descendants: &'a T,
|
||||
|
||||
/// The containing block for absolute descendants. "If the element has
|
||||
|
@ -29,7 +29,7 @@ pub(crate) struct ContainingBlockManager<'a, T> {
|
|||
/// undefined.
|
||||
/// 2. Otherwise, the containing block is formed by the padding edge of the
|
||||
/// ancestor."
|
||||
/// https://www.w3.org/TR/CSS2/visudet.html#containing-block-details
|
||||
/// <https://www.w3.org/TR/CSS2/visudet.html#containing-block-details>
|
||||
/// If the ancestor forms a containing block for all descendants (see below),
|
||||
/// this value will be None and absolute descendants will use the containing
|
||||
/// block for fixed descendants.
|
||||
|
@ -41,7 +41,7 @@ pub(crate) struct ContainingBlockManager<'a, T> {
|
|||
/// establish a containing block for all descendants. Its padding box will be
|
||||
/// used to layout for all of its absolute-position descendants,
|
||||
/// fixed-position descendants, and descendant fixed background attachments."
|
||||
/// https://w3c.github.io/csswg-drafts/css-transforms-1/#containing-block-for-all-descendants
|
||||
/// <https://w3c.github.io/csswg-drafts/css-transforms-1/#containing-block-for-all-descendants>
|
||||
/// See `ComputedValues::establishes_containing_block_for_all_descendants`
|
||||
/// for a list of conditions where an element forms a containing block for
|
||||
/// all descendants.
|
||||
|
|
|
@ -31,13 +31,13 @@ pub struct FragmentTree {
|
|||
pub(crate) root_fragments: Vec<ArcRefCell<Fragment>>,
|
||||
|
||||
/// The scrollable overflow rectangle for the entire tree
|
||||
/// https://drafts.csswg.org/css-overflow/#scrollable
|
||||
/// <https://drafts.csswg.org/css-overflow/#scrollable>
|
||||
pub(crate) scrollable_overflow: PhysicalRect<Length>,
|
||||
|
||||
/// The containing block used in the layout of this fragment tree.
|
||||
pub(crate) initial_containing_block: PhysicalRect<Length>,
|
||||
|
||||
/// https://drafts.csswg.org/css-backgrounds/#special-backgrounds
|
||||
/// <https://drafts.csswg.org/css-backgrounds/#special-backgrounds>
|
||||
#[serde(skip)]
|
||||
pub(crate) canvas_background: CanvasBackground,
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ use crate::dom::NodeExt;
|
|||
use crate::dom_traversal::{NodeAndStyleInfo, PseudoElementContentItem};
|
||||
use crate::replaced::ReplacedContent;
|
||||
|
||||
/// https://drafts.csswg.org/css-lists/#content-property
|
||||
/// <https://drafts.csswg.org/css-lists/#content-property>
|
||||
pub(crate) fn make_marker<'dom, Node>(
|
||||
context: &LayoutContext,
|
||||
info: &NodeAndStyleInfo<Node>,
|
||||
|
@ -44,7 +44,7 @@ where
|
|||
})
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-lists/#marker-string
|
||||
/// <https://drafts.csswg.org/css-lists/#marker-string>
|
||||
fn marker_string(style: &style_structs::List) -> Option<&'static str> {
|
||||
match style.list_style_type {
|
||||
ListStyleType::None => None,
|
||||
|
|
|
@ -755,13 +755,13 @@ struct AbsoluteAxisSolver<'a> {
|
|||
impl<'a> AbsoluteAxisSolver<'a> {
|
||||
/// This unifies some of the parts in common in:
|
||||
///
|
||||
/// * https://drafts.csswg.org/css2/visudet.html#abs-non-replaced-width
|
||||
/// * https://drafts.csswg.org/css2/visudet.html#abs-non-replaced-height
|
||||
/// * <https://drafts.csswg.org/css2/visudet.html#abs-non-replaced-width>
|
||||
/// * <https://drafts.csswg.org/css2/visudet.html#abs-non-replaced-height>
|
||||
///
|
||||
/// … and:
|
||||
///
|
||||
/// * https://drafts.csswg.org/css2/visudet.html#abs-replaced-width
|
||||
/// * https://drafts.csswg.org/css2/visudet.html#abs-replaced-height
|
||||
/// * <https://drafts.csswg.org/css2/visudet.html#abs-replaced-width>
|
||||
/// * <https://drafts.csswg.org/css2/visudet.html#abs-replaced-height>
|
||||
///
|
||||
/// In the replaced case, `size` is never `Auto`.
|
||||
fn solve_for_size(&self, computed_size: LengthOrAuto) -> AxisResult {
|
||||
|
@ -859,7 +859,7 @@ fn vec_append_owned<T>(a: &mut Vec<T>, mut b: Vec<T>) {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css2/visuren.html#relative-positioning
|
||||
/// <https://drafts.csswg.org/css2/visuren.html#relative-positioning>
|
||||
pub(crate) fn relative_adjustement(
|
||||
style: &ComputedValues,
|
||||
containing_block: &ContainingBlock,
|
||||
|
|
|
@ -199,7 +199,7 @@ pub fn process_node_scroll_id_request<'dom>(
|
|||
layout_node.generate_scroll_id(id)
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/cssom-view/#scrolling-area
|
||||
/// <https://drafts.csswg.org/cssom-view/#scrolling-area>
|
||||
pub fn process_node_scroll_area_request(
|
||||
requested_node: Option<OpaqueNode>,
|
||||
fragment_tree: Option<Arc<FragmentTree>>,
|
||||
|
|
|
@ -38,18 +38,18 @@ pub(crate) struct ReplacedContent {
|
|||
|
||||
/// * Raster images always have an intrinsic width and height, with 1 image pixel = 1px.
|
||||
/// The intrinsic ratio should be based on dividing those.
|
||||
/// See https://github.com/w3c/csswg-drafts/issues/4572 for the case where either is zero.
|
||||
/// See <https://github.com/w3c/csswg-drafts/issues/4572> for the case where either is zero.
|
||||
/// PNG specifically disallows this but I (SimonSapin) am not sure about other formats.
|
||||
///
|
||||
/// * Form controls have both intrinsic width and height **but no intrinsic ratio**.
|
||||
/// See https://github.com/w3c/csswg-drafts/issues/1044 and
|
||||
/// https://drafts.csswg.org/css-images/#intrinsic-dimensions “In general, […]”
|
||||
/// See <https://github.com/w3c/csswg-drafts/issues/1044> and
|
||||
/// <https://drafts.csswg.org/css-images/#intrinsic-dimensions> “In general, […]”
|
||||
///
|
||||
/// * For SVG, see https://svgwg.org/svg2-draft/coords.html#SizingSVGInCSS
|
||||
/// and again https://github.com/w3c/csswg-drafts/issues/4572.
|
||||
/// * For SVG, see <https://svgwg.org/svg2-draft/coords.html#SizingSVGInCSS>
|
||||
/// and again <https://github.com/w3c/csswg-drafts/issues/4572>.
|
||||
///
|
||||
/// * IFrames do not have intrinsic width and height or intrinsic ratio according
|
||||
/// to https://drafts.csswg.org/css-images/#intrinsic-dimensions.
|
||||
/// to <https://drafts.csswg.org/css-images/#intrinsic-dimensions>.
|
||||
#[derive(Debug, Serialize)]
|
||||
pub(crate) struct IntrinsicSizes {
|
||||
pub width: Option<Au>,
|
||||
|
@ -318,11 +318,11 @@ impl ReplacedContent {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css2/visudet.html#inline-replaced-width
|
||||
/// https://drafts.csswg.org/css2/visudet.html#inline-replaced-height
|
||||
/// <https://drafts.csswg.org/css2/visudet.html#inline-replaced-width>
|
||||
/// <https://drafts.csswg.org/css2/visudet.html#inline-replaced-height>
|
||||
///
|
||||
/// Also used in other cases, for example
|
||||
/// https://drafts.csswg.org/css2/visudet.html#block-replaced-width
|
||||
/// <https://drafts.csswg.org/css2/visudet.html#block-replaced-width>
|
||||
pub fn used_size_as_if_inline_element(
|
||||
&self,
|
||||
containing_block: &ContainingBlock,
|
||||
|
|
|
@ -2,7 +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/. */
|
||||
|
||||
//! https://drafts.csswg.org/css-sizing/
|
||||
//! <https://drafts.csswg.org/css-sizing/>
|
||||
|
||||
use serde::Serialize;
|
||||
use style::logical_geometry::WritingMode;
|
||||
|
@ -19,7 +19,7 @@ pub(crate) struct ContentSizes {
|
|||
pub max_content: Length,
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-sizing/#intrinsic-sizes
|
||||
/// <https://drafts.csswg.org/css-sizing/#intrinsic-sizes>
|
||||
impl ContentSizes {
|
||||
pub fn zero() -> Self {
|
||||
Self {
|
||||
|
@ -51,7 +51,7 @@ impl ContentSizes {
|
|||
}
|
||||
|
||||
impl ContentSizes {
|
||||
/// https://drafts.csswg.org/css2/visudet.html#shrink-to-fit-float
|
||||
/// <https://drafts.csswg.org/css2/visudet.html#shrink-to-fit-float>
|
||||
pub fn shrink_to_fit(&self, available_size: Length) -> Length {
|
||||
available_size.max(self.min_content).min(self.max_content)
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ pub(crate) enum DisplayGeneratingBox {
|
|||
outside: DisplayOutside,
|
||||
inside: DisplayInside,
|
||||
},
|
||||
// https://drafts.csswg.org/css-display-3/#layout-specific-display
|
||||
/// <https://drafts.csswg.org/css-display-3/#layout-specific-display>
|
||||
LayoutInternal(DisplayLayoutInternal),
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ pub(crate) enum DisplayOutside {
|
|||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
pub(crate) enum DisplayInside {
|
||||
// “list-items are limited to the Flow Layout display types”
|
||||
// https://drafts.csswg.org/css-display/#list-items
|
||||
// <https://drafts.csswg.org/css-display/#list-items>
|
||||
Flow { is_list_item: bool },
|
||||
FlowRoot { is_list_item: bool },
|
||||
Flex,
|
||||
|
@ -71,7 +71,7 @@ pub(crate) enum DisplayInside {
|
|||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
/// https://drafts.csswg.org/css-display-3/#layout-specific-display
|
||||
/// <https://drafts.csswg.org/css-display-3/#layout-specific-display>
|
||||
pub(crate) enum DisplayLayoutInternal {
|
||||
TableCaption,
|
||||
TableCell,
|
||||
|
@ -84,7 +84,7 @@ pub(crate) enum DisplayLayoutInternal {
|
|||
}
|
||||
|
||||
impl DisplayLayoutInternal {
|
||||
/// https://drafts.csswg.org/css-display-3/#layout-specific-displa
|
||||
/// <https://drafts.csswg.org/css-display-3/#layout-specific-displa>
|
||||
pub(crate) fn display_inside(&self) -> DisplayInside {
|
||||
// When we add ruby, the display_inside of ruby must be Flow.
|
||||
// TODO: this should be unreachable for everything but
|
||||
|
@ -407,7 +407,7 @@ impl ComputedValuesExt for ComputedValues {
|
|||
}
|
||||
|
||||
/// Get the effective z-index of this fragment. Z-indices only apply to positioned elements
|
||||
/// per CSS 2 9.9.1 (http://www.w3.org/TR/CSS2/visuren.html#z-index), so this value may differ
|
||||
/// per CSS 2 9.9.1 (<http://www.w3.org/TR/CSS2/visuren.html#z-index>), so this value may differ
|
||||
/// from the value specified in the style.
|
||||
fn effective_z_index(&self) -> i32 {
|
||||
match self.get_box().position {
|
||||
|
|
|
@ -303,7 +303,7 @@ impl TableBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#algorithm-for-processing-rows
|
||||
/// <https://html.spec.whatwg.org/multipage/#algorithm-for-processing-rows>
|
||||
/// Push a single cell onto the slot map, handling any colspans it may have, and
|
||||
/// setting up the outgoing rowspans.
|
||||
pub fn add_cell(&mut self, cell: TableSlotCell) {
|
||||
|
@ -468,7 +468,7 @@ where
|
|||
.push(AnonymousTableContent::Text(info.clone(), text));
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#forming-a-table
|
||||
/// <https://html.spec.whatwg.org/multipage/#forming-a-table>
|
||||
fn handle_element(
|
||||
&mut self,
|
||||
info: &NodeAndStyleInfo<Node>,
|
||||
|
@ -646,7 +646,7 @@ where
|
|||
.push(AnonymousTableContent::Text(info.clone(), text));
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#algorithm-for-processing-rows
|
||||
/// <https://html.spec.whatwg.org/multipage/#algorithm-for-processing-rows>
|
||||
fn handle_element(
|
||||
&mut self,
|
||||
info: &NodeAndStyleInfo<Node>,
|
||||
|
|
|
@ -139,7 +139,7 @@ pub enum TableSlot {
|
|||
///
|
||||
/// If there is more than one cell that spans a slot, this is a table model error, but
|
||||
/// we still keep track of it. See
|
||||
/// https://html.spec.whatwg.org/multipage/#table-model-error
|
||||
/// <https://html.spec.whatwg.org/multipage/#table-model-error>
|
||||
Spanned(Vec<TableSlotOffset>),
|
||||
|
||||
/// An empty spot in the table. This can happen when there is a gap in columns between
|
||||
|
|
|
@ -137,7 +137,7 @@ pub enum CACertificates {
|
|||
///
|
||||
/// FIXME: The `ignore_certificate_errors` argument ignores all certificate errors. This
|
||||
/// is used when running the WPT tests, because rustls currently rejects the WPT certificiate.
|
||||
/// See https://github.com/servo/servo/issues/30080
|
||||
/// See <https://github.com/servo/servo/issues/30080>
|
||||
pub fn create_tls_config(
|
||||
ca_certificates: CACertificates,
|
||||
ignore_certificate_errors: bool,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! Implementation of cookie creation and matching as specified by
|
||||
//! http://tools.ietf.org/html/rfc6265
|
||||
//! <http://tools.ietf.org/html/rfc6265>
|
||||
|
||||
use std::borrow::ToOwned;
|
||||
use std::net::{Ipv4Addr, Ipv6Addr};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! Implementation of cookie storage as specified in
|
||||
//! http://tools.ietf.org/html/rfc6265
|
||||
//! <http://tools.ietf.org/html/rfc6265>
|
||||
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::hash_map::Entry;
|
||||
|
|
|
@ -164,7 +164,7 @@ pub async fn fetch_with_cors_cache(
|
|||
main_fetch(request, cache, false, false, target, &mut None, &context).await;
|
||||
}
|
||||
|
||||
/// https://www.w3.org/TR/CSP/#should-block-request
|
||||
/// <https://www.w3.org/TR/CSP/#should-block-request>
|
||||
pub fn should_request_be_blocked_by_csp(request: &Request) -> csp::CheckResult {
|
||||
let origin = match &request.origin {
|
||||
Origin::Client => return csp::CheckResult::Allowed,
|
||||
|
|
|
@ -144,7 +144,7 @@ impl HstsList {
|
|||
}
|
||||
}
|
||||
|
||||
/// Step 2.9 of https://fetch.spec.whatwg.org/#concept-main-fetch.
|
||||
/// Step 2.9 of <https://fetch.spec.whatwg.org/#concept-main-fetch>.
|
||||
pub fn apply_hsts_rules(&self, url: &mut ServoUrl) {
|
||||
if url.scheme() != "http" && url.scheme() != "ws" {
|
||||
return;
|
||||
|
|
|
@ -223,7 +223,7 @@ fn strict_origin_when_cross_origin(
|
|||
strip_url_for_use_as_referrer(referrer_url, true)
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#schemelessly-same-site
|
||||
/// <https://html.spec.whatwg.org/multipage/#schemelessly-same-site>
|
||||
fn is_schemelessy_same_site(site_a: &ImmutableOrigin, site_b: &ImmutableOrigin) -> bool {
|
||||
// Step 1
|
||||
if !site_a.is_tuple() && !site_b.is_tuple() && site_a == site_b {
|
||||
|
|
|
@ -94,7 +94,7 @@ fn set_webrender_image_key(webrender_api: &WebrenderIpcSender, image: &mut Image
|
|||
// Aux structs and enums.
|
||||
// ======================================================================
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#list-of-available-images
|
||||
/// <https://html.spec.whatwg.org/multipage/#list-of-available-images>
|
||||
type ImageKey = (ServoUrl, ImmutableOrigin, Option<CorsSettings>);
|
||||
|
||||
// Represents all the currently pending loads/decodings. For
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
//! Re-entrant mutexes are like mutexes, but where it is expected
|
||||
//! that a single thread may own a lock more than once.
|
||||
|
||||
//! It provides the same interface as https://github.com/rust-lang/rust/blob/5edaa7eefd76d4996dcf85dfc1c1a3f737087257/src/libstd/sys_common/remutex.rs
|
||||
//! It provides the same interface as <https://github.com/rust-lang/rust/blob/5edaa7eefd76d4996dcf85dfc1c1a3f737087257/src/libstd/sys_common/remutex.rs>
|
||||
//! so if those types are ever exported, we should be able to replace this implemtation.
|
||||
|
||||
use std::cell::{Cell, UnsafeCell};
|
||||
|
@ -148,7 +148,7 @@ unsafe impl Send for HandOverHandMutex {}
|
|||
|
||||
/// A type for re-entrant mutexes.
|
||||
///
|
||||
/// It provides the same interface as https://github.com/rust-lang/rust/blob/5edaa7eefd76d4996dcf85dfc1c1a3f737087257/src/libstd/sys_common/remutex.rs
|
||||
/// It provides the same interface as <https://github.com/rust-lang/rust/blob/5edaa7eefd76d4996dcf85dfc1c1a3f737087257/src/libstd/sys_common/remutex.rs>
|
||||
|
||||
pub struct ReentrantMutex<T> {
|
||||
mutex: HandOverHandMutex,
|
||||
|
|
|
@ -342,7 +342,7 @@ impl Callback for TransmitBodyPromiseRejectionHandler {
|
|||
}
|
||||
}
|
||||
|
||||
/// The result of https://fetch.spec.whatwg.org/#concept-bodyinit-extract
|
||||
/// The result of <https://fetch.spec.whatwg.org/#concept-bodyinit-extract>
|
||||
pub struct ExtractedBody {
|
||||
pub stream: DomRoot<ReadableStream>,
|
||||
pub source: BodySource,
|
||||
|
@ -353,12 +353,12 @@ pub struct ExtractedBody {
|
|||
impl ExtractedBody {
|
||||
/// Build a request body from the extracted body,
|
||||
/// to be sent over IPC to net to use with `concept-request-transmit-body`,
|
||||
/// see https://fetch.spec.whatwg.org/#concept-request-transmit-body.
|
||||
/// see <https://fetch.spec.whatwg.org/#concept-request-transmit-body>.
|
||||
///
|
||||
/// Also returning the corresponding readable stream,
|
||||
/// to be stored on the request in script,
|
||||
/// and potentially used as part of `consume_body`,
|
||||
/// see https://fetch.spec.whatwg.org/#concept-body-consume-body
|
||||
/// see <https://fetch.spec.whatwg.org/#concept-body-consume-body>
|
||||
///
|
||||
/// Transmitting a body over fetch, and consuming it in script,
|
||||
/// are mutually exclusive operations, since each will lock the stream to a reader.
|
||||
|
|
|
@ -150,7 +150,7 @@ pub(crate) struct CanvasState {
|
|||
#[no_trace]
|
||||
image_cache: Arc<dyn ImageCache>,
|
||||
/// The base URL for resolving CSS image URL values.
|
||||
/// Needed because of https://github.com/servo/servo/issues/17625
|
||||
/// Needed because of <https://github.com/servo/servo/issues/17625>
|
||||
#[no_trace]
|
||||
base_url: ServoUrl,
|
||||
#[no_trace]
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
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