mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
First steps of &JSRef -> JSRef conversion
Replace &JSRef with JSRef in the bulk of the generated code. This will remove a level of indirection throughout all DOM code. This patch doesn't change methods implemented on JSRef<T> to take `self` rather than `&self`, and it leaves a few other uses of &JSRef, but those changes can be made incrementally.
This commit is contained in:
parent
b8f34bbc51
commit
4fa8725111
126 changed files with 994 additions and 992 deletions
|
@ -39,14 +39,14 @@ impl HTMLObjectElementDerived for EventTarget {
|
|||
}
|
||||
|
||||
impl HTMLObjectElement {
|
||||
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLObjectElement {
|
||||
pub fn new_inherited(localName: DOMString, document: JSRef<Document>) -> HTMLObjectElement {
|
||||
HTMLObjectElement {
|
||||
htmlelement: HTMLElement::new_inherited(HTMLObjectElementTypeId, localName, document),
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLObjectElement> {
|
||||
pub fn new(localName: DOMString, document: JSRef<Document>) -> Temporary<HTMLObjectElement> {
|
||||
let element = HTMLObjectElement::new_inherited(localName, document);
|
||||
Node::reflect_node(box element, document, HTMLObjectElementBinding::Wrap)
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ impl<'a> ProcessDataURL for JSRef<'a, HTMLObjectElement> {
|
|||
// Makes the local `data` member match the status of the `data` attribute and starts
|
||||
/// prefetching the image. This method must be called after `data` is changed.
|
||||
fn process_data_url(&self, image_cache: ImageCacheTask) {
|
||||
let elem: &JSRef<Element> = ElementCast::from_ref(self);
|
||||
let elem: JSRef<Element> = ElementCast::from_ref(*self);
|
||||
|
||||
// TODO: support other values
|
||||
match (elem.get_attribute(Null, "type").map(|x| x.root().Value()),
|
||||
|
@ -84,14 +84,14 @@ pub fn is_image_data(uri: &str) -> bool {
|
|||
|
||||
impl<'a> HTMLObjectElementMethods for JSRef<'a, HTMLObjectElement> {
|
||||
fn Validity(&self) -> Temporary<ValidityState> {
|
||||
let window = window_from_node(self).root();
|
||||
ValidityState::new(&*window)
|
||||
let window = window_from_node(*self).root();
|
||||
ValidityState::new(*window)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> VirtualMethods for JSRef<'a, HTMLObjectElement> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods> {
|
||||
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
||||
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_borrowed_ref(self);
|
||||
Some(htmlelement as &VirtualMethods)
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLObjectElement> {
|
|||
}
|
||||
|
||||
if "data" == name.as_slice() {
|
||||
let window = window_from_node(self).root();
|
||||
let window = window_from_node(*self).root();
|
||||
self.process_data_url(window.deref().image_cache_task.clone());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue