mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Fix commonmark Markdown warnings in docs, part 1
Fixes warnings from rust-lang/rust#44229 when `--enable-commonmark` is passed to rustdoc. This is mostly a global find-and-replace for bare URIs on lines by themselves in doc comments.
This commit is contained in:
parent
aa3122e7d1
commit
efc3683cc7
137 changed files with 572 additions and 565 deletions
|
@ -230,10 +230,10 @@ pub struct CallSetup {
|
|||
old_compartment: *mut JSCompartment,
|
||||
/// The exception handling used for the call.
|
||||
handling: ExceptionHandling,
|
||||
/// https://heycam.github.io/webidl/#es-invoking-callback-functions
|
||||
/// <https://heycam.github.io/webidl/#es-invoking-callback-functions>
|
||||
/// steps 8 and 18.2.
|
||||
entry_script: Option<AutoEntryScript>,
|
||||
/// https://heycam.github.io/webidl/#es-invoking-callback-functions
|
||||
/// <https://heycam.github.io/webidl/#es-invoking-callback-functions>
|
||||
/// steps 9 and 18.1.
|
||||
incumbent_script: Option<AutoIncumbentScript>,
|
||||
}
|
||||
|
|
|
@ -6,31 +6,31 @@
|
|||
//!
|
||||
//! | IDL type | Argument type | Return type |
|
||||
//! |-------------------------|-----------------|----------------|
|
||||
//! | any | `JSVal` |
|
||||
//! | boolean | `bool` |
|
||||
//! | byte | `i8` |
|
||||
//! | octet | `u8` |
|
||||
//! | short | `i16` |
|
||||
//! | unsigned short | `u16` |
|
||||
//! | long | `i32` |
|
||||
//! | unsigned long | `u32` |
|
||||
//! | long long | `i64` |
|
||||
//! | unsigned long long | `u64` |
|
||||
//! | unrestricted float | `f32` |
|
||||
//! | float | `Finite<f32>` |
|
||||
//! | unrestricted double | `f64` |
|
||||
//! | double | `Finite<f64>` |
|
||||
//! | DOMString | `DOMString` |
|
||||
//! | USVString | `USVString` |
|
||||
//! | ByteString | `ByteString` |
|
||||
//! | object | `*mut JSObject` |
|
||||
//! | any | `JSVal` | |
|
||||
//! | boolean | `bool` | |
|
||||
//! | byte | `i8` | |
|
||||
//! | octet | `u8` | |
|
||||
//! | short | `i16` | |
|
||||
//! | unsigned short | `u16` | |
|
||||
//! | long | `i32` | |
|
||||
//! | unsigned long | `u32` | |
|
||||
//! | long long | `i64` | |
|
||||
//! | unsigned long long | `u64` | |
|
||||
//! | unrestricted float | `f32` | |
|
||||
//! | float | `Finite<f32>` | |
|
||||
//! | unrestricted double | `f64` | |
|
||||
//! | double | `Finite<f64>` | |
|
||||
//! | DOMString | `DOMString` | |
|
||||
//! | USVString | `USVString` | |
|
||||
//! | ByteString | `ByteString` | |
|
||||
//! | object | `*mut JSObject` | |
|
||||
//! | interface types | `&T` | `DomRoot<T>` |
|
||||
//! | dictionary types | `&T` | *unsupported* |
|
||||
//! | enumeration types | `T` |
|
||||
//! | callback function types | `Rc<T>` |
|
||||
//! | nullable types | `Option<T>` |
|
||||
//! | sequences | `Vec<T>` |
|
||||
//! | union types | `T` |
|
||||
//! | enumeration types | `T` | |
|
||||
//! | callback function types | `Rc<T>` | |
|
||||
//! | nullable types | `Option<T>` | |
|
||||
//! | sequences | `Vec<T>` | |
|
||||
//! | union types | `T` | |
|
||||
|
||||
use dom::bindings::error::{Error, Fallible};
|
||||
use dom::bindings::inheritance::Castable;
|
||||
|
|
|
@ -548,7 +548,7 @@ unsafe extern "C" fn has_instance_hook(cx: *mut JSContext,
|
|||
}
|
||||
|
||||
/// Return whether a value is an instance of a given prototype.
|
||||
/// http://heycam.github.io/webidl/#es-interface-hasinstance
|
||||
/// <http://heycam.github.io/webidl/#es-interface-hasinstance>
|
||||
unsafe fn has_instance(
|
||||
cx: *mut JSContext,
|
||||
interface_object: HandleObject,
|
||||
|
|
|
@ -712,7 +712,7 @@ impl<T: DomObject> LayoutDom<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Helper trait for safer manipulations of Option<Heap<T>> values.
|
||||
/// Helper trait for safer manipulations of `Option<Heap<T>>` values.
|
||||
pub trait OptionalHeapSetter {
|
||||
type Value;
|
||||
/// Update this optional heap value with a new value.
|
||||
|
|
|
@ -41,7 +41,7 @@ pub struct AutoEntryScript {
|
|||
}
|
||||
|
||||
impl AutoEntryScript {
|
||||
/// https://html.spec.whatwg.org/multipage/#prepare-to-run-script
|
||||
/// <https://html.spec.whatwg.org/multipage/#prepare-to-run-script>
|
||||
pub fn new(global: &GlobalScope) -> Self {
|
||||
STACK.with(|stack| {
|
||||
trace!("Prepare to run script with {:p}", global);
|
||||
|
@ -58,7 +58,7 @@ impl AutoEntryScript {
|
|||
}
|
||||
|
||||
impl Drop for AutoEntryScript {
|
||||
/// https://html.spec.whatwg.org/multipage/#clean-up-after-running-script
|
||||
/// <https://html.spec.whatwg.org/multipage/#clean-up-after-running-script>
|
||||
fn drop(&mut self) {
|
||||
STACK.with(|stack| {
|
||||
let mut stack = stack.borrow_mut();
|
||||
|
@ -96,7 +96,7 @@ pub struct AutoIncumbentScript {
|
|||
}
|
||||
|
||||
impl AutoIncumbentScript {
|
||||
/// https://html.spec.whatwg.org/multipage/#prepare-to-run-a-callback
|
||||
/// <https://html.spec.whatwg.org/multipage/#prepare-to-run-a-callback>
|
||||
pub fn new(global: &GlobalScope) -> Self {
|
||||
// Step 2-3.
|
||||
unsafe {
|
||||
|
@ -120,7 +120,7 @@ impl AutoIncumbentScript {
|
|||
}
|
||||
|
||||
impl Drop for AutoIncumbentScript {
|
||||
/// https://html.spec.whatwg.org/multipage/#clean-up-after-running-a-callback
|
||||
/// <https://html.spec.whatwg.org/multipage/#clean-up-after-running-a-callback>
|
||||
fn drop(&mut self) {
|
||||
STACK.with(|stack| {
|
||||
// Step 4.
|
||||
|
|
|
@ -194,7 +194,7 @@ pub unsafe fn find_enum_value<'a, T>(cx: *mut JSContext,
|
|||
}
|
||||
|
||||
/// Returns wether `obj` is a platform object
|
||||
/// https://heycam.github.io/webidl/#dfn-platform-object
|
||||
/// <https://heycam.github.io/webidl/#dfn-platform-object>
|
||||
pub fn is_platform_object(obj: *mut JSObject) -> bool {
|
||||
unsafe {
|
||||
// Fast-path the common case
|
||||
|
|
|
@ -329,7 +329,7 @@ fn read_file(global: &GlobalScope, id: Uuid) -> Result<Vec<u8>, ()> {
|
|||
}
|
||||
|
||||
/// Extract bytes from BlobParts, used by Blob and File constructor
|
||||
/// https://w3c.github.io/FileAPI/#constructorBlob
|
||||
/// <https://w3c.github.io/FileAPI/#constructorBlob>
|
||||
pub fn blob_parts_to_bytes(blobparts: Vec<BlobOrString>) -> Result<Vec<u8>, ()> {
|
||||
let mut ret = vec![];
|
||||
|
||||
|
@ -376,7 +376,7 @@ impl BlobMethods for Blob {
|
|||
}
|
||||
|
||||
/// Get the normalized, MIME-parsable type string
|
||||
/// https://w3c.github.io/FileAPI/#dfn-type
|
||||
/// <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
|
||||
|
|
|
@ -21,14 +21,14 @@ pub struct CSS {
|
|||
}
|
||||
|
||||
impl CSS {
|
||||
/// http://dev.w3.org/csswg/cssom/#serialize-an-identifier
|
||||
/// <http://dev.w3.org/csswg/cssom/#serialize-an-identifier>
|
||||
pub fn Escape(_: &Window, ident: DOMString) -> Fallible<DOMString> {
|
||||
let mut escaped = String::new();
|
||||
serialize_identifier(&ident, &mut escaped).unwrap();
|
||||
Ok(DOMString::from(escaped))
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-conditional/#dom-css-supports
|
||||
/// <https://drafts.csswg.org/css-conditional/#dom-css-supports>
|
||||
pub fn Supports(win: &Window, property: DOMString, value: DOMString) -> bool {
|
||||
let mut decl = String::new();
|
||||
serialize_identifier(&property, &mut decl).unwrap();
|
||||
|
@ -45,7 +45,7 @@ impl CSS {
|
|||
decl.eval(&context)
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-conditional/#dom-css-supports
|
||||
/// <https://drafts.csswg.org/css-conditional/#dom-css-supports>
|
||||
pub fn Supports_(win: &Window, condition: DOMString) -> bool {
|
||||
let mut input = ParserInput::new(&condition);
|
||||
let mut input = Parser::new(&mut input);
|
||||
|
|
|
@ -37,7 +37,7 @@ impl CSSConditionRule {
|
|||
}
|
||||
|
||||
impl CSSConditionRuleMethods for CSSConditionRule {
|
||||
/// https://drafts.csswg.org/css-conditional-3/#dom-cssconditionrule-conditiontext
|
||||
/// <https://drafts.csswg.org/css-conditional-3/#dom-cssconditionrule-conditiontext>
|
||||
fn ConditionText(&self) -> DOMString {
|
||||
if let Some(rule) = self.downcast::<CSSMediaRule>() {
|
||||
rule.get_condition_text()
|
||||
|
@ -48,7 +48,7 @@ impl CSSConditionRuleMethods for CSSConditionRule {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-conditional-3/#dom-cssconditionrule-conditiontext
|
||||
/// <https://drafts.csswg.org/css-conditional-3/#dom-cssconditionrule-conditiontext>
|
||||
fn SetConditionText(&self, text: DOMString) {
|
||||
if let Some(rule) = self.downcast::<CSSMediaRule>() {
|
||||
rule.set_condition_text(text)
|
||||
|
|
|
@ -59,7 +59,7 @@ impl CSSMediaRule {
|
|||
})
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-conditional-3/#the-cssmediarule-interface
|
||||
/// <https://drafts.csswg.org/css-conditional-3/#the-cssmediarule-interface>
|
||||
pub fn get_condition_text(&self) -> DOMString {
|
||||
let guard = self.cssconditionrule.shared_lock().read();
|
||||
let rule = self.mediarule.read_with(&guard);
|
||||
|
@ -67,7 +67,7 @@ impl CSSMediaRule {
|
|||
list.to_css_string().into()
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-conditional-3/#the-cssmediarule-interface
|
||||
/// <https://drafts.csswg.org/css-conditional-3/#the-cssmediarule-interface>
|
||||
pub fn set_condition_text(&self, text: DOMString) {
|
||||
let mut input = ParserInput::new(&text);
|
||||
let mut input = Parser::new(&mut input);
|
||||
|
|
|
@ -34,7 +34,7 @@ impl CSSStyleValue {
|
|||
}
|
||||
|
||||
impl CSSStyleValueMethods for CSSStyleValue {
|
||||
/// https://drafts.css-houdini.org/css-typed-om-1/#CSSStyleValue-stringification-behavior
|
||||
/// <https://drafts.css-houdini.org/css-typed-om-1/#CSSStyleValue-stringification-behavior>
|
||||
fn Stringifier(&self) -> DOMString {
|
||||
DOMString::from(&*self.value)
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ impl CSSStyleValue {
|
|||
/// Parse the value as a `url()`.
|
||||
/// TODO: This should really always be an absolute URL, but we currently
|
||||
/// return relative URLs for computed values, so we pass in a base.
|
||||
/// https://github.com/servo/servo/issues/17625
|
||||
/// <https://github.com/servo/servo/issues/17625>
|
||||
pub fn get_url(&self, base_url: ServoUrl) -> Option<ServoUrl> {
|
||||
let mut input = ParserInput::new(&*self.value);
|
||||
let mut parser = Parser::new(&mut input);
|
||||
|
|
|
@ -46,14 +46,14 @@ impl CSSSupportsRule {
|
|||
CSSSupportsRuleBinding::Wrap)
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface
|
||||
/// <https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface>
|
||||
pub fn get_condition_text(&self) -> DOMString {
|
||||
let guard = self.cssconditionrule.shared_lock().read();
|
||||
let rule = self.supportsrule.read_with(&guard);
|
||||
rule.condition.to_css_string().into()
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface
|
||||
/// <https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface>
|
||||
pub fn set_condition_text(&self, text: DOMString) {
|
||||
let mut input = ParserInput::new(&text);
|
||||
let mut input = Parser::new(&mut input);
|
||||
|
|
|
@ -40,7 +40,7 @@ use std::ops::Deref;
|
|||
use std::ptr;
|
||||
use std::rc::Rc;
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#customelementregistry
|
||||
/// <https://html.spec.whatwg.org/multipage/#customelementregistry>
|
||||
#[dom_struct]
|
||||
pub struct CustomElementRegistry {
|
||||
reflector_: Reflector,
|
||||
|
@ -74,12 +74,12 @@ impl CustomElementRegistry {
|
|||
}
|
||||
|
||||
/// Cleans up any active promises
|
||||
/// https://github.com/servo/servo/issues/15318
|
||||
/// <https://github.com/servo/servo/issues/15318>
|
||||
pub fn teardown(&self) {
|
||||
self.when_defined.borrow_mut().clear()
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#look-up-a-custom-element-definition
|
||||
/// <https://html.spec.whatwg.org/multipage/#look-up-a-custom-element-definition>
|
||||
pub fn lookup_definition(&self,
|
||||
local_name: &LocalName,
|
||||
is: Option<&LocalName>)
|
||||
|
@ -97,7 +97,7 @@ impl CustomElementRegistry {
|
|||
}).cloned()
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define>
|
||||
/// Steps 10.1, 10.2
|
||||
#[allow(unsafe_code)]
|
||||
fn check_prototype(&self, constructor: HandleObject, prototype: MutableHandleValue) -> ErrorResult {
|
||||
|
@ -119,7 +119,7 @@ impl CustomElementRegistry {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define>
|
||||
/// Steps 10.3, 10.4
|
||||
fn get_callbacks(&self, prototype: HandleObject) -> Fallible<LifecycleCallbacks> {
|
||||
let cx = self.window.get_cx();
|
||||
|
@ -133,7 +133,7 @@ impl CustomElementRegistry {
|
|||
})
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define>
|
||||
/// Step 10.6
|
||||
#[allow(unsafe_code)]
|
||||
fn get_observed_attributes(&self, constructor: HandleObject) -> Fallible<Vec<DOMString>> {
|
||||
|
@ -161,7 +161,7 @@ impl CustomElementRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define>
|
||||
/// Step 10.4
|
||||
#[allow(unsafe_code)]
|
||||
fn get_callback(cx: *mut JSContext, prototype: HandleObject, name: &[u8]) -> Fallible<Option<Rc<Function>>> {
|
||||
|
@ -188,7 +188,7 @@ fn get_callback(cx: *mut JSContext, prototype: HandleObject, name: &[u8]) -> Fal
|
|||
|
||||
impl CustomElementRegistryMethods for CustomElementRegistry {
|
||||
#[allow(unsafe_code, unrooted_must_root)]
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define>
|
||||
fn Define(&self, name: DOMString, constructor_: Rc<Function>, options: &ElementDefinitionOptions) -> ErrorResult {
|
||||
let cx = self.window.get_cx();
|
||||
rooted!(in(cx) let constructor = constructor_.callback());
|
||||
|
@ -321,7 +321,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-get
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-get>
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn Get(&self, cx: *mut JSContext, name: DOMString) -> JSVal {
|
||||
match self.definitions.borrow().get(&LocalName::from(&*name)) {
|
||||
|
@ -334,7 +334,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-whendefined
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-whendefined>
|
||||
#[allow(unrooted_must_root)]
|
||||
fn WhenDefined(&self, name: DOMString) -> Rc<Promise> {
|
||||
let global_scope = self.window.upcast::<GlobalScope>();
|
||||
|
@ -390,7 +390,7 @@ pub enum ConstructionStackEntry {
|
|||
AlreadyConstructedMarker,
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#custom-element-definition
|
||||
/// <https://html.spec.whatwg.org/multipage/#custom-element-definition>
|
||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
||||
pub struct CustomElementDefinition {
|
||||
pub name: LocalName,
|
||||
|
@ -424,7 +424,7 @@ impl CustomElementDefinition {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#autonomous-custom-element
|
||||
/// <https://html.spec.whatwg.org/multipage/#autonomous-custom-element>
|
||||
pub fn is_autonomous(&self) -> bool {
|
||||
self.name == self.local_name
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ impl CustomElementDefinition {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#concept-upgrade-an-element
|
||||
/// <https://html.spec.whatwg.org/multipage/#concept-upgrade-an-element>
|
||||
#[allow(unsafe_code)]
|
||||
pub fn upgrade_element(definition: Rc<CustomElementDefinition>, element: &Element) {
|
||||
// Steps 1-2
|
||||
|
@ -536,7 +536,7 @@ pub fn upgrade_element(definition: Rc<CustomElementDefinition>, element: &Elemen
|
|||
element.set_custom_element_definition(definition);
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#concept-upgrade-an-element
|
||||
/// <https://html.spec.whatwg.org/multipage/#concept-upgrade-an-element>
|
||||
/// Steps 7.1-7.2
|
||||
#[allow(unsafe_code)]
|
||||
fn run_upgrade_constructor(constructor: &Rc<Function>, element: &Element) -> ErrorResult {
|
||||
|
@ -567,7 +567,7 @@ fn run_upgrade_constructor(constructor: &Rc<Function>, element: &Element) -> Err
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#concept-try-upgrade
|
||||
/// <https://html.spec.whatwg.org/multipage/#concept-try-upgrade>
|
||||
pub fn try_upgrade_element(element: &Element) {
|
||||
// Step 1
|
||||
let document = document_from_node(element);
|
||||
|
@ -595,7 +595,7 @@ pub enum CustomElementReaction {
|
|||
}
|
||||
|
||||
impl CustomElementReaction {
|
||||
/// https://html.spec.whatwg.org/multipage/#invoke-custom-element-reactions
|
||||
/// <https://html.spec.whatwg.org/multipage/#invoke-custom-element-reactions>
|
||||
#[allow(unsafe_code)]
|
||||
pub fn invoke(&self, element: &Element) {
|
||||
// Step 2.1
|
||||
|
@ -616,14 +616,14 @@ pub enum CallbackReaction {
|
|||
AttributeChanged(LocalName, Option<DOMString>, Option<DOMString>, Namespace),
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#processing-the-backup-element-queue
|
||||
/// <https://html.spec.whatwg.org/multipage/#processing-the-backup-element-queue>
|
||||
#[derive(Clone, Copy, Eq, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
enum BackupElementQueueFlag {
|
||||
Processing,
|
||||
NotProcessing,
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack
|
||||
/// <https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack>
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[must_root]
|
||||
pub struct CustomElementReactionStack {
|
||||
|
@ -658,7 +658,7 @@ impl CustomElementReactionStack {
|
|||
self.stack.borrow_mut().append(&mut *stack);
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#enqueue-an-element-on-the-appropriate-element-queue
|
||||
/// <https://html.spec.whatwg.org/multipage/#enqueue-an-element-on-the-appropriate-element-queue>
|
||||
/// Step 4
|
||||
pub fn invoke_backup_element_queue(&self) {
|
||||
// Step 4.1
|
||||
|
@ -668,7 +668,7 @@ impl CustomElementReactionStack {
|
|||
self.processing_backup_element_queue.set(BackupElementQueueFlag::NotProcessing);
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#enqueue-an-element-on-the-appropriate-element-queue
|
||||
/// <https://html.spec.whatwg.org/multipage/#enqueue-an-element-on-the-appropriate-element-queue>
|
||||
pub fn enqueue_element(&self, element: &Element) {
|
||||
if let Some(current_queue) = self.stack.borrow().last() {
|
||||
// Step 2
|
||||
|
@ -690,7 +690,7 @@ impl CustomElementReactionStack {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#enqueue-a-custom-element-callback-reaction
|
||||
/// <https://html.spec.whatwg.org/multipage/#enqueue-a-custom-element-callback-reaction>
|
||||
#[allow(unsafe_code)]
|
||||
pub fn enqueue_callback_reaction(&self,
|
||||
element: &Element,
|
||||
|
@ -763,7 +763,7 @@ impl CustomElementReactionStack {
|
|||
self.enqueue_element(element);
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#enqueue-a-custom-element-upgrade-reaction
|
||||
/// <https://html.spec.whatwg.org/multipage/#enqueue-a-custom-element-upgrade-reaction>
|
||||
pub fn enqueue_upgrade_reaction(&self, element: &Element, definition: Rc<CustomElementDefinition>) {
|
||||
// Step 1
|
||||
element.push_upgrade_reaction(definition);
|
||||
|
@ -772,7 +772,7 @@ impl CustomElementReactionStack {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#element-queue
|
||||
/// <https://html.spec.whatwg.org/multipage/#element-queue>
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
#[must_root]
|
||||
struct ElementQueue {
|
||||
|
@ -786,7 +786,7 @@ impl ElementQueue {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#invoke-custom-element-reactions
|
||||
/// <https://html.spec.whatwg.org/multipage/#invoke-custom-element-reactions>
|
||||
fn invoke_reactions(&self) {
|
||||
// Steps 1-2
|
||||
while let Some(element) = self.next_element() {
|
||||
|
@ -804,7 +804,7 @@ impl ElementQueue {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#valid-custom-element-name
|
||||
/// <https://html.spec.whatwg.org/multipage/#valid-custom-element-name>
|
||||
pub fn is_valid_custom_element_name(name: &str) -> bool {
|
||||
// Custom elment names must match:
|
||||
// PotentialCustomElementName ::= [a-z] (PCENChar)* '-' (PCENChar)*
|
||||
|
@ -847,7 +847,7 @@ pub fn is_valid_custom_element_name(name: &str) -> bool {
|
|||
}
|
||||
|
||||
/// Check if this character is a PCENChar
|
||||
/// https://html.spec.whatwg.org/multipage/#prod-pcenchar
|
||||
/// <https://html.spec.whatwg.org/multipage/#prod-pcenchar>
|
||||
fn is_potential_custom_element_char(c: char) -> bool {
|
||||
c == '-' || c == '.' || c == '_' || c == '\u{B7}' ||
|
||||
(c >= '0' && c <= '9') ||
|
||||
|
|
|
@ -219,7 +219,7 @@ impl ::style::stylesheets::StylesheetInDocument for StyleSheetInDocument {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#document
|
||||
/// <https://dom.spec.whatwg.org/#document>
|
||||
#[dom_struct]
|
||||
pub struct Document {
|
||||
node: Node,
|
||||
|
@ -261,23 +261,23 @@ pub struct Document {
|
|||
focused: MutNullableDom<Element>,
|
||||
/// The script element that is currently executing.
|
||||
current_script: MutNullableDom<HTMLScriptElement>,
|
||||
/// https://html.spec.whatwg.org/multipage/#pending-parsing-blocking-script
|
||||
/// <https://html.spec.whatwg.org/multipage/#pending-parsing-blocking-script>
|
||||
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
|
||||
deferred_scripts: PendingInOrderScriptVec,
|
||||
/// https://html.spec.whatwg.org/multipage/#list-of-scripts-that-will-execute-in-order-as-soon-as-possible
|
||||
/// <https://html.spec.whatwg.org/multipage/#list-of-scripts-that-will-execute-in-order-as-soon-as-possible>
|
||||
asap_in_order_scripts_list: PendingInOrderScriptVec,
|
||||
/// https://html.spec.whatwg.org/multipage/#set-of-scripts-that-will-execute-as-soon-as-possible
|
||||
/// <https://html.spec.whatwg.org/multipage/#set-of-scripts-that-will-execute-as-soon-as-possible>
|
||||
asap_scripts_set: DomRefCell<Vec<Dom<HTMLScriptElement>>>,
|
||||
/// https://html.spec.whatwg.org/multipage/#concept-n-noscript
|
||||
/// <https://html.spec.whatwg.org/multipage/#concept-n-noscript>
|
||||
/// True if scripting is enabled for all scripts in this document
|
||||
scripting_enabled: bool,
|
||||
/// https://html.spec.whatwg.org/multipage/#animation-frame-callback-identifier
|
||||
/// <https://html.spec.whatwg.org/multipage/#animation-frame-callback-identifier>
|
||||
/// Current identifier of animation frame callback
|
||||
animation_frame_ident: Cell<u32>,
|
||||
/// https://html.spec.whatwg.org/multipage/#list-of-animation-frame-callbacks
|
||||
/// <https://html.spec.whatwg.org/multipage/#list-of-animation-frame-callbacks>
|
||||
/// List of animation frame callbacks
|
||||
animation_frame_list: DomRefCell<Vec<(u32, Option<AnimationFrameCallback>)>>,
|
||||
/// Whether we're in the process of running animation callbacks.
|
||||
|
@ -294,7 +294,7 @@ pub struct Document {
|
|||
/// The cached first `base` element with an `href` attribute.
|
||||
base_element: MutNullableDom<HTMLBaseElement>,
|
||||
/// This field is set to the document itself for inert documents.
|
||||
/// https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document
|
||||
/// <https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document>
|
||||
appropriate_template_contents_owner_document: MutNullableDom<Document>,
|
||||
/// Information on elements needing restyle to ship over to the layout thread when the
|
||||
/// time comes.
|
||||
|
@ -302,10 +302,10 @@ pub struct Document {
|
|||
/// This flag will be true if layout suppressed a reflow attempt that was
|
||||
/// needed in order for the page to be painted.
|
||||
needs_paint: Cell<bool>,
|
||||
/// http://w3c.github.io/touch-events/#dfn-active-touch-point
|
||||
/// <http://w3c.github.io/touch-events/#dfn-active-touch-point>
|
||||
active_touch_points: DomRefCell<Vec<Dom<Touch>>>,
|
||||
/// Navigation Timing properties:
|
||||
/// https://w3c.github.io/navigation-timing/#sec-PerformanceNavigationTiming
|
||||
/// <https://w3c.github.io/navigation-timing/#sec-PerformanceNavigationTiming>
|
||||
dom_loading: Cell<u64>,
|
||||
dom_interactive: Cell<u64>,
|
||||
dom_content_loaded_event_start: Cell<u64>,
|
||||
|
@ -313,21 +313,21 @@ pub struct Document {
|
|||
dom_complete: Cell<u64>,
|
||||
load_event_start: Cell<u64>,
|
||||
load_event_end: Cell<u64>,
|
||||
/// https://html.spec.whatwg.org/multipage/#concept-document-https-state
|
||||
/// <https://html.spec.whatwg.org/multipage/#concept-document-https-state>
|
||||
https_state: Cell<HttpsState>,
|
||||
touchpad_pressure_phase: Cell<TouchpadPressurePhase>,
|
||||
/// The document's origin.
|
||||
origin: MutableOrigin,
|
||||
/// https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-states
|
||||
referrer_policy: Cell<Option<ReferrerPolicy>>,
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-document-referrer
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-document-referrer>
|
||||
referrer: Option<String>,
|
||||
/// https://html.spec.whatwg.org/multipage/#target-element
|
||||
/// <https://html.spec.whatwg.org/multipage/#target-element>
|
||||
target_element: MutNullableDom<Element>,
|
||||
/// https://w3c.github.io/uievents/#event-type-dblclick
|
||||
/// <https://w3c.github.io/uievents/#event-type-dblclick>
|
||||
#[ignore_heap_size_of = "Defined in std"]
|
||||
last_click_info: DomRefCell<Option<(Instant, Point2D<f32>)>>,
|
||||
/// https://html.spec.whatwg.org/multipage/#ignore-destructive-writes-counter
|
||||
/// <https://html.spec.whatwg.org/multipage/#ignore-destructive-writes-counter>
|
||||
ignore_destructive_writes_counter: Cell<u32>,
|
||||
/// The number of spurious `requestAnimationFrame()` requests we've received.
|
||||
///
|
||||
|
@ -421,7 +421,7 @@ impl Document {
|
|||
#[inline]
|
||||
pub fn has_browsing_context(&self) -> bool { self.has_browsing_context }
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#concept-document-bc
|
||||
/// <https://html.spec.whatwg.org/multipage/#concept-document-bc>
|
||||
#[inline]
|
||||
pub fn browsing_context(&self) -> Option<DomRoot<WindowProxy>> {
|
||||
if self.has_browsing_context {
|
||||
|
@ -524,7 +524,7 @@ impl Document {
|
|||
}
|
||||
|
||||
/// Refresh the cached first base element in the DOM.
|
||||
/// https://github.com/w3c/web-platform-tests/issues/2122
|
||||
/// <https://github.com/w3c/web-platform-tests/issues/2122>
|
||||
pub fn refresh_base_element(&self) {
|
||||
let base = self.upcast::<Node>()
|
||||
.traverse_preorder()
|
||||
|
@ -667,7 +667,7 @@ impl Document {
|
|||
}
|
||||
|
||||
/// Attempt to find a named element in this page's document.
|
||||
/// https://html.spec.whatwg.org/multipage/#the-indicated-part-of-the-document
|
||||
/// <https://html.spec.whatwg.org/multipage/#the-indicated-part-of-the-document>
|
||||
pub fn find_fragment_node(&self, fragid: &str) -> Option<DomRoot<Element>> {
|
||||
// Step 1 is not handled here; the fragid is already obtained by the calling function
|
||||
// Step 2: Simply use None to indicate the top of the document.
|
||||
|
@ -682,7 +682,7 @@ impl Document {
|
|||
|
||||
/// Scroll to the target element, and when we do not find a target
|
||||
/// and the fragment is empty or "top", scroll to the top.
|
||||
/// https://html.spec.whatwg.org/multipage/#scroll-to-the-fragment-identifier
|
||||
/// <https://html.spec.whatwg.org/multipage/#scroll-to-the-fragment-identifier>
|
||||
pub fn check_and_scroll_fragment(&self, fragment: &str) {
|
||||
let target = self.find_fragment_node(fragment);
|
||||
|
||||
|
@ -1522,7 +1522,7 @@ impl Document {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-window-requestanimationframe
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-window-requestanimationframe>
|
||||
pub fn request_animation_frame(&self, callback: AnimationFrameCallback) -> u32 {
|
||||
let ident = self.animation_frame_ident.get() + 1;
|
||||
|
||||
|
@ -1554,7 +1554,7 @@ impl Document {
|
|||
ident
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-window-cancelanimationframe
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-window-cancelanimationframe>
|
||||
pub fn cancel_animation_frame(&self, ident: u32) {
|
||||
let mut list = self.animation_frame_list.borrow_mut();
|
||||
if let Some(pair) = list.iter_mut().find(|pair| pair.0 == ident) {
|
||||
|
@ -1562,7 +1562,7 @@ impl Document {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#run-the-animation-frame-callbacks
|
||||
/// <https://html.spec.whatwg.org/multipage/#run-the-animation-frame-callbacks>
|
||||
pub fn run_the_animation_frame_callbacks(&self) {
|
||||
rooted_vec!(let mut animation_frame_list);
|
||||
mem::swap(
|
||||
|
@ -2000,7 +2000,7 @@ impl Document {
|
|||
event.fire(target);
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#cookie-averse-document-object
|
||||
/// <https://html.spec.whatwg.org/multipage/#cookie-averse-document-object>
|
||||
pub fn is_cookie_averse(&self) -> bool {
|
||||
!self.has_browsing_context || !url_has_network_scheme(&self.url())
|
||||
}
|
||||
|
@ -2013,7 +2013,7 @@ impl Document {
|
|||
self.window.layout().nodes_from_point_response()
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#look-up-a-custom-element-definition
|
||||
/// <https://html.spec.whatwg.org/multipage/#look-up-a-custom-element-definition>
|
||||
pub fn lookup_custom_element_definition(&self,
|
||||
namespace: &Namespace,
|
||||
local_name: &LocalName,
|
||||
|
@ -2151,7 +2151,7 @@ fn get_registrable_domain_suffix_of_or_is_equal_to(host_suffix_string: &str, ori
|
|||
Some(host)
|
||||
}
|
||||
|
||||
/// https://url.spec.whatwg.org/#network-scheme
|
||||
/// <https://url.spec.whatwg.org/#network-scheme>
|
||||
fn url_has_network_scheme(url: &ServoUrl) -> bool {
|
||||
match url.scheme() {
|
||||
"ftp" | "http" | "https" => true,
|
||||
|
@ -2225,7 +2225,7 @@ impl Document {
|
|||
/// Per-process shared lock for author-origin stylesheets
|
||||
///
|
||||
/// FIXME: make it per-document or per-pipeline instead:
|
||||
/// https://github.com/servo/servo/issues/16027
|
||||
/// <https://github.com/servo/servo/issues/16027>
|
||||
/// (Need to figure out what to do with the style attribute
|
||||
/// of elements adopted into another document.)
|
||||
static ref PER_PROCESS_AUTHOR_SHARED_LOCK: StyleSharedRwLock = {
|
||||
|
@ -2466,7 +2466,7 @@ impl Document {
|
|||
})
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document
|
||||
/// <https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document>
|
||||
pub fn appropriate_template_contents_owner_document(&self) -> DomRoot<Document> {
|
||||
self.appropriate_template_contents_owner_document.or_init(|| {
|
||||
let doctype = if self.is_html_document {
|
||||
|
@ -3977,7 +3977,7 @@ fn update_with_current_time_ms(marker: &Cell<u64>) {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/webappsec-referrer-policy/#determine-policy-for-token
|
||||
/// <https://w3c.github.io/webappsec-referrer-policy/#determine-policy-for-token>
|
||||
pub fn determine_policy_for_token(token: &str) -> Option<ReferrerPolicy> {
|
||||
match_ignore_ascii_case! { token,
|
||||
"never" | "no-referrer" => Some(ReferrerPolicy::NoReferrer),
|
||||
|
|
|
@ -151,12 +151,12 @@ pub struct Element {
|
|||
/// when it has exclusive access to the element.
|
||||
#[ignore_heap_size_of = "bitflags defined in rust-selectors"]
|
||||
selector_flags: Cell<ElementSelectorFlags>,
|
||||
/// https://html.spec.whatwg.org/multipage/#custom-element-reaction-queue
|
||||
/// <https://html.spec.whatwg.org/multipage/#custom-element-reaction-queue>
|
||||
custom_element_reaction_queue: DomRefCell<Vec<CustomElementReaction>>,
|
||||
/// https://dom.spec.whatwg.org/#concept-element-custom-element-definition
|
||||
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-definition>
|
||||
#[ignore_heap_size_of = "Rc"]
|
||||
custom_element_definition: DomRefCell<Option<Rc<CustomElementDefinition>>>,
|
||||
/// https://dom.spec.whatwg.org/#concept-element-custom-element-state
|
||||
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-state>
|
||||
custom_element_state: Cell<CustomElementState>,
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ pub enum CustomElementCreationMode {
|
|||
Asynchronous,
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#concept-element-custom-element-state
|
||||
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-state>
|
||||
#[derive(Clone, Copy, Eq, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
pub enum CustomElementState {
|
||||
Undefined,
|
||||
|
@ -2063,7 +2063,7 @@ impl ElementMethods for Element {
|
|||
self.upcast::<Node>().client_rect().size.height
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/DOM-Parsing/#widl-Element-innerHTML
|
||||
/// <https://w3c.github.io/DOM-Parsing/#widl-Element-innerHTML>
|
||||
fn GetInnerHTML(&self) -> Fallible<DOMString> {
|
||||
let qname = QualName::new(self.prefix().clone(),
|
||||
self.namespace().clone(),
|
||||
|
@ -2075,7 +2075,7 @@ impl ElementMethods for Element {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/DOM-Parsing/#widl-Element-innerHTML
|
||||
/// <https://w3c.github.io/DOM-Parsing/#widl-Element-innerHTML>
|
||||
fn SetInnerHTML(&self, value: DOMString) -> ErrorResult {
|
||||
// Step 1.
|
||||
let frag = self.parse_fragment(value)?;
|
||||
|
@ -2779,7 +2779,7 @@ impl Element {
|
|||
|
||||
/// Please call this method *only* for real click events
|
||||
///
|
||||
/// https://html.spec.whatwg.org/multipage/#run-authentic-click-activation-steps
|
||||
/// <https://html.spec.whatwg.org/multipage/#run-authentic-click-activation-steps>
|
||||
///
|
||||
/// Use an element's synthetic click activation (or handle_event) for any script-triggered clicks.
|
||||
/// If the spec says otherwise, check with Manishearth first
|
||||
|
@ -2859,7 +2859,7 @@ impl Element {
|
|||
self.state.get().contains(IN_ACTIVE_STATE)
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#concept-selector-active
|
||||
/// <https://html.spec.whatwg.org/multipage/#concept-selector-active>
|
||||
pub fn set_active_state(&self, value: bool) {
|
||||
self.set_state(IN_ACTIVE_STATE, value);
|
||||
|
||||
|
@ -2936,7 +2936,7 @@ impl Element {
|
|||
self.set_state(IN_FULLSCREEN_STATE, value)
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#connected
|
||||
/// <https://dom.spec.whatwg.org/#connected>
|
||||
pub fn is_connected(&self) -> bool {
|
||||
let node = self.upcast::<Node>();
|
||||
let root = node.GetRootNode();
|
||||
|
@ -2998,11 +2998,11 @@ impl Element {
|
|||
#[derive(Clone, Copy)]
|
||||
pub enum AttributeMutation<'a> {
|
||||
/// The attribute is set, keep track of old value.
|
||||
/// https://dom.spec.whatwg.org/#attribute-is-set
|
||||
/// <https://dom.spec.whatwg.org/#attribute-is-set>
|
||||
Set(Option<&'a AttrValue>),
|
||||
|
||||
/// The attribute is removed.
|
||||
/// https://dom.spec.whatwg.org/#attribute-is-removed
|
||||
/// <https://dom.spec.whatwg.org/#attribute-is-removed>
|
||||
Removed,
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ const DEFAULT_RECONNECTION_TIME: u64 = 5000;
|
|||
struct GenerationId(u32);
|
||||
|
||||
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-eventsource-readystate
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-eventsource-readystate>
|
||||
enum ReadyState {
|
||||
Connecting = 0,
|
||||
Open = 1,
|
||||
|
@ -90,7 +90,7 @@ struct EventSourceContext {
|
|||
}
|
||||
|
||||
impl EventSourceContext {
|
||||
/// https://html.spec.whatwg.org/multipage/#announce-the-connection
|
||||
/// <https://html.spec.whatwg.org/multipage/#announce-the-connection>
|
||||
fn announce_the_connection(&self) {
|
||||
let event_source = self.event_source.root();
|
||||
if self.gen_id != event_source.generation_id.get() {
|
||||
|
@ -111,7 +111,7 @@ impl EventSourceContext {
|
|||
);
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#fail-the-connection
|
||||
/// <https://html.spec.whatwg.org/multipage/#fail-the-connection>
|
||||
fn fail_the_connection(&self) {
|
||||
let event_source = self.event_source.root();
|
||||
if self.gen_id != event_source.generation_id.get() {
|
||||
|
|
|
@ -71,7 +71,7 @@ pub enum ListenerPhase {
|
|||
Bubbling,
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#internal-raw-uncompiled-handler
|
||||
/// <https://html.spec.whatwg.org/multipage/#internal-raw-uncompiled-handler>
|
||||
#[derive(Clone, JSTraceable, PartialEq)]
|
||||
struct InternalRawUncompiledHandler {
|
||||
source: DOMString,
|
||||
|
@ -90,7 +90,7 @@ enum InlineEventListener {
|
|||
impl InlineEventListener {
|
||||
/// Get a compiled representation of this event handler, compiling it from its
|
||||
/// raw source if necessary.
|
||||
/// https://html.spec.whatwg.org/multipage/#getting-the-current-value-of-the-event-handler
|
||||
/// <https://html.spec.whatwg.org/multipage/#getting-the-current-value-of-the-event-handler>
|
||||
fn get_compiled_handler(&mut self, owner: &EventTarget, ty: &Atom)
|
||||
-> Option<CommonEventHandler> {
|
||||
match mem::replace(self, InlineEventListener::Null) {
|
||||
|
@ -314,7 +314,7 @@ impl EventTarget {
|
|||
*self.handlers.borrow_mut() = Default::default();
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#event-handler-attributes:event-handlers-11
|
||||
/// <https://html.spec.whatwg.org/multipage/#event-handler-attributes:event-handlers-11>
|
||||
fn set_inline_event_listener(&self,
|
||||
ty: Atom,
|
||||
listener: Option<InlineEventListener>) {
|
||||
|
@ -353,7 +353,7 @@ impl EventTarget {
|
|||
}
|
||||
|
||||
/// Store the raw uncompiled event handler for on-demand compilation later.
|
||||
/// https://html.spec.whatwg.org/multipage/#event-handler-attributes:event-handler-content-attributes-3
|
||||
/// <https://html.spec.whatwg.org/multipage/#event-handler-attributes:event-handler-content-attributes-3>
|
||||
pub fn set_event_handler_uncompiled(&self,
|
||||
url: ServoUrl,
|
||||
line: usize,
|
||||
|
|
|
@ -90,7 +90,7 @@ pub struct GlobalScope {
|
|||
#[ignore_heap_size_of = "channels are hard"]
|
||||
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#in-error-reporting-mode
|
||||
/// <https://html.spec.whatwg.org/multipage/#in-error-reporting-mode>
|
||||
in_error_reporting_mode: Cell<bool>,
|
||||
|
||||
/// Associated resource threads for use by DOM objects like XMLHttpRequest,
|
||||
|
@ -107,7 +107,7 @@ pub struct GlobalScope {
|
|||
/// It is refcounted because windows in the same script thread share the
|
||||
/// same microtask queue.
|
||||
///
|
||||
/// https://html.spec.whatwg.org/multipage/#microtask-queue
|
||||
/// <https://html.spec.whatwg.org/multipage/#microtask-queue>
|
||||
#[ignore_heap_size_of = "Rc<T> is hard"]
|
||||
microtask_queue: Rc<MicrotaskQueue>,
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ impl GlobalScope {
|
|||
self.downcast::<Window>().expect("expected a Window scope")
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#report-the-error
|
||||
/// <https://html.spec.whatwg.org/multipage/#report-the-error>
|
||||
pub fn report_an_error(&self, error_info: ErrorInfo, value: HandleValue) {
|
||||
// Step 1.
|
||||
if self.in_error_reporting_mode.get() {
|
||||
|
|
|
@ -576,12 +576,12 @@ impl Activatable for HTMLAnchorElement {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name
|
||||
/// <https://html.spec.whatwg.org/multipage/#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>
|
||||
fn is_current_browsing_context(target: DOMString) -> bool {
|
||||
target.is_empty() || target == "_self"
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#following-hyperlinks-2
|
||||
/// <https://html.spec.whatwg.org/multipage/#following-hyperlinks-2>
|
||||
pub fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<String>, referrer_policy: Option<ReferrerPolicy>) {
|
||||
// Step 1: replace.
|
||||
// Step 2: source browsing context.
|
||||
|
|
|
@ -38,7 +38,7 @@ impl HTMLBaseElement {
|
|||
HTMLBaseElementBinding::Wrap)
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#frozen-base-url
|
||||
/// <https://html.spec.whatwg.org/multipage/#frozen-base-url>
|
||||
pub fn frozen_base_url(&self) -> ServoUrl {
|
||||
let href = self.upcast::<Element>().get_attribute(&ns!(), &local_name!("href"))
|
||||
.expect("The frozen base url is only defined for base elements \
|
||||
|
|
|
@ -48,7 +48,7 @@ impl HTMLBodyElement {
|
|||
HTMLBodyElementBinding::Wrap)
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/cssom-view/#the-html-body-element
|
||||
/// <https://drafts.csswg.org/cssom-view/#the-html-body-element>
|
||||
pub fn is_the_html_body_element(&self) -> bool {
|
||||
let self_node = self.upcast::<Node>();
|
||||
let root_elem = self.upcast::<Element>().root_element();
|
||||
|
|
|
@ -144,7 +144,7 @@ impl HTMLButtonElementMethods for HTMLButtonElement {
|
|||
}
|
||||
|
||||
impl HTMLButtonElement {
|
||||
/// https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set
|
||||
/// <https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set>
|
||||
/// Steps range from 3.1 to 3.7 (specific to HTMLButtonElement)
|
||||
pub fn form_datum(&self, submitter: Option<FormSubmitter>) -> Option<FormDatum> {
|
||||
// Step 3.1: disabled state check is in get_unclean_dataset
|
||||
|
|
|
@ -130,7 +130,7 @@ impl HTMLFontElementLayoutHelpers for LayoutDom<HTMLFontElement> {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#rules-for-parsing-a-legacy-font-size
|
||||
/// <https://html.spec.whatwg.org/multipage/#rules-for-parsing-a-legacy-font-size>
|
||||
fn parse_size(mut input: &str) -> AttrValue {
|
||||
let original_input = input;
|
||||
// Steps 1 & 2 are not relevant
|
||||
|
|
|
@ -452,7 +452,7 @@ impl HTMLFormElement {
|
|||
}
|
||||
|
||||
/// Interactively validate the constraints of form elements
|
||||
/// https://html.spec.whatwg.org/multipage/#interactively-validate-the-constraints
|
||||
/// <https://html.spec.whatwg.org/multipage/#interactively-validate-the-constraints>
|
||||
fn interactive_validation(&self) -> Result<(), ()> {
|
||||
// Step 1-3
|
||||
let _unhandled_invalid_controls = match self.static_validation() {
|
||||
|
@ -466,7 +466,7 @@ impl HTMLFormElement {
|
|||
}
|
||||
|
||||
/// Statitically validate the constraints of form elements
|
||||
/// https://html.spec.whatwg.org/multipage/#statically-validate-the-constraints
|
||||
/// <https://html.spec.whatwg.org/multipage/#statically-validate-the-constraints>
|
||||
fn static_validation(&self) -> Result<(), Vec<FormSubmittableElement>> {
|
||||
let node = self.upcast::<Node>();
|
||||
// FIXME(#3553): This is an incorrect way of getting controls owned by the
|
||||
|
@ -506,7 +506,7 @@ impl HTMLFormElement {
|
|||
Err(unhandled_invalid_controls)
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set
|
||||
/// <https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set>
|
||||
/// Steps range from 1 to 3
|
||||
fn get_unclean_dataset(&self, submitter: Option<FormSubmitter>) -> Vec<FormDatum> {
|
||||
let controls = self.controls.borrow();
|
||||
|
@ -564,7 +564,7 @@ impl HTMLFormElement {
|
|||
// https://html.spec.whatwg.org/multipage/#the-directionality
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set
|
||||
/// <https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set>
|
||||
pub fn get_form_dataset(&self, submitter: Option<FormSubmitter>) -> Vec<FormDatum> {
|
||||
fn clean_crlf(s: &str) -> DOMString {
|
||||
// Step 4
|
||||
|
|
|
@ -39,7 +39,7 @@ impl HTMLHeadElement {
|
|||
HTMLHeadElementBinding::Wrap)
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#meta-referrer
|
||||
/// <https://html.spec.whatwg.org/multipage/#meta-referrer>
|
||||
pub fn set_document_referrer(&self) {
|
||||
let doc = document_from_node(self);
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ impl HTMLIFrameElement {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#process-the-iframe-attributes
|
||||
/// <https://html.spec.whatwg.org/multipage/#process-the-iframe-attributes>
|
||||
fn process_the_iframe_attributes(&self, mode: ProcessingMode) {
|
||||
// TODO: srcdoc
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ impl HTMLImageElement {
|
|||
window.add_pending_reflow();
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#abort-the-image-request
|
||||
/// <https://html.spec.whatwg.org/multipage/#abort-the-image-request>
|
||||
fn abort_request(&self, state: State, request: ImageRequestPhase) {
|
||||
let mut request = match request {
|
||||
ImageRequestPhase::Current => self.current_request.borrow_mut(),
|
||||
|
@ -369,7 +369,7 @@ impl HTMLImageElement {
|
|||
request.metadata = None;
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#update-the-source-set
|
||||
/// <https://html.spec.whatwg.org/multipage/#update-the-source-set>
|
||||
fn update_source_set(&self) -> Vec<DOMString> {
|
||||
let elem = self.upcast::<Element>();
|
||||
// TODO: follow the algorithm
|
||||
|
@ -380,7 +380,7 @@ impl HTMLImageElement {
|
|||
vec![src]
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#select-an-image-source
|
||||
/// <https://html.spec.whatwg.org/multipage/#select-an-image-source>
|
||||
fn select_image_source(&self) -> Option<DOMString> {
|
||||
// TODO: select an image source from source set
|
||||
self.update_source_set().first().cloned()
|
||||
|
@ -536,7 +536,7 @@ impl HTMLImageElement {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#update-the-image-data
|
||||
/// <https://html.spec.whatwg.org/multipage/#update-the-image-data>
|
||||
fn update_the_image_data(&self) {
|
||||
let document = document_from_node(self);
|
||||
let window = document.window();
|
||||
|
|
|
@ -669,7 +669,7 @@ impl HTMLInputElement {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set
|
||||
/// <https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set>
|
||||
/// Steps range from 3.1 to 3.7 (specific to HTMLInputElement)
|
||||
pub fn form_datums(&self, submitter: Option<FormSubmitter>) -> Vec<FormDatum> {
|
||||
// 3.1: disabled state check is in get_unclean_dataset
|
||||
|
|
|
@ -55,7 +55,7 @@ pub struct HTMLLinkElement {
|
|||
stylesheet: DomRefCell<Option<Arc<Stylesheet>>>,
|
||||
cssom_stylesheet: MutNullableDom<CSSStyleSheet>,
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts
|
||||
/// <https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts>
|
||||
parser_inserted: Cell<bool>,
|
||||
/// The number of loads that this link element has triggered (could be more
|
||||
/// than one because of imports) and have not yet finished.
|
||||
|
@ -156,7 +156,7 @@ fn string_is_stylesheet(value: &Option<String>) -> bool {
|
|||
|
||||
/// Favicon spec usage in accordance with CEF implementation:
|
||||
/// only url of icon is required/used
|
||||
/// https://html.spec.whatwg.org/multipage/#rel-icon
|
||||
/// <https://html.spec.whatwg.org/multipage/#rel-icon>
|
||||
fn is_favicon(value: &Option<String>) -> bool {
|
||||
match *value {
|
||||
Some(ref value) => {
|
||||
|
@ -250,7 +250,7 @@ impl VirtualMethods for HTMLLinkElement {
|
|||
|
||||
|
||||
impl HTMLLinkElement {
|
||||
/// https://html.spec.whatwg.org/multipage/#concept-link-obtain
|
||||
/// <https://html.spec.whatwg.org/multipage/#concept-link-obtain>
|
||||
fn handle_stylesheet_url(&self, href: &str) {
|
||||
let document = document_from_node(self);
|
||||
if document.browsing_context().is_none() {
|
||||
|
|
|
@ -54,29 +54,29 @@ use time::{self, Timespec, Duration};
|
|||
// media element event task source.
|
||||
pub struct HTMLMediaElement {
|
||||
htmlelement: HTMLElement,
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-networkstate
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-networkstate>
|
||||
network_state: Cell<NetworkState>,
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-readystate
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-readystate>
|
||||
ready_state: Cell<ReadyState>,
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-srcobject
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-srcobject>
|
||||
src_object: MutNullableDom<Blob>,
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-currentsrc
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-currentsrc>
|
||||
current_src: DomRefCell<String>,
|
||||
/// Incremented whenever tasks associated with this element are cancelled.
|
||||
generation_id: Cell<u32>,
|
||||
/// https://html.spec.whatwg.org/multipage/#fire-loadeddata
|
||||
/// <https://html.spec.whatwg.org/multipage/#fire-loadeddata>
|
||||
///
|
||||
/// Reset to false every time the load algorithm is invoked.
|
||||
fired_loadeddata_event: Cell<bool>,
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-error
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-error>
|
||||
error: MutNullableDom<MediaError>,
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-paused
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-paused>
|
||||
paused: Cell<bool>,
|
||||
/// https://html.spec.whatwg.org/multipage/#attr-media-autoplay
|
||||
/// <https://html.spec.whatwg.org/multipage/#attr-media-autoplay>
|
||||
autoplaying: Cell<bool>,
|
||||
/// https://html.spec.whatwg.org/multipage/#delaying-the-load-event-flag
|
||||
/// <https://html.spec.whatwg.org/multipage/#delaying-the-load-event-flag>
|
||||
delaying_the_load_event_flag: DomRefCell<Option<LoadBlocker>>,
|
||||
/// https://html.spec.whatwg.org/multipage/#list-of-pending-play-promises
|
||||
/// <https://html.spec.whatwg.org/multipage/#list-of-pending-play-promises>
|
||||
#[ignore_heap_size_of = "promises are hard"]
|
||||
pending_play_promises: DomRefCell<Vec<Rc<Promise>>>,
|
||||
/// Play promises which are soon to be fulfilled by a queued task.
|
||||
|
@ -84,7 +84,7 @@ pub struct HTMLMediaElement {
|
|||
in_flight_play_promises_queue: DomRefCell<VecDeque<(Box<[Rc<Promise>]>, ErrorResult)>>,
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-networkstate
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-networkstate>
|
||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
|
||||
#[repr(u8)]
|
||||
pub enum NetworkState {
|
||||
|
@ -94,7 +94,7 @@ pub enum NetworkState {
|
|||
NoSource = HTMLMediaElementConstants::NETWORK_NO_SOURCE as u8,
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-readystate
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-readystate>
|
||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq, PartialOrd)]
|
||||
#[repr(u8)]
|
||||
enum ReadyState {
|
||||
|
@ -145,7 +145,7 @@ impl HTMLMediaElement {
|
|||
/// Nothing happens if the element was already delaying the load event and
|
||||
/// we pass true to that method again.
|
||||
///
|
||||
/// https://html.spec.whatwg.org/multipage/#delaying-the-load-event-flag
|
||||
/// <https://html.spec.whatwg.org/multipage/#delaying-the-load-event-flag>
|
||||
fn delay_load_event(&self, delay: bool) {
|
||||
let mut blocker = self.delaying_the_load_event_flag.borrow_mut();
|
||||
if delay && blocker.is_none() {
|
||||
|
@ -155,7 +155,7 @@ impl HTMLMediaElement {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-media-play
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-media-play>
|
||||
// FIXME(nox): Move this back to HTMLMediaElementMethods::Play once
|
||||
// Rc<Promise> doesn't require #[allow(unrooted_must_root)] anymore.
|
||||
fn play(&self, promise: &Rc<Promise>) {
|
||||
|
@ -236,7 +236,7 @@ impl HTMLMediaElement {
|
|||
// Not applicable here, the promise is returned from Play.
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#internal-pause-steps
|
||||
/// <https://html.spec.whatwg.org/multipage/#internal-pause-steps>
|
||||
fn internal_pause_steps(&self) {
|
||||
// Step 1.
|
||||
self.autoplaying.set(false);
|
||||
|
@ -807,7 +807,7 @@ impl HTMLMediaElement {
|
|||
|
||||
/// Handles insertion of `source` children.
|
||||
///
|
||||
/// https://html.spec.whatwg.org/multipage/#the-source-element:nodes-are-inserted
|
||||
/// <https://html.spec.whatwg.org/multipage/#the-source-element:nodes-are-inserted>
|
||||
pub fn handle_source_child_insertion(&self) {
|
||||
if self.upcast::<Element>().has_attribute(&local_name!("src")) {
|
||||
return;
|
||||
|
|
|
@ -135,7 +135,7 @@ impl HTMLMetaElement {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#meta-referrer
|
||||
/// <https://html.spec.whatwg.org/multipage/#meta-referrer>
|
||||
fn apply_referrer(&self) {
|
||||
if let Some(parent) = self.upcast::<Node>().GetParentElement() {
|
||||
if let Some(head) = parent.downcast::<HTMLHeadElement>() {
|
||||
|
|
|
@ -32,10 +32,10 @@ use style::str::{split_html_space_chars, str_join};
|
|||
pub struct HTMLOptionElement {
|
||||
htmlelement: HTMLElement,
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#attr-option-selected
|
||||
/// <https://html.spec.whatwg.org/multipage/#attr-option-selected>
|
||||
selectedness: Cell<bool>,
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#concept-option-dirtiness
|
||||
/// <https://html.spec.whatwg.org/multipage/#concept-option-dirtiness>
|
||||
dirtiness: Cell<bool>,
|
||||
}
|
||||
|
||||
|
|
|
@ -49,13 +49,13 @@ use uuid::Uuid;
|
|||
pub struct HTMLScriptElement {
|
||||
htmlelement: HTMLElement,
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#already-started
|
||||
/// <https://html.spec.whatwg.org/multipage/#already-started>
|
||||
already_started: Cell<bool>,
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#parser-inserted
|
||||
/// <https://html.spec.whatwg.org/multipage/#parser-inserted>
|
||||
parser_inserted: Cell<bool>,
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#non-blocking
|
||||
/// <https://html.spec.whatwg.org/multipage/#non-blocking>
|
||||
///
|
||||
/// (currently unused)
|
||||
non_blocking: Cell<bool>,
|
||||
|
@ -190,7 +190,7 @@ impl FetchResponseListener for ScriptContext {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#fetch-a-classic-script
|
||||
/// <https://html.spec.whatwg.org/multipage/#fetch-a-classic-script>
|
||||
/// step 4-9
|
||||
fn process_response_eof(&mut self, response: Result<(), NetworkError>) {
|
||||
// Step 5.
|
||||
|
@ -226,7 +226,7 @@ impl FetchResponseListener for ScriptContext {
|
|||
|
||||
impl PreInvoke for ScriptContext {}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#fetch-a-classic-script
|
||||
/// <https://html.spec.whatwg.org/multipage/#fetch-a-classic-script>
|
||||
fn fetch_a_classic_script(script: &HTMLScriptElement,
|
||||
kind: ExternalScriptKind,
|
||||
url: ServoUrl,
|
||||
|
@ -286,7 +286,7 @@ fn fetch_a_classic_script(script: &HTMLScriptElement,
|
|||
}
|
||||
|
||||
impl HTMLScriptElement {
|
||||
/// https://html.spec.whatwg.org/multipage/#prepare-a-script
|
||||
/// <https://html.spec.whatwg.org/multipage/#prepare-a-script>
|
||||
pub fn prepare(&self) {
|
||||
// Step 1.
|
||||
if self.already_started.get() {
|
||||
|
@ -500,7 +500,7 @@ impl HTMLScriptElement {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#execute-the-script-block
|
||||
/// <https://html.spec.whatwg.org/multipage/#execute-the-script-block>
|
||||
pub fn execute(&self, result: Result<ClassicScript, NetworkError>) {
|
||||
// Step 1.
|
||||
let doc = document_from_node(self);
|
||||
|
|
|
@ -44,7 +44,7 @@ impl VirtualMethods for HTMLSourceElement {
|
|||
Some(self.upcast::<HTMLElement>() as &VirtualMethods)
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#the-source-element:nodes-are-inserted
|
||||
/// <https://html.spec.whatwg.org/multipage/#the-source-element:nodes-are-inserted>
|
||||
fn bind_to_tree(&self, tree_in_doc: bool) {
|
||||
self.super_type().unwrap().bind_to_tree(tree_in_doc);
|
||||
let parent = self.upcast::<Node>().GetParentNode().unwrap();
|
||||
|
|
|
@ -34,7 +34,7 @@ pub struct HTMLStyleElement {
|
|||
#[ignore_heap_size_of = "Arc"]
|
||||
stylesheet: DomRefCell<Option<Arc<Stylesheet>>>,
|
||||
cssom_stylesheet: MutNullableDom<CSSStyleSheet>,
|
||||
/// https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts
|
||||
/// <https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts>
|
||||
parser_inserted: Cell<bool>,
|
||||
in_stack_of_open_elements: Cell<bool>,
|
||||
pending_loads: Cell<u32>,
|
||||
|
|
|
@ -20,7 +20,7 @@ use html5ever::{LocalName, Prefix};
|
|||
pub struct HTMLTemplateElement {
|
||||
htmlelement: HTMLElement,
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#template-contents
|
||||
/// <https://html.spec.whatwg.org/multipage/#template-contents>
|
||||
contents: MutNullableDom<DocumentFragment>,
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ impl HTMLTemplateElement {
|
|||
}
|
||||
|
||||
impl HTMLTemplateElementMethods for HTMLTemplateElement {
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-template-content
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-template-content>
|
||||
fn Content(&self) -> DomRoot<DocumentFragment> {
|
||||
self.contents.or_init(|| {
|
||||
let doc = document_from_node(self);
|
||||
|
@ -60,7 +60,7 @@ impl VirtualMethods for HTMLTemplateElement {
|
|||
Some(self.upcast::<HTMLElement>() as &VirtualMethods)
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#template-adopting-steps
|
||||
/// <https://html.spec.whatwg.org/multipage/#template-adopting-steps>
|
||||
fn adopting_steps(&self, old_doc: &Document) {
|
||||
self.super_type().unwrap().adopting_steps(old_doc);
|
||||
// Step 1.
|
||||
|
@ -69,7 +69,7 @@ impl VirtualMethods for HTMLTemplateElement {
|
|||
Node::adopt(self.Content().upcast(), &doc);
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#the-template-element:concept-node-clone-ext
|
||||
/// <https://html.spec.whatwg.org/multipage/#the-template-element:concept-node-clone-ext>
|
||||
fn cloning_steps(&self, copy: &Node, maybe_doc: Option<&Document>,
|
||||
clone_children: CloneChildrenFlag) {
|
||||
self.super_type().unwrap().cloning_steps(copy, maybe_doc, clone_children);
|
||||
|
|
|
@ -134,7 +134,7 @@ impl WeakMediaQueryListVec {
|
|||
}
|
||||
|
||||
/// Evaluate media query lists and report changes
|
||||
/// https://drafts.csswg.org/cssom-view/#evaluate-media-queries-and-report-changes
|
||||
/// <https://drafts.csswg.org/cssom-view/#evaluate-media-queries-and-report-changes>
|
||||
pub fn evaluate_and_report_changes(&self) {
|
||||
rooted_vec!(let mut mql_list);
|
||||
self.cell.borrow_mut().update(|mql| {
|
||||
|
|
|
@ -72,7 +72,7 @@ impl MutationObserver {
|
|||
Ok(observer)
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask
|
||||
/// <https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask>
|
||||
pub fn queue_mutation_observer_compound_microtask() {
|
||||
// Step 1
|
||||
if ScriptThread::is_mutation_observer_compound_microtask_queued() {
|
||||
|
@ -84,7 +84,7 @@ impl MutationObserver {
|
|||
ScriptThread::enqueue_microtask(Microtask::NotifyMutationObservers);
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#notify-mutation-observers
|
||||
/// <https://dom.spec.whatwg.org/#notify-mutation-observers>
|
||||
pub fn notify_mutation_observers() {
|
||||
// Step 1
|
||||
ScriptThread::set_mutation_observer_compound_microtask_queued(false);
|
||||
|
@ -103,7 +103,7 @@ impl MutationObserver {
|
|||
// TODO: Step 6 (slot signals)
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#queueing-a-mutation-record
|
||||
/// <https://dom.spec.whatwg.org/#queueing-a-mutation-record>
|
||||
pub fn queue_a_mutation_record(target: &Node, attr_type: Mutation) {
|
||||
// Step 1
|
||||
let mut interestedObservers: Vec<(DomRoot<MutationObserver>, Option<DOMString>)> = vec![];
|
||||
|
@ -182,7 +182,7 @@ impl MutationObserver {
|
|||
}
|
||||
|
||||
impl MutationObserverMethods for MutationObserver {
|
||||
/// https://dom.spec.whatwg.org/#dom-mutationobserver-observe
|
||||
/// <https://dom.spec.whatwg.org/#dom-mutationobserver-observe>
|
||||
fn Observe(&self, target: &Node, options: &MutationObserverInit) -> Fallible<()> {
|
||||
let attribute_filter = options.attributeFilter.clone().unwrap_or(vec![]);
|
||||
let attribute_old_value = options.attributeOldValue.unwrap_or(false);
|
||||
|
|
|
@ -198,8 +198,8 @@ impl Drop for Node {
|
|||
}
|
||||
|
||||
/// suppress observers flag
|
||||
/// https://dom.spec.whatwg.org/#concept-node-insert
|
||||
/// https://dom.spec.whatwg.org/#concept-node-remove
|
||||
/// <https://dom.spec.whatwg.org/#concept-node-insert>
|
||||
/// <https://dom.spec.whatwg.org/#concept-node-remove>
|
||||
#[derive(Clone, Copy, HeapSizeOf)]
|
||||
enum SuppressObserver {
|
||||
Suppressed,
|
||||
|
@ -764,7 +764,7 @@ impl Node {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#scope-match-a-selectors-string
|
||||
/// <https://dom.spec.whatwg.org/#scope-match-a-selectors-string>
|
||||
/// Get an iterator over all nodes which match a set of selectors
|
||||
/// Be careful not to do anything which may manipulate the DOM tree
|
||||
/// whilst iterating, otherwise the iterator may be invalidated.
|
||||
|
@ -1887,7 +1887,7 @@ impl Node {
|
|||
copy
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#child-text-content
|
||||
/// <https://html.spec.whatwg.org/multipage/#child-text-content>
|
||||
pub fn child_text_content(&self) -> DOMString {
|
||||
Node::collect_text_contents(self.children())
|
||||
}
|
||||
|
|
|
@ -35,12 +35,12 @@ impl PaintSize {
|
|||
}
|
||||
|
||||
impl PaintSizeMethods for PaintSize {
|
||||
/// https://drafts.css-houdini.org/css-paint-api/#paintsize
|
||||
/// <https://drafts.css-houdini.org/css-paint-api/#paintsize>
|
||||
fn Width(&self) -> Finite<f64> {
|
||||
self.width
|
||||
}
|
||||
|
||||
/// https://drafts.css-houdini.org/css-paint-api/#paintsize
|
||||
/// <https://drafts.css-houdini.org/css-paint-api/#paintsize>
|
||||
fn Height(&self) -> Finite<f64> {
|
||||
self.height
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ use style_traits::CSSPixel;
|
|||
use style_traits::DevicePixel;
|
||||
use style_traits::SpeculativePainter;
|
||||
|
||||
/// https://drafts.css-houdini.org/css-paint-api/#paintworkletglobalscope
|
||||
/// <https://drafts.css-houdini.org/css-paint-api/#paintworkletglobalscope>
|
||||
#[dom_struct]
|
||||
pub struct PaintWorkletGlobalScope {
|
||||
/// The worklet global for this object
|
||||
|
@ -70,9 +70,9 @@ pub struct PaintWorkletGlobalScope {
|
|||
/// The image cache
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
image_cache: Arc<ImageCache>,
|
||||
/// https://drafts.css-houdini.org/css-paint-api/#paint-definitions
|
||||
/// <https://drafts.css-houdini.org/css-paint-api/#paint-definitions>
|
||||
paint_definitions: DomRefCell<HashMap<Atom, Box<PaintDefinition>>>,
|
||||
/// https://drafts.css-houdini.org/css-paint-api/#paint-class-instances
|
||||
/// <https://drafts.css-houdini.org/css-paint-api/#paint-class-instances>
|
||||
paint_class_instances: DomRefCell<HashMap<Atom, Box<Heap<JSVal>>>>,
|
||||
/// The most recent name the worklet was called with
|
||||
cached_name: DomRefCell<Atom>,
|
||||
|
@ -169,7 +169,7 @@ impl PaintWorkletGlobalScope {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.css-houdini.org/css-paint-api/#draw-a-paint-image
|
||||
/// <https://drafts.css-houdini.org/css-paint-api/#draw-a-paint-image>
|
||||
fn draw_a_paint_image(&self,
|
||||
name: &Atom,
|
||||
size_in_px: TypedSize2D<f32, CSSPixel>,
|
||||
|
@ -187,7 +187,7 @@ impl PaintWorkletGlobalScope {
|
|||
self.invoke_a_paint_callback(name, size_in_px, size_in_dpx, device_pixel_ratio, properties, arguments)
|
||||
}
|
||||
|
||||
/// https://drafts.css-houdini.org/css-paint-api/#invoke-a-paint-callback
|
||||
/// <https://drafts.css-houdini.org/css-paint-api/#invoke-a-paint-callback>
|
||||
#[allow(unsafe_code)]
|
||||
fn invoke_a_paint_callback(&self,
|
||||
name: &Atom,
|
||||
|
@ -367,7 +367,7 @@ impl PaintWorkletGlobalScope {
|
|||
impl PaintWorkletGlobalScopeMethods for PaintWorkletGlobalScope {
|
||||
#[allow(unsafe_code)]
|
||||
#[allow(unrooted_must_root)]
|
||||
/// https://drafts.css-houdini.org/css-paint-api/#dom-paintworkletglobalscope-registerpaint
|
||||
/// <https://drafts.css-houdini.org/css-paint-api/#dom-paintworkletglobalscope-registerpaint>
|
||||
fn RegisterPaint(&self, name: DOMString, paint_ctor: Rc<VoidFunction>) -> Fallible<()> {
|
||||
let name = Atom::from(name);
|
||||
let cx = self.worklet_global.get_cx();
|
||||
|
@ -461,7 +461,7 @@ pub enum PaintWorkletTask {
|
|||
}
|
||||
|
||||
/// A paint definition
|
||||
/// https://drafts.css-houdini.org/css-paint-api/#paint-definition
|
||||
/// <https://drafts.css-houdini.org/css-paint-api/#paint-definition>
|
||||
/// This type is dangerous, because it contains uboxed `Heap<JSVal>` values,
|
||||
/// which can't be moved.
|
||||
#[derive(HeapSizeOf, JSTraceable)]
|
||||
|
|
|
@ -199,7 +199,7 @@ impl Performance {
|
|||
/// notify the observers if no other notification task is already queued.
|
||||
///
|
||||
/// Algorithm spec:
|
||||
/// https://w3c.github.io/performance-timeline/#queue-a-performanceentry
|
||||
/// <https://w3c.github.io/performance-timeline/#queue-a-performanceentry>
|
||||
pub fn queue_entry(&self, entry: &PerformanceEntry,
|
||||
add_to_performance_entries_buffer: bool) {
|
||||
// Steps 1-3.
|
||||
|
@ -233,7 +233,7 @@ impl Performance {
|
|||
/// Observers notifications task.
|
||||
///
|
||||
/// Algorithm spec (step 7):
|
||||
/// https://w3c.github.io/performance-timeline/#queue-a-performanceentry
|
||||
/// <https://w3c.github.io/performance-timeline/#queue-a-performanceentry>
|
||||
pub fn notify_observers(&self) {
|
||||
// Step 7.1.
|
||||
self.pending_notification_observers_task.set(false);
|
||||
|
|
|
@ -1031,19 +1031,19 @@ impl WeakRangeVec {
|
|||
}
|
||||
|
||||
/// Used for steps 2.1-2. when inserting a node.
|
||||
/// https://dom.spec.whatwg.org/#concept-node-insert
|
||||
/// <https://dom.spec.whatwg.org/#concept-node-insert>
|
||||
pub fn increase_above(&self, node: &Node, offset: u32, delta: u32) {
|
||||
self.map_offset_above(node, offset, |offset| offset + delta);
|
||||
}
|
||||
|
||||
/// Used for steps 4-5. when removing a node.
|
||||
/// https://dom.spec.whatwg.org/#concept-node-remove
|
||||
/// <https://dom.spec.whatwg.org/#concept-node-remove>
|
||||
pub fn decrease_above(&self, node: &Node, offset: u32, delta: u32) {
|
||||
self.map_offset_above(node, offset, |offset| offset - delta);
|
||||
}
|
||||
|
||||
/// Used for steps 2-3. when removing a node.
|
||||
/// https://dom.spec.whatwg.org/#concept-node-remove
|
||||
/// <https://dom.spec.whatwg.org/#concept-node-remove>
|
||||
pub fn drain_to_parent(&self, context: &UnbindContext, child: &Node) {
|
||||
if self.is_empty() {
|
||||
return;
|
||||
|
@ -1072,7 +1072,7 @@ impl WeakRangeVec {
|
|||
}
|
||||
|
||||
/// Used for steps 7.1-2. when normalizing a node.
|
||||
/// https://dom.spec.whatwg.org/#dom-node-normalize
|
||||
/// <https://dom.spec.whatwg.org/#dom-node-normalize>
|
||||
pub fn drain_to_preceding_text_sibling(&self, node: &Node, sibling: &Node, length: u32) {
|
||||
if self.is_empty() {
|
||||
return;
|
||||
|
@ -1099,7 +1099,7 @@ impl WeakRangeVec {
|
|||
}
|
||||
|
||||
/// Used for steps 7.3-4. when normalizing a node.
|
||||
/// https://dom.spec.whatwg.org/#dom-node-normalize
|
||||
/// <https://dom.spec.whatwg.org/#dom-node-normalize>
|
||||
pub fn move_to_text_child_at(&self,
|
||||
node: &Node, offset: u32,
|
||||
child: &Node, new_offset: u32) {
|
||||
|
@ -1142,7 +1142,7 @@ impl WeakRangeVec {
|
|||
}
|
||||
|
||||
/// Used for steps 8-11. when replacing character data.
|
||||
/// https://dom.spec.whatwg.org/#concept-cd-replace
|
||||
/// <https://dom.spec.whatwg.org/#concept-cd-replace>
|
||||
pub fn replace_code_units(&self,
|
||||
node: &Node, offset: u32,
|
||||
removed_code_units: u32, added_code_units: u32) {
|
||||
|
@ -1156,7 +1156,7 @@ impl WeakRangeVec {
|
|||
}
|
||||
|
||||
/// Used for steps 7.2-3. when splitting a text node.
|
||||
/// https://dom.spec.whatwg.org/#concept-text-split
|
||||
/// <https://dom.spec.whatwg.org/#concept-text-split>
|
||||
pub fn move_to_following_text_sibling_above(&self,
|
||||
node: &Node, offset: u32,
|
||||
sibling: &Node) {
|
||||
|
@ -1202,7 +1202,7 @@ impl WeakRangeVec {
|
|||
}
|
||||
|
||||
/// Used for steps 7.4-5. when splitting a text node.
|
||||
/// https://dom.spec.whatwg.org/#concept-text-split
|
||||
/// <https://dom.spec.whatwg.org/#concept-text-split>
|
||||
pub fn increment_at(&self, node: &Node, offset: u32) {
|
||||
unsafe {
|
||||
(*self.cell.get()).update(|entry| {
|
||||
|
|
|
@ -730,7 +730,7 @@ impl TreeSink for Sink {
|
|||
self.send_op(ParseOperation::ReparentChildren { parent: parent.id, new_parent: new_parent.id });
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#html-integration-point
|
||||
/// <https://html.spec.whatwg.org/multipage/#html-integration-point>
|
||||
/// Specifically, the <annotation-xml> cases.
|
||||
fn is_mathml_annotation_xml_integration_point(&self, handle: &Self::Handle) -> bool {
|
||||
let node_data = self.get_parse_node_data(&handle.id);
|
||||
|
|
|
@ -88,11 +88,11 @@ pub struct ServoParser {
|
|||
last_chunk_received: Cell<bool>,
|
||||
/// Whether this parser should avoid passing any further data to the tokenizer.
|
||||
suspended: Cell<bool>,
|
||||
/// https://html.spec.whatwg.org/multipage/#script-nesting-level
|
||||
/// <https://html.spec.whatwg.org/multipage/#script-nesting-level>
|
||||
script_nesting_level: Cell<usize>,
|
||||
/// https://html.spec.whatwg.org/multipage/#abort-a-parser
|
||||
/// <https://html.spec.whatwg.org/multipage/#abort-a-parser>
|
||||
aborted: Cell<bool>,
|
||||
/// https://html.spec.whatwg.org/multipage/#script-created-parser
|
||||
/// <https://html.spec.whatwg.org/multipage/#script-created-parser>
|
||||
script_created_parser: bool,
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ impl ServoParser {
|
|||
|
||||
/// Corresponds to the latter part of the "Otherwise" branch of the 'An end
|
||||
/// tag whose tag name is "script"' of
|
||||
/// https://html.spec.whatwg.org/multipage/#parsing-main-incdata
|
||||
/// <https://html.spec.whatwg.org/multipage/#parsing-main-incdata>
|
||||
///
|
||||
/// This first moves everything from the script input to the beginning of
|
||||
/// the network input, effectively resetting the insertion point to just
|
||||
|
@ -930,7 +930,7 @@ impl TreeSink for Sink {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#html-integration-point
|
||||
/// <https://html.spec.whatwg.org/multipage/#html-integration-point>
|
||||
/// Specifically, the <annotation-xml> cases.
|
||||
fn is_mathml_annotation_xml_integration_point(&self, handle: &Dom<Node>) -> bool {
|
||||
let elem = handle.downcast::<Element>().unwrap();
|
||||
|
|
|
@ -147,7 +147,7 @@ impl StorageMethods for Storage {
|
|||
|
||||
|
||||
impl Storage {
|
||||
/// https://html.spec.whatwg.org/multipage/#send-a-storage-notification
|
||||
/// <https://html.spec.whatwg.org/multipage/#send-a-storage-notification>
|
||||
fn broadcast_change_notification(&self, key: Option<String>, old_value: Option<String>,
|
||||
new_value: Option<String>) {
|
||||
let storage = self.storage_type;
|
||||
|
@ -156,7 +156,7 @@ impl Storage {
|
|||
self.global().script_to_constellation_chan().send(msg).unwrap();
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#send-a-storage-notification
|
||||
/// <https://html.spec.whatwg.org/multipage/#send-a-storage-notification>
|
||||
pub fn queue_storage_event(
|
||||
&self,
|
||||
url: ServoUrl,
|
||||
|
|
|
@ -53,19 +53,19 @@ impl StylePropertyMapReadOnly {
|
|||
}
|
||||
|
||||
impl StylePropertyMapReadOnlyMethods for StylePropertyMapReadOnly {
|
||||
/// https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymapreadonly-get
|
||||
/// <https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymapreadonly-get>
|
||||
fn Get(&self, property: DOMString) -> Option<DomRoot<CSSStyleValue>> {
|
||||
// TODO: avoid constructing an Atom
|
||||
self.entries.get(&Atom::from(property)).map(|value| DomRoot::from_ref(&**value))
|
||||
}
|
||||
|
||||
/// https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymapreadonly-has
|
||||
/// <https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymapreadonly-has>
|
||||
fn Has(&self, property: DOMString) -> bool {
|
||||
// TODO: avoid constructing an Atom
|
||||
self.entries.contains_key(&Atom::from(property))
|
||||
}
|
||||
|
||||
/// https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymapreadonly-getproperties
|
||||
/// <https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymapreadonly-getproperties>
|
||||
fn GetProperties(&self) -> Vec<DOMString> {
|
||||
let mut result: Vec<DOMString> = self.entries.keys()
|
||||
.map(|key| DOMString::from(&**key))
|
||||
|
|
|
@ -42,7 +42,7 @@ impl TextDecoder {
|
|||
TextDecoderBinding::Wrap)
|
||||
}
|
||||
|
||||
/// https://encoding.spec.whatwg.org/#dom-textdecoder
|
||||
/// <https://encoding.spec.whatwg.org/#dom-textdecoder>
|
||||
pub fn Constructor(global: &GlobalScope,
|
||||
label: DOMString,
|
||||
options: &TextDecoderBinding::TextDecoderOptions)
|
||||
|
|
|
@ -60,42 +60,42 @@ impl Touch {
|
|||
}
|
||||
|
||||
impl TouchMethods for Touch {
|
||||
/// https://w3c.github.io/touch-events/#widl-Touch-identifier
|
||||
/// <https://w3c.github.io/touch-events/#widl-Touch-identifier>
|
||||
fn Identifier(&self) -> i32 {
|
||||
self.identifier
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/touch-events/#widl-Touch-target
|
||||
/// <https://w3c.github.io/touch-events/#widl-Touch-target>
|
||||
fn Target(&self) -> DomRoot<EventTarget> {
|
||||
self.target.get()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/touch-events/#widl-Touch-screenX
|
||||
/// <https://w3c.github.io/touch-events/#widl-Touch-screenX>
|
||||
fn ScreenX(&self) -> Finite<f64> {
|
||||
Finite::wrap(self.screen_x)
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/touch-events/#widl-Touch-screenY
|
||||
/// <https://w3c.github.io/touch-events/#widl-Touch-screenY>
|
||||
fn ScreenY(&self) -> Finite<f64> {
|
||||
Finite::wrap(self.screen_y)
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/touch-events/#widl-Touch-clientX
|
||||
/// <https://w3c.github.io/touch-events/#widl-Touch-clientX>
|
||||
fn ClientX(&self) -> Finite<f64> {
|
||||
Finite::wrap(self.client_x)
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/touch-events/#widl-Touch-clientY
|
||||
/// <https://w3c.github.io/touch-events/#widl-Touch-clientY>
|
||||
fn ClientY(&self) -> Finite<f64> {
|
||||
Finite::wrap(self.client_y)
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/touch-events/#widl-Touch-clientX
|
||||
/// <https://w3c.github.io/touch-events/#widl-Touch-clientX>
|
||||
fn PageX(&self) -> Finite<f64> {
|
||||
Finite::wrap(self.page_x)
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/touch-events/#widl-Touch-clientY
|
||||
/// <https://w3c.github.io/touch-events/#widl-Touch-clientY>
|
||||
fn PageY(&self) -> Finite<f64> {
|
||||
Finite::wrap(self.page_y)
|
||||
}
|
||||
|
|
|
@ -80,42 +80,42 @@ impl TouchEvent {
|
|||
}
|
||||
|
||||
impl<'a> TouchEventMethods for &'a TouchEvent {
|
||||
/// https://w3c.github.io/touch-events/#widl-TouchEvent-ctrlKey
|
||||
/// <https://w3c.github.io/touch-events/#widl-TouchEvent-ctrlKey>
|
||||
fn CtrlKey(&self) -> bool {
|
||||
self.ctrl_key.get()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/touch-events/#widl-TouchEvent-shiftKey
|
||||
/// <https://w3c.github.io/touch-events/#widl-TouchEvent-shiftKey>
|
||||
fn ShiftKey(&self) -> bool {
|
||||
self.shift_key.get()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/touch-events/#widl-TouchEvent-altKey
|
||||
/// <https://w3c.github.io/touch-events/#widl-TouchEvent-altKey>
|
||||
fn AltKey(&self) -> bool {
|
||||
self.alt_key.get()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/touch-events/#widl-TouchEvent-metaKey
|
||||
/// <https://w3c.github.io/touch-events/#widl-TouchEvent-metaKey>
|
||||
fn MetaKey(&self) -> bool {
|
||||
self.meta_key.get()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/touch-events/#widl-TouchEventInit-touches
|
||||
/// <https://w3c.github.io/touch-events/#widl-TouchEventInit-touches>
|
||||
fn Touches(&self) -> DomRoot<TouchList> {
|
||||
self.touches.get()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/touch-events/#widl-TouchEvent-targetTouches
|
||||
/// <https://w3c.github.io/touch-events/#widl-TouchEvent-targetTouches>
|
||||
fn TargetTouches(&self) -> DomRoot<TouchList> {
|
||||
self.target_touches.get()
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/touch-events/#widl-TouchEvent-changedTouches
|
||||
/// <https://w3c.github.io/touch-events/#widl-TouchEvent-changedTouches>
|
||||
fn ChangedTouches(&self) -> DomRoot<TouchList> {
|
||||
self.changed_touches.get()
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#dom-event-istrusted
|
||||
/// <https://dom.spec.whatwg.org/#dom-event-istrusted>
|
||||
fn IsTrusted(&self) -> bool {
|
||||
self.uievent.IsTrusted()
|
||||
}
|
||||
|
|
|
@ -31,17 +31,17 @@ impl TouchList {
|
|||
}
|
||||
|
||||
impl TouchListMethods for TouchList {
|
||||
/// https://w3c.github.io/touch-events/#widl-TouchList-length
|
||||
/// <https://w3c.github.io/touch-events/#widl-TouchList-length>
|
||||
fn Length(&self) -> u32 {
|
||||
self.touches.len() as u32
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/touch-events/#widl-TouchList-item-getter-Touch-unsigned-long-index
|
||||
/// <https://w3c.github.io/touch-events/#widl-TouchList-item-getter-Touch-unsigned-long-index>
|
||||
fn Item(&self, index: u32) -> Option<DomRoot<Touch>> {
|
||||
self.touches.get(index as usize).map(|js| DomRoot::from_ref(&**js))
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/touch-events/#widl-TouchList-item-getter-Touch-unsigned-long-index
|
||||
/// <https://w3c.github.io/touch-events/#widl-TouchList-item-getter-Touch-unsigned-long-index>
|
||||
fn IndexedGetter(&self, index: u32) -> Option<DomRoot<Touch>> {
|
||||
self.Item(index)
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ pub trait VirtualMethods {
|
|||
fn super_type(&self) -> Option<&VirtualMethods>;
|
||||
|
||||
/// Called when attributes of a node are mutated.
|
||||
/// https://dom.spec.whatwg.org/#attribute-is-set
|
||||
/// https://dom.spec.whatwg.org/#attribute-is-removed
|
||||
/// <https://dom.spec.whatwg.org/#attribute-is-set>
|
||||
/// <https://dom.spec.whatwg.org/#attribute-is-removed>
|
||||
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
||||
if let Some(s) = self.super_type() {
|
||||
s.attribute_mutated(attr, mutation);
|
||||
|
@ -100,7 +100,7 @@ pub trait VirtualMethods {
|
|||
/// Called when a Node is removed from a tree, where 'tree_in_doc'
|
||||
/// indicates whether the tree is part of a Document.
|
||||
/// Implements removing steps:
|
||||
/// https://dom.spec.whatwg.org/#concept-node-remove-ext
|
||||
/// <https://dom.spec.whatwg.org/#concept-node-remove-ext>
|
||||
fn unbind_from_tree(&self, context: &UnbindContext) {
|
||||
if let Some(ref s) = self.super_type() {
|
||||
s.unbind_from_tree(context);
|
||||
|
@ -121,14 +121,14 @@ pub trait VirtualMethods {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#concept-node-adopt-ext
|
||||
/// <https://dom.spec.whatwg.org/#concept-node-adopt-ext>
|
||||
fn adopting_steps(&self, old_doc: &Document) {
|
||||
if let Some(ref s) = self.super_type() {
|
||||
s.adopting_steps(old_doc);
|
||||
}
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#concept-node-clone-ext
|
||||
/// <https://dom.spec.whatwg.org/#concept-node-clone-ext>
|
||||
fn cloning_steps(&self, copy: &Node, maybe_doc: Option<&Document>,
|
||||
clone_children: CloneChildrenFlag) {
|
||||
if let Some(ref s) = self.super_type() {
|
||||
|
|
|
@ -270,7 +270,7 @@ pub struct TexImage2DValidatorResult {
|
|||
}
|
||||
|
||||
/// TexImage2d validator as per
|
||||
/// https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexImage2D.xml
|
||||
/// <https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexImage2D.xml>
|
||||
impl<'a> WebGLValidator for TexImage2DValidator<'a> {
|
||||
type ValidatedOutput = TexImage2DValidatorResult;
|
||||
type Error = TexImageValidationError;
|
||||
|
|
|
@ -129,7 +129,7 @@ impl WebSocket {
|
|||
global, WebSocketBinding::Wrap)
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-websocket
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-websocket>
|
||||
pub fn Constructor(global: &GlobalScope,
|
||||
url: DOMString,
|
||||
protocols: Option<StringOrStringSequence>)
|
||||
|
@ -391,14 +391,14 @@ impl WebSocketMethods for WebSocket {
|
|||
|
||||
|
||||
/// Task queued when *the WebSocket connection is established*.
|
||||
/// https://html.spec.whatwg.org/multipage/#feedback-from-the-protocol:concept-websocket-established
|
||||
/// <https://html.spec.whatwg.org/multipage/#feedback-from-the-protocol:concept-websocket-established>
|
||||
struct ConnectionEstablishedTask {
|
||||
address: Trusted<WebSocket>,
|
||||
protocol_in_use: Option<String>,
|
||||
}
|
||||
|
||||
impl TaskOnce for ConnectionEstablishedTask {
|
||||
/// https://html.spec.whatwg.org/multipage/#feedback-from-the-protocol:concept-websocket-established
|
||||
/// <https://html.spec.whatwg.org/multipage/#feedback-from-the-protocol:concept-websocket-established>
|
||||
fn run_once(self) {
|
||||
let ws = self.address.root();
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ pub struct Window {
|
|||
|
||||
/// Worklets
|
||||
test_worklet: MutNullableDom<Worklet>,
|
||||
/// https://drafts.css-houdini.org/css-paint-api-1/#paint-worklet
|
||||
/// <https://drafts.css-houdini.org/css-paint-api-1/#paint-worklet>
|
||||
paint_worklet: MutNullableDom<Worklet>,
|
||||
/// The Webrender Document id associated with this window.
|
||||
#[ignore_heap_size_of = "defined in webrender_api"]
|
||||
|
@ -360,7 +360,7 @@ impl Window {
|
|||
}
|
||||
|
||||
/// Returns the window proxy if it has not been discarded.
|
||||
/// https://html.spec.whatwg.org/multipage/#a-browsing-context-is-discarded
|
||||
/// <https://html.spec.whatwg.org/multipage/#a-browsing-context-is-discarded>
|
||||
pub fn undiscarded_window_proxy(&self) -> Option<DomRoot<WindowProxy>> {
|
||||
self.window_proxy.get()
|
||||
.and_then(|window_proxy| if window_proxy.is_browsing_context_discarded() {
|
||||
|
@ -742,13 +742,13 @@ impl WindowMethods for Window {
|
|||
base64_atob(atob)
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-window-requestanimationframe
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-window-requestanimationframe>
|
||||
fn RequestAnimationFrame(&self, callback: Rc<FrameRequestCallback>) -> u32 {
|
||||
self.Document()
|
||||
.request_animation_frame(AnimationFrameCallback::FrameRequestCallback { callback })
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-window-cancelanimationframe
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-window-cancelanimationframe>
|
||||
fn CancelAnimationFrame(&self, ident: u32) {
|
||||
let doc = self.Document();
|
||||
doc.cancel_animation_frame(ident);
|
||||
|
@ -1090,7 +1090,7 @@ impl Window {
|
|||
self.ignore_further_async_events.borrow().store(true, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/cssom-view/#dom-window-scroll
|
||||
/// <https://drafts.csswg.org/cssom-view/#dom-window-scroll>
|
||||
pub fn scroll(&self, x_: f64, y_: f64, behavior: ScrollBehavior) {
|
||||
// Step 3
|
||||
let xfinite = if x_.is_finite() { x_ } else { 0.0f64 };
|
||||
|
@ -1144,7 +1144,7 @@ impl Window {
|
|||
None);
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/cssom-view/#perform-a-scroll
|
||||
/// <https://drafts.csswg.org/cssom-view/#perform-a-scroll>
|
||||
pub fn perform_a_scroll(&self,
|
||||
x: f32,
|
||||
y: f32,
|
||||
|
|
|
@ -74,7 +74,7 @@ const WORKLET_THREAD_POOL_SIZE: u32 = 3;
|
|||
const MIN_GC_THRESHOLD: u32 = 1_000_000;
|
||||
|
||||
#[dom_struct]
|
||||
/// https://drafts.css-houdini.org/worklets/#worklet
|
||||
/// <https://drafts.css-houdini.org/worklets/#worklet>
|
||||
pub struct Worklet {
|
||||
reflector: Reflector,
|
||||
window: Dom<Window>,
|
||||
|
@ -109,7 +109,7 @@ impl Worklet {
|
|||
|
||||
impl WorkletMethods for Worklet {
|
||||
#[allow(unrooted_must_root)]
|
||||
/// https://drafts.css-houdini.org/worklets/#dom-worklet-addmodule
|
||||
/// <https://drafts.css-houdini.org/worklets/#dom-worklet-addmodule>
|
||||
fn AddModule(&self, module_url: USVString, options: &WorkletOptions) -> Rc<Promise> {
|
||||
// Step 1.
|
||||
let promise = Promise::new(self.window.upcast());
|
||||
|
@ -159,7 +159,7 @@ impl WorkletId {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.css-houdini.org/worklets/#pending-tasks-struct
|
||||
/// <https://drafts.css-houdini.org/worklets/#pending-tasks-struct>
|
||||
#[derive(Clone, Debug)]
|
||||
struct PendingTasksStruct(Arc<AtomicIsize>);
|
||||
|
||||
|
@ -275,7 +275,7 @@ impl WorkletThreadPool {
|
|||
/// Loads a worklet module into every worklet thread.
|
||||
/// If all of the threads load successfully, the promise is resolved.
|
||||
/// If any of the threads fails to load, the promise is rejected.
|
||||
/// https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script
|
||||
/// <https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script>
|
||||
fn fetch_and_invoke_a_worklet_script(&self,
|
||||
pipeline_id: PipelineId,
|
||||
worklet_id: WorkletId,
|
||||
|
@ -552,7 +552,7 @@ impl WorkletThread {
|
|||
}
|
||||
|
||||
/// Fetch and invoke a worklet script.
|
||||
/// https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script
|
||||
/// <https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script>
|
||||
fn fetch_and_invoke_a_worklet_script(&self,
|
||||
global_scope: &WorkletGlobalScope,
|
||||
pipeline_id: PipelineId,
|
||||
|
|
|
@ -33,7 +33,7 @@ use std::sync::Arc;
|
|||
use std::sync::mpsc::Sender;
|
||||
|
||||
#[dom_struct]
|
||||
/// https://drafts.css-houdini.org/worklets/#workletglobalscope
|
||||
/// <https://drafts.css-houdini.org/worklets/#workletglobalscope>
|
||||
pub struct WorkletGlobalScope {
|
||||
/// The global for this worklet.
|
||||
globalscope: GlobalScope,
|
||||
|
@ -154,7 +154,7 @@ pub struct WorkletGlobalScopeInit {
|
|||
pub image_cache: Arc<ImageCache>,
|
||||
}
|
||||
|
||||
/// https://drafts.css-houdini.org/worklets/#worklet-global-scope-type
|
||||
/// <https://drafts.css-houdini.org/worklets/#worklet-global-scope-type>
|
||||
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable)]
|
||||
pub enum WorkletGlobalScopeType {
|
||||
/// A servo-specific testing worklet
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue