mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Clean up the cast calls
This commit is contained in:
parent
13ea3ac413
commit
68014af78e
66 changed files with 412 additions and 718 deletions
|
@ -19,7 +19,6 @@ use dom::bindings::trace::JSTraceable;
|
|||
use dom::document::Document;
|
||||
use dom::element::{AttributeMutation, Element, ElementCreator};
|
||||
use dom::event::{Event, EventBubbles, EventCancelable};
|
||||
use dom::eventtarget::EventTarget;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::{ChildrenMutation, CloneChildrenFlag, Node};
|
||||
use dom::node::{document_from_node, window_from_node};
|
||||
|
@ -190,8 +189,7 @@ impl HTMLScriptElement {
|
|||
return NextParserState::Continue;
|
||||
}
|
||||
// Step 5.
|
||||
let node = self.upcast::<Node>();
|
||||
if !node.is_in_doc() {
|
||||
if !self.upcast::<Node>().is_in_doc() {
|
||||
return NextParserState::Continue;
|
||||
}
|
||||
// Step 6, 7.
|
||||
|
@ -507,16 +505,13 @@ impl HTMLScriptElement {
|
|||
type_,
|
||||
bubbles,
|
||||
cancelable);
|
||||
let event = event.r();
|
||||
let target = self.upcast::<EventTarget>();
|
||||
event.fire(target)
|
||||
event.fire(self.upcast())
|
||||
}
|
||||
}
|
||||
|
||||
impl VirtualMethods for HTMLScriptElement {
|
||||
fn super_type(&self) -> Option<&VirtualMethods> {
|
||||
let htmlelement: &HTMLElement = self.upcast::<HTMLElement>();
|
||||
Some(htmlelement as &VirtualMethods)
|
||||
Some(self.upcast::<HTMLElement>() as &VirtualMethods)
|
||||
}
|
||||
|
||||
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
||||
|
@ -537,8 +532,7 @@ impl VirtualMethods for HTMLScriptElement {
|
|||
if let Some(ref s) = self.super_type() {
|
||||
s.children_changed(mutation);
|
||||
}
|
||||
let node = self.upcast::<Node>();
|
||||
if !self.parser_inserted.get() && node.is_in_doc() {
|
||||
if !self.parser_inserted.get() && self.upcast::<Node>().is_in_doc() {
|
||||
self.prepare();
|
||||
}
|
||||
}
|
||||
|
@ -561,8 +555,7 @@ impl VirtualMethods for HTMLScriptElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#already-started
|
||||
if self.already_started.get() {
|
||||
let copy_elem = copy.downcast::<HTMLScriptElement>().unwrap();
|
||||
copy_elem.mark_already_started();
|
||||
copy.downcast::<HTMLScriptElement>().unwrap().mark_already_started();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -580,8 +573,7 @@ impl HTMLScriptElementMethods for HTMLScriptElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-script-text
|
||||
fn SetText(&self, value: DOMString) {
|
||||
let node = self.upcast::<Node>();
|
||||
node.SetTextContent(Some(value))
|
||||
self.upcast::<Node>().SetTextContent(Some(value))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue