mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
clippy: Fix explicit_auto_deref
warnings in components/script
(#31837)
* clippy: Fix explicit auto-deref warnings * clippy: Fix explicit auto-deref warnings * refactor: Tidy up code * refactor: Fix method not found errors
This commit is contained in:
parent
3fc157338e
commit
3c05b58221
62 changed files with 157 additions and 168 deletions
|
@ -685,7 +685,7 @@ impl Callback for ConsumeBodyPromiseHandler {
|
||||||
.expect("No bytes for ConsumeBodyPromiseHandler.");
|
.expect("No bytes for ConsumeBodyPromiseHandler.");
|
||||||
|
|
||||||
// Append the value property to bytes.
|
// Append the value property to bytes.
|
||||||
bytes.extend_from_slice(&*chunk);
|
bytes.extend_from_slice(&chunk);
|
||||||
|
|
||||||
let global = stream.global();
|
let global = stream.global();
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ pub fn handle_get_children(
|
||||||
node_id: String,
|
node_id: String,
|
||||||
reply: IpcSender<Option<Vec<NodeInfo>>>,
|
reply: IpcSender<Option<Vec<NodeInfo>>>,
|
||||||
) {
|
) {
|
||||||
match find_node_by_unique_id(documents, pipeline, &*node_id) {
|
match find_node_by_unique_id(documents, pipeline, &node_id) {
|
||||||
None => return reply.send(None).unwrap(),
|
None => return reply.send(None).unwrap(),
|
||||||
Some(parent) => {
|
Some(parent) => {
|
||||||
let children = parent.children().map(|child| child.summarize()).collect();
|
let children = parent.children().map(|child| child.summarize()).collect();
|
||||||
|
@ -138,7 +138,7 @@ pub fn handle_get_layout(
|
||||||
node_id: String,
|
node_id: String,
|
||||||
reply: IpcSender<Option<ComputedNodeLayout>>,
|
reply: IpcSender<Option<ComputedNodeLayout>>,
|
||||||
) {
|
) {
|
||||||
let node = match find_node_by_unique_id(documents, pipeline, &*node_id) {
|
let node = match find_node_by_unique_id(documents, pipeline, &node_id) {
|
||||||
None => return reply.send(None).unwrap(),
|
None => return reply.send(None).unwrap(),
|
||||||
Some(found_node) => found_node,
|
Some(found_node) => found_node,
|
||||||
};
|
};
|
||||||
|
@ -198,7 +198,7 @@ pub fn handle_modify_attribute(
|
||||||
node_id: String,
|
node_id: String,
|
||||||
modifications: Vec<Modification>,
|
modifications: Vec<Modification>,
|
||||||
) {
|
) {
|
||||||
let node = match find_node_by_unique_id(documents, pipeline, &*node_id) {
|
let node = match find_node_by_unique_id(documents, pipeline, &node_id) {
|
||||||
None => {
|
None => {
|
||||||
return warn!(
|
return warn!(
|
||||||
"node id {} for pipeline id {} is not found",
|
"node id {} for pipeline id {} is not found",
|
||||||
|
|
|
@ -255,7 +255,7 @@ impl<'dom> AttrHelpersForLayout<'dom> for LayoutDom<'dom, Attr> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn as_str(self) -> &'dom str {
|
fn as_str(self) -> &'dom str {
|
||||||
&**self.value()
|
self.value()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -156,12 +156,12 @@ unsafe fn html_constructor(
|
||||||
// Any prototype used to create these elements will be overwritten before returning
|
// Any prototype used to create these elements will be overwritten before returning
|
||||||
// from this function, so we don't bother overwriting the defaults here.
|
// from this function, so we don't bother overwriting the defaults here.
|
||||||
let element = if definition.is_autonomous() {
|
let element = if definition.is_autonomous() {
|
||||||
DomRoot::upcast(HTMLElement::new(name.local, None, &*document, None))
|
DomRoot::upcast(HTMLElement::new(name.local, None, &document, None))
|
||||||
} else {
|
} else {
|
||||||
create_native_html_element(
|
create_native_html_element(
|
||||||
name,
|
name,
|
||||||
None,
|
None,
|
||||||
&*document,
|
&document,
|
||||||
ElementCreator::ScriptCreated,
|
ElementCreator::ScriptCreated,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
|
@ -176,7 +176,7 @@ unsafe fn html_constructor(
|
||||||
element.set_custom_element_definition(definition.clone());
|
element.set_custom_element_definition(definition.clone());
|
||||||
|
|
||||||
// Step 8.5
|
// Step 8.5
|
||||||
if !check_type(&*element) {
|
if !check_type(&element) {
|
||||||
throw_dom_exception(cx, global, Error::InvalidState);
|
throw_dom_exception(cx, global, Error::InvalidState);
|
||||||
return Err(());
|
return Err(());
|
||||||
} else {
|
} else {
|
||||||
|
@ -193,7 +193,7 @@ unsafe fn html_constructor(
|
||||||
construction_stack.push(ConstructionStackEntry::AlreadyConstructedMarker);
|
construction_stack.push(ConstructionStackEntry::AlreadyConstructedMarker);
|
||||||
|
|
||||||
// Step 13
|
// Step 13
|
||||||
if !check_type(&*element) {
|
if !check_type(&element) {
|
||||||
throw_dom_exception(cx, global, Error::InvalidState);
|
throw_dom_exception(cx, global, Error::InvalidState);
|
||||||
return Err(());
|
return Err(());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -246,7 +246,7 @@ pub unsafe fn report_cross_origin_denial(cx: SafeJSContext, id: RawHandleId, acc
|
||||||
if !JS_IsExceptionPending(*cx) {
|
if !JS_IsExceptionPending(*cx) {
|
||||||
let global = GlobalScope::from_context(*cx, InRealm::Already(&in_realm_proof));
|
let global = GlobalScope::from_context(*cx, InRealm::Already(&in_realm_proof));
|
||||||
// TODO: include `id` and `access` in the exception message
|
// TODO: include `id` and `access` in the exception message
|
||||||
throw_dom_exception(cx, &*global, Error::Security);
|
throw_dom_exception(cx, &global, Error::Security);
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,7 +246,7 @@ impl BlobMethods for Blob {
|
||||||
normalize_type_string(&content_type.unwrap_or(DOMString::from("")).to_string());
|
normalize_type_string(&content_type.unwrap_or(DOMString::from("")).to_string());
|
||||||
let rel_pos = RelativePos::from_opts(start, end);
|
let rel_pos = RelativePos::from_opts(start, end);
|
||||||
let blob_impl = BlobImpl::new_sliced(rel_pos, self.blob_id.clone(), type_string);
|
let blob_impl = BlobImpl::new_sliced(rel_pos, self.blob_id.clone(), type_string);
|
||||||
Blob::new(&*self.global(), blob_impl)
|
Blob::new(&self.global(), blob_impl)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://w3c.github.io/FileAPI/#text-method-algo
|
// https://w3c.github.io/FileAPI/#text-method-algo
|
||||||
|
|
|
@ -649,7 +649,7 @@ fn resolve_uuid_name(
|
||||||
StringOrUnsignedLong::String(dstring) => {
|
StringOrUnsignedLong::String(dstring) => {
|
||||||
// Step 2.
|
// Step 2.
|
||||||
let regex = Regex::new(VALID_UUID_REGEX).unwrap();
|
let regex = Regex::new(VALID_UUID_REGEX).unwrap();
|
||||||
if regex.is_match(&*dstring) {
|
if regex.is_match(&dstring) {
|
||||||
Ok(dstring)
|
Ok(dstring)
|
||||||
} else {
|
} else {
|
||||||
// Step 3.
|
// Step 3.
|
||||||
|
|
|
@ -49,7 +49,7 @@ impl BroadcastChannel {
|
||||||
global,
|
global,
|
||||||
proto,
|
proto,
|
||||||
);
|
);
|
||||||
global.track_broadcast_channel(&*channel);
|
global.track_broadcast_channel(&channel);
|
||||||
channel
|
channel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ pub trait LayoutCanvasRenderingContext2DHelpers {
|
||||||
impl LayoutCanvasRenderingContext2DHelpers for LayoutDom<'_, CanvasRenderingContext2D> {
|
impl LayoutCanvasRenderingContext2DHelpers for LayoutDom<'_, CanvasRenderingContext2D> {
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe fn get_ipc_renderer(self) -> IpcSender<CanvasMsg> {
|
unsafe fn get_ipc_renderer(self) -> IpcSender<CanvasMsg> {
|
||||||
(*self.unsafe_get()).canvas_state.get_ipc_renderer().clone()
|
(self.unsafe_get()).canvas_state.get_ipc_renderer().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
|
|
@ -163,7 +163,7 @@ impl CharacterDataMethods for CharacterData {
|
||||||
// https://dom.spec.whatwg.org/#dom-characterdata-appenddatadata
|
// https://dom.spec.whatwg.org/#dom-characterdata-appenddatadata
|
||||||
fn AppendData(&self, data: DOMString) {
|
fn AppendData(&self, data: DOMString) {
|
||||||
// FIXME(ajeffrey): Efficient append on DOMStrings?
|
// FIXME(ajeffrey): Efficient append on DOMStrings?
|
||||||
self.append_data(&*data);
|
self.append_data(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-characterdata-insertdataoffset-data
|
// https://dom.spec.whatwg.org/#dom-characterdata-insertdataoffset-data
|
||||||
|
|
|
@ -92,7 +92,7 @@ impl CompositionEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn data(&self) -> &str {
|
pub fn data(&self) -> &str {
|
||||||
&*self.data
|
&self.data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ fn create_html_element(
|
||||||
proto,
|
proto,
|
||||||
));
|
));
|
||||||
result.set_custom_element_state(CustomElementState::Undefined);
|
result.set_custom_element_state(CustomElementState::Undefined);
|
||||||
ScriptThread::enqueue_upgrade_reaction(&*result, definition);
|
ScriptThread::enqueue_upgrade_reaction(&result, definition);
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
CustomElementCreationMode::Synchronous => {
|
CustomElementCreationMode::Synchronous => {
|
||||||
|
@ -185,10 +185,10 @@ fn create_html_element(
|
||||||
element.set_custom_element_state(CustomElementState::Undefined);
|
element.set_custom_element_state(CustomElementState::Undefined);
|
||||||
match mode {
|
match mode {
|
||||||
// Step 5.3
|
// Step 5.3
|
||||||
CustomElementCreationMode::Synchronous => upgrade_element(definition, &*element),
|
CustomElementCreationMode::Synchronous => upgrade_element(definition, &element),
|
||||||
// Step 5.4
|
// Step 5.4
|
||||||
CustomElementCreationMode::Asynchronous => {
|
CustomElementCreationMode::Asynchronous => {
|
||||||
ScriptThread::enqueue_upgrade_reaction(&*element, definition)
|
ScriptThread::enqueue_upgrade_reaction(&element, definition)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return element;
|
return element;
|
||||||
|
@ -203,7 +203,7 @@ fn create_html_element(
|
||||||
result.set_custom_element_state(CustomElementState::Undefined);
|
result.set_custom_element_state(CustomElementState::Undefined);
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
if is_valid_custom_element_name(&*name.local) {
|
if is_valid_custom_element_name(&name.local) {
|
||||||
result.set_custom_element_state(CustomElementState::Undefined);
|
result.set_custom_element_state(CustomElementState::Undefined);
|
||||||
} else {
|
} else {
|
||||||
result.set_custom_element_state(CustomElementState::Uncustomized);
|
result.set_custom_element_state(CustomElementState::Uncustomized);
|
||||||
|
@ -383,7 +383,7 @@ pub fn create_native_html_element(
|
||||||
local_name!("video") => make!(HTMLVideoElement),
|
local_name!("video") => make!(HTMLVideoElement),
|
||||||
local_name!("wbr") => make!(HTMLElement),
|
local_name!("wbr") => make!(HTMLElement),
|
||||||
local_name!("xmp") => make!(HTMLPreElement),
|
local_name!("xmp") => make!(HTMLPreElement),
|
||||||
_ if is_valid_custom_element_name(&*name.local) => make!(HTMLElement),
|
_ if is_valid_custom_element_name(&name.local) => make!(HTMLElement),
|
||||||
_ => make!(HTMLUnknownElement),
|
_ => make!(HTMLUnknownElement),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ impl CSSRuleList {
|
||||||
.flatten();
|
.flatten();
|
||||||
let loader = owner
|
let loader = owner
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|element| StylesheetLoader::for_element(&**element));
|
.map(|element| StylesheetLoader::for_element(element));
|
||||||
let new_rule = css_rules.insert_rule(
|
let new_rule = css_rules.insert_rule(
|
||||||
&parent_stylesheet.shared_lock,
|
&parent_stylesheet.shared_lock,
|
||||||
rule,
|
rule,
|
||||||
|
|
|
@ -109,7 +109,7 @@ impl CSSStyleRuleMethods for CSSStyleRule {
|
||||||
url_data: &url_data,
|
url_data: &url_data,
|
||||||
for_supports_rule: false,
|
for_supports_rule: false,
|
||||||
};
|
};
|
||||||
let mut css_parser = CssParserInput::new(&*value);
|
let mut css_parser = CssParserInput::new(&value);
|
||||||
let mut css_parser = CssParser::new(&mut css_parser);
|
let mut css_parser = CssParser::new(&mut css_parser);
|
||||||
// TODO: Maybe allow setting relative selectors from the OM, if we're in a nested style
|
// TODO: Maybe allow setting relative selectors from the OM, if we're in a nested style
|
||||||
// rule?
|
// rule?
|
||||||
|
|
|
@ -44,11 +44,11 @@ impl CSSStyleValue {
|
||||||
/// return relative URLs for computed values, so we pass in a base.
|
/// 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> {
|
pub fn get_url(&self, base_url: ServoUrl) -> Option<ServoUrl> {
|
||||||
let mut input = ParserInput::new(&*self.value);
|
let mut input = ParserInput::new(&self.value);
|
||||||
let mut parser = Parser::new(&mut input);
|
let mut parser = Parser::new(&mut input);
|
||||||
parser
|
parser
|
||||||
.expect_url()
|
.expect_url()
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|string| base_url.join(&*string).ok())
|
.and_then(|string| base_url.join(&string).ok())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -391,7 +391,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
|
||||||
*candidate.namespace() == ns!(html) &&
|
*candidate.namespace() == ns!(html) &&
|
||||||
(extends.is_none() || is.as_ref() == Some(&name))
|
(extends.is_none() || is.as_ref() == Some(&name))
|
||||||
{
|
{
|
||||||
ScriptThread::enqueue_upgrade_reaction(&*candidate, definition.clone());
|
ScriptThread::enqueue_upgrade_reaction(&candidate, definition.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -636,7 +636,7 @@ impl Document {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn window(&self) -> &Window {
|
pub fn window(&self) -> &Window {
|
||||||
&*self.window
|
&self.window
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -2959,12 +2959,12 @@ impl<'dom> LayoutDocumentHelpers<'dom> for LayoutDom<'dom, Document> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn needs_paint_from_layout(self) {
|
unsafe fn needs_paint_from_layout(self) {
|
||||||
(*self.unsafe_get()).needs_paint.set(true)
|
(self.unsafe_get()).needs_paint.set(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn will_paint(self) {
|
unsafe fn will_paint(self) {
|
||||||
(*self.unsafe_get()).needs_paint.set(false)
|
(self.unsafe_get()).needs_paint.set(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -3306,7 +3306,7 @@ impl Document {
|
||||||
proto: Option<HandleObject>,
|
proto: Option<HandleObject>,
|
||||||
) -> Fallible<DomRoot<Document>> {
|
) -> Fallible<DomRoot<Document>> {
|
||||||
let doc = window.Document();
|
let doc = window.Document();
|
||||||
let docloader = DocumentLoader::new(&*doc.loader());
|
let docloader = DocumentLoader::new(&doc.loader());
|
||||||
Ok(Document::new_with_proto(
|
Ok(Document::new_with_proto(
|
||||||
window,
|
window,
|
||||||
proto,
|
proto,
|
||||||
|
@ -4095,8 +4095,7 @@ impl DocumentMethods for Document {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Step 5
|
// Step 5
|
||||||
let host = match get_registrable_domain_suffix_of_or_is_equal_to(&*value, effective_domain)
|
let host = match get_registrable_domain_suffix_of_or_is_equal_to(&value, effective_domain) {
|
||||||
{
|
|
||||||
None => return Err(Error::Security),
|
None => return Err(Error::Security),
|
||||||
Some(host) => host,
|
Some(host) => host,
|
||||||
};
|
};
|
||||||
|
@ -4946,7 +4945,7 @@ impl DocumentMethods for Document {
|
||||||
let mut names_with_first_named_element_map: HashMap<&Atom, &Element> = HashMap::new();
|
let mut names_with_first_named_element_map: HashMap<&Atom, &Element> = HashMap::new();
|
||||||
|
|
||||||
let name_map = self.name_map.borrow();
|
let name_map = self.name_map.borrow();
|
||||||
for (name, elements) in &(*name_map).0 {
|
for (name, elements) in &(name_map).0 {
|
||||||
if name.is_empty() {
|
if name.is_empty() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -4958,7 +4957,7 @@ impl DocumentMethods for Document {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let id_map = self.id_map.borrow();
|
let id_map = self.id_map.borrow();
|
||||||
for (id, elements) in &(*id_map).0 {
|
for (id, elements) in &(id_map).0 {
|
||||||
if id.is_empty() {
|
if id.is_empty() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ impl DOMParserMethods for DOMParser {
|
||||||
.parse()
|
.parse()
|
||||||
.expect("Supported type is not a MIME type");
|
.expect("Supported type is not a MIME type");
|
||||||
let doc = self.window.Document();
|
let doc = self.window.Document();
|
||||||
let loader = DocumentLoader::new(&*doc.loader());
|
let loader = DocumentLoader::new(&doc.loader());
|
||||||
match ty {
|
match ty {
|
||||||
Text_html => {
|
Text_html => {
|
||||||
let document = Document::new(
|
let document = Document::new(
|
||||||
|
|
|
@ -73,10 +73,10 @@ impl DOMQuad {
|
||||||
Ok(DOMQuad::new_with_proto(
|
Ok(DOMQuad::new_with_proto(
|
||||||
global,
|
global,
|
||||||
proto,
|
proto,
|
||||||
&*DOMPoint::new_from_init(global, p1),
|
&DOMPoint::new_from_init(global, p1),
|
||||||
&*DOMPoint::new_from_init(global, p2),
|
&DOMPoint::new_from_init(global, p2),
|
||||||
&*DOMPoint::new_from_init(global, p3),
|
&DOMPoint::new_from_init(global, p3),
|
||||||
&*DOMPoint::new_from_init(global, p4),
|
&DOMPoint::new_from_init(global, p4),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,16 +84,16 @@ impl DOMQuad {
|
||||||
pub fn FromRect(global: &GlobalScope, other: &DOMRectInit) -> DomRoot<DOMQuad> {
|
pub fn FromRect(global: &GlobalScope, other: &DOMRectInit) -> DomRoot<DOMQuad> {
|
||||||
DOMQuad::new(
|
DOMQuad::new(
|
||||||
global,
|
global,
|
||||||
&*DOMPoint::new(global, other.x, other.y, 0f64, 1f64),
|
&DOMPoint::new(global, other.x, other.y, 0f64, 1f64),
|
||||||
&*DOMPoint::new(global, other.x + other.width, other.y, 0f64, 1f64),
|
&DOMPoint::new(global, other.x + other.width, other.y, 0f64, 1f64),
|
||||||
&*DOMPoint::new(
|
&DOMPoint::new(
|
||||||
global,
|
global,
|
||||||
other.x + other.width,
|
other.x + other.width,
|
||||||
other.y + other.height,
|
other.y + other.height,
|
||||||
0f64,
|
0f64,
|
||||||
1f64,
|
1f64,
|
||||||
),
|
),
|
||||||
&*DOMPoint::new(global, other.x, other.y + other.height, 0f64, 1f64),
|
&DOMPoint::new(global, other.x, other.y + other.height, 0f64, 1f64),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -535,14 +535,14 @@ impl Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Steps 4, 5 and 6.
|
// Steps 4, 5 and 6.
|
||||||
let shadow_root = ShadowRoot::new(self, &*self.node.owner_doc());
|
let shadow_root = ShadowRoot::new(self, &self.node.owner_doc());
|
||||||
self.ensure_rare_data().shadow_root = Some(Dom::from_ref(&*shadow_root));
|
self.ensure_rare_data().shadow_root = Some(Dom::from_ref(&*shadow_root));
|
||||||
shadow_root
|
shadow_root
|
||||||
.upcast::<Node>()
|
.upcast::<Node>()
|
||||||
.set_containing_shadow_root(Some(&shadow_root));
|
.set_containing_shadow_root(Some(&shadow_root));
|
||||||
|
|
||||||
if self.is_connected() {
|
if self.is_connected() {
|
||||||
self.node.owner_doc().register_shadow_root(&*shadow_root);
|
self.node.owner_doc().register_shadow_root(&shadow_root);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
||||||
|
@ -1047,22 +1047,22 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn id_attribute(self) -> *const Option<Atom> {
|
fn id_attribute(self) -> *const Option<Atom> {
|
||||||
unsafe { (*self.unsafe_get()).id_attribute.borrow_for_layout() }
|
unsafe { (self.unsafe_get()).id_attribute.borrow_for_layout() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn style_attribute(self) -> *const Option<Arc<Locked<PropertyDeclarationBlock>>> {
|
fn style_attribute(self) -> *const Option<Arc<Locked<PropertyDeclarationBlock>>> {
|
||||||
unsafe { (*self.unsafe_get()).style_attribute.borrow_for_layout() }
|
unsafe { (self.unsafe_get()).style_attribute.borrow_for_layout() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn local_name(self) -> &'dom LocalName {
|
fn local_name(self) -> &'dom LocalName {
|
||||||
unsafe { &(*self.unsafe_get()).local_name }
|
unsafe { &(self.unsafe_get()).local_name }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn namespace(self) -> &'dom Namespace {
|
fn namespace(self) -> &'dom Namespace {
|
||||||
unsafe { &(*self.unsafe_get()).namespace }
|
unsafe { &(self.unsafe_get()).namespace }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_lang_for_layout(self) -> String {
|
fn get_lang_for_layout(self) -> String {
|
||||||
|
@ -1091,7 +1091,7 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn get_state_for_layout(self) -> ElementState {
|
fn get_state_for_layout(self) -> ElementState {
|
||||||
unsafe { (*self.unsafe_get()).state.get() }
|
unsafe { (self.unsafe_get()).state.get() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1099,7 +1099,7 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
|
||||||
fn insert_selector_flags(self, flags: ElementSelectorFlags) {
|
fn insert_selector_flags(self, flags: ElementSelectorFlags) {
|
||||||
debug_assert!(thread_state::get().is_layout());
|
debug_assert!(thread_state::get().is_layout());
|
||||||
unsafe {
|
unsafe {
|
||||||
let f = &(*self.unsafe_get()).selector_flags;
|
let f = &(self.unsafe_get()).selector_flags;
|
||||||
f.set(f.get() | flags);
|
f.set(f.get() | flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1107,7 +1107,7 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn has_selector_flags(self, flags: ElementSelectorFlags) -> bool {
|
fn has_selector_flags(self, flags: ElementSelectorFlags) -> bool {
|
||||||
unsafe { (*self.unsafe_get()).selector_flags.get().contains(flags) }
|
unsafe { (self.unsafe_get()).selector_flags.get().contains(flags) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -3305,7 +3305,7 @@ impl<'a> SelectorsElement for DomRoot<Element> {
|
||||||
// a string containing commas (separating each language tag in
|
// a string containing commas (separating each language tag in
|
||||||
// a list) but the pseudo-class instead should be parsing and
|
// a list) but the pseudo-class instead should be parsing and
|
||||||
// storing separate <ident> or <string>s for each language tag.
|
// storing separate <ident> or <string>s for each language tag.
|
||||||
NonTSPseudoClass::Lang(ref lang) => extended_filtering(&*self.get_lang(), &*lang),
|
NonTSPseudoClass::Lang(ref lang) => extended_filtering(&self.get_lang(), lang),
|
||||||
|
|
||||||
NonTSPseudoClass::ReadOnly => !Element::state(self).contains(pseudo_class.state_flag()),
|
NonTSPseudoClass::ReadOnly => !Element::state(self).contains(pseudo_class.state_flag()),
|
||||||
|
|
||||||
|
@ -3358,7 +3358,7 @@ impl<'a> SelectorsElement for DomRoot<Element> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_class(&self, name: &AtomIdent, case_sensitivity: CaseSensitivity) -> bool {
|
fn has_class(&self, name: &AtomIdent, case_sensitivity: CaseSensitivity) -> bool {
|
||||||
Element::has_class(&**self, name, case_sensitivity)
|
Element::has_class(self, name, case_sensitivity)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_html_element_in_html_document(&self) -> bool {
|
fn is_html_element_in_html_document(&self) -> bool {
|
||||||
|
|
|
@ -234,7 +234,7 @@ impl EventSourceContext {
|
||||||
.to_jsval(*GlobalScope::get_cx(), data.handle_mut())
|
.to_jsval(*GlobalScope::get_cx(), data.handle_mut())
|
||||||
};
|
};
|
||||||
MessageEvent::new(
|
MessageEvent::new(
|
||||||
&*event_source.global(),
|
&event_source.global(),
|
||||||
type_,
|
type_,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
@ -520,7 +520,7 @@ impl EventSource {
|
||||||
// TODO: Step 2 relevant settings object
|
// TODO: Step 2 relevant settings object
|
||||||
// Step 3
|
// Step 3
|
||||||
let base_url = global.api_base_url();
|
let base_url = global.api_base_url();
|
||||||
let url_record = match base_url.join(&*url) {
|
let url_record = match base_url.join(&url) {
|
||||||
Ok(u) => u,
|
Ok(u) => u,
|
||||||
// Step 4
|
// Step 4
|
||||||
Err(_) => return Err(Error::Syntax),
|
Err(_) => return Err(Error::Syntax),
|
||||||
|
|
|
@ -76,7 +76,7 @@ impl FormDataEvent {
|
||||||
Atom::from(type_),
|
Atom::from(type_),
|
||||||
bubbles,
|
bubbles,
|
||||||
cancelable,
|
cancelable,
|
||||||
&*init.formData.clone(),
|
&init.formData.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok(event)
|
Ok(event)
|
||||||
|
|
|
@ -630,7 +630,7 @@ impl FileListener {
|
||||||
|
|
||||||
let task = task!(enqueue_stream_chunk: move || {
|
let task = task!(enqueue_stream_chunk: move || {
|
||||||
let stream = trusted.root();
|
let stream = trusted.root();
|
||||||
stream_handle_incoming(&*stream, Ok(blob_buf.bytes));
|
stream_handle_incoming(&stream, Ok(blob_buf.bytes));
|
||||||
});
|
});
|
||||||
|
|
||||||
let _ = self
|
let _ = self
|
||||||
|
@ -654,7 +654,7 @@ impl FileListener {
|
||||||
|
|
||||||
let task = task!(enqueue_stream_chunk: move || {
|
let task = task!(enqueue_stream_chunk: move || {
|
||||||
let stream = trusted.root();
|
let stream = trusted.root();
|
||||||
stream_handle_incoming(&*stream, Ok(bytes_in));
|
stream_handle_incoming(&stream, Ok(bytes_in));
|
||||||
});
|
});
|
||||||
|
|
||||||
let _ = self
|
let _ = self
|
||||||
|
@ -692,7 +692,7 @@ impl FileListener {
|
||||||
|
|
||||||
let task = task!(enqueue_stream_chunk: move || {
|
let task = task!(enqueue_stream_chunk: move || {
|
||||||
let stream = trusted.root();
|
let stream = trusted.root();
|
||||||
stream_handle_eof(&*stream);
|
stream_handle_eof(&stream);
|
||||||
});
|
});
|
||||||
|
|
||||||
let _ = self
|
let _ = self
|
||||||
|
@ -728,7 +728,7 @@ impl FileListener {
|
||||||
let _ = self.task_source.queue_with_canceller(
|
let _ = self.task_source.queue_with_canceller(
|
||||||
task!(error_stream: move || {
|
task!(error_stream: move || {
|
||||||
let stream = trusted_stream.root();
|
let stream = trusted_stream.root();
|
||||||
stream_handle_incoming(&*stream, error);
|
stream_handle_incoming(&stream, error);
|
||||||
}),
|
}),
|
||||||
&self.task_canceller,
|
&self.task_canceller,
|
||||||
);
|
);
|
||||||
|
@ -875,7 +875,7 @@ impl GlobalScope {
|
||||||
// Step 2.6
|
// Step 2.6
|
||||||
if let Some(worker_id) = installing_worker {
|
if let Some(worker_id) = installing_worker {
|
||||||
let worker = self.get_serviceworker(script_url, scope, worker_id);
|
let worker = self.get_serviceworker(script_url, scope, worker_id);
|
||||||
new_registration.set_installing(&*worker);
|
new_registration.set_installing(&worker);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: 2.7 (waiting worker)
|
// TODO: 2.7 (waiting worker)
|
||||||
|
|
|
@ -159,7 +159,7 @@ impl GPUBufferMethods for GPUBuffer {
|
||||||
WebGPURequest::UnmapBuffer {
|
WebGPURequest::UnmapBuffer {
|
||||||
buffer_id: self.id().0,
|
buffer_id: self.id().0,
|
||||||
device_id: self.device.id().0,
|
device_id: self.device.id().0,
|
||||||
array_buffer: IpcSharedMemory::from_bytes(&*m_info.mapping.lock().unwrap()),
|
array_buffer: IpcSharedMemory::from_bytes(&m_info.mapping.lock().unwrap()),
|
||||||
is_map_read: m_info.map_mode == Some(GPUMapModeConstants::READ),
|
is_map_read: m_info.map_mode == Some(GPUMapModeConstants::READ),
|
||||||
offset: m_range.start,
|
offset: m_range.start,
|
||||||
size: m_range.end - m_range.start,
|
size: m_range.end - m_range.start,
|
||||||
|
|
|
@ -164,7 +164,7 @@ impl GPUDevice {
|
||||||
)),
|
)),
|
||||||
global,
|
global,
|
||||||
);
|
);
|
||||||
queue.set_device(&*device);
|
queue.set_device(&device);
|
||||||
device
|
device
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -653,7 +653,7 @@ impl GPUDeviceMethods for GPUDevice {
|
||||||
&self.global(),
|
&self.global(),
|
||||||
bind_group,
|
bind_group,
|
||||||
self.device,
|
self.device,
|
||||||
&*descriptor.layout,
|
&descriptor.layout,
|
||||||
descriptor.parent.label.clone().unwrap_or_default(),
|
descriptor.parent.label.clone().unwrap_or_default(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,7 +290,7 @@ impl Headers {
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#concept-header-extract-mime-type
|
// https://fetch.spec.whatwg.org/#concept-header-extract-mime-type
|
||||||
pub fn extract_mime_type(&self) -> Vec<u8> {
|
pub fn extract_mime_type(&self) -> Vec<u8> {
|
||||||
extract_mime_type(&*self.header_list.borrow()).unwrap_or(vec![])
|
extract_mime_type(&self.header_list.borrow()).unwrap_or(vec![])
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine
|
// https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine
|
||||||
|
|
|
@ -136,7 +136,7 @@ impl History {
|
||||||
if state_changed {
|
if state_changed {
|
||||||
PopStateEvent::dispatch_jsval(
|
PopStateEvent::dispatch_jsval(
|
||||||
self.window.upcast::<EventTarget>(),
|
self.window.upcast::<EventTarget>(),
|
||||||
&*self.window,
|
&self.window,
|
||||||
unsafe { HandleValue::from_raw(self.state.handle()) },
|
unsafe { HandleValue::from_raw(self.state.handle()) },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -439,8 +439,8 @@ impl HTMLCanvasElementMethods for HTMLCanvasElement {
|
||||||
/// <https://w3c.github.io/mediacapture-fromelement/#dom-htmlcanvaselement-capturestream>
|
/// <https://w3c.github.io/mediacapture-fromelement/#dom-htmlcanvaselement-capturestream>
|
||||||
fn CaptureStream(&self, _frame_request_rate: Option<Finite<f64>>) -> DomRoot<MediaStream> {
|
fn CaptureStream(&self, _frame_request_rate: Option<Finite<f64>>) -> DomRoot<MediaStream> {
|
||||||
let global = self.global();
|
let global = self.global();
|
||||||
let stream = MediaStream::new(&*global);
|
let stream = MediaStream::new(&global);
|
||||||
let track = MediaStreamTrack::new(&*global, MediaStreamId::new(), MediaStreamType::Video);
|
let track = MediaStreamTrack::new(&global, MediaStreamId::new(), MediaStreamType::Video);
|
||||||
stream.AddTrack(&track);
|
stream.AddTrack(&track);
|
||||||
stream
|
stream
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,7 +297,7 @@ impl HTMLCollection {
|
||||||
|
|
||||||
pub fn elements_iter<'a>(&'a self) -> impl Iterator<Item = DomRoot<Element>> + 'a {
|
pub fn elements_iter<'a>(&'a self) -> impl Iterator<Item = DomRoot<Element>> + 'a {
|
||||||
// Iterate forwards from the root.
|
// Iterate forwards from the root.
|
||||||
self.elements_iter_after(&*self.root)
|
self.elements_iter_after(&self.root)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn elements_iter_before<'a>(
|
pub fn elements_iter_before<'a>(
|
||||||
|
|
|
@ -35,7 +35,7 @@ impl HTMLFormControlsCollection {
|
||||||
.upcast::<Node>()
|
.upcast::<Node>()
|
||||||
.GetRootNode(&GetRootNodeOptions::empty());
|
.GetRootNode(&GetRootNodeOptions::empty());
|
||||||
HTMLFormControlsCollection {
|
HTMLFormControlsCollection {
|
||||||
collection: HTMLCollection::new_inherited(&*root_of_form, filter),
|
collection: HTMLCollection::new_inherited(&root_of_form, filter),
|
||||||
form: Dom::from_ref(form),
|
form: Dom::from_ref(form),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ impl HTMLFormControlsCollectionMethods for HTMLFormControlsCollection {
|
||||||
// specifically HTMLFormElement::Elements(),
|
// specifically HTMLFormElement::Elements(),
|
||||||
// and the collection filter excludes image inputs.
|
// and the collection filter excludes image inputs.
|
||||||
Some(RadioNodeListOrElement::RadioNodeList(
|
Some(RadioNodeListOrElement::RadioNodeList(
|
||||||
RadioNodeList::new_controls_except_image_inputs(window, &*self.form, &name),
|
RadioNodeList::new_controls_except_image_inputs(window, &self.form, &name),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
// Step 3
|
// Step 3
|
||||||
|
|
|
@ -178,7 +178,7 @@ impl HTMLFormElement {
|
||||||
self.controls
|
self.controls
|
||||||
.borrow()
|
.borrow()
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|n| HTMLFormElement::filter_for_radio_list(mode, *n, name))
|
.filter(|n| HTMLFormElement::filter_for_radio_list(mode, n, name))
|
||||||
.nth(index as usize)
|
.nth(index as usize)
|
||||||
.and_then(|n| Some(DomRoot::from_ref(n.upcast::<Node>())))
|
.and_then(|n| Some(DomRoot::from_ref(n.upcast::<Node>())))
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ impl HTMLFormElement {
|
||||||
self.controls
|
self.controls
|
||||||
.borrow()
|
.borrow()
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|n| HTMLFormElement::filter_for_radio_list(mode, &**n, name))
|
.filter(|n| HTMLFormElement::filter_for_radio_list(mode, n, name))
|
||||||
.count() as u32
|
.count() as u32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -653,7 +653,7 @@ impl HTMLFormElement {
|
||||||
|
|
||||||
// Substep 2, 3, 4
|
// Substep 2, 3, 4
|
||||||
let mut candidate_encodings =
|
let mut candidate_encodings =
|
||||||
split_html_space_chars(&*input).filter_map(|c| Encoding::for_label(c.as_bytes()));
|
split_html_space_chars(&input).filter_map(|c| Encoding::for_label(c.as_bytes()));
|
||||||
|
|
||||||
// Substep 5, 6
|
// Substep 5, 6
|
||||||
return candidate_encodings.next().unwrap_or(UTF_8);
|
return candidate_encodings.next().unwrap_or(UTF_8);
|
||||||
|
|
|
@ -492,7 +492,7 @@ impl HTMLMediaElement {
|
||||||
if delay && blocker.is_none() {
|
if delay && blocker.is_none() {
|
||||||
*blocker = Some(LoadBlocker::new(&document_from_node(self), LoadType::Media));
|
*blocker = Some(LoadBlocker::new(&document_from_node(self), LoadType::Media));
|
||||||
} else if !delay && blocker.is_some() {
|
} else if !delay && blocker.is_some() {
|
||||||
LoadBlocker::terminate(&mut *blocker);
|
LoadBlocker::terminate(&mut blocker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1550,7 +1550,7 @@ impl HTMLMediaElement {
|
||||||
PlayerEvent::Error(ref error) => {
|
PlayerEvent::Error(ref error) => {
|
||||||
error!("Player error: {:?}", error);
|
error!("Player error: {:?}", error);
|
||||||
self.error.set(Some(&*MediaError::new(
|
self.error.set(Some(&*MediaError::new(
|
||||||
&*window_from_node(self),
|
&window_from_node(self),
|
||||||
MEDIA_ERR_DECODE,
|
MEDIA_ERR_DECODE,
|
||||||
)));
|
)));
|
||||||
self.upcast::<EventTarget>().fire_event(atom!("error"));
|
self.upcast::<EventTarget>().fire_event(atom!("error"));
|
||||||
|
@ -2817,7 +2817,7 @@ impl FetchResponseListener for HTMLMediaElementFetchListener {
|
||||||
|
|
||||||
// Step 2
|
// Step 2
|
||||||
elem.error.set(Some(&*MediaError::new(
|
elem.error.set(Some(&*MediaError::new(
|
||||||
&*window_from_node(&*elem),
|
&window_from_node(&*elem),
|
||||||
MEDIA_ERR_NETWORK,
|
MEDIA_ERR_NETWORK,
|
||||||
)));
|
)));
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ unsafe extern "C" fn off_thread_compilation_callback(
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
finish_fetching_a_classic_script(&*elem, script_kind, url, load);
|
finish_fetching_a_classic_script(&elem, script_kind, url, load);
|
||||||
}),
|
}),
|
||||||
&context.canceller,
|
&context.canceller,
|
||||||
);
|
);
|
||||||
|
@ -401,7 +401,7 @@ impl FetchResponseListener for ClassicContext {
|
||||||
(Err(err), _) | (_, Err(err)) => {
|
(Err(err), _) | (_, Err(err)) => {
|
||||||
// Step 6, response is an error.
|
// Step 6, response is an error.
|
||||||
finish_fetching_a_classic_script(
|
finish_fetching_a_classic_script(
|
||||||
&*self.elem.root(),
|
&self.elem.root(),
|
||||||
self.kind,
|
self.kind,
|
||||||
self.url.clone(),
|
self.url.clone(),
|
||||||
Err(NoTrace(err.clone())),
|
Err(NoTrace(err.clone())),
|
||||||
|
@ -464,7 +464,7 @@ impl FetchResponseListener for ClassicContext {
|
||||||
self.fetch_options.clone(),
|
self.fetch_options.clone(),
|
||||||
ScriptType::Classic,
|
ScriptType::Classic,
|
||||||
);
|
);
|
||||||
finish_fetching_a_classic_script(&*elem, self.kind, self.url.clone(), Ok(load));
|
finish_fetching_a_classic_script(&elem, self.kind, self.url.clone(), Ok(load));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -442,17 +442,17 @@ impl HTMLTableElementLayoutHelpers for LayoutDom<'_, HTMLTableElement> {
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn get_border(self) -> Option<u32> {
|
fn get_border(self) -> Option<u32> {
|
||||||
unsafe { (*self.unsafe_get()).border.get() }
|
unsafe { (self.unsafe_get()).border.get() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn get_cellpadding(self) -> Option<u32> {
|
fn get_cellpadding(self) -> Option<u32> {
|
||||||
unsafe { (*self.unsafe_get()).cellpadding.get() }
|
unsafe { (self.unsafe_get()).cellpadding.get() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn get_cellspacing(self) -> Option<u32> {
|
fn get_cellspacing(self) -> Option<u32> {
|
||||||
unsafe { (*self.unsafe_get()).cellspacing.get() }
|
unsafe { (self.unsafe_get()).cellspacing.get() }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_width(self) -> LengthOrPercentageOrAuto {
|
fn get_width(self) -> LengthOrPercentageOrAuto {
|
||||||
|
|
|
@ -205,7 +205,7 @@ impl HTMLVideoElement {
|
||||||
// (which triggers no media load algorithm unless a explicit call to .load() is done)
|
// (which triggers no media load algorithm unless a explicit call to .load() is done)
|
||||||
// will block the document's load event forever.
|
// will block the document's load event forever.
|
||||||
let mut blocker = self.load_blocker.borrow_mut();
|
let mut blocker = self.load_blocker.borrow_mut();
|
||||||
LoadBlocker::terminate(&mut *blocker);
|
LoadBlocker::terminate(&mut blocker);
|
||||||
*blocker = Some(LoadBlocker::new(
|
*blocker = Some(LoadBlocker::new(
|
||||||
&document_from_node(self),
|
&document_from_node(self),
|
||||||
LoadType::Image(poster_url.clone()),
|
LoadType::Image(poster_url.clone()),
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl MediaElementAudioSourceNode {
|
||||||
) -> Fallible<MediaElementAudioSourceNode> {
|
) -> Fallible<MediaElementAudioSourceNode> {
|
||||||
let node = AudioNode::new_inherited(
|
let node = AudioNode::new_inherited(
|
||||||
AudioNodeInit::MediaElementSourceNode,
|
AudioNodeInit::MediaElementSourceNode,
|
||||||
&*context.base(),
|
&context.base(),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
|
@ -78,7 +78,7 @@ impl MediaElementAudioSourceNode {
|
||||||
context: &AudioContext,
|
context: &AudioContext,
|
||||||
options: &MediaElementAudioSourceOptions,
|
options: &MediaElementAudioSourceOptions,
|
||||||
) -> Fallible<DomRoot<MediaElementAudioSourceNode>> {
|
) -> Fallible<DomRoot<MediaElementAudioSourceNode>> {
|
||||||
MediaElementAudioSourceNode::new_with_proto(window, proto, context, &*options.mediaElement)
|
MediaElementAudioSourceNode::new_with_proto(window, proto, context, &options.mediaElement)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,15 +36,15 @@ impl MessageChannel {
|
||||||
// Step 2
|
// Step 2
|
||||||
let port2 = MessagePort::new(incumbent);
|
let port2 = MessagePort::new(incumbent);
|
||||||
|
|
||||||
incumbent.track_message_port(&*port1, None);
|
incumbent.track_message_port(&port1, None);
|
||||||
incumbent.track_message_port(&*port2, None);
|
incumbent.track_message_port(&port2, None);
|
||||||
|
|
||||||
// Step 3
|
// Step 3
|
||||||
incumbent.entangle_ports(*port1.message_port_id(), *port2.message_port_id());
|
incumbent.entangle_ports(*port1.message_port_id(), *port2.message_port_id());
|
||||||
|
|
||||||
// Steps 4-6
|
// Steps 4-6
|
||||||
reflect_dom_object_with_proto(
|
reflect_dom_object_with_proto(
|
||||||
Box::new(MessageChannel::new_inherited(&*port1, &*port2)),
|
Box::new(MessageChannel::new_inherited(&port1, &port2)),
|
||||||
incumbent,
|
incumbent,
|
||||||
proto,
|
proto,
|
||||||
)
|
)
|
||||||
|
|
|
@ -183,8 +183,8 @@ impl Transferable for MessagePort {
|
||||||
*port_impls = Some(ports);
|
*port_impls = Some(ports);
|
||||||
}
|
}
|
||||||
|
|
||||||
let PipelineNamespaceId(name_space) = (*id).namespace_id;
|
let PipelineNamespaceId(name_space) = (id).namespace_id;
|
||||||
let MessagePortIndex(index) = (*id).index;
|
let MessagePortIndex(index) = (id).index;
|
||||||
let index = index.get();
|
let index = index.get();
|
||||||
|
|
||||||
let mut big: [u8; 8] = [0; 8];
|
let mut big: [u8; 8] = [0; 8];
|
||||||
|
|
|
@ -94,7 +94,7 @@ impl MutationObserver {
|
||||||
) -> Fallible<DomRoot<MutationObserver>> {
|
) -> Fallible<DomRoot<MutationObserver>> {
|
||||||
global.set_exists_mut_observer();
|
global.set_exists_mut_observer();
|
||||||
let observer = MutationObserver::new_with_proto(global, proto, callback);
|
let observer = MutationObserver::new_with_proto(global, proto, callback);
|
||||||
ScriptThread::add_mutation_observer(&*observer);
|
ScriptThread::add_mutation_observer(&observer);
|
||||||
Ok(observer)
|
Ok(observer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ impl MutationObserver {
|
||||||
if !queue.is_empty() {
|
if !queue.is_empty() {
|
||||||
let _ = mo
|
let _ = mo
|
||||||
.callback
|
.callback
|
||||||
.Call_(&**mo, queue, &**mo, ExceptionHandling::Report);
|
.Call_(&**mo, queue, mo, ExceptionHandling::Report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: Step 6 (slot signals)
|
// TODO: Step 6 (slot signals)
|
||||||
|
|
|
@ -282,7 +282,7 @@ impl Node {
|
||||||
node.set_flag(NodeFlags::IS_CONNECTED, parent_is_connected);
|
node.set_flag(NodeFlags::IS_CONNECTED, parent_is_connected);
|
||||||
// Out-of-document elements never have the descendants flag set.
|
// Out-of-document elements never have the descendants flag set.
|
||||||
debug_assert!(!node.get_flag(NodeFlags::HAS_DIRTY_DESCENDANTS));
|
debug_assert!(!node.get_flag(NodeFlags::HAS_DIRTY_DESCENDANTS));
|
||||||
vtable_for(&*node).bind_to_tree(&BindContext {
|
vtable_for(&node).bind_to_tree(&BindContext {
|
||||||
tree_connected: parent_is_connected,
|
tree_connected: parent_is_connected,
|
||||||
tree_in_doc: parent_in_doc,
|
tree_in_doc: parent_in_doc,
|
||||||
});
|
});
|
||||||
|
@ -313,11 +313,11 @@ impl Node {
|
||||||
// This needs to be in its own loop, because unbind_from_tree may
|
// This needs to be in its own loop, because unbind_from_tree may
|
||||||
// rely on the state of IS_IN_DOC of the context node's descendants,
|
// rely on the state of IS_IN_DOC of the context node's descendants,
|
||||||
// e.g. when removing a <form>.
|
// e.g. when removing a <form>.
|
||||||
vtable_for(&*node).unbind_from_tree(context);
|
vtable_for(&node).unbind_from_tree(context);
|
||||||
// https://dom.spec.whatwg.org/#concept-node-remove step 14
|
// https://dom.spec.whatwg.org/#concept-node-remove step 14
|
||||||
if let Some(element) = node.as_custom_element() {
|
if let Some(element) = node.as_custom_element() {
|
||||||
ScriptThread::enqueue_callback_reaction(
|
ScriptThread::enqueue_callback_reaction(
|
||||||
&*element,
|
&element,
|
||||||
CallbackReaction::Disconnected,
|
CallbackReaction::Disconnected,
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
@ -551,7 +551,7 @@ impl Node {
|
||||||
s.push_str(" ");
|
s.push_str(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
s.push_str(&*self.debug_str());
|
s.push_str(&self.debug_str());
|
||||||
debug!("{:?}", s);
|
debug!("{:?}", s);
|
||||||
|
|
||||||
// FIXME: this should have a pure version?
|
// FIXME: this should have a pure version?
|
||||||
|
@ -1443,14 +1443,14 @@ impl<'dom> LayoutNodeHelpers<'dom> for LayoutDom<'dom, Node> {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe fn get_flag(self, flag: NodeFlags) -> bool {
|
unsafe fn get_flag(self, flag: NodeFlags) -> bool {
|
||||||
(*self.unsafe_get()).flags.get().contains(flag)
|
(self.unsafe_get()).flags.get().contains(flag)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe fn set_flag(self, flag: NodeFlags, value: bool) {
|
unsafe fn set_flag(self, flag: NodeFlags, value: bool) {
|
||||||
let this = self.unsafe_get();
|
let this = self.unsafe_get();
|
||||||
let mut flags = (*this).flags.get();
|
let mut flags = (this).flags.get();
|
||||||
|
|
||||||
if value {
|
if value {
|
||||||
flags.insert(flag);
|
flags.insert(flag);
|
||||||
|
@ -1458,7 +1458,7 @@ impl<'dom> LayoutNodeHelpers<'dom> for LayoutDom<'dom, Node> {
|
||||||
flags.remove(flag);
|
flags.remove(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
(*this).flags.set(flags);
|
(this).flags.set(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1846,7 +1846,7 @@ impl Node {
|
||||||
{
|
{
|
||||||
// Step 3.2.
|
// Step 3.2.
|
||||||
ScriptThread::enqueue_callback_reaction(
|
ScriptThread::enqueue_callback_reaction(
|
||||||
&*descendant,
|
&descendant,
|
||||||
CallbackReaction::Adopted(old_doc.clone(), DomRoot::from_ref(document)),
|
CallbackReaction::Adopted(old_doc.clone(), DomRoot::from_ref(document)),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
@ -2072,7 +2072,7 @@ impl Node {
|
||||||
// Step 7.
|
// Step 7.
|
||||||
for kid in new_nodes {
|
for kid in new_nodes {
|
||||||
// Step 7.1.
|
// Step 7.1.
|
||||||
parent.add_child(*kid, child);
|
parent.add_child(kid, child);
|
||||||
// Step 7.7.
|
// Step 7.7.
|
||||||
for descendant in kid
|
for descendant in kid
|
||||||
.traverse_preorder(ShadowIncluding::Yes)
|
.traverse_preorder(ShadowIncluding::Yes)
|
||||||
|
@ -2083,7 +2083,7 @@ impl Node {
|
||||||
if descendant.get_custom_element_definition().is_some() {
|
if descendant.get_custom_element_definition().is_some() {
|
||||||
// Step 7.7.2.1.
|
// Step 7.7.2.1.
|
||||||
ScriptThread::enqueue_callback_reaction(
|
ScriptThread::enqueue_callback_reaction(
|
||||||
&*descendant,
|
&descendant,
|
||||||
CallbackReaction::Connected,
|
CallbackReaction::Connected,
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
@ -2289,7 +2289,7 @@ impl Node {
|
||||||
IsHTMLDocument::NonHTMLDocument
|
IsHTMLDocument::NonHTMLDocument
|
||||||
};
|
};
|
||||||
let window = document.window();
|
let window = document.window();
|
||||||
let loader = DocumentLoader::new(&*document.loader());
|
let loader = DocumentLoader::new(&document.loader());
|
||||||
let document = Document::new(
|
let document = Document::new(
|
||||||
window,
|
window,
|
||||||
HasBrowsingContext::No,
|
HasBrowsingContext::No,
|
||||||
|
@ -3270,7 +3270,7 @@ impl<'a> ChildrenMutation<'a> {
|
||||||
} else {
|
} else {
|
||||||
ChildrenMutation::Replace {
|
ChildrenMutation::Replace {
|
||||||
prev,
|
prev,
|
||||||
removed: *removed,
|
removed,
|
||||||
added,
|
added,
|
||||||
next,
|
next,
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,13 +150,8 @@ impl PaintWorkletGlobalScope {
|
||||||
self.upcast(),
|
self.upcast(),
|
||||||
properties.iter().cloned(),
|
properties.iter().cloned(),
|
||||||
);
|
);
|
||||||
let result = self.draw_a_paint_image(
|
let result =
|
||||||
&name,
|
self.draw_a_paint_image(&name, size, device_pixel_ratio, &map, &arguments);
|
||||||
size,
|
|
||||||
device_pixel_ratio,
|
|
||||||
&*map,
|
|
||||||
&*arguments,
|
|
||||||
);
|
|
||||||
if (result.image_key.is_some()) && (result.missing_image_urls.is_empty()) {
|
if (result.image_key.is_some()) && (result.missing_image_urls.is_empty()) {
|
||||||
*self.cached_name.borrow_mut() = name;
|
*self.cached_name.borrow_mut() = name;
|
||||||
self.cached_size.set(size);
|
self.cached_size.set(size);
|
||||||
|
@ -180,13 +175,8 @@ impl PaintWorkletGlobalScope {
|
||||||
self.upcast(),
|
self.upcast(),
|
||||||
properties.iter().cloned(),
|
properties.iter().cloned(),
|
||||||
);
|
);
|
||||||
let result = self.draw_a_paint_image(
|
let result =
|
||||||
&name,
|
self.draw_a_paint_image(&name, size, device_pixel_ratio, &map, &arguments);
|
||||||
size,
|
|
||||||
device_pixel_ratio,
|
|
||||||
&*map,
|
|
||||||
&*arguments,
|
|
||||||
);
|
|
||||||
if (result.image_key.is_some()) && (result.missing_image_urls.is_empty()) {
|
if (result.image_key.is_some()) && (result.missing_image_urls.is_empty()) {
|
||||||
*self.cached_name.borrow_mut() = name;
|
*self.cached_name.borrow_mut() = name;
|
||||||
*self.cached_properties.borrow_mut() = properties;
|
*self.cached_properties.borrow_mut() = properties;
|
||||||
|
@ -322,7 +312,7 @@ impl PaintWorkletGlobalScope {
|
||||||
.map(|argument| ObjectValue(argument.reflector().get_jsobject().get()))
|
.map(|argument| ObjectValue(argument.reflector().get_jsobject().get()))
|
||||||
.collect();
|
.collect();
|
||||||
let arguments_value_array =
|
let arguments_value_array =
|
||||||
unsafe { HandleValueArray::from_rooted_slice(&*arguments_value_vec) };
|
unsafe { HandleValueArray::from_rooted_slice(&arguments_value_vec) };
|
||||||
rooted!(in(*cx) let argument_object = unsafe { NewArrayObject(*cx, &arguments_value_array) });
|
rooted!(in(*cx) let argument_object = unsafe { NewArrayObject(*cx, &arguments_value_array) });
|
||||||
|
|
||||||
let args_slice = [
|
let args_slice = [
|
||||||
|
@ -576,7 +566,7 @@ impl PaintWorkletGlobalScopeMethods for PaintWorkletGlobalScope {
|
||||||
paint_function.handle(),
|
paint_function.handle(),
|
||||||
alpha,
|
alpha,
|
||||||
input_arguments.len(),
|
input_arguments.len(),
|
||||||
&*context,
|
&context,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Step 20.
|
// Step 20.
|
||||||
|
|
|
@ -192,7 +192,7 @@ impl PerformanceObserverMethods for PerformanceObserver {
|
||||||
// Step 6.3
|
// Step 6.3
|
||||||
if entry_types.is_empty() {
|
if entry_types.is_empty() {
|
||||||
Console::internal_warn(
|
Console::internal_warn(
|
||||||
&*self.global(),
|
&self.global(),
|
||||||
DOMString::from("No valid entry type provided to observe()."),
|
DOMString::from("No valid entry type provided to observe()."),
|
||||||
);
|
);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
@ -209,7 +209,7 @@ impl PerformanceObserverMethods for PerformanceObserver {
|
||||||
// Step 7.2
|
// Step 7.2
|
||||||
if !VALID_ENTRY_TYPES.contains(&entry_type.as_ref()) {
|
if !VALID_ENTRY_TYPES.contains(&entry_type.as_ref()) {
|
||||||
Console::internal_warn(
|
Console::internal_warn(
|
||||||
&*self.global(),
|
&self.global(),
|
||||||
DOMString::from("No valid entry type provided to observe()."),
|
DOMString::from("No valid entry type provided to observe()."),
|
||||||
);
|
);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
|
|
@ -246,7 +246,7 @@ impl Promise {
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub fn append_native_handler(&self, handler: &PromiseNativeHandler, _comp: InRealm) {
|
pub fn append_native_handler(&self, handler: &PromiseNativeHandler, _comp: InRealm) {
|
||||||
let _ais = AutoEntryScript::new(&*handler.global());
|
let _ais = AutoEntryScript::new(&handler.global());
|
||||||
let cx = GlobalScope::get_cx();
|
let cx = GlobalScope::get_cx();
|
||||||
rooted!(in(*cx) let resolve_func =
|
rooted!(in(*cx) let resolve_func =
|
||||||
create_native_handler_function(*cx,
|
create_native_handler_function(*cx,
|
||||||
|
|
|
@ -1010,7 +1010,7 @@ impl RangeMethods for Range {
|
||||||
|
|
||||||
// Step 3.
|
// Step 3.
|
||||||
s.push_str(
|
s.push_str(
|
||||||
&*char_data
|
&char_data
|
||||||
.SubstringData(
|
.SubstringData(
|
||||||
self.start_offset(),
|
self.start_offset(),
|
||||||
char_data.Length() - self.start_offset(),
|
char_data.Length() - self.start_offset(),
|
||||||
|
@ -1027,14 +1027,14 @@ impl RangeMethods for Range {
|
||||||
|
|
||||||
while let Some(child) = iter.next() {
|
while let Some(child) = iter.next() {
|
||||||
if self.contains(child.upcast()) {
|
if self.contains(child.upcast()) {
|
||||||
s.push_str(&*child.upcast::<CharacterData>().Data());
|
s.push_str(&child.upcast::<CharacterData>().Data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 5.
|
// Step 5.
|
||||||
if let Some(text_node) = end_node.downcast::<Text>() {
|
if let Some(text_node) = end_node.downcast::<Text>() {
|
||||||
let char_data = text_node.upcast::<CharacterData>();
|
let char_data = text_node.upcast::<CharacterData>();
|
||||||
s.push_str(&*char_data.SubstringData(0, self.end_offset()).unwrap());
|
s.push_str(&char_data.SubstringData(0, self.end_offset()).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 6.
|
// Step 6.
|
||||||
|
|
|
@ -250,7 +250,7 @@ impl ReadableStream {
|
||||||
|
|
||||||
let global = self.global();
|
let global = self.global();
|
||||||
let _ar = enter_realm(&*global);
|
let _ar = enter_realm(&*global);
|
||||||
let _aes = AutoEntryScript::new(&*global);
|
let _aes = AutoEntryScript::new(&global);
|
||||||
|
|
||||||
let cx = GlobalScope::get_cx();
|
let cx = GlobalScope::get_cx();
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ impl RTCDataChannel {
|
||||||
global,
|
global,
|
||||||
);
|
);
|
||||||
|
|
||||||
peer_connection.register_data_channel(rtc_data_channel.servo_media_id, &*rtc_data_channel);
|
peer_connection.register_data_channel(rtc_data_channel.servo_media_id, &rtc_data_channel);
|
||||||
|
|
||||||
rtc_data_channel
|
rtc_data_channel
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,7 @@ impl SelectionMethods for Selection {
|
||||||
// https://w3c.github.io/selection-api/#dom-selection-addrange
|
// https://w3c.github.io/selection-api/#dom-selection-addrange
|
||||||
fn AddRange(&self, range: &Range) {
|
fn AddRange(&self, range: &Range) {
|
||||||
// Step 1
|
// Step 1
|
||||||
if !self.is_same_root(&*range.start_container()) {
|
if !self.is_same_root(&range.start_container()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,9 +319,9 @@ impl SelectionMethods for Selection {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 4
|
// Step 4
|
||||||
if !self.is_same_root(&*range.start_container()) {
|
if !self.is_same_root(&range.start_container()) {
|
||||||
// Step 5, and its following 8 and 9
|
// Step 5, and its following 8 and 9
|
||||||
self.set_range(&*Range::new(&self.document, node, offset, node, offset));
|
self.set_range(&Range::new(&self.document, node, offset, node, offset));
|
||||||
self.direction.set(Direction::Forwards);
|
self.direction.set(Direction::Forwards);
|
||||||
} else {
|
} else {
|
||||||
let old_anchor_node = &*self.GetAnchorNode().unwrap(); // has range, therefore has anchor node
|
let old_anchor_node = &*self.GetAnchorNode().unwrap(); // has range, therefore has anchor node
|
||||||
|
@ -335,7 +335,7 @@ impl SelectionMethods for Selection {
|
||||||
};
|
};
|
||||||
if is_old_anchor_before_or_equal {
|
if is_old_anchor_before_or_equal {
|
||||||
// Step 6, and its following 8 and 9
|
// Step 6, and its following 8 and 9
|
||||||
self.set_range(&*Range::new(
|
self.set_range(&Range::new(
|
||||||
&self.document,
|
&self.document,
|
||||||
old_anchor_node,
|
old_anchor_node,
|
||||||
old_anchor_offset,
|
old_anchor_offset,
|
||||||
|
@ -345,7 +345,7 @@ impl SelectionMethods for Selection {
|
||||||
self.direction.set(Direction::Forwards);
|
self.direction.set(Direction::Forwards);
|
||||||
} else {
|
} else {
|
||||||
// Step 7, and its following 8 and 9
|
// Step 7, and its following 8 and 9
|
||||||
self.set_range(&*Range::new(
|
self.set_range(&Range::new(
|
||||||
&self.document,
|
&self.document,
|
||||||
node,
|
node,
|
||||||
offset,
|
offset,
|
||||||
|
@ -394,7 +394,7 @@ impl SelectionMethods for Selection {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if is_focus_before_anchor {
|
if is_focus_before_anchor {
|
||||||
self.set_range(&*Range::new(
|
self.set_range(&Range::new(
|
||||||
&self.document,
|
&self.document,
|
||||||
focus_node,
|
focus_node,
|
||||||
focus_offset,
|
focus_offset,
|
||||||
|
@ -403,7 +403,7 @@ impl SelectionMethods for Selection {
|
||||||
));
|
));
|
||||||
self.direction.set(Direction::Backwards);
|
self.direction.set(Direction::Backwards);
|
||||||
} else {
|
} else {
|
||||||
self.set_range(&*Range::new(
|
self.set_range(&Range::new(
|
||||||
&self.document,
|
&self.document,
|
||||||
anchor_node,
|
anchor_node,
|
||||||
anchor_offset,
|
anchor_offset,
|
||||||
|
@ -428,7 +428,7 @@ impl SelectionMethods for Selection {
|
||||||
// Spec wording just says node length here, but WPT specifically
|
// Spec wording just says node length here, but WPT specifically
|
||||||
// wants number of children (the main difference is that it's 0
|
// wants number of children (the main difference is that it's 0
|
||||||
// for cdata).
|
// for cdata).
|
||||||
self.set_range(&*Range::new(
|
self.set_range(&Range::new(
|
||||||
&self.document,
|
&self.document,
|
||||||
node,
|
node,
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -48,7 +48,7 @@ impl ServiceWorkerContainer {
|
||||||
#[allow(crown::unrooted_must_root)]
|
#[allow(crown::unrooted_must_root)]
|
||||||
pub fn new(global: &GlobalScope) -> DomRoot<ServiceWorkerContainer> {
|
pub fn new(global: &GlobalScope) -> DomRoot<ServiceWorkerContainer> {
|
||||||
let client = Client::new(global.as_window());
|
let client = Client::new(global.as_window());
|
||||||
let container = ServiceWorkerContainer::new_inherited(&*client);
|
let container = ServiceWorkerContainer::new_inherited(&client);
|
||||||
reflect_dom_object(Box::new(container), global)
|
reflect_dom_object(Box::new(container), global)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ impl ServiceWorkerContainerMethods for ServiceWorkerContainer {
|
||||||
);
|
);
|
||||||
|
|
||||||
let scope_things =
|
let scope_things =
|
||||||
ServiceWorkerRegistration::create_scope_things(&*global, script_url.clone());
|
ServiceWorkerRegistration::create_scope_things(&global, script_url.clone());
|
||||||
|
|
||||||
// B: Step 8 - 13
|
// B: Step 8 - 13
|
||||||
let job = Job::create_job(
|
let job = Job::create_job(
|
||||||
|
|
|
@ -425,7 +425,7 @@ impl Tokenizer {
|
||||||
let element = create_element_for_token(
|
let element = create_element_for_token(
|
||||||
name,
|
name,
|
||||||
attrs,
|
attrs,
|
||||||
&*self.document,
|
&self.document,
|
||||||
ElementCreator::ParserCreated(current_line),
|
ElementCreator::ParserCreated(current_line),
|
||||||
ParsingAlgorithm::Normal,
|
ParsingAlgorithm::Normal,
|
||||||
);
|
);
|
||||||
|
@ -480,7 +480,7 @@ impl Tokenizer {
|
||||||
},
|
},
|
||||||
ParseOperation::RemoveFromParent { target } => {
|
ParseOperation::RemoveFromParent { target } => {
|
||||||
if let Some(ref parent) = self.get_node(&target).GetParentNode() {
|
if let Some(ref parent) = self.get_node(&target).GetParentNode() {
|
||||||
parent.RemoveChild(&**self.get_node(&target)).unwrap();
|
parent.RemoveChild(self.get_node(&target)).unwrap();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ParseOperation::MarkScriptAlreadyStarted { node } => {
|
ParseOperation::MarkScriptAlreadyStarted { node } => {
|
||||||
|
|
|
@ -173,7 +173,7 @@ impl SerializationIterator {
|
||||||
let mut ret = SerializationIterator { stack: vec![] };
|
let mut ret = SerializationIterator { stack: vec![] };
|
||||||
if skip_first || node.is::<DocumentFragment>() || node.is::<Document>() {
|
if skip_first || node.is::<DocumentFragment>() || node.is::<Document>() {
|
||||||
for c in rev_children_iter(node) {
|
for c in rev_children_iter(node) {
|
||||||
ret.push_node(&*c);
|
ret.push_node(&c);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ret.push_node(node);
|
ret.push_node(node);
|
||||||
|
|
|
@ -483,7 +483,7 @@ impl ServoParser {
|
||||||
prefetch_input.push_back(chunk.clone());
|
prefetch_input.push_back(chunk.clone());
|
||||||
self.prefetch_tokenizer
|
self.prefetch_tokenizer
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.feed(&mut *prefetch_input);
|
.feed(&mut prefetch_input);
|
||||||
}
|
}
|
||||||
// Push the chunk into the network input stream,
|
// Push the chunk into the network input stream,
|
||||||
// which is tokenized lazily.
|
// which is tokenized lazily.
|
||||||
|
@ -1130,7 +1130,7 @@ impl TreeSink for Sink {
|
||||||
let element = create_element_for_token(
|
let element = create_element_for_token(
|
||||||
name,
|
name,
|
||||||
attrs,
|
attrs,
|
||||||
&*self.document,
|
&self.document,
|
||||||
ElementCreator::ParserCreated(self.current_line),
|
ElementCreator::ParserCreated(self.current_line),
|
||||||
self.parsing_algorithm,
|
self.parsing_algorithm,
|
||||||
);
|
);
|
||||||
|
|
|
@ -206,7 +206,7 @@ impl PrefetchSink {
|
||||||
|
|
||||||
fn get_referrer_policy(&self, tag: &Tag, name: LocalName) -> Option<ReferrerPolicy> {
|
fn get_referrer_policy(&self, tag: &Tag, name: LocalName) -> Option<ReferrerPolicy> {
|
||||||
self.get_attr(tag, name)
|
self.get_attr(tag, name)
|
||||||
.and_then(|attr| determine_policy_for_token(&*attr.value))
|
.and_then(|attr| determine_policy_for_token(&attr.value))
|
||||||
.or(self.referrer_policy)
|
.or(self.referrer_policy)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ impl TestWorklet {
|
||||||
fn new(window: &Window, proto: Option<HandleObject>) -> DomRoot<TestWorklet> {
|
fn new(window: &Window, proto: Option<HandleObject>) -> DomRoot<TestWorklet> {
|
||||||
let worklet = Worklet::new(window, WorkletGlobalScopeType::Test);
|
let worklet = Worklet::new(window, WorkletGlobalScopeType::Test);
|
||||||
reflect_dom_object_with_proto(
|
reflect_dom_object_with_proto(
|
||||||
Box::new(TestWorklet::new_inherited(&*worklet)),
|
Box::new(TestWorklet::new_inherited(&worklet)),
|
||||||
window,
|
window,
|
||||||
proto,
|
proto,
|
||||||
)
|
)
|
||||||
|
|
|
@ -1565,7 +1565,7 @@ impl WebGLRenderingContext {
|
||||||
rb.storage(self.api_type, samples, internal_format, width, height)
|
rb.storage(self.api_type, samples, internal_format, width, height)
|
||||||
);
|
);
|
||||||
if let Some(fb) = self.bound_draw_framebuffer.get() {
|
if let Some(fb) = self.bound_draw_framebuffer.get() {
|
||||||
fb.invalidate_renderbuffer(&*rb);
|
fb.invalidate_renderbuffer(&rb);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: https://github.com/servo/servo/issues/13710
|
// FIXME: https://github.com/servo/servo/issues/13710
|
||||||
|
@ -1639,7 +1639,7 @@ impl WebGLRenderingContext {
|
||||||
});
|
});
|
||||||
|
|
||||||
if let Some(fb) = self.bound_draw_framebuffer.get() {
|
if let Some(fb) = self.bound_draw_framebuffer.get() {
|
||||||
fb.invalidate_texture(&*texture);
|
fb.invalidate_texture(&texture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -245,7 +245,7 @@ impl WindowProxy {
|
||||||
));
|
));
|
||||||
|
|
||||||
// Create a new dissimilar-origin window.
|
// Create a new dissimilar-origin window.
|
||||||
let window = DissimilarOriginWindow::new(global_to_clone_from, &*window_proxy);
|
let window = DissimilarOriginWindow::new(global_to_clone_from, &window_proxy);
|
||||||
let window_jsobject = window.reflector().get_jsobject();
|
let window_jsobject = window.reflector().get_jsobject();
|
||||||
assert!(!window_jsobject.get().is_null());
|
assert!(!window_jsobject.get().is_null());
|
||||||
assert_ne!(
|
assert_ne!(
|
||||||
|
@ -442,7 +442,7 @@ impl WindowProxy {
|
||||||
let creator =
|
let creator =
|
||||||
CreatorBrowsingContextInfo::from(parent_browsing_context, None);
|
CreatorBrowsingContextInfo::from(parent_browsing_context, None);
|
||||||
WindowProxy::new_dissimilar_origin(
|
WindowProxy::new_dissimilar_origin(
|
||||||
&*global_to_clone_from,
|
&global_to_clone_from,
|
||||||
opener_id,
|
opener_id,
|
||||||
opener_top_id,
|
opener_top_id,
|
||||||
None,
|
None,
|
||||||
|
@ -690,7 +690,7 @@ impl WindowProxy {
|
||||||
return debug!("Attempt to unset the currently active window on a windowproxy that does not have one.");
|
return debug!("Attempt to unset the currently active window on a windowproxy that does not have one.");
|
||||||
}
|
}
|
||||||
let globalscope = self.global();
|
let globalscope = self.global();
|
||||||
let window = DissimilarOriginWindow::new(&*globalscope, self);
|
let window = DissimilarOriginWindow::new(&globalscope, self);
|
||||||
self.set_window(&*window.upcast(), &XORIGIN_PROXY_HANDLER);
|
self.set_window(&*window.upcast(), &XORIGIN_PROXY_HANDLER);
|
||||||
self.currently_active.set(None);
|
self.currently_active.set(None);
|
||||||
}
|
}
|
||||||
|
@ -1091,7 +1091,7 @@ unsafe fn throw_security_error(cx: *mut JSContext, realm: InRealm) -> bool {
|
||||||
if !JS_IsExceptionPending(cx) {
|
if !JS_IsExceptionPending(cx) {
|
||||||
let safe_context = SafeJSContext::from_ptr(cx);
|
let safe_context = SafeJSContext::from_ptr(cx);
|
||||||
let global = GlobalScope::from_context(cx, realm);
|
let global = GlobalScope::from_context(cx, realm);
|
||||||
throw_dom_exception(safe_context, &*global, Error::Security);
|
throw_dom_exception(safe_context, &global, Error::Security);
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
|
@ -668,7 +668,7 @@ impl WorkletThread {
|
||||||
// to the main script thread.
|
// to the main script thread.
|
||||||
// https://github.com/w3c/css-houdini-drafts/issues/407
|
// https://github.com/w3c/css-houdini-drafts/issues/407
|
||||||
let ok = script
|
let ok = script
|
||||||
.map(|script| global_scope.evaluate_js(&*script))
|
.map(|script| global_scope.evaluate_js(&script))
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
@ -1517,7 +1517,7 @@ impl XMLHttpRequest {
|
||||||
let wr = self.global();
|
let wr = self.global();
|
||||||
let win = wr.as_window();
|
let win = wr.as_window();
|
||||||
let doc = win.Document();
|
let doc = win.Document();
|
||||||
let docloader = DocumentLoader::new(&*doc.loader());
|
let docloader = DocumentLoader::new(&doc.loader());
|
||||||
let base = wr.get_url();
|
let base = wr.get_url();
|
||||||
let parsed_url = match base.join(&self.ResponseURL().0) {
|
let parsed_url = match base.join(&self.ResponseURL().0) {
|
||||||
Ok(parsed) => Some(parsed),
|
Ok(parsed) => Some(parsed),
|
||||||
|
|
|
@ -108,8 +108,8 @@ impl XRInputSourcesChangeEvent {
|
||||||
init.parent.bubbles,
|
init.parent.bubbles,
|
||||||
init.parent.cancelable,
|
init.parent.cancelable,
|
||||||
&init.session,
|
&init.session,
|
||||||
&*init.added,
|
&init.added,
|
||||||
&*init.removed,
|
&init.removed,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ impl XRRenderState {
|
||||||
F: FnOnce(&[Dom<XRLayer>]) -> R,
|
F: FnOnce(&[Dom<XRLayer>]) -> R,
|
||||||
{
|
{
|
||||||
let layers = self.layers.borrow();
|
let layers = self.layers.borrow();
|
||||||
f(&*layers)
|
f(&layers)
|
||||||
}
|
}
|
||||||
pub fn has_sub_images(&self, sub_images: &[SubImages]) -> bool {
|
pub fn has_sub_images(&self, sub_images: &[SubImages]) -> bool {
|
||||||
if let Some(base_layer) = self.base_layer.get() {
|
if let Some(base_layer) = self.base_layer.get() {
|
||||||
|
|
|
@ -429,10 +429,10 @@ impl XRSession {
|
||||||
frame.set_animation_frame(true);
|
frame.set_animation_frame(true);
|
||||||
|
|
||||||
// Step 10
|
// Step 10
|
||||||
self.apply_frame_updates(&*frame);
|
self.apply_frame_updates(&frame);
|
||||||
|
|
||||||
// TODO: how does this fit with the webxr and xr layers specs?
|
// TODO: how does this fit with the webxr and xr layers specs?
|
||||||
self.layers_begin_frame(&*frame);
|
self.layers_begin_frame(&frame);
|
||||||
|
|
||||||
// Step 11-12
|
// Step 11-12
|
||||||
self.outside_raf.set(false);
|
self.outside_raf.set(false);
|
||||||
|
@ -450,7 +450,7 @@ impl XRSession {
|
||||||
*self.current_raf_callback_list.borrow_mut() = vec![];
|
*self.current_raf_callback_list.borrow_mut() = vec![];
|
||||||
|
|
||||||
// TODO: how does this fit with the webxr and xr layers specs?
|
// TODO: how does this fit with the webxr and xr layers specs?
|
||||||
self.layers_end_frame(&*frame);
|
self.layers_end_frame(&frame);
|
||||||
|
|
||||||
// Step 13
|
// Step 13
|
||||||
frame.set_active(false);
|
frame.set_active(false);
|
||||||
|
|
|
@ -354,7 +354,7 @@ impl ModuleTree {
|
||||||
|
|
||||||
let realm = enter_realm(&*owner.global());
|
let realm = enter_realm(&*owner.global());
|
||||||
let comp = InRealm::Entered(&realm);
|
let comp = InRealm::Entered(&realm);
|
||||||
let _ais = AutoIncumbentScript::new(&*owner.global());
|
let _ais = AutoIncumbentScript::new(&owner.global());
|
||||||
|
|
||||||
let mut promise = self.promise.borrow_mut();
|
let mut promise = self.promise.borrow_mut();
|
||||||
match promise.as_ref() {
|
match promise.as_ref() {
|
||||||
|
@ -390,7 +390,7 @@ impl ModuleTree {
|
||||||
|
|
||||||
let realm = enter_realm(&*owner.global());
|
let realm = enter_realm(&*owner.global());
|
||||||
let comp = InRealm::Entered(&realm);
|
let comp = InRealm::Entered(&realm);
|
||||||
let _ais = AutoIncumbentScript::new(&*owner.global());
|
let _ais = AutoIncumbentScript::new(&owner.global());
|
||||||
|
|
||||||
let mut promise = self.promise.borrow_mut();
|
let mut promise = self.promise.borrow_mut();
|
||||||
match promise.as_ref() {
|
match promise.as_ref() {
|
||||||
|
@ -930,11 +930,11 @@ impl ModuleOwner {
|
||||||
.has_attribute(&local_name!("async"));
|
.has_attribute(&local_name!("async"));
|
||||||
|
|
||||||
if !asynch && (*script.root()).get_parser_inserted() {
|
if !asynch && (*script.root()).get_parser_inserted() {
|
||||||
document.deferred_script_loaded(&*script.root(), load);
|
document.deferred_script_loaded(&script.root(), load);
|
||||||
} else if !asynch && !(*script.root()).get_non_blocking() {
|
} else if !asynch && !(*script.root()).get_non_blocking() {
|
||||||
document.asap_in_order_script_loaded(&*script.root(), load);
|
document.asap_in_order_script_loaded(&script.root(), load);
|
||||||
} else {
|
} else {
|
||||||
document.asap_script_loaded(&*script.root(), load);
|
document.asap_script_loaded(&script.root(), load);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -2205,10 +2205,10 @@ impl ScriptThread {
|
||||||
None => warn!("Message sent to closed pipeline {}.", id),
|
None => warn!("Message sent to closed pipeline {}.", id),
|
||||||
},
|
},
|
||||||
DevtoolScriptControlMsg::SetTimelineMarkers(id, marker_types, reply) => {
|
DevtoolScriptControlMsg::SetTimelineMarkers(id, marker_types, reply) => {
|
||||||
devtools::handle_set_timeline_markers(&*documents, id, marker_types, reply)
|
devtools::handle_set_timeline_markers(&documents, id, marker_types, reply)
|
||||||
},
|
},
|
||||||
DevtoolScriptControlMsg::DropTimelineMarkers(id, marker_types) => {
|
DevtoolScriptControlMsg::DropTimelineMarkers(id, marker_types) => {
|
||||||
devtools::handle_drop_timeline_markers(&*documents, id, marker_types)
|
devtools::handle_drop_timeline_markers(&documents, id, marker_types)
|
||||||
},
|
},
|
||||||
DevtoolScriptControlMsg::RequestAnimationFrame(id, name) => {
|
DevtoolScriptControlMsg::RequestAnimationFrame(id, name) => {
|
||||||
devtools::handle_request_animation_frame(&documents, id, name)
|
devtools::handle_request_animation_frame(&documents, id, name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue