mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +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
|
@ -35,14 +35,14 @@ impl HTMLLinkElementDerived for EventTarget {
|
|||
}
|
||||
|
||||
impl HTMLLinkElement {
|
||||
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLLinkElement {
|
||||
pub fn new_inherited(localName: DOMString, document: JSRef<Document>) -> HTMLLinkElement {
|
||||
HTMLLinkElement {
|
||||
htmlelement: HTMLElement::new_inherited(HTMLLinkElementTypeId, localName, document)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn new(localName: DOMString, document: &JSRef<Document>) -> Temporary<HTMLLinkElement> {
|
||||
pub fn new(localName: DOMString, document: JSRef<Document>) -> Temporary<HTMLLinkElement> {
|
||||
let element = HTMLLinkElement::new_inherited(localName, document);
|
||||
Node::reflect_node(box element, document, HTMLLinkElementBinding::Wrap)
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ impl HTMLLinkElement {
|
|||
|
||||
impl<'a> VirtualMethods for JSRef<'a, HTMLLinkElement> {
|
||||
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)
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLLinkElement> {
|
|||
_ => (),
|
||||
}
|
||||
|
||||
let node: &JSRef<Node> = NodeCast::from_ref(self);
|
||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
||||
match name.as_slice() {
|
||||
"href" => node.set_enabled_state(true),
|
||||
_ => ()
|
||||
|
@ -73,7 +73,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLLinkElement> {
|
|||
_ => (),
|
||||
}
|
||||
|
||||
let node: &JSRef<Node> = NodeCast::from_ref(self);
|
||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
||||
match name.as_slice() {
|
||||
"href" => node.set_enabled_state(false),
|
||||
_ => ()
|
||||
|
@ -87,7 +87,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLLinkElement> {
|
|||
}
|
||||
|
||||
if tree_in_doc {
|
||||
let element: &JSRef<Element> = ElementCast::from_ref(self);
|
||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
||||
|
||||
// FIXME: workaround for https://github.com/mozilla/rust/issues/13246;
|
||||
// we get unrooting order failures if these are inside the match.
|
||||
|
@ -119,7 +119,7 @@ trait PrivateHTMLLinkElementHelpers {
|
|||
|
||||
impl<'a> PrivateHTMLLinkElementHelpers for JSRef<'a, HTMLLinkElement> {
|
||||
fn handle_stylesheet_url(&self, href: &str) {
|
||||
let window = window_from_node(self).root();
|
||||
let window = window_from_node(*self).root();
|
||||
match UrlParser::new().base_url(&window.deref().page().get_url()).parse(href) {
|
||||
Ok(url) => {
|
||||
let LayoutChan(ref layout_chan) = *window.deref().page().layout_chan;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue