mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Remove most RootedReference uses
We can replace all uses of RootedReference for Option<T> by Option::deref calls.
This commit is contained in:
parent
7bdfad92a5
commit
5fe5e5d6de
34 changed files with 186 additions and 185 deletions
|
@ -6,7 +6,7 @@ use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::AttrBinding::{self, AttrMethods};
|
use crate::dom::bindings::codegen::Bindings::AttrBinding::{self, AttrMethods};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||||
use crate::dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom, RootedReference};
|
use crate::dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::customelementregistry::CallbackReaction;
|
use crate::dom::customelementregistry::CallbackReaction;
|
||||||
use crate::dom::element::{AttributeMutation, Element};
|
use crate::dom::element::{AttributeMutation, Element};
|
||||||
|
@ -194,7 +194,7 @@ impl Attr {
|
||||||
ScriptThread::enqueue_callback_reaction(owner, reaction, None);
|
ScriptThread::enqueue_callback_reaction(owner, reaction, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(Some(owner), self.owner().r());
|
assert_eq!(Some(owner), self.owner().deref());
|
||||||
owner.will_mutate_attr(self);
|
owner.will_mutate_attr(self);
|
||||||
self.swap_value(&mut value);
|
self.swap_value(&mut value);
|
||||||
if self.identifier.namespace == ns!() {
|
if self.identifier.namespace == ns!() {
|
||||||
|
@ -227,7 +227,7 @@ impl Attr {
|
||||||
match (self.owner(), owner) {
|
match (self.owner(), owner) {
|
||||||
(Some(old), None) => {
|
(Some(old), None) => {
|
||||||
// Already gone from the list of attributes of old owner.
|
// Already gone from the list of attributes of old owner.
|
||||||
assert!(old.get_attribute(&ns, &self.identifier.local_name).r() != Some(self))
|
assert!(old.get_attribute(&ns, &self.identifier.local_name).deref() != Some(self))
|
||||||
},
|
},
|
||||||
(Some(old), Some(new)) => assert_eq!(&*old, new),
|
(Some(old), Some(new)) => assert_eq!(&*old, new),
|
||||||
_ => {},
|
_ => {},
|
||||||
|
|
|
@ -7250,8 +7250,10 @@ def camel_to_upper_snake(s):
|
||||||
|
|
||||||
def process_arg(expr, arg):
|
def process_arg(expr, arg):
|
||||||
if arg.type.isGeckoInterface() and not arg.type.unroll().inner.isCallback():
|
if arg.type.isGeckoInterface() and not arg.type.unroll().inner.isCallback():
|
||||||
if arg.type.nullable() or arg.type.isSequence() or arg.optional:
|
if arg.variadic or arg.type.isSequence() or arg.type.nullable() and arg.optional:
|
||||||
expr += ".r()"
|
expr += ".r()"
|
||||||
|
elif arg.type.nullable() or arg.optional:
|
||||||
|
expr += ".deref()"
|
||||||
else:
|
else:
|
||||||
expr = "&" + expr
|
expr = "&" + expr
|
||||||
elif isinstance(arg.type, IDLPromiseType):
|
elif isinstance(arg.type, IDLPromiseType):
|
||||||
|
|
|
@ -42,7 +42,6 @@ use std::marker::PhantomData;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::rc::Rc;
|
|
||||||
use style::thread_state;
|
use style::thread_state;
|
||||||
|
|
||||||
/// A rooted value.
|
/// A rooted value.
|
||||||
|
@ -272,13 +271,6 @@ impl<'root, T: DomObject + 'root> RootedReference<'root> for DomRoot<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'root, T: DomObject + 'root> RootedReference<'root> for Dom<T> {
|
|
||||||
type Ref = &'root T;
|
|
||||||
fn r(&'root self) -> &'root T {
|
|
||||||
&self
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'root, T: JSTraceable + DomObject + 'root> RootedReference<'root> for [Dom<T>] {
|
impl<'root, T: JSTraceable + DomObject + 'root> RootedReference<'root> for [Dom<T>] {
|
||||||
type Ref = &'root [&'root T];
|
type Ref = &'root [&'root T];
|
||||||
fn r(&'root self) -> &'root [&'root T] {
|
fn r(&'root self) -> &'root [&'root T] {
|
||||||
|
@ -286,13 +278,6 @@ impl<'root, T: JSTraceable + DomObject + 'root> RootedReference<'root> for [Dom<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'root, T: DomObject + 'root> RootedReference<'root> for Rc<T> {
|
|
||||||
type Ref = &'root T;
|
|
||||||
fn r(&'root self) -> &'root T {
|
|
||||||
self
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'root, T: RootedReference<'root> + 'root> RootedReference<'root> for Option<T> {
|
impl<'root, T: RootedReference<'root> + 'root> RootedReference<'root> for Option<T> {
|
||||||
type Ref = Option<T::Ref>;
|
type Ref = Option<T::Ref>;
|
||||||
fn r(&'root self) -> Option<T::Ref> {
|
fn r(&'root self) -> Option<T::Ref> {
|
||||||
|
|
|
@ -10,7 +10,7 @@ use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMe
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot, RootedReference};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::bluetoothdevice::BluetoothDevice;
|
use crate::dom::bluetoothdevice::BluetoothDevice;
|
||||||
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
||||||
|
@ -80,7 +80,6 @@ impl BluetoothAdvertisingEvent {
|
||||||
init: &BluetoothAdvertisingEventInit,
|
init: &BluetoothAdvertisingEventInit,
|
||||||
) -> Fallible<DomRoot<BluetoothAdvertisingEvent>> {
|
) -> Fallible<DomRoot<BluetoothAdvertisingEvent>> {
|
||||||
let global = window.upcast::<GlobalScope>();
|
let global = window.upcast::<GlobalScope>();
|
||||||
let device = init.device.r();
|
|
||||||
let name = init.name.clone();
|
let name = init.name.clone();
|
||||||
let appearance = init.appearance.clone();
|
let appearance = init.appearance.clone();
|
||||||
let txPower = init.txPower.clone();
|
let txPower = init.txPower.clone();
|
||||||
|
@ -92,7 +91,7 @@ impl BluetoothAdvertisingEvent {
|
||||||
Atom::from(type_),
|
Atom::from(type_),
|
||||||
bubbles,
|
bubbles,
|
||||||
cancelable,
|
cancelable,
|
||||||
device,
|
&init.device,
|
||||||
name,
|
name,
|
||||||
appearance,
|
appearance,
|
||||||
txPower,
|
txPower,
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::dom::bindings::codegen::Bindings::CompositionEventBinding::{
|
||||||
use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventBinding::UIEventMethods;
|
use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventBinding::UIEventMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||||
use crate::dom::bindings::root::{DomRoot, RootedReference};
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::uievent::UIEvent;
|
use crate::dom::uievent::UIEvent;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
|
@ -53,7 +53,7 @@ impl CompositionEvent {
|
||||||
type_,
|
type_,
|
||||||
init.parent.parent.bubbles,
|
init.parent.parent.bubbles,
|
||||||
init.parent.parent.cancelable,
|
init.parent.parent.cancelable,
|
||||||
init.parent.view.r(),
|
init.parent.view.deref(),
|
||||||
init.parent.detail,
|
init.parent.detail,
|
||||||
init.data.clone(),
|
init.data.clone(),
|
||||||
);
|
);
|
||||||
|
|
|
@ -640,7 +640,7 @@ impl Document {
|
||||||
.upcast::<Element>()
|
.upcast::<Element>()
|
||||||
.has_attribute(&local_name!("href"))
|
.has_attribute(&local_name!("href"))
|
||||||
});
|
});
|
||||||
self.base_element.set(base.r());
|
self.base_element.set(base.deref());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dom_count(&self) -> u32 {
|
pub fn dom_count(&self) -> u32 {
|
||||||
|
@ -766,7 +766,7 @@ impl Document {
|
||||||
{
|
{
|
||||||
let mut id_map = self.id_map.borrow_mut();
|
let mut id_map = self.id_map.borrow_mut();
|
||||||
let elements = id_map.entry(id.clone()).or_insert(Vec::new());
|
let elements = id_map.entry(id.clone()).or_insert(Vec::new());
|
||||||
elements.insert_pre_order(element, root.r().upcast::<Node>());
|
elements.insert_pre_order(element, root.upcast::<Node>());
|
||||||
}
|
}
|
||||||
self.reset_form_owner_for_listeners(&id);
|
self.reset_form_owner_for_listeners(&id);
|
||||||
}
|
}
|
||||||
|
@ -817,10 +817,10 @@ impl Document {
|
||||||
let target = self.find_fragment_node(fragment);
|
let target = self.find_fragment_node(fragment);
|
||||||
|
|
||||||
// Step 1
|
// Step 1
|
||||||
self.set_target_element(target.r());
|
self.set_target_element(target.deref());
|
||||||
|
|
||||||
let point = target
|
let point = target
|
||||||
.r()
|
.as_ref()
|
||||||
.map(|element| {
|
.map(|element| {
|
||||||
// FIXME(#8275, pcwalton): This is pretty bogus when multiple layers are involved.
|
// FIXME(#8275, pcwalton): This is pretty bogus when multiple layers are involved.
|
||||||
// Really what needs to happen is that this needs to go through layout to ask which
|
// Really what needs to happen is that this needs to go through layout to ask which
|
||||||
|
@ -858,7 +858,7 @@ impl Document {
|
||||||
y,
|
y,
|
||||||
global_scope.pipeline_id().root_scroll_id(),
|
global_scope.pipeline_id().root_scroll_id(),
|
||||||
ScrollBehavior::Instant,
|
ScrollBehavior::Instant,
|
||||||
target.r(),
|
target.deref(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -922,7 +922,7 @@ impl Document {
|
||||||
/// Reassign the focus context to the element that last requested focus during this
|
/// Reassign the focus context to the element that last requested focus during this
|
||||||
/// transaction, or none if no elements requested it.
|
/// transaction, or none if no elements requested it.
|
||||||
pub fn commit_focus_transaction(&self, focus_type: FocusType) {
|
pub fn commit_focus_transaction(&self, focus_type: FocusType) {
|
||||||
if self.focused == self.possibly_focused.get().r() {
|
if self.focused == self.possibly_focused.get().deref() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if let Some(ref elem) = self.focused.get() {
|
if let Some(ref elem) = self.focused.get() {
|
||||||
|
@ -937,7 +937,7 @@ impl Document {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.focused.set(self.possibly_focused.get().r());
|
self.focused.set(self.possibly_focused.get().deref());
|
||||||
|
|
||||||
if let Some(ref elem) = self.focused.get() {
|
if let Some(ref elem) = self.focused.get() {
|
||||||
elem.set_focus_state(true);
|
elem.set_focus_state(true);
|
||||||
|
@ -1265,7 +1265,7 @@ impl Document {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the current mouse over target for next frame.
|
// Store the current mouse over target for next frame.
|
||||||
prev_mouse_over_target.set(maybe_new_target.r());
|
prev_mouse_over_target.set(maybe_new_target.deref());
|
||||||
|
|
||||||
self.window
|
self.window
|
||||||
.reflow(ReflowGoal::Full, ReflowReason::MouseEvent);
|
.reflow(ReflowGoal::Full, ReflowReason::MouseEvent);
|
||||||
|
@ -2859,7 +2859,7 @@ impl Document {
|
||||||
|
|
||||||
fn create_node_list<F: Fn(&Node) -> bool>(&self, callback: F) -> DomRoot<NodeList> {
|
fn create_node_list<F: Fn(&Node) -> bool>(&self, callback: F) -> DomRoot<NodeList> {
|
||||||
let doc = self.GetDocumentElement();
|
let doc = self.GetDocumentElement();
|
||||||
let maybe_node = doc.r().map(Castable::upcast::<Node>);
|
let maybe_node = doc.deref().map(Castable::upcast::<Node>);
|
||||||
let iter = maybe_node
|
let iter = maybe_node
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|node| node.traverse_preorder())
|
.flat_map(|node| node.traverse_preorder())
|
||||||
|
@ -3140,7 +3140,7 @@ impl Document {
|
||||||
// https://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen
|
// https://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen
|
||||||
pub fn enter_fullscreen(&self, pending: &Element) -> Rc<Promise> {
|
pub fn enter_fullscreen(&self, pending: &Element) -> Rc<Promise> {
|
||||||
// Step 1
|
// Step 1
|
||||||
let promise = Promise::new(self.global().r());
|
let promise = Promise::new(&self.global());
|
||||||
let mut error = false;
|
let mut error = false;
|
||||||
|
|
||||||
// Step 4
|
// Step 4
|
||||||
|
@ -3211,7 +3211,7 @@ impl Document {
|
||||||
pub fn exit_fullscreen(&self) -> Rc<Promise> {
|
pub fn exit_fullscreen(&self) -> Rc<Promise> {
|
||||||
let global = self.global();
|
let global = self.global();
|
||||||
// Step 1
|
// Step 1
|
||||||
let promise = Promise::new(global.r());
|
let promise = Promise::new(&global);
|
||||||
// Step 2
|
// Step 2
|
||||||
if self.fullscreen_element.get().is_none() {
|
if self.fullscreen_element.get().is_none() {
|
||||||
promise.reject_error(Error::Type(String::from("fullscreen is null")));
|
promise.reject_error(Error::Type(String::from("fullscreen is null")));
|
||||||
|
@ -3228,7 +3228,7 @@ impl Document {
|
||||||
self.send_to_embedder(event);
|
self.send_to_embedder(event);
|
||||||
|
|
||||||
// Step 9
|
// Step 9
|
||||||
let trusted_element = Trusted::new(element.r());
|
let trusted_element = Trusted::new(&*element);
|
||||||
let trusted_promise = TrustedPromise::new(promise.clone());
|
let trusted_promise = TrustedPromise::new(promise.clone());
|
||||||
let handler = ElementPerformFullscreenExit::new(trusted_element, trusted_promise);
|
let handler = ElementPerformFullscreenExit::new(trusted_element, trusted_promise);
|
||||||
let pipeline_id = Some(global.pipeline_id());
|
let pipeline_id = Some(global.pipeline_id());
|
||||||
|
@ -3275,7 +3275,6 @@ impl Document {
|
||||||
if let Some(listeners) = map.get(id) {
|
if let Some(listeners) = map.get(id) {
|
||||||
for listener in listeners {
|
for listener in listeners {
|
||||||
listener
|
listener
|
||||||
.r()
|
|
||||||
.as_maybe_form_control()
|
.as_maybe_form_control()
|
||||||
.expect("Element must be a form control")
|
.expect("Element must be a form control")
|
||||||
.reset_form_owner();
|
.reset_form_owner();
|
||||||
|
@ -3841,7 +3840,7 @@ impl DocumentMethods for Document {
|
||||||
let parent = root.upcast::<Node>();
|
let parent = root.upcast::<Node>();
|
||||||
let child = elem.upcast::<Node>();
|
let child = elem.upcast::<Node>();
|
||||||
parent
|
parent
|
||||||
.InsertBefore(child, parent.GetFirstChild().r())
|
.InsertBefore(child, parent.GetFirstChild().deref())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -3926,7 +3925,7 @@ impl DocumentMethods for Document {
|
||||||
|
|
||||||
// Step 2.
|
// Step 2.
|
||||||
let old_body = self.GetBody();
|
let old_body = self.GetBody();
|
||||||
if old_body.r() == Some(new_body) {
|
if old_body.deref() == Some(new_body) {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||||
use crate::dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
|
use crate::dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
|
||||||
use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
|
use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
|
||||||
use crate::dom::bindings::reflector::DomObject;
|
use crate::dom::bindings::reflector::DomObject;
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom, RootedReference};
|
use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom};
|
||||||
use crate::dom::bindings::str::{DOMString, USVString};
|
use crate::dom::bindings::str::{DOMString, USVString};
|
||||||
use crate::dom::bindings::xmlname::XMLName::InvalidXMLName;
|
use crate::dom::bindings::xmlname::XMLName::InvalidXMLName;
|
||||||
use crate::dom::bindings::xmlname::{
|
use crate::dom::bindings::xmlname::{
|
||||||
|
@ -1292,7 +1292,7 @@ impl Element {
|
||||||
ScriptThread::enqueue_callback_reaction(self, reaction, None);
|
ScriptThread::enqueue_callback_reaction(self, reaction, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert!(attr.GetOwnerElement().r() == Some(self));
|
assert!(attr.GetOwnerElement().deref() == Some(self));
|
||||||
self.will_mutate_attr(attr);
|
self.will_mutate_attr(attr);
|
||||||
self.attrs.borrow_mut().push(Dom::from_ref(attr));
|
self.attrs.borrow_mut().push(Dom::from_ref(attr));
|
||||||
if attr.namespace() == &ns!() {
|
if attr.namespace() == &ns!() {
|
||||||
|
@ -1607,12 +1607,12 @@ impl Element {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
AdjacentPosition::AfterBegin => {
|
AdjacentPosition::AfterBegin => {
|
||||||
Node::pre_insert(node, &self_node, self_node.GetFirstChild().r()).map(Some)
|
Node::pre_insert(node, &self_node, self_node.GetFirstChild().deref()).map(Some)
|
||||||
},
|
},
|
||||||
AdjacentPosition::BeforeEnd => Node::pre_insert(node, &self_node, None).map(Some),
|
AdjacentPosition::BeforeEnd => Node::pre_insert(node, &self_node, None).map(Some),
|
||||||
AdjacentPosition::AfterEnd => {
|
AdjacentPosition::AfterEnd => {
|
||||||
if let Some(parent) = self_node.GetParentNode() {
|
if let Some(parent) = self_node.GetParentNode() {
|
||||||
Node::pre_insert(node, &parent, self_node.GetNextSibling().r()).map(Some)
|
Node::pre_insert(node, &parent, self_node.GetNextSibling().deref()).map(Some)
|
||||||
} else {
|
} else {
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
@ -1652,7 +1652,7 @@ impl Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 9
|
// Step 9
|
||||||
if doc.GetBody().r() == self.downcast::<HTMLElement>() &&
|
if doc.GetBody().deref() == self.downcast::<HTMLElement>() &&
|
||||||
doc.quirks_mode() == QuirksMode::Quirks &&
|
doc.quirks_mode() == QuirksMode::Quirks &&
|
||||||
!self.potentially_scrollable()
|
!self.potentially_scrollable()
|
||||||
{
|
{
|
||||||
|
@ -2121,7 +2121,7 @@ impl ElementMethods for Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 7
|
// Step 7
|
||||||
if doc.GetBody().r() == self.downcast::<HTMLElement>() &&
|
if doc.GetBody().deref() == self.downcast::<HTMLElement>() &&
|
||||||
doc.quirks_mode() == QuirksMode::Quirks &&
|
doc.quirks_mode() == QuirksMode::Quirks &&
|
||||||
!self.potentially_scrollable()
|
!self.potentially_scrollable()
|
||||||
{
|
{
|
||||||
|
@ -2171,7 +2171,7 @@ impl ElementMethods for Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 9
|
// Step 9
|
||||||
if doc.GetBody().r() == self.downcast::<HTMLElement>() &&
|
if doc.GetBody().deref() == self.downcast::<HTMLElement>() &&
|
||||||
doc.quirks_mode() == QuirksMode::Quirks &&
|
doc.quirks_mode() == QuirksMode::Quirks &&
|
||||||
!self.potentially_scrollable()
|
!self.potentially_scrollable()
|
||||||
{
|
{
|
||||||
|
@ -2217,7 +2217,7 @@ impl ElementMethods for Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 7
|
// Step 7
|
||||||
if doc.GetBody().r() == self.downcast::<HTMLElement>() &&
|
if doc.GetBody().deref() == self.downcast::<HTMLElement>() &&
|
||||||
doc.quirks_mode() == QuirksMode::Quirks &&
|
doc.quirks_mode() == QuirksMode::Quirks &&
|
||||||
!self.potentially_scrollable()
|
!self.potentially_scrollable()
|
||||||
{
|
{
|
||||||
|
@ -2268,7 +2268,7 @@ impl ElementMethods for Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 9
|
// Step 9
|
||||||
if doc.GetBody().r() == self.downcast::<HTMLElement>() &&
|
if doc.GetBody().deref() == self.downcast::<HTMLElement>() &&
|
||||||
doc.quirks_mode() == QuirksMode::Quirks &&
|
doc.quirks_mode() == QuirksMode::Quirks &&
|
||||||
!self.potentially_scrollable()
|
!self.potentially_scrollable()
|
||||||
{
|
{
|
||||||
|
@ -2737,7 +2737,7 @@ impl VirtualMethods for Element {
|
||||||
|
|
||||||
let doc = document_from_node(self);
|
let doc = document_from_node(self);
|
||||||
let fullscreen = doc.GetFullscreenElement();
|
let fullscreen = doc.GetFullscreenElement();
|
||||||
if fullscreen.r() == Some(self) {
|
if fullscreen.deref() == Some(self) {
|
||||||
doc.exit_fullscreen();
|
doc.exit_fullscreen();
|
||||||
}
|
}
|
||||||
if let Some(ref value) = *self.id_attribute.borrow() {
|
if let Some(ref value) = *self.id_attribute.borrow() {
|
||||||
|
@ -3392,7 +3392,7 @@ impl TaskOnce for ElementPerformFullscreenEnter {
|
||||||
fn run_once(self) {
|
fn run_once(self) {
|
||||||
let element = self.element.root();
|
let element = self.element.root();
|
||||||
let promise = self.promise.root();
|
let promise = self.promise.root();
|
||||||
let document = document_from_node(element.r());
|
let document = document_from_node(&*element);
|
||||||
|
|
||||||
// Step 7.1
|
// Step 7.1
|
||||||
if self.error || !element.fullscreen_element_ready_check() {
|
if self.error || !element.fullscreen_element_ready_check() {
|
||||||
|
@ -3442,7 +3442,7 @@ impl TaskOnce for ElementPerformFullscreenExit {
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
fn run_once(self) {
|
fn run_once(self) {
|
||||||
let element = self.element.root();
|
let element = self.element.root();
|
||||||
let document = document_from_node(element.r());
|
let document = document_from_node(&*element);
|
||||||
// TODO Step 9.1-5
|
// TODO Step 9.1-5
|
||||||
// Step 9.6
|
// Step 9.6
|
||||||
element.set_fullscreen_state(false);
|
element.set_fullscreen_state(false);
|
||||||
|
|
|
@ -477,7 +477,12 @@ fn dispatch_to_listeners(event: &Event, target: &EventTarget, event_path: &[&Eve
|
||||||
|
|
||||||
// Step 6.
|
// Step 6.
|
||||||
for object in event_path.iter().rev() {
|
for object in event_path.iter().rev() {
|
||||||
invoke(window.r(), object, event, Some(ListenerPhase::Capturing));
|
invoke(
|
||||||
|
window.deref(),
|
||||||
|
object,
|
||||||
|
event,
|
||||||
|
Some(ListenerPhase::Capturing),
|
||||||
|
);
|
||||||
if event.stop_propagation.get() {
|
if event.stop_propagation.get() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -489,7 +494,7 @@ fn dispatch_to_listeners(event: &Event, target: &EventTarget, event_path: &[&Eve
|
||||||
event.phase.set(EventPhase::AtTarget);
|
event.phase.set(EventPhase::AtTarget);
|
||||||
|
|
||||||
// Step 8.
|
// Step 8.
|
||||||
invoke(window.r(), target, event, None);
|
invoke(window.deref(), target, event, None);
|
||||||
if event.stop_propagation.get() {
|
if event.stop_propagation.get() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -505,7 +510,7 @@ fn dispatch_to_listeners(event: &Event, target: &EventTarget, event_path: &[&Eve
|
||||||
|
|
||||||
// Step 9.2.
|
// Step 9.2.
|
||||||
for object in event_path {
|
for object in event_path {
|
||||||
invoke(window.r(), object, event, Some(ListenerPhase::Bubbling));
|
invoke(window.deref(), object, event, Some(ListenerPhase::Bubbling));
|
||||||
if event.stop_propagation.get() {
|
if event.stop_propagation.get() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||||
use crate::dom::bindings::root::{DomRoot, MutNullableDom, RootedReference};
|
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::event::{EventBubbles, EventCancelable};
|
use crate::dom::event::{EventBubbles, EventCancelable};
|
||||||
use crate::dom::eventtarget::EventTarget;
|
use crate::dom::eventtarget::EventTarget;
|
||||||
|
@ -72,9 +72,9 @@ impl FocusEvent {
|
||||||
type_,
|
type_,
|
||||||
bubbles,
|
bubbles,
|
||||||
cancelable,
|
cancelable,
|
||||||
init.parent.view.r(),
|
init.parent.view.deref(),
|
||||||
init.parent.detail,
|
init.parent.detail,
|
||||||
init.relatedTarget.r(),
|
init.relatedTarget.deref(),
|
||||||
);
|
);
|
||||||
Ok(event)
|
Ok(event)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
||||||
use crate::dom::bindings::error::{Error, ErrorResult};
|
use crate::dom::bindings::error::{Error, ErrorResult};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::inheritance::{ElementTypeId, HTMLElementTypeId, NodeTypeId};
|
use crate::dom::bindings::inheritance::{ElementTypeId, HTMLElementTypeId, NodeTypeId};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom, RootedReference};
|
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner};
|
use crate::dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner};
|
||||||
use crate::dom::document::{Document, FocusType};
|
use crate::dom::document::{Document, FocusType};
|
||||||
|
@ -694,7 +694,7 @@ impl HTMLElement {
|
||||||
.take_while(|elem| !elem.is_labelable_element())
|
.take_while(|elem| !elem.is_labelable_element())
|
||||||
.filter_map(DomRoot::downcast::<HTMLLabelElement>)
|
.filter_map(DomRoot::downcast::<HTMLLabelElement>)
|
||||||
.filter(|elem| !elem.upcast::<Element>().has_attribute(&local_name!("for")))
|
.filter(|elem| !elem.upcast::<Element>().has_attribute(&local_name!("for")))
|
||||||
.filter(|elem| elem.first_labelable_descendant().r() == Some(self))
|
.filter(|elem| elem.first_labelable_descendant().deref() == Some(self))
|
||||||
.map(DomRoot::upcast::<Node>);
|
.map(DomRoot::upcast::<Node>);
|
||||||
|
|
||||||
let id = element.Id();
|
let id = element.Id();
|
||||||
|
|
|
@ -15,7 +15,7 @@ use crate::dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTex
|
||||||
use crate::dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
|
use crate::dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
|
||||||
use crate::dom::bindings::refcounted::Trusted;
|
use crate::dom::bindings::refcounted::Trusted;
|
||||||
use crate::dom::bindings::reflector::DomObject;
|
use crate::dom::bindings::reflector::DomObject;
|
||||||
use crate::dom::bindings::root::{Dom, DomOnceCell, DomRoot, RootedReference};
|
use crate::dom::bindings::root::{Dom, DomOnceCell, DomRoot};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::blob::Blob;
|
use crate::dom::blob::Blob;
|
||||||
use crate::dom::document::Document;
|
use crate::dom::document::Document;
|
||||||
|
@ -817,7 +817,7 @@ impl HTMLFormElement {
|
||||||
|
|
||||||
fn add_control<T: ?Sized + FormControl>(&self, control: &T) {
|
fn add_control<T: ?Sized + FormControl>(&self, control: &T) {
|
||||||
let root = self.upcast::<Element>().root_element();
|
let root = self.upcast::<Element>().root_element();
|
||||||
let root = root.r().upcast::<Node>();
|
let root = root.upcast::<Node>();
|
||||||
|
|
||||||
let mut controls = self.controls.borrow_mut();
|
let mut controls = self.controls.borrow_mut();
|
||||||
controls.insert_pre_order(control.to_element(), root);
|
controls.insert_pre_order(control.to_element(), root);
|
||||||
|
@ -828,7 +828,7 @@ impl HTMLFormElement {
|
||||||
let mut controls = self.controls.borrow_mut();
|
let mut controls = self.controls.borrow_mut();
|
||||||
controls
|
controls
|
||||||
.iter()
|
.iter()
|
||||||
.position(|c| c.r() == control)
|
.position(|c| &**c == control)
|
||||||
.map(|idx| controls.remove(idx));
|
.map(|idx| controls.remove(idx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1072,11 +1072,10 @@ pub trait FormControl: DomObject {
|
||||||
if let Some(o) = old_owner {
|
if let Some(o) = old_owner {
|
||||||
o.remove_control(self);
|
o.remove_control(self);
|
||||||
}
|
}
|
||||||
let new_owner = new_owner.as_ref().map(|o| {
|
if let Some(ref new_owner) = new_owner {
|
||||||
o.add_control(self);
|
new_owner.add_control(self);
|
||||||
o.r()
|
}
|
||||||
});
|
self.set_form_owner(new_owner.deref());
|
||||||
self.set_form_owner(new_owner);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
|
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::HTMLHeadElementBinding;
|
use crate::dom::bindings::codegen::Bindings::HTMLHeadElementBinding;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::root::{DomRoot, RootedReference};
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::document::{determine_policy_for_token, Document};
|
use crate::dom::document::{determine_policy_for_token, Document};
|
||||||
use crate::dom::element::Element;
|
use crate::dom::element::Element;
|
||||||
use crate::dom::htmlelement::HTMLElement;
|
use crate::dom::htmlelement::HTMLElement;
|
||||||
|
@ -49,7 +49,7 @@ impl HTMLHeadElement {
|
||||||
pub fn set_document_referrer(&self) {
|
pub fn set_document_referrer(&self) {
|
||||||
let doc = document_from_node(self);
|
let doc = document_from_node(self);
|
||||||
|
|
||||||
if doc.GetHead().r() != Some(self) {
|
if doc.GetHead().deref() != Some(self) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ impl HTMLHeadElement {
|
||||||
});
|
});
|
||||||
|
|
||||||
for meta in candidates {
|
for meta in candidates {
|
||||||
if let Some(content) = meta.get_attribute(&ns!(), &local_name!("content")).r() {
|
if let Some(ref content) = meta.get_attribute(&ns!(), &local_name!("content")) {
|
||||||
let content = content.value();
|
let content = content.value();
|
||||||
let content_val = content.trim();
|
let content_val = content.trim();
|
||||||
if !content_val.is_empty() {
|
if !content_val.is_empty() {
|
||||||
|
|
|
@ -14,7 +14,7 @@ use crate::dom::bindings::codegen::Bindings::KeyboardEventBinding::KeyboardEvent
|
||||||
use crate::dom::bindings::error::{Error, ErrorResult};
|
use crate::dom::bindings::error::{Error, ErrorResult};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::DomObject;
|
use crate::dom::bindings::reflector::DomObject;
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom, RootedReference};
|
use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom};
|
||||||
use crate::dom::bindings::str::{DOMString, USVString};
|
use crate::dom::bindings::str::{DOMString, USVString};
|
||||||
use crate::dom::compositionevent::CompositionEvent;
|
use crate::dom::compositionevent::CompositionEvent;
|
||||||
use crate::dom::document::Document;
|
use crate::dom::document::Document;
|
||||||
|
@ -903,7 +903,7 @@ fn broadcast_radio_checked(broadcaster: &HTMLInputElement, group: Option<&Atom>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
do_broadcast(doc.upcast(), broadcaster, owner.r(), group)
|
do_broadcast(doc.upcast(), broadcaster, owner.deref(), group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#radio-button-group
|
// https://html.spec.whatwg.org/multipage/#radio-button-group
|
||||||
|
@ -914,7 +914,7 @@ fn in_same_group(
|
||||||
) -> bool {
|
) -> bool {
|
||||||
other.input_type() == InputType::Radio &&
|
other.input_type() == InputType::Radio &&
|
||||||
// TODO Both a and b are in the same home subtree.
|
// TODO Both a and b are in the same home subtree.
|
||||||
other.form_owner().r() == owner &&
|
other.form_owner().deref() == owner &&
|
||||||
match (other.radio_group_name(), group) {
|
match (other.radio_group_name(), group) {
|
||||||
(Some(ref s1), Some(s2)) => compatibility_caseless_match_str(s1, s2) && s2 != &atom!(""),
|
(Some(ref s1), Some(s2)) => compatibility_caseless_match_str(s1, s2) && s2 != &atom!(""),
|
||||||
_ => false
|
_ => false
|
||||||
|
@ -1629,8 +1629,8 @@ impl Activatable for HTMLInputElement {
|
||||||
.query_selector_iter(DOMString::from("input[type=radio]"))
|
.query_selector_iter(DOMString::from("input[type=radio]"))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.filter_map(DomRoot::downcast::<HTMLInputElement>)
|
.filter_map(DomRoot::downcast::<HTMLInputElement>)
|
||||||
.find(|r| in_same_group(&*r, owner.r(), group.as_ref()) && r.Checked());
|
.find(|r| in_same_group(&*r, owner.deref(), group.as_ref()) && r.Checked());
|
||||||
cache.checked_radio = checked_member.r().map(Dom::from_ref);
|
cache.checked_radio = checked_member.deref().map(Dom::from_ref);
|
||||||
cache.checked_changed = self.checked_changed.get();
|
cache.checked_changed = self.checked_changed.get();
|
||||||
self.SetChecked(true);
|
self.SetChecked(true);
|
||||||
},
|
},
|
||||||
|
@ -1666,22 +1666,21 @@ impl Activatable for HTMLInputElement {
|
||||||
InputType::Radio => {
|
InputType::Radio => {
|
||||||
// We want to restore state only if the element had been changed in the first place
|
// We want to restore state only if the element had been changed in the first place
|
||||||
if cache.was_mutable {
|
if cache.was_mutable {
|
||||||
match cache.checked_radio.r() {
|
if let Some(ref o) = cache.checked_radio {
|
||||||
Some(o) => {
|
// Avoiding iterating through the whole tree here, instead
|
||||||
// Avoiding iterating through the whole tree here, instead
|
// we can check if the conditions for radio group siblings apply
|
||||||
// we can check if the conditions for radio group siblings apply
|
if in_same_group(
|
||||||
if in_same_group(
|
&o,
|
||||||
&o,
|
self.form_owner().deref(),
|
||||||
self.form_owner().r(),
|
self.radio_group_name().as_ref(),
|
||||||
self.radio_group_name().as_ref(),
|
) {
|
||||||
) {
|
o.SetChecked(true);
|
||||||
o.SetChecked(true);
|
} else {
|
||||||
} else {
|
self.SetChecked(false);
|
||||||
self.SetChecked(false);
|
}
|
||||||
}
|
} else {
|
||||||
},
|
self.SetChecked(false);
|
||||||
None => self.SetChecked(false),
|
}
|
||||||
};
|
|
||||||
self.checked_changed.set(cache.checked_changed);
|
self.checked_changed.set(cache.checked_changed);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListBi
|
||||||
use crate::dom::bindings::codegen::Bindings::HTMLLinkElementBinding;
|
use crate::dom::bindings::codegen::Bindings::HTMLLinkElementBinding;
|
||||||
use crate::dom::bindings::codegen::Bindings::HTMLLinkElementBinding::HTMLLinkElementMethods;
|
use crate::dom::bindings::codegen::Bindings::HTMLLinkElementBinding::HTMLLinkElementMethods;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::root::{DomRoot, MutNullableDom, RootedReference};
|
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
||||||
use crate::dom::bindings::str::{DOMString, USVString};
|
use crate::dom::bindings::str::{DOMString, USVString};
|
||||||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||||
use crate::dom::document::Document;
|
use crate::dom::document::Document;
|
||||||
|
@ -285,7 +285,7 @@ impl HTMLLinkElement {
|
||||||
let cors_setting = cors_setting_for_element(element);
|
let cors_setting = cors_setting_for_element(element);
|
||||||
|
|
||||||
let mq_attribute = element.get_attribute(&ns!(), &local_name!("media"));
|
let mq_attribute = element.get_attribute(&ns!(), &local_name!("media"));
|
||||||
let value = mq_attribute.r().map(|a| a.value());
|
let value = mq_attribute.as_ref().map(|a| a.value());
|
||||||
let mq_str = match value {
|
let mq_str = match value {
|
||||||
Some(ref value) => &***value,
|
Some(ref value) => &***value,
|
||||||
None => "",
|
None => "",
|
||||||
|
@ -309,7 +309,7 @@ impl HTMLLinkElement {
|
||||||
let media = MediaList::parse(&context, &mut css_parser);
|
let media = MediaList::parse(&context, &mut css_parser);
|
||||||
|
|
||||||
let im_attribute = element.get_attribute(&ns!(), &local_name!("integrity"));
|
let im_attribute = element.get_attribute(&ns!(), &local_name!("integrity"));
|
||||||
let integrity_val = im_attribute.r().map(|a| a.value());
|
let integrity_val = im_attribute.as_ref().map(|a| a.value());
|
||||||
let integrity_metadata = match integrity_val {
|
let integrity_metadata = match integrity_val {
|
||||||
Some(ref value) => &***value,
|
Some(ref value) => &***value,
|
||||||
None => "",
|
None => "",
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::dom::bindings::codegen::Bindings::HTMLMetaElementBinding;
|
||||||
use crate::dom::bindings::codegen::Bindings::HTMLMetaElementBinding::HTMLMetaElementMethods;
|
use crate::dom::bindings::codegen::Bindings::HTMLMetaElementBinding::HTMLMetaElementMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::root::{DomRoot, MutNullableDom, RootedReference};
|
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||||
use crate::dom::document::Document;
|
use crate::dom::document::Document;
|
||||||
|
@ -83,7 +83,7 @@ impl HTMLMetaElement {
|
||||||
|
|
||||||
fn process_attributes(&self) {
|
fn process_attributes(&self) {
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
if let Some(name) = element.get_attribute(&ns!(), &local_name!("name")).r() {
|
if let Some(ref name) = element.get_attribute(&ns!(), &local_name!("name")) {
|
||||||
let name = name.value().to_ascii_lowercase();
|
let name = name.value().to_ascii_lowercase();
|
||||||
let name = name.trim_matches(HTML_SPACE_CHARACTERS);
|
let name = name.trim_matches(HTML_SPACE_CHARACTERS);
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ impl HTMLMetaElement {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
if let Some(content) = element.get_attribute(&ns!(), &local_name!("content")).r() {
|
if let Some(ref content) = element.get_attribute(&ns!(), &local_name!("content")) {
|
||||||
let content = content.value();
|
let content = content.value();
|
||||||
if !content.is_empty() {
|
if !content.is_empty() {
|
||||||
if let Some(translated_rule) = ViewportRule::from_meta(&**content) {
|
if let Some(translated_rule) = ViewportRule::from_meta(&**content) {
|
||||||
|
@ -136,7 +136,7 @@ impl HTMLMetaElement {
|
||||||
|
|
||||||
fn process_referrer_attribute(&self) {
|
fn process_referrer_attribute(&self) {
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
if let Some(name) = element.get_attribute(&ns!(), &local_name!("name")).r() {
|
if let Some(ref name) = element.get_attribute(&ns!(), &local_name!("name")) {
|
||||||
let name = name.value().to_ascii_lowercase();
|
let name = name.value().to_ascii_lowercase();
|
||||||
let name = name.trim_matches(HTML_SPACE_CHARACTERS);
|
let name = name.trim_matches(HTML_SPACE_CHARACTERS);
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ use crate::dom::bindings::codegen::UnionTypes::{
|
||||||
use crate::dom::bindings::error::{Error, ErrorResult};
|
use crate::dom::bindings::error::{Error, ErrorResult};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||||
use crate::dom::bindings::root::{DomRoot, RootedReference};
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::element::Element;
|
use crate::dom::element::Element;
|
||||||
use crate::dom::htmlcollection::{CollectionFilter, HTMLCollection};
|
use crate::dom::htmlcollection::{CollectionFilter, HTMLCollection};
|
||||||
|
@ -185,14 +185,14 @@ impl HTMLOptionsCollectionMethods for HTMLOptionsCollection {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Step 5
|
// Step 5
|
||||||
let parent = if let Some(reference_node) = reference_node.r() {
|
let parent = if let Some(ref reference_node) = reference_node {
|
||||||
reference_node.GetParentNode().unwrap()
|
reference_node.GetParentNode().unwrap()
|
||||||
} else {
|
} else {
|
||||||
root
|
root
|
||||||
};
|
};
|
||||||
|
|
||||||
// Step 6
|
// Step 6
|
||||||
Node::pre_insert(node, &parent, reference_node.r()).map(|_| ())
|
Node::pre_insert(node, &parent, reference_node.deref()).map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-htmloptionscollection-remove
|
// https://html.spec.whatwg.org/multipage/#dom-htmloptionscollection-remove
|
||||||
|
|
|
@ -11,7 +11,7 @@ use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::refcounted::Trusted;
|
use crate::dom::bindings::refcounted::Trusted;
|
||||||
use crate::dom::bindings::reflector::DomObject;
|
use crate::dom::bindings::reflector::DomObject;
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot, RootedReference};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::bindings::str::{DOMString, USVString};
|
use crate::dom::bindings::str::{DOMString, USVString};
|
||||||
use crate::dom::document::Document;
|
use crate::dom::document::Document;
|
||||||
use crate::dom::element::{
|
use crate::dom::element::{
|
||||||
|
@ -409,8 +409,8 @@ impl HTMLScriptElement {
|
||||||
// Step 13.
|
// Step 13.
|
||||||
let for_attribute = element.get_attribute(&ns!(), &local_name!("for"));
|
let for_attribute = element.get_attribute(&ns!(), &local_name!("for"));
|
||||||
let event_attribute = element.get_attribute(&ns!(), &local_name!("event"));
|
let event_attribute = element.get_attribute(&ns!(), &local_name!("event"));
|
||||||
match (for_attribute.r(), event_attribute.r()) {
|
match (for_attribute, event_attribute) {
|
||||||
(Some(for_attribute), Some(event_attribute)) => {
|
(Some(ref for_attribute), Some(ref event_attribute)) => {
|
||||||
let for_value = for_attribute.value().to_ascii_lowercase();
|
let for_value = for_attribute.value().to_ascii_lowercase();
|
||||||
let for_value = for_value.trim_matches(HTML_SPACE_CHARACTERS);
|
let for_value = for_value.trim_matches(HTML_SPACE_CHARACTERS);
|
||||||
if for_value != "window" {
|
if for_value != "window" {
|
||||||
|
@ -441,7 +441,7 @@ impl HTMLScriptElement {
|
||||||
|
|
||||||
// Step 18: Integrity metadata.
|
// Step 18: Integrity metadata.
|
||||||
let im_attribute = element.get_attribute(&ns!(), &local_name!("integrity"));
|
let im_attribute = element.get_attribute(&ns!(), &local_name!("integrity"));
|
||||||
let integrity_val = im_attribute.r().map(|a| a.value());
|
let integrity_val = im_attribute.as_ref().map(|a| a.value());
|
||||||
let integrity_metadata = match integrity_val {
|
let integrity_metadata = match integrity_val {
|
||||||
Some(ref value) => &***value,
|
Some(ref value) => &***value,
|
||||||
None => "",
|
None => "",
|
||||||
|
@ -619,7 +619,7 @@ impl HTMLScriptElement {
|
||||||
self.run_a_classic_script(&script);
|
self.run_a_classic_script(&script);
|
||||||
|
|
||||||
// Step 6.
|
// Step 6.
|
||||||
document.set_current_script(old_script.r());
|
document.set_current_script(old_script.deref());
|
||||||
|
|
||||||
// Step 7.
|
// Step 7.
|
||||||
if let Some(doc) = neutralized_doc {
|
if let Some(doc) = neutralized_doc {
|
||||||
|
|
|
@ -9,7 +9,7 @@ use crate::dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableE
|
||||||
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||||
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom, RootedReference};
|
use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::document::Document;
|
use crate::dom::document::Document;
|
||||||
use crate::dom::element::{AttributeMutation, Element, RawLayoutElementHelpers};
|
use crate::dom::element::{AttributeMutation, Element, RawLayoutElementHelpers};
|
||||||
|
@ -119,7 +119,7 @@ impl HTMLTableElement {
|
||||||
|
|
||||||
if let Some(section) = section {
|
if let Some(section) = section {
|
||||||
let reference_element = node.child_elements().find(reference_predicate);
|
let reference_element = node.child_elements().find(reference_predicate);
|
||||||
let reference_node = reference_element.r().map(|e| e.upcast());
|
let reference_node = reference_element.as_ref().map(|e| e.upcast());
|
||||||
|
|
||||||
node.InsertBefore(section.upcast(), reference_node)?;
|
node.InsertBefore(section.upcast(), reference_node)?;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ impl HTMLTableElementMethods for HTMLTableElement {
|
||||||
|
|
||||||
if let Some(caption) = new_caption {
|
if let Some(caption) = new_caption {
|
||||||
let node = self.upcast::<Node>();
|
let node = self.upcast::<Node>();
|
||||||
node.InsertBefore(caption.upcast(), node.GetFirstChild().r())
|
node.InsertBefore(caption.upcast(), node.GetFirstChild().deref())
|
||||||
.expect("Insertion failed");
|
.expect("Insertion failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ impl HTMLTableElementMethods for HTMLTableElement {
|
||||||
fn filter(&self, elem: &Element, root: &Node) -> bool {
|
fn filter(&self, elem: &Element, root: &Node) -> bool {
|
||||||
elem.is::<HTMLTableSectionElement>() &&
|
elem.is::<HTMLTableSectionElement>() &&
|
||||||
elem.local_name() == &local_name!("tbody") &&
|
elem.local_name() == &local_name!("tbody") &&
|
||||||
elem.upcast::<Node>().GetParentNode().r() == Some(root)
|
elem.upcast::<Node>().GetParentNode().deref() == Some(root)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ impl HTMLTableElementMethods for HTMLTableElement {
|
||||||
.find(|n| n.is::<HTMLTableSectionElement>() && n.local_name() == &local_name!("tbody"));
|
.find(|n| n.is::<HTMLTableSectionElement>() && n.local_name() == &local_name!("tbody"));
|
||||||
let reference_element = last_tbody.and_then(|t| t.upcast::<Node>().GetNextSibling());
|
let reference_element = last_tbody.and_then(|t| t.upcast::<Node>().GetNextSibling());
|
||||||
|
|
||||||
node.InsertBefore(tbody.upcast(), reference_element.r())
|
node.InsertBefore(tbody.upcast(), reference_element.deref())
|
||||||
.expect("Insertion failed");
|
.expect("Insertion failed");
|
||||||
tbody
|
tbody
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ use crate::dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::HTM
|
||||||
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||||
use crate::dom::bindings::error::{ErrorResult, Fallible};
|
use crate::dom::bindings::error::{ErrorResult, Fallible};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom, RootedReference};
|
use crate::dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::document::Document;
|
use crate::dom::document::Document;
|
||||||
use crate::dom::element::{Element, RawLayoutElementHelpers};
|
use crate::dom::element::{Element, RawLayoutElementHelpers};
|
||||||
|
@ -31,7 +31,7 @@ struct CellsFilter;
|
||||||
impl CollectionFilter for CellsFilter {
|
impl CollectionFilter for CellsFilter {
|
||||||
fn filter(&self, elem: &Element, root: &Node) -> bool {
|
fn filter(&self, elem: &Element, root: &Node) -> bool {
|
||||||
(elem.is::<HTMLTableCellElement>()) &&
|
(elem.is::<HTMLTableCellElement>()) &&
|
||||||
elem.upcast::<Node>().GetParentNode().r() == Some(root)
|
elem.upcast::<Node>().GetParentNode().deref() == Some(root)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::{
|
||||||
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||||
use crate::dom::bindings::error::{ErrorResult, Fallible};
|
use crate::dom::bindings::error::{ErrorResult, Fallible};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::root::{DomRoot, LayoutDom, RootedReference};
|
use crate::dom::bindings::root::{DomRoot, LayoutDom};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::document::Document;
|
use crate::dom::document::Document;
|
||||||
use crate::dom::element::{Element, RawLayoutElementHelpers};
|
use crate::dom::element::{Element, RawLayoutElementHelpers};
|
||||||
|
@ -58,7 +58,8 @@ impl HTMLTableSectionElement {
|
||||||
struct RowsFilter;
|
struct RowsFilter;
|
||||||
impl CollectionFilter for RowsFilter {
|
impl CollectionFilter for RowsFilter {
|
||||||
fn filter(&self, elem: &Element, root: &Node) -> bool {
|
fn filter(&self, elem: &Element, root: &Node) -> bool {
|
||||||
elem.is::<HTMLTableRowElement>() && elem.upcast::<Node>().GetParentNode().r() == Some(root)
|
elem.is::<HTMLTableRowElement>() &&
|
||||||
|
elem.upcast::<Node>().GetParentNode().deref() == Some(root)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ use crate::dom::bindings::codegen::Bindings::InputEventBinding::{self, InputEven
|
||||||
use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventBinding::UIEventMethods;
|
use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventBinding::UIEventMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||||
use crate::dom::bindings::root::{DomRoot, RootedReference};
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::uievent::UIEvent;
|
use crate::dom::uievent::UIEvent;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
|
@ -54,7 +54,7 @@ impl InputEvent {
|
||||||
type_,
|
type_,
|
||||||
init.parent.parent.bubbles,
|
init.parent.parent.bubbles,
|
||||||
init.parent.parent.cancelable,
|
init.parent.parent.cancelable,
|
||||||
init.parent.view.r(),
|
init.parent.view.deref(),
|
||||||
init.parent.detail,
|
init.parent.detail,
|
||||||
init.data.clone(),
|
init.data.clone(),
|
||||||
init.isComposing,
|
init.isComposing,
|
||||||
|
|
|
@ -9,7 +9,7 @@ use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||||
use crate::dom::bindings::root::{DomRoot, RootedReference};
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::event::Event;
|
use crate::dom::event::Event;
|
||||||
use crate::dom::uievent::UIEvent;
|
use crate::dom::uievent::UIEvent;
|
||||||
|
@ -111,7 +111,7 @@ impl KeyboardEvent {
|
||||||
type_,
|
type_,
|
||||||
init.parent.parent.parent.bubbles,
|
init.parent.parent.parent.bubbles,
|
||||||
init.parent.parent.parent.cancelable,
|
init.parent.parent.parent.cancelable,
|
||||||
init.parent.parent.view.r(),
|
init.parent.parent.view.deref(),
|
||||||
init.parent.parent.detail,
|
init.parent.parent.detail,
|
||||||
Key::Unidentified,
|
Key::Unidentified,
|
||||||
init.code.clone(),
|
init.code.clone(),
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||||
use crate::dom::bindings::root::{DomRoot, MutNullableDom, RootedReference};
|
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
||||||
use crate::dom::eventtarget::EventTarget;
|
use crate::dom::eventtarget::EventTarget;
|
||||||
|
@ -115,7 +115,7 @@ impl MouseEvent {
|
||||||
type_,
|
type_,
|
||||||
bubbles,
|
bubbles,
|
||||||
cancelable,
|
cancelable,
|
||||||
init.parent.parent.view.r(),
|
init.parent.parent.view.deref(),
|
||||||
init.parent.parent.detail,
|
init.parent.parent.detail,
|
||||||
init.screenX,
|
init.screenX,
|
||||||
init.screenY,
|
init.screenY,
|
||||||
|
@ -126,7 +126,7 @@ impl MouseEvent {
|
||||||
init.parent.shiftKey,
|
init.parent.shiftKey,
|
||||||
init.parent.metaKey,
|
init.parent.metaKey,
|
||||||
init.button,
|
init.button,
|
||||||
init.relatedTarget.r(),
|
init.relatedTarget.deref(),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
Ok(event)
|
Ok(event)
|
||||||
|
|
|
@ -230,11 +230,11 @@ impl Node {
|
||||||
assert!(new_child.next_sibling.get().is_none());
|
assert!(new_child.next_sibling.get().is_none());
|
||||||
match before {
|
match before {
|
||||||
Some(ref before) => {
|
Some(ref before) => {
|
||||||
assert!(before.parent_node.get().r() == Some(self));
|
assert!(before.parent_node.get().deref() == Some(self));
|
||||||
let prev_sibling = before.GetPreviousSibling();
|
let prev_sibling = before.GetPreviousSibling();
|
||||||
match prev_sibling {
|
match prev_sibling {
|
||||||
None => {
|
None => {
|
||||||
assert!(Some(*before) == self.first_child.get().r());
|
assert!(self.first_child.get().deref() == Some(*before));
|
||||||
self.first_child.set(Some(new_child));
|
self.first_child.set(Some(new_child));
|
||||||
},
|
},
|
||||||
Some(ref prev_sibling) => {
|
Some(ref prev_sibling) => {
|
||||||
|
@ -276,27 +276,36 @@ impl Node {
|
||||||
///
|
///
|
||||||
/// Fails unless `child` is a child of this node.
|
/// Fails unless `child` is a child of this node.
|
||||||
fn remove_child(&self, child: &Node, cached_index: Option<u32>) {
|
fn remove_child(&self, child: &Node, cached_index: Option<u32>) {
|
||||||
assert!(child.parent_node.get().r() == Some(self));
|
assert!(child.parent_node.get().deref() == Some(self));
|
||||||
let prev_sibling = child.GetPreviousSibling();
|
let prev_sibling = child.GetPreviousSibling();
|
||||||
match prev_sibling {
|
match prev_sibling {
|
||||||
None => {
|
None => {
|
||||||
self.first_child.set(child.next_sibling.get().r());
|
self.first_child.set(child.next_sibling.get().deref());
|
||||||
},
|
},
|
||||||
Some(ref prev_sibling) => {
|
Some(ref prev_sibling) => {
|
||||||
prev_sibling.next_sibling.set(child.next_sibling.get().r());
|
prev_sibling
|
||||||
|
.next_sibling
|
||||||
|
.set(child.next_sibling.get().deref());
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
let next_sibling = child.GetNextSibling();
|
let next_sibling = child.GetNextSibling();
|
||||||
match next_sibling {
|
match next_sibling {
|
||||||
None => {
|
None => {
|
||||||
self.last_child.set(child.prev_sibling.get().r());
|
self.last_child.set(child.prev_sibling.get().deref());
|
||||||
},
|
},
|
||||||
Some(ref next_sibling) => {
|
Some(ref next_sibling) => {
|
||||||
next_sibling.prev_sibling.set(child.prev_sibling.get().r());
|
next_sibling
|
||||||
|
.prev_sibling
|
||||||
|
.set(child.prev_sibling.get().deref());
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
let context = UnbindContext::new(self, prev_sibling.r(), next_sibling.r(), cached_index);
|
let context = UnbindContext::new(
|
||||||
|
self,
|
||||||
|
prev_sibling.deref(),
|
||||||
|
next_sibling.deref(),
|
||||||
|
cached_index,
|
||||||
|
);
|
||||||
|
|
||||||
child.prev_sibling.set(None);
|
child.prev_sibling.set(None);
|
||||||
child.next_sibling.set(None);
|
child.next_sibling.set(None);
|
||||||
|
@ -678,7 +687,7 @@ impl Node {
|
||||||
document != window.Document(),
|
document != window.Document(),
|
||||||
is_body_element,
|
is_body_element,
|
||||||
document.quirks_mode(),
|
document.quirks_mode(),
|
||||||
html_element.r() == self.downcast::<Element>(),
|
html_element.deref() == self.downcast::<Element>(),
|
||||||
) {
|
) {
|
||||||
// Step 2 && Step 5
|
// Step 2 && Step 5
|
||||||
(true, _, _, _) | (_, false, QuirksMode::Quirks, true) => Rect::zero(),
|
(true, _, _, _) | (_, false, QuirksMode::Quirks, true) => Rect::zero(),
|
||||||
|
@ -725,7 +734,7 @@ impl Node {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Step 6.
|
// Step 6.
|
||||||
Node::pre_insert(&node, &parent, viable_previous_sibling.r())?;
|
Node::pre_insert(&node, &parent, viable_previous_sibling.deref())?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -748,7 +757,7 @@ impl Node {
|
||||||
let node = self.owner_doc().node_from_nodes_and_strings(nodes)?;
|
let node = self.owner_doc().node_from_nodes_and_strings(nodes)?;
|
||||||
|
|
||||||
// Step 5.
|
// Step 5.
|
||||||
Node::pre_insert(&node, &parent, viable_next_sibling.r())?;
|
Node::pre_insert(&node, &parent, viable_next_sibling.deref())?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -771,7 +780,7 @@ impl Node {
|
||||||
parent.ReplaceChild(&node, self)?;
|
parent.ReplaceChild(&node, self)?;
|
||||||
} else {
|
} else {
|
||||||
// Step 6.
|
// Step 6.
|
||||||
Node::pre_insert(&node, &parent, viable_next_sibling.r())?;
|
Node::pre_insert(&node, &parent, viable_next_sibling.deref())?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -783,7 +792,7 @@ impl Node {
|
||||||
let node = doc.node_from_nodes_and_strings(nodes)?;
|
let node = doc.node_from_nodes_and_strings(nodes)?;
|
||||||
// Step 2.
|
// Step 2.
|
||||||
let first_child = self.first_child.get();
|
let first_child = self.first_child.get();
|
||||||
Node::pre_insert(&node, self, first_child.r()).map(|_| ())
|
Node::pre_insert(&node, self, first_child.deref()).map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-parentnode-append
|
// https://dom.spec.whatwg.org/#dom-parentnode-append
|
||||||
|
@ -968,7 +977,7 @@ impl Node {
|
||||||
None => return Err(Error::IndexSize),
|
None => return Err(Error::IndexSize),
|
||||||
Some(node) => node,
|
Some(node) => node,
|
||||||
};
|
};
|
||||||
self.InsertBefore(tr_node, node.r())?;
|
self.InsertBefore(tr_node, node.deref())?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1667,7 +1676,7 @@ impl Node {
|
||||||
let reference_child = match child {
|
let reference_child = match child {
|
||||||
Some(child) if child == node => {
|
Some(child) if child == node => {
|
||||||
reference_child_root = node.GetNextSibling();
|
reference_child_root = node.GetNextSibling();
|
||||||
reference_child_root.r()
|
reference_child_root.deref()
|
||||||
},
|
},
|
||||||
_ => child,
|
_ => child,
|
||||||
};
|
};
|
||||||
|
@ -1697,7 +1706,7 @@ impl Node {
|
||||||
) {
|
) {
|
||||||
node.owner_doc().add_script_and_layout_blocker();
|
node.owner_doc().add_script_and_layout_blocker();
|
||||||
debug_assert!(&*node.owner_doc() == &*parent.owner_doc());
|
debug_assert!(&*node.owner_doc() == &*parent.owner_doc());
|
||||||
debug_assert!(child.map_or(true, |child| Some(parent) == child.GetParentNode().r()));
|
debug_assert!(child.map_or(true, |child| Some(parent) == child.GetParentNode().deref()));
|
||||||
|
|
||||||
// Step 1.
|
// Step 1.
|
||||||
let count = if node.is::<DocumentFragment>() {
|
let count = if node.is::<DocumentFragment>() {
|
||||||
|
@ -1718,8 +1727,8 @@ impl Node {
|
||||||
// Step 3.
|
// Step 3.
|
||||||
new_nodes.extend(node.children().map(|kid| Dom::from_ref(&*kid)));
|
new_nodes.extend(node.children().map(|kid| Dom::from_ref(&*kid)));
|
||||||
// Step 4.
|
// Step 4.
|
||||||
for kid in new_nodes.r() {
|
for kid in &*new_nodes {
|
||||||
Node::remove(*kid, node, SuppressObserver::Suppressed);
|
Node::remove(kid, node, SuppressObserver::Suppressed);
|
||||||
}
|
}
|
||||||
// Step 5.
|
// Step 5.
|
||||||
vtable_for(&node).children_changed(&ChildrenMutation::replace_all(new_nodes.r(), &[]));
|
vtable_for(&node).children_changed(&ChildrenMutation::replace_all(new_nodes.r(), &[]));
|
||||||
|
@ -1772,7 +1781,7 @@ impl Node {
|
||||||
}
|
}
|
||||||
if let SuppressObserver::Unsuppressed = suppress_observers {
|
if let SuppressObserver::Unsuppressed = suppress_observers {
|
||||||
vtable_for(&parent).children_changed(&ChildrenMutation::insert(
|
vtable_for(&parent).children_changed(&ChildrenMutation::insert(
|
||||||
previous_sibling.r(),
|
previous_sibling.deref(),
|
||||||
new_nodes,
|
new_nodes,
|
||||||
child,
|
child,
|
||||||
));
|
));
|
||||||
|
@ -1780,7 +1789,7 @@ impl Node {
|
||||||
let mutation = Mutation::ChildList {
|
let mutation = Mutation::ChildList {
|
||||||
added: Some(new_nodes),
|
added: Some(new_nodes),
|
||||||
removed: None,
|
removed: None,
|
||||||
prev: previous_sibling.r(),
|
prev: previous_sibling.deref(),
|
||||||
next: child,
|
next: child,
|
||||||
};
|
};
|
||||||
MutationObserver::queue_a_mutation_record(&parent, mutation);
|
MutationObserver::queue_a_mutation_record(&parent, mutation);
|
||||||
|
@ -1810,8 +1819,8 @@ impl Node {
|
||||||
&[] as &[&Node]
|
&[] as &[&Node]
|
||||||
};
|
};
|
||||||
// Step 4.
|
// Step 4.
|
||||||
for child in removed_nodes.r() {
|
for child in &*removed_nodes {
|
||||||
Node::remove(*child, parent, SuppressObserver::Suppressed);
|
Node::remove(child, parent, SuppressObserver::Suppressed);
|
||||||
}
|
}
|
||||||
// Step 5.
|
// Step 5.
|
||||||
if let Some(node) = node {
|
if let Some(node) = node {
|
||||||
|
@ -1883,18 +1892,18 @@ impl Node {
|
||||||
// Step 12.
|
// Step 12.
|
||||||
if let SuppressObserver::Unsuppressed = suppress_observers {
|
if let SuppressObserver::Unsuppressed = suppress_observers {
|
||||||
vtable_for(&parent).children_changed(&ChildrenMutation::replace(
|
vtable_for(&parent).children_changed(&ChildrenMutation::replace(
|
||||||
old_previous_sibling.r(),
|
old_previous_sibling.deref(),
|
||||||
&Some(&node),
|
&Some(&node),
|
||||||
&[],
|
&[],
|
||||||
old_next_sibling.r(),
|
old_next_sibling.deref(),
|
||||||
));
|
));
|
||||||
|
|
||||||
let removed = [node];
|
let removed = [node];
|
||||||
let mutation = Mutation::ChildList {
|
let mutation = Mutation::ChildList {
|
||||||
added: None,
|
added: None,
|
||||||
removed: Some(&removed),
|
removed: Some(&removed),
|
||||||
prev: old_previous_sibling.r(),
|
prev: old_previous_sibling.deref(),
|
||||||
next: old_next_sibling.r(),
|
next: old_next_sibling.deref(),
|
||||||
};
|
};
|
||||||
MutationObserver::queue_a_mutation_record(&parent, mutation);
|
MutationObserver::queue_a_mutation_record(&parent, mutation);
|
||||||
}
|
}
|
||||||
|
@ -2204,7 +2213,7 @@ impl NodeMethods for Node {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Step 3.
|
// Step 3.
|
||||||
Node::replace_all(node.r(), self);
|
Node::replace_all(node.deref(), self);
|
||||||
},
|
},
|
||||||
NodeTypeId::CharacterData(..) => {
|
NodeTypeId::CharacterData(..) => {
|
||||||
let characterdata = self.downcast::<CharacterData>().unwrap();
|
let characterdata = self.downcast::<CharacterData>().unwrap();
|
||||||
|
@ -2308,10 +2317,10 @@ impl NodeMethods for Node {
|
||||||
// Step 7-8.
|
// Step 7-8.
|
||||||
let child_next_sibling = child.GetNextSibling();
|
let child_next_sibling = child.GetNextSibling();
|
||||||
let node_next_sibling = node.GetNextSibling();
|
let node_next_sibling = node.GetNextSibling();
|
||||||
let reference_child = if child_next_sibling.r() == Some(node) {
|
let reference_child = if child_next_sibling.deref() == Some(node) {
|
||||||
node_next_sibling.r()
|
node_next_sibling.deref()
|
||||||
} else {
|
} else {
|
||||||
child_next_sibling.r()
|
child_next_sibling.deref()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Step 9.
|
// Step 9.
|
||||||
|
@ -2343,7 +2352,7 @@ impl NodeMethods for Node {
|
||||||
|
|
||||||
// Step 14.
|
// Step 14.
|
||||||
vtable_for(&self).children_changed(&ChildrenMutation::replace(
|
vtable_for(&self).children_changed(&ChildrenMutation::replace(
|
||||||
previous_sibling.r(),
|
previous_sibling.deref(),
|
||||||
&removed_child,
|
&removed_child,
|
||||||
nodes,
|
nodes,
|
||||||
reference_child,
|
reference_child,
|
||||||
|
@ -2352,7 +2361,7 @@ impl NodeMethods for Node {
|
||||||
let mutation = Mutation::ChildList {
|
let mutation = Mutation::ChildList {
|
||||||
added: Some(nodes),
|
added: Some(nodes),
|
||||||
removed: removed.as_ref().map(|r| &r[..]),
|
removed: removed.as_ref().map(|r| &r[..]),
|
||||||
prev: previous_sibling.r(),
|
prev: previous_sibling.deref(),
|
||||||
next: reference_child,
|
next: reference_child,
|
||||||
};
|
};
|
||||||
MutationObserver::queue_a_mutation_record(&self, mutation);
|
MutationObserver::queue_a_mutation_record(&self, mutation);
|
||||||
|
@ -3014,7 +3023,7 @@ where
|
||||||
if head_node == node {
|
if head_node == node {
|
||||||
head += 1;
|
head += 1;
|
||||||
}
|
}
|
||||||
if elem_node == node.r() || head == self.len() {
|
if elem_node == &*node || head == self.len() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::NodeListBinding;
|
use crate::dom::bindings::codegen::Bindings::NodeListBinding;
|
||||||
use crate::dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods;
|
use crate::dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom, RootedReference};
|
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
|
||||||
use crate::dom::node::{ChildrenMutation, Node};
|
use crate::dom::node::{ChildrenMutation, Node};
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
@ -132,7 +132,7 @@ impl ChildrenList {
|
||||||
let last_visited = node.GetFirstChild();
|
let last_visited = node.GetFirstChild();
|
||||||
ChildrenList {
|
ChildrenList {
|
||||||
node: Dom::from_ref(node),
|
node: Dom::from_ref(node),
|
||||||
last_visited: MutNullableDom::new(last_visited.r()),
|
last_visited: MutNullableDom::new(last_visited.deref()),
|
||||||
last_index: Cell::new(0u32),
|
last_index: Cell::new(0u32),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,7 @@ impl ChildrenList {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset(&self) {
|
fn reset(&self) {
|
||||||
self.last_visited.set(self.node.GetFirstChild().r());
|
self.last_visited.set(self.node.GetFirstChild().deref());
|
||||||
self.last_index.set(0u32);
|
self.last_index.set(0u32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ use crate::dom::bindings::codegen::Bindings::OfflineAudioCompletionEventBinding:
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot, RootedReference};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
|
@ -59,7 +59,7 @@ impl OfflineAudioCompletionEvent {
|
||||||
Atom::from(type_),
|
Atom::from(type_),
|
||||||
bubbles,
|
bubbles,
|
||||||
cancelable,
|
cancelable,
|
||||||
init.renderedBuffer.r(),
|
&init.renderedBuffer,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::inheritance::{CharacterDataTypeId, NodeTypeId};
|
use crate::dom::bindings::inheritance::{CharacterDataTypeId, NodeTypeId};
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot, MutDom, RootedReference};
|
use crate::dom::bindings::root::{Dom, DomRoot, MutDom};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::bindings::trace::JSTraceable;
|
use crate::dom::bindings::trace::JSTraceable;
|
||||||
use crate::dom::bindings::weakref::{WeakRef, WeakRefVec};
|
use crate::dom::bindings::weakref::{WeakRef, WeakRefVec};
|
||||||
|
@ -730,7 +730,7 @@ impl RangeMethods for Range {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Step 6.
|
// Step 6.
|
||||||
Node::ensure_pre_insertion_validity(node, &parent, reference_node.r())?;
|
Node::ensure_pre_insertion_validity(node, &parent, reference_node.deref())?;
|
||||||
|
|
||||||
// Step 7.
|
// Step 7.
|
||||||
let split_text;
|
let split_text;
|
||||||
|
@ -738,14 +738,14 @@ impl RangeMethods for Range {
|
||||||
Some(text) => {
|
Some(text) => {
|
||||||
split_text = text.SplitText(start_offset)?;
|
split_text = text.SplitText(start_offset)?;
|
||||||
let new_reference = DomRoot::upcast::<Node>(split_text);
|
let new_reference = DomRoot::upcast::<Node>(split_text);
|
||||||
assert!(new_reference.GetParentNode().r() == Some(&parent));
|
assert!(new_reference.GetParentNode().deref() == Some(&parent));
|
||||||
Some(new_reference)
|
Some(new_reference)
|
||||||
},
|
},
|
||||||
_ => reference_node,
|
_ => reference_node,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Step 8.
|
// Step 8.
|
||||||
let reference_node = if Some(node) == reference_node.r() {
|
let reference_node = if Some(node) == reference_node.deref() {
|
||||||
node.GetNextSibling()
|
node.GetNextSibling()
|
||||||
} else {
|
} else {
|
||||||
reference_node
|
reference_node
|
||||||
|
@ -755,7 +755,9 @@ impl RangeMethods for Range {
|
||||||
node.remove_self();
|
node.remove_self();
|
||||||
|
|
||||||
// Step 10.
|
// Step 10.
|
||||||
let new_offset = reference_node.r().map_or(parent.len(), |node| node.index());
|
let new_offset = reference_node
|
||||||
|
.as_ref()
|
||||||
|
.map_or(parent.len(), |node| node.index());
|
||||||
|
|
||||||
// Step 11
|
// Step 11
|
||||||
let new_offset = new_offset +
|
let new_offset = new_offset +
|
||||||
|
@ -766,7 +768,7 @@ impl RangeMethods for Range {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Step 12.
|
// Step 12.
|
||||||
Node::pre_insert(node, &parent, reference_node.r())?;
|
Node::pre_insert(node, &parent, reference_node.deref())?;
|
||||||
|
|
||||||
// Step 13.
|
// Step 13.
|
||||||
if self.Collapsed() {
|
if self.Collapsed() {
|
||||||
|
@ -842,7 +844,7 @@ impl RangeMethods for Range {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 8.
|
// Step 8.
|
||||||
for child in contained_children.r() {
|
for child in &*contained_children {
|
||||||
child.remove_self();
|
child.remove_self();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -959,7 +961,7 @@ impl RangeMethods for Range {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Step 2.
|
// Step 2.
|
||||||
let element = Element::fragment_parsing_context(&owner_doc, element.r());
|
let element = Element::fragment_parsing_context(&owner_doc, element.deref());
|
||||||
|
|
||||||
// Step 3.
|
// Step 3.
|
||||||
let fragment_node = element.parse_fragment(fragment)?;
|
let fragment_node = element.parse_fragment(fragment)?;
|
||||||
|
|
|
@ -14,7 +14,7 @@ use crate::dom::bindings::codegen::Bindings::ServoParserBinding;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::refcounted::Trusted;
|
use crate::dom::bindings::refcounted::Trusted;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom, RootedReference};
|
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
|
||||||
use crate::dom::bindings::settings_stack::is_execution_stack_empty;
|
use crate::dom::bindings::settings_stack::is_execution_stack_empty;
|
||||||
use crate::dom::bindings::str::{DOMString, USVString};
|
use crate::dom::bindings::str::{DOMString, USVString};
|
||||||
use crate::dom::characterdata::CharacterData;
|
use crate::dom::characterdata::CharacterData;
|
||||||
|
@ -203,7 +203,7 @@ impl ServoParser {
|
||||||
|
|
||||||
let fragment_context = FragmentContext {
|
let fragment_context = FragmentContext {
|
||||||
context_elem: context_node,
|
context_elem: context_node,
|
||||||
form_elem: form.r(),
|
form_elem: form.deref(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let parser = ServoParser::new(
|
let parser = ServoParser::new(
|
||||||
|
|
|
@ -9,7 +9,7 @@ use crate::dom::bindings::codegen::Bindings::StorageEventBinding::StorageEventMe
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||||
use crate::dom::bindings::root::{DomRoot, MutNullableDom, RootedReference};
|
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
||||||
use crate::dom::bindings::str::{DOMString, USVString};
|
use crate::dom::bindings::str::{DOMString, USVString};
|
||||||
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
||||||
use crate::dom::storage::Storage;
|
use crate::dom::storage::Storage;
|
||||||
|
@ -91,7 +91,7 @@ impl StorageEvent {
|
||||||
let oldValue = init.oldValue.clone();
|
let oldValue = init.oldValue.clone();
|
||||||
let newValue = init.newValue.clone();
|
let newValue = init.newValue.clone();
|
||||||
let url = init.url.clone();
|
let url = init.url.clone();
|
||||||
let storageArea = init.storageArea.r();
|
let storageArea = init.storageArea.deref();
|
||||||
let bubbles = EventBubbles::from(init.parent.bubbles);
|
let bubbles = EventBubbles::from(init.parent.bubbles);
|
||||||
let cancelable = EventCancelable::from(init.parent.cancelable);
|
let cancelable = EventCancelable::from(init.parent.cancelable);
|
||||||
let event = StorageEvent::new(
|
let event = StorageEvent::new(
|
||||||
|
|
|
@ -9,7 +9,7 @@ use crate::dom::bindings::codegen::Bindings::TextBinding::{self, TextMethods};
|
||||||
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::root::{DomRoot, RootedReference};
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::characterdata::CharacterData;
|
use crate::dom::characterdata::CharacterData;
|
||||||
use crate::dom::document::Document;
|
use crate::dom::document::Document;
|
||||||
|
@ -68,7 +68,7 @@ impl TextMethods for Text {
|
||||||
if let Some(ref parent) = parent {
|
if let Some(ref parent) = parent {
|
||||||
// Step 7.1.
|
// Step 7.1.
|
||||||
parent
|
parent
|
||||||
.InsertBefore(new_node.upcast(), node.GetNextSibling().r())
|
.InsertBefore(new_node.upcast(), node.GetNextSibling().deref())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
// Steps 7.2-3.
|
// Steps 7.2-3.
|
||||||
node.ranges()
|
node.ranges()
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||||
use crate::dom::bindings::root::{DomRoot, MutNullableDom, RootedReference};
|
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
|
@ -73,7 +73,7 @@ impl UIEvent {
|
||||||
type_,
|
type_,
|
||||||
bubbles,
|
bubbles,
|
||||||
cancelable,
|
cancelable,
|
||||||
init.view.r(),
|
init.view.deref(),
|
||||||
init.detail,
|
init.detail,
|
||||||
);
|
);
|
||||||
Ok(event)
|
Ok(event)
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::dom::bindings::error::{throw_dom_exception, Error};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::proxyhandler::{fill_property_descriptor, get_property_descriptor};
|
use crate::dom::bindings::proxyhandler::{fill_property_descriptor, get_property_descriptor};
|
||||||
use crate::dom::bindings::reflector::{DomObject, Reflector};
|
use crate::dom::bindings::reflector::{DomObject, Reflector};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot, RootedReference};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::bindings::trace::JSTraceable;
|
use crate::dom::bindings::trace::JSTraceable;
|
||||||
use crate::dom::bindings::utils::{get_array_index_from_id, AsVoidPtr, WindowProxyHandler};
|
use crate::dom::bindings::utils::{get_array_index_from_id, AsVoidPtr, WindowProxyHandler};
|
||||||
|
@ -488,7 +488,7 @@ impl WindowProxy {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn frame_element(&self) -> Option<&Element> {
|
pub fn frame_element(&self) -> Option<&Element> {
|
||||||
self.frame_element.r()
|
self.frame_element.deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn document(&self) -> Option<DomRoot<Document>> {
|
pub fn document(&self) -> Option<DomRoot<Document>> {
|
||||||
|
@ -498,7 +498,7 @@ impl WindowProxy {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parent(&self) -> Option<&WindowProxy> {
|
pub fn parent(&self) -> Option<&WindowProxy> {
|
||||||
self.parent.r()
|
self.parent.deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn top(&self) -> &WindowProxy {
|
pub fn top(&self) -> &WindowProxy {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#![cfg_attr(feature = "unstable", feature(on_unimplemented))]
|
#![cfg_attr(feature = "unstable", feature(on_unimplemented))]
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
#![feature(drain_filter)]
|
#![feature(drain_filter)]
|
||||||
|
#![feature(inner_deref)]
|
||||||
#![feature(plugin)]
|
#![feature(plugin)]
|
||||||
#![feature(type_alias_enum_variants)]
|
#![feature(type_alias_enum_variants)]
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
|
|
|
@ -33,8 +33,8 @@ use crate::dom::bindings::conversions::{
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::num::Finite;
|
use crate::dom::bindings::num::Finite;
|
||||||
use crate::dom::bindings::reflector::DomObject;
|
use crate::dom::bindings::reflector::DomObject;
|
||||||
|
use crate::dom::bindings::root::ThreadLocalStackRoots;
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom, RootCollection};
|
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom, RootCollection};
|
||||||
use crate::dom::bindings::root::{RootedReference, ThreadLocalStackRoots};
|
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::bindings::structuredclone::StructuredCloneData;
|
use crate::dom::bindings::structuredclone::StructuredCloneData;
|
||||||
use crate::dom::bindings::trace::JSTraceable;
|
use crate::dom::bindings::trace::JSTraceable;
|
||||||
|
@ -2196,7 +2196,7 @@ impl ScriptThread {
|
||||||
pipeline_id
|
pipeline_id
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
Some(window) => window.History().r().activate_state(history_state_id, url),
|
Some(window) => window.History().activate_state(history_state_id, url),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2212,7 +2212,7 @@ impl ScriptThread {
|
||||||
pipeline_id
|
pipeline_id
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
Some(window) => window.History().r().remove_states(history_states),
|
Some(window) => window.History().remove_states(history_states),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2655,7 +2655,7 @@ impl ScriptThread {
|
||||||
global_to_clone,
|
global_to_clone,
|
||||||
browsing_context_id,
|
browsing_context_id,
|
||||||
top_level_browsing_context_id,
|
top_level_browsing_context_id,
|
||||||
parent.r(),
|
parent.deref(),
|
||||||
opener,
|
opener,
|
||||||
);
|
);
|
||||||
self.window_proxies
|
self.window_proxies
|
||||||
|
@ -2701,8 +2701,8 @@ impl ScriptThread {
|
||||||
&window,
|
&window,
|
||||||
browsing_context_id,
|
browsing_context_id,
|
||||||
top_level_browsing_context_id,
|
top_level_browsing_context_id,
|
||||||
iframe.r().map(Castable::upcast),
|
iframe.deref().map(Castable::upcast),
|
||||||
parent.r(),
|
parent.deref(),
|
||||||
opener,
|
opener,
|
||||||
);
|
);
|
||||||
self.window_proxies
|
self.window_proxies
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue