mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Remove doublepointer in VirtualMethods, and from_borrowed_ref
Most of the heavy lifting done by: ``` $ ls *rs | xargs gawk -i inplace '/let .*: &&.*from_borrowed_ref/{sub("&&", "\\&");sub("_borrowed_","_");} {print $0}' $ ls *rs | xargs gawk -i inplace "/impl.*VirtualMethods/{in_vm=1; sub(/<'a>/,\"\");sub(/&'a /,\"\")} /^}\$/{in_vm=0;} in_vm{\$0=gensub(/\\*self([^.])/,\"self\\\1\",\"g\"); sub(/from_borrowed_ref/,\"from_ref\")} {print}" ```
This commit is contained in:
parent
5e83a3f0a3
commit
b33c5427bc
34 changed files with 159 additions and 164 deletions
|
@ -5839,11 +5839,6 @@ impl ${name}Cast {
|
||||||
unsafe { mem::transmute(derived) }
|
unsafe { mem::transmute(derived) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn from_borrowed_ref<'a, 'b, T: ${fromBound}+Reflectable>(derived: &'a &'b T) -> &'a &'b ${name} {
|
|
||||||
unsafe { mem::transmute(derived) }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn from_layout_js<T: ${fromBound}+Reflectable>(derived: &LayoutJS<T>) -> LayoutJS<${name}> {
|
pub fn from_layout_js<T: ${fromBound}+Reflectable>(derived: &LayoutJS<T>) -> LayoutJS<${name}> {
|
||||||
|
|
|
@ -1543,9 +1543,9 @@ impl<'a> ElementMethods for &'a Element {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a Element {
|
impl VirtualMethods for Element {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let node: &&Node = NodeCast::from_borrowed_ref(self);
|
let node: &Node = NodeCast::from_ref(self);
|
||||||
Some(node as &VirtualMethods)
|
Some(node as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1554,11 +1554,11 @@ impl<'a> VirtualMethods for &'a Element {
|
||||||
s.after_set_attr(attr);
|
s.after_set_attr(attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
match attr.local_name() {
|
match attr.local_name() {
|
||||||
&atom!("style") => {
|
&atom!("style") => {
|
||||||
// Modifying the `style` attribute might change style.
|
// Modifying the `style` attribute might change style.
|
||||||
let doc = document_from_node(*self);
|
let doc = document_from_node(self);
|
||||||
let base_url = doc.r().base_url();
|
let base_url = doc.r().base_url();
|
||||||
let value = attr.value();
|
let value = attr.value();
|
||||||
let style = Some(parse_style_attribute(&value, &base_url));
|
let style = Some(parse_style_attribute(&value, &base_url));
|
||||||
|
@ -1571,7 +1571,7 @@ impl<'a> VirtualMethods for &'a Element {
|
||||||
&atom!("class") => {
|
&atom!("class") => {
|
||||||
// Modifying a class can change style.
|
// Modifying a class can change style.
|
||||||
if node.is_in_doc() {
|
if node.is_in_doc() {
|
||||||
let document = document_from_node(*self);
|
let document = document_from_node(self);
|
||||||
document.r().content_changed(node, NodeDamage::NodeStyleDamaged);
|
document.r().content_changed(node, NodeDamage::NodeStyleDamaged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1579,10 +1579,10 @@ impl<'a> VirtualMethods for &'a Element {
|
||||||
// Modifying an ID might change style.
|
// Modifying an ID might change style.
|
||||||
let value = attr.value();
|
let value = attr.value();
|
||||||
if node.is_in_doc() {
|
if node.is_in_doc() {
|
||||||
let doc = document_from_node(*self);
|
let doc = document_from_node(self);
|
||||||
if !value.is_empty() {
|
if !value.is_empty() {
|
||||||
let value = value.atom().unwrap().clone();
|
let value = value.atom().unwrap().clone();
|
||||||
doc.r().register_named_element(*self, value);
|
doc.r().register_named_element(self, value);
|
||||||
}
|
}
|
||||||
doc.r().content_changed(node, NodeDamage::NodeStyleDamaged);
|
doc.r().content_changed(node, NodeDamage::NodeStyleDamaged);
|
||||||
}
|
}
|
||||||
|
@ -1590,7 +1590,7 @@ impl<'a> VirtualMethods for &'a Element {
|
||||||
_ => {
|
_ => {
|
||||||
// Modifying any other attribute might change arbitrary things.
|
// Modifying any other attribute might change arbitrary things.
|
||||||
if node.is_in_doc() {
|
if node.is_in_doc() {
|
||||||
let document = document_from_node(*self);
|
let document = document_from_node(self);
|
||||||
document.r().content_changed(node, NodeDamage::OtherNodeDamage);
|
document.r().content_changed(node, NodeDamage::OtherNodeDamage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1602,14 +1602,14 @@ impl<'a> VirtualMethods for &'a Element {
|
||||||
s.before_remove_attr(attr);
|
s.before_remove_attr(attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
match attr.local_name() {
|
match attr.local_name() {
|
||||||
&atom!("style") => {
|
&atom!("style") => {
|
||||||
// Modifying the `style` attribute might change style.
|
// Modifying the `style` attribute might change style.
|
||||||
*self.style_attribute.borrow_mut() = None;
|
*self.style_attribute.borrow_mut() = None;
|
||||||
|
|
||||||
if node.is_in_doc() {
|
if node.is_in_doc() {
|
||||||
let doc = document_from_node(*self);
|
let doc = document_from_node(self);
|
||||||
doc.r().content_changed(node, NodeDamage::NodeStyleDamaged);
|
doc.r().content_changed(node, NodeDamage::NodeStyleDamaged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1617,10 +1617,10 @@ impl<'a> VirtualMethods for &'a Element {
|
||||||
// Modifying an ID can change style.
|
// Modifying an ID can change style.
|
||||||
let value = attr.value();
|
let value = attr.value();
|
||||||
if node.is_in_doc() {
|
if node.is_in_doc() {
|
||||||
let doc = document_from_node(*self);
|
let doc = document_from_node(self);
|
||||||
if !value.is_empty() {
|
if !value.is_empty() {
|
||||||
let value = value.atom().unwrap().clone();
|
let value = value.atom().unwrap().clone();
|
||||||
doc.r().unregister_named_element(*self, value);
|
doc.r().unregister_named_element(self, value);
|
||||||
}
|
}
|
||||||
doc.r().content_changed(node, NodeDamage::NodeStyleDamaged);
|
doc.r().content_changed(node, NodeDamage::NodeStyleDamaged);
|
||||||
}
|
}
|
||||||
|
@ -1628,14 +1628,14 @@ impl<'a> VirtualMethods for &'a Element {
|
||||||
&atom!("class") => {
|
&atom!("class") => {
|
||||||
// Modifying a class can change style.
|
// Modifying a class can change style.
|
||||||
if node.is_in_doc() {
|
if node.is_in_doc() {
|
||||||
let document = document_from_node(*self);
|
let document = document_from_node(self);
|
||||||
document.r().content_changed(node, NodeDamage::NodeStyleDamaged);
|
document.r().content_changed(node, NodeDamage::NodeStyleDamaged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
// Modifying any other attribute might change arbitrary things.
|
// Modifying any other attribute might change arbitrary things.
|
||||||
if node.is_in_doc() {
|
if node.is_in_doc() {
|
||||||
let doc = document_from_node(*self);
|
let doc = document_from_node(self);
|
||||||
doc.r().content_changed(node, NodeDamage::OtherNodeDamage);
|
doc.r().content_changed(node, NodeDamage::OtherNodeDamage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1658,11 +1658,11 @@ impl<'a> VirtualMethods for &'a Element {
|
||||||
if !tree_in_doc { return; }
|
if !tree_in_doc { return; }
|
||||||
|
|
||||||
if let Some(ref attr) = self.get_attribute(&ns!(""), &atom!("id")) {
|
if let Some(ref attr) = self.get_attribute(&ns!(""), &atom!("id")) {
|
||||||
let doc = document_from_node(*self);
|
let doc = document_from_node(self);
|
||||||
let value = attr.r().Value();
|
let value = attr.r().Value();
|
||||||
if !value.is_empty() {
|
if !value.is_empty() {
|
||||||
let value = Atom::from_slice(&value);
|
let value = Atom::from_slice(&value);
|
||||||
doc.r().register_named_element(*self, value);
|
doc.r().register_named_element(self, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1675,11 +1675,11 @@ impl<'a> VirtualMethods for &'a Element {
|
||||||
if !tree_in_doc { return; }
|
if !tree_in_doc { return; }
|
||||||
|
|
||||||
if let Some(ref attr) = self.get_attribute(&ns!(""), &atom!("id")) {
|
if let Some(ref attr) = self.get_attribute(&ns!(""), &atom!("id")) {
|
||||||
let doc = document_from_node(*self);
|
let doc = document_from_node(self);
|
||||||
let value = attr.r().Value();
|
let value = attr.r().Value();
|
||||||
if !value.is_empty() {
|
if !value.is_empty() {
|
||||||
let value = Atom::from_slice(&value);
|
let value = Atom::from_slice(&value);
|
||||||
doc.r().unregister_named_element(*self, value);
|
doc.r().unregister_named_element(self, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,7 +367,7 @@ impl<'a> EventTargetMethods for &'a EventTarget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a EventTarget {
|
impl VirtualMethods for EventTarget {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,9 +67,9 @@ impl HTMLAnchorElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLAnchorElement {
|
impl VirtualMethods for HTMLAnchorElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,9 +58,9 @@ impl<'a> HTMLAppletElementMethods for &'a HTMLAppletElement {
|
||||||
make_atomic_setter!(SetName, "name");
|
make_atomic_setter!(SetName, "name");
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLAppletElement {
|
impl VirtualMethods for HTMLAppletElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
Some(HTMLElementCast::from_borrowed_ref(self) as &VirtualMethods)
|
Some(HTMLElementCast::from_ref(self) as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {
|
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {
|
||||||
|
|
|
@ -53,9 +53,9 @@ impl HTMLAreaElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLAreaElement {
|
impl VirtualMethods for HTMLAreaElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,9 +80,9 @@ impl HTMLBaseElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLBaseElement {
|
impl VirtualMethods for HTMLBaseElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
Some(HTMLElementCast::from_borrowed_ref(self) as &VirtualMethods)
|
Some(HTMLElementCast::from_ref(self) as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn after_set_attr(&self, attr: &Attr) {
|
fn after_set_attr(&self, attr: &Attr) {
|
||||||
|
|
|
@ -106,9 +106,9 @@ impl<'a> HTMLBodyElementHelpers for &'a HTMLBodyElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLBodyElement {
|
impl VirtualMethods for HTMLBodyElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let element: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let element: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(element as &VirtualMethods)
|
Some(element as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ impl<'a> VirtualMethods for &'a HTMLBodyElement {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let window = window_from_node(*self);
|
let window = window_from_node(self);
|
||||||
let document = window.r().Document();
|
let document = window.r().Document();
|
||||||
document.r().set_reflow_timeout(time::precise_time_ns() + INITIAL_REFLOW_DELAY);
|
document.r().set_reflow_timeout(time::precise_time_ns() + INITIAL_REFLOW_DELAY);
|
||||||
let ConstellationChan(ref chan) = window.r().constellation_chan();
|
let ConstellationChan(ref chan) = window.r().constellation_chan();
|
||||||
|
@ -141,7 +141,7 @@ impl<'a> VirtualMethods for &'a HTMLBodyElement {
|
||||||
"onbeforeunload", "onhashchange", "onlanguagechange", "onmessage",
|
"onbeforeunload", "onhashchange", "onlanguagechange", "onmessage",
|
||||||
"onoffline", "ononline", "onpagehide", "onpageshow", "onpopstate",
|
"onoffline", "ononline", "onpagehide", "onpageshow", "onpopstate",
|
||||||
"onstorage", "onresize", "onunload", "onerror"];
|
"onstorage", "onresize", "onunload", "onerror"];
|
||||||
let window = window_from_node(*self);
|
let window = window_from_node(self);
|
||||||
let (cx, url, reflector) = (window.r().get_cx(),
|
let (cx, url, reflector) = (window.r().get_cx(),
|
||||||
window.r().get_url(),
|
window.r().get_url(),
|
||||||
window.r().reflector().get_jsobject());
|
window.r().reflector().get_jsobject());
|
||||||
|
@ -149,7 +149,7 @@ impl<'a> VirtualMethods for &'a HTMLBodyElement {
|
||||||
if FORWARDED_EVENTS.iter().any(|&event| &**name == event) {
|
if FORWARDED_EVENTS.iter().any(|&event| &**name == event) {
|
||||||
EventTargetCast::from_ref(window.r())
|
EventTargetCast::from_ref(window.r())
|
||||||
} else {
|
} else {
|
||||||
EventTargetCast::from_ref(*self)
|
EventTargetCast::from_ref(self)
|
||||||
};
|
};
|
||||||
evtarget.set_event_handler_uncompiled(cx, url, reflector,
|
evtarget.set_event_handler_uncompiled(cx, url, reflector,
|
||||||
&name[2..],
|
&name[2..],
|
||||||
|
@ -161,7 +161,7 @@ impl<'a> VirtualMethods for &'a HTMLBodyElement {
|
||||||
self.background_color.set(str::parse_legacy_color(&attr.value()).ok())
|
self.background_color.set(str::parse_legacy_color(&attr.value()).ok())
|
||||||
}
|
}
|
||||||
&atom!("background") => {
|
&atom!("background") => {
|
||||||
let doc = document_from_node(*self);
|
let doc = document_from_node(self);
|
||||||
let base = doc.r().url();
|
let base = doc.r().url();
|
||||||
|
|
||||||
*self.background.borrow_mut() = UrlParser::new().base_url(&base).parse(&attr.value()).ok();
|
*self.background.borrow_mut() = UrlParser::new().base_url(&base).parse(&attr.value()).ok();
|
||||||
|
|
|
@ -132,9 +132,9 @@ impl<'a> HTMLButtonElementMethods for &'a HTMLButtonElement {
|
||||||
make_setter!(SetValue, "value");
|
make_setter!(SetValue, "value");
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLButtonElement {
|
impl VirtualMethods for HTMLButtonElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ impl<'a> VirtualMethods for &'a HTMLButtonElement {
|
||||||
|
|
||||||
match attr.local_name() {
|
match attr.local_name() {
|
||||||
&atom!("disabled") => {
|
&atom!("disabled") => {
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.set_disabled_state(true);
|
node.set_disabled_state(true);
|
||||||
node.set_enabled_state(false);
|
node.set_enabled_state(false);
|
||||||
},
|
},
|
||||||
|
@ -160,7 +160,7 @@ impl<'a> VirtualMethods for &'a HTMLButtonElement {
|
||||||
|
|
||||||
match attr.local_name() {
|
match attr.local_name() {
|
||||||
&atom!("disabled") => {
|
&atom!("disabled") => {
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.set_disabled_state(false);
|
node.set_disabled_state(false);
|
||||||
node.set_enabled_state(true);
|
node.set_enabled_state(true);
|
||||||
node.check_ancestors_disabled_state_for_form_control();
|
node.check_ancestors_disabled_state_for_form_control();
|
||||||
|
@ -174,7 +174,7 @@ impl<'a> VirtualMethods for &'a HTMLButtonElement {
|
||||||
s.bind_to_tree(tree_in_doc);
|
s.bind_to_tree(tree_in_doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.check_ancestors_disabled_state_for_form_control();
|
node.check_ancestors_disabled_state_for_form_control();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ impl<'a> VirtualMethods for &'a HTMLButtonElement {
|
||||||
s.unbind_from_tree(tree_in_doc);
|
s.unbind_from_tree(tree_in_doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
if node.ancestors().any(|ancestor| ancestor.r().is_htmlfieldsetelement()) {
|
if node.ancestors().any(|ancestor| ancestor.r().is_htmlfieldsetelement()) {
|
||||||
node.check_ancestors_disabled_state_for_form_control();
|
node.check_ancestors_disabled_state_for_form_control();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -260,9 +260,9 @@ impl<'a> HTMLCanvasElementMethods for &'a HTMLCanvasElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLCanvasElement {
|
impl VirtualMethods for HTMLCanvasElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let element: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let element: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(element as &VirtualMethods)
|
Some(element as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -322,9 +322,9 @@ impl<'a> HTMLElementCustomAttributeHelpers for &'a HTMLElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLElement {
|
impl VirtualMethods for HTMLElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let element: &&Element = ElementCast::from_borrowed_ref(self);
|
let element: &Element = ElementCast::from_ref(self);
|
||||||
Some(element as &VirtualMethods)
|
Some(element as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,11 +348,11 @@ impl<'a> VirtualMethods for &'a HTMLElement {
|
||||||
|
|
||||||
let name = attr.local_name();
|
let name = attr.local_name();
|
||||||
if name.starts_with("on") {
|
if name.starts_with("on") {
|
||||||
let window = window_from_node(*self);
|
let window = window_from_node(self);
|
||||||
let (cx, url, reflector) = (window.r().get_cx(),
|
let (cx, url, reflector) = (window.r().get_cx(),
|
||||||
window.r().get_url(),
|
window.r().get_url(),
|
||||||
window.r().reflector().get_jsobject());
|
window.r().reflector().get_jsobject());
|
||||||
let evtarget = EventTargetCast::from_ref(*self);
|
let evtarget = EventTargetCast::from_ref(self);
|
||||||
evtarget.set_event_handler_uncompiled(cx, url, reflector,
|
evtarget.set_event_handler_uncompiled(cx, url, reflector,
|
||||||
&name[2..],
|
&name[2..],
|
||||||
(**attr.value()).to_owned());
|
(**attr.value()).to_owned());
|
||||||
|
|
|
@ -85,9 +85,9 @@ impl<'a> HTMLFieldSetElementMethods for &'a HTMLFieldSetElement {
|
||||||
make_bool_setter!(SetDisabled, "disabled");
|
make_bool_setter!(SetDisabled, "disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLFieldSetElement {
|
impl VirtualMethods for HTMLFieldSetElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ impl<'a> VirtualMethods for &'a HTMLFieldSetElement {
|
||||||
|
|
||||||
match attr.local_name() {
|
match attr.local_name() {
|
||||||
&atom!("disabled") => {
|
&atom!("disabled") => {
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.set_disabled_state(true);
|
node.set_disabled_state(true);
|
||||||
node.set_enabled_state(false);
|
node.set_enabled_state(false);
|
||||||
let maybe_legend = node.children()
|
let maybe_legend = node.children()
|
||||||
|
@ -138,7 +138,7 @@ impl<'a> VirtualMethods for &'a HTMLFieldSetElement {
|
||||||
|
|
||||||
match attr.local_name() {
|
match attr.local_name() {
|
||||||
&atom!("disabled") => {
|
&atom!("disabled") => {
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.set_disabled_state(false);
|
node.set_disabled_state(false);
|
||||||
node.set_enabled_state(true);
|
node.set_enabled_state(true);
|
||||||
let maybe_legend = node.children()
|
let maybe_legend = node.children()
|
||||||
|
|
|
@ -55,9 +55,9 @@ impl<'a> HTMLFontElementMethods for &'a HTMLFontElement {
|
||||||
make_setter!(SetColor, "color");
|
make_setter!(SetColor, "color");
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLFontElement {
|
impl VirtualMethods for HTMLFontElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -571,9 +571,9 @@ pub trait FormControl<'a> : Copy + Sized {
|
||||||
fn to_element(self) -> &'a Element;
|
fn to_element(self) -> &'a Element;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLFormElement {
|
impl VirtualMethods for HTMLFormElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
Some(HTMLElementCast::from_borrowed_ref(self) as &VirtualMethods)
|
Some(HTMLElementCast::from_ref(self) as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {
|
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {
|
||||||
|
|
|
@ -46,12 +46,12 @@ impl HTMLHeadElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLHeadElement {
|
impl VirtualMethods for HTMLHeadElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
fn bind_to_tree(&self, _tree_in_doc: bool) {
|
fn bind_to_tree(&self, _tree_in_doc: bool) {
|
||||||
load_script(*self);
|
load_script(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -365,9 +365,9 @@ impl<'a> HTMLIFrameElementMethods for &'a HTMLIFrameElement {
|
||||||
make_setter!(SetHeight, "height");
|
make_setter!(SetHeight, "height");
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLIFrameElement {
|
impl VirtualMethods for HTMLIFrameElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ impl<'a> VirtualMethods for &'a HTMLIFrameElement {
|
||||||
self.sandbox.set(Some(modes));
|
self.sandbox.set(Some(modes));
|
||||||
}
|
}
|
||||||
&atom!("src") => {
|
&atom!("src") => {
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
if node.is_in_doc() {
|
if node.is_in_doc() {
|
||||||
self.process_the_iframe_attributes()
|
self.process_the_iframe_attributes()
|
||||||
}
|
}
|
||||||
|
@ -440,7 +440,7 @@ impl<'a> VirtualMethods for &'a HTMLIFrameElement {
|
||||||
// https://html.spec.whatwg.org/multipage/#a-browsing-context-is-discarded
|
// https://html.spec.whatwg.org/multipage/#a-browsing-context-is-discarded
|
||||||
match (self.containing_page_pipeline_id(), self.subpage_id()) {
|
match (self.containing_page_pipeline_id(), self.subpage_id()) {
|
||||||
(Some(containing_pipeline_id), Some(subpage_id)) => {
|
(Some(containing_pipeline_id), Some(subpage_id)) => {
|
||||||
let window = window_from_node(*self);
|
let window = window_from_node(self);
|
||||||
let window = window.r();
|
let window = window.r();
|
||||||
|
|
||||||
let ConstellationChan(ref chan) = window.constellation_chan();
|
let ConstellationChan(ref chan) = window.constellation_chan();
|
||||||
|
|
|
@ -304,9 +304,9 @@ impl<'a> HTMLImageElementMethods for &'a HTMLImageElement {
|
||||||
make_setter!(SetBorder, "border");
|
make_setter!(SetBorder, "border");
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLImageElement {
|
impl VirtualMethods for HTMLImageElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ impl<'a> VirtualMethods for &'a HTMLImageElement {
|
||||||
|
|
||||||
match attr.local_name() {
|
match attr.local_name() {
|
||||||
&atom!("src") => {
|
&atom!("src") => {
|
||||||
let window = window_from_node(*self);
|
let window = window_from_node(self);
|
||||||
let url = window.r().get_url();
|
let url = window.r().get_url();
|
||||||
self.update_image(Some(((**attr.value()).to_owned(), &url)));
|
self.update_image(Some(((**attr.value()).to_owned(), &url)));
|
||||||
},
|
},
|
||||||
|
|
|
@ -456,9 +456,9 @@ impl<'a> HTMLInputElementHelpers for &'a HTMLInputElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLInputElement {
|
impl VirtualMethods for HTMLInputElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ impl<'a> VirtualMethods for &'a HTMLInputElement {
|
||||||
|
|
||||||
match attr.local_name() {
|
match attr.local_name() {
|
||||||
&atom!("disabled") => {
|
&atom!("disabled") => {
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.set_disabled_state(true);
|
node.set_disabled_state(true);
|
||||||
node.set_enabled_state(false);
|
node.set_enabled_state(false);
|
||||||
}
|
}
|
||||||
|
@ -532,7 +532,7 @@ impl<'a> VirtualMethods for &'a HTMLInputElement {
|
||||||
|
|
||||||
match attr.local_name() {
|
match attr.local_name() {
|
||||||
&atom!("disabled") => {
|
&atom!("disabled") => {
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.set_disabled_state(false);
|
node.set_disabled_state(false);
|
||||||
node.set_enabled_state(true);
|
node.set_enabled_state(true);
|
||||||
node.check_ancestors_disabled_state_for_form_control();
|
node.check_ancestors_disabled_state_for_form_control();
|
||||||
|
@ -548,7 +548,7 @@ impl<'a> VirtualMethods for &'a HTMLInputElement {
|
||||||
}
|
}
|
||||||
&atom!("type") => {
|
&atom!("type") => {
|
||||||
if self.input_type.get() == InputType::InputRadio {
|
if self.input_type.get() == InputType::InputRadio {
|
||||||
broadcast_radio_checked(*self,
|
broadcast_radio_checked(self,
|
||||||
self.get_radio_group_name()
|
self.get_radio_group_name()
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|group| &**group));
|
.map(|group| &**group));
|
||||||
|
@ -584,7 +584,7 @@ impl<'a> VirtualMethods for &'a HTMLInputElement {
|
||||||
s.bind_to_tree(tree_in_doc);
|
s.bind_to_tree(tree_in_doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.check_ancestors_disabled_state_for_form_control();
|
node.check_ancestors_disabled_state_for_form_control();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,7 +593,7 @@ impl<'a> VirtualMethods for &'a HTMLInputElement {
|
||||||
s.unbind_from_tree(tree_in_doc);
|
s.unbind_from_tree(tree_in_doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
if node.ancestors().any(|ancestor| ancestor.r().is_htmlfieldsetelement()) {
|
if node.ancestors().any(|ancestor| ancestor.r().is_htmlfieldsetelement()) {
|
||||||
node.check_ancestors_disabled_state_for_form_control();
|
node.check_ancestors_disabled_state_for_form_control();
|
||||||
} else {
|
} else {
|
||||||
|
@ -617,8 +617,8 @@ impl<'a> VirtualMethods for &'a HTMLInputElement {
|
||||||
|
|
||||||
//TODO: set the editing position for text inputs
|
//TODO: set the editing position for text inputs
|
||||||
|
|
||||||
let doc = document_from_node(*self);
|
let doc = document_from_node(self);
|
||||||
doc.r().request_focus(ElementCast::from_ref(*self));
|
doc.r().request_focus(ElementCast::from_ref(self));
|
||||||
} else if &*event.Type() == "keydown" && !event.DefaultPrevented() &&
|
} else if &*event.Type() == "keydown" && !event.DefaultPrevented() &&
|
||||||
(self.input_type.get() == InputType::InputText ||
|
(self.input_type.get() == InputType::InputText ||
|
||||||
self.input_type.get() == InputType::InputPassword) {
|
self.input_type.get() == InputType::InputPassword) {
|
||||||
|
|
|
@ -101,9 +101,9 @@ fn is_favicon(value: &Option<String>) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLLinkElement {
|
impl VirtualMethods for HTMLLinkElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,12 +112,12 @@ impl<'a> VirtualMethods for &'a HTMLLinkElement {
|
||||||
s.after_set_attr(attr);
|
s.after_set_attr(attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
if !node.is_in_doc() {
|
if !node.is_in_doc() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let element = ElementCast::from_ref(*self);
|
let element = ElementCast::from_ref(self);
|
||||||
let rel = get_attr(element, &atom!("rel"));
|
let rel = get_attr(element, &atom!("rel"));
|
||||||
|
|
||||||
match (rel, attr.local_name()) {
|
match (rel, attr.local_name()) {
|
||||||
|
@ -150,7 +150,7 @@ impl<'a> VirtualMethods for &'a HTMLLinkElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
if tree_in_doc {
|
if tree_in_doc {
|
||||||
let element = ElementCast::from_ref(*self);
|
let element = ElementCast::from_ref(self);
|
||||||
|
|
||||||
let rel = get_attr(element, &atom!("rel"));
|
let rel = get_attr(element, &atom!("rel"));
|
||||||
let href = get_attr(element, &atom!("href"));
|
let href = get_attr(element, &atom!("href"));
|
||||||
|
|
|
@ -99,9 +99,9 @@ impl<'a> HTMLObjectElementMethods for &'a HTMLObjectElement {
|
||||||
make_setter!(SetType, "type");
|
make_setter!(SetType, "type");
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLObjectElement {
|
impl VirtualMethods for HTMLObjectElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,9 +60,9 @@ impl<'a> HTMLOptGroupElementMethods for &'a HTMLOptGroupElement {
|
||||||
make_bool_setter!(SetDisabled, "disabled");
|
make_bool_setter!(SetDisabled, "disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLOptGroupElement {
|
impl VirtualMethods for HTMLOptGroupElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ impl<'a> VirtualMethods for &'a HTMLOptGroupElement {
|
||||||
|
|
||||||
match attr.local_name() {
|
match attr.local_name() {
|
||||||
&atom!("disabled") => {
|
&atom!("disabled") => {
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.set_disabled_state(true);
|
node.set_disabled_state(true);
|
||||||
node.set_enabled_state(false);
|
node.set_enabled_state(false);
|
||||||
for child in node.children() {
|
for child in node.children() {
|
||||||
|
@ -94,7 +94,7 @@ impl<'a> VirtualMethods for &'a HTMLOptGroupElement {
|
||||||
|
|
||||||
match attr.local_name() {
|
match attr.local_name() {
|
||||||
&atom!("disabled") => {
|
&atom!("disabled") => {
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.set_disabled_state(false);
|
node.set_disabled_state(false);
|
||||||
node.set_enabled_state(true);
|
node.set_enabled_state(true);
|
||||||
for child in node.children() {
|
for child in node.children() {
|
||||||
|
|
|
@ -128,9 +128,9 @@ impl<'a> HTMLOptionElementMethods for &'a HTMLOptionElement {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLOptionElement {
|
impl VirtualMethods for HTMLOptionElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ impl<'a> VirtualMethods for &'a HTMLOptionElement {
|
||||||
|
|
||||||
match attr.local_name() {
|
match attr.local_name() {
|
||||||
&atom!("disabled") => {
|
&atom!("disabled") => {
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.set_disabled_state(true);
|
node.set_disabled_state(true);
|
||||||
node.set_enabled_state(false);
|
node.set_enabled_state(false);
|
||||||
},
|
},
|
||||||
|
@ -156,7 +156,7 @@ impl<'a> VirtualMethods for &'a HTMLOptionElement {
|
||||||
|
|
||||||
match attr.local_name() {
|
match attr.local_name() {
|
||||||
&atom!("disabled") => {
|
&atom!("disabled") => {
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.set_disabled_state(false);
|
node.set_disabled_state(false);
|
||||||
node.set_enabled_state(true);
|
node.set_enabled_state(true);
|
||||||
node.check_parent_disabled_state_for_option();
|
node.check_parent_disabled_state_for_option();
|
||||||
|
@ -170,7 +170,7 @@ impl<'a> VirtualMethods for &'a HTMLOptionElement {
|
||||||
s.bind_to_tree(tree_in_doc);
|
s.bind_to_tree(tree_in_doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.check_parent_disabled_state_for_option();
|
node.check_parent_disabled_state_for_option();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ impl<'a> VirtualMethods for &'a HTMLOptionElement {
|
||||||
s.unbind_from_tree(tree_in_doc);
|
s.unbind_from_tree(tree_in_doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
if node.GetParentNode().is_some() {
|
if node.GetParentNode().is_some() {
|
||||||
node.check_parent_disabled_state_for_option();
|
node.check_parent_disabled_state_for_option();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -561,9 +561,9 @@ impl<'a> PrivateHTMLScriptElementHelpers for &'a HTMLScriptElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLScriptElement {
|
impl VirtualMethods for HTMLScriptElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ impl<'a> VirtualMethods for &'a HTMLScriptElement {
|
||||||
if let Some(ref s) = self.super_type() {
|
if let Some(ref s) = self.super_type() {
|
||||||
s.after_set_attr(attr);
|
s.after_set_attr(attr);
|
||||||
}
|
}
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
if attr.local_name() == &atom!("src") && !self.parser_inserted.get() && node.is_in_doc() {
|
if attr.local_name() == &atom!("src") && !self.parser_inserted.get() && node.is_in_doc() {
|
||||||
self.prepare();
|
self.prepare();
|
||||||
}
|
}
|
||||||
|
@ -581,7 +581,7 @@ impl<'a> VirtualMethods for &'a HTMLScriptElement {
|
||||||
if let Some(ref s) = self.super_type() {
|
if let Some(ref s) = self.super_type() {
|
||||||
s.children_changed(mutation);
|
s.children_changed(mutation);
|
||||||
}
|
}
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
if !self.parser_inserted.get() && node.is_in_doc() {
|
if !self.parser_inserted.get() && node.is_in_doc() {
|
||||||
self.prepare();
|
self.prepare();
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,9 +105,9 @@ impl<'a> HTMLSelectElementMethods for &'a HTMLSelectElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLSelectElement {
|
impl VirtualMethods for HTMLSelectElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ impl<'a> VirtualMethods for &'a HTMLSelectElement {
|
||||||
|
|
||||||
match attr.local_name() {
|
match attr.local_name() {
|
||||||
&atom!("disabled") => {
|
&atom!("disabled") => {
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.set_disabled_state(true);
|
node.set_disabled_state(true);
|
||||||
node.set_enabled_state(false);
|
node.set_enabled_state(false);
|
||||||
},
|
},
|
||||||
|
@ -133,7 +133,7 @@ impl<'a> VirtualMethods for &'a HTMLSelectElement {
|
||||||
|
|
||||||
match attr.local_name() {
|
match attr.local_name() {
|
||||||
&atom!("disabled") => {
|
&atom!("disabled") => {
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.set_disabled_state(false);
|
node.set_disabled_state(false);
|
||||||
node.set_enabled_state(true);
|
node.set_enabled_state(true);
|
||||||
node.check_ancestors_disabled_state_for_form_control();
|
node.check_ancestors_disabled_state_for_form_control();
|
||||||
|
@ -147,7 +147,7 @@ impl<'a> VirtualMethods for &'a HTMLSelectElement {
|
||||||
s.bind_to_tree(tree_in_doc);
|
s.bind_to_tree(tree_in_doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.check_ancestors_disabled_state_for_form_control();
|
node.check_ancestors_disabled_state_for_form_control();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ impl<'a> VirtualMethods for &'a HTMLSelectElement {
|
||||||
s.unbind_from_tree(tree_in_doc);
|
s.unbind_from_tree(tree_in_doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
if node.ancestors().any(|ancestor| ancestor.r().is_htmlfieldsetelement()) {
|
if node.ancestors().any(|ancestor| ancestor.r().is_htmlfieldsetelement()) {
|
||||||
node.check_ancestors_disabled_state_for_form_control();
|
node.check_ancestors_disabled_state_for_form_control();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -82,9 +82,9 @@ impl<'a> StyleElementHelpers for &'a HTMLStyleElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLStyleElement {
|
impl VirtualMethods for HTMLStyleElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ impl<'a> VirtualMethods for &'a HTMLStyleElement {
|
||||||
if let Some(ref s) = self.super_type() {
|
if let Some(ref s) = self.super_type() {
|
||||||
s.children_changed(mutation);
|
s.children_changed(mutation);
|
||||||
}
|
}
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
if node.is_in_doc() {
|
if node.is_in_doc() {
|
||||||
self.parse_own_css();
|
self.parse_own_css();
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,9 +101,9 @@ impl<'a> HTMLTableCellElementHelpers for &'a HTMLTableCellElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLTableCellElement {
|
impl VirtualMethods for HTMLTableCellElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,9 +158,9 @@ impl<'a> HTMLTableElementHelpers for &'a HTMLTableElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLTableElement {
|
impl VirtualMethods for HTMLTableElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,9 +64,9 @@ impl<'a> HTMLTableRowElementHelpers for &'a HTMLTableRowElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLTableRowElement {
|
impl VirtualMethods for HTMLTableRowElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,9 @@ impl<'a> HTMLTableSectionElementHelpers for &'a HTMLTableSectionElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLTableSectionElement {
|
impl VirtualMethods for HTMLTableSectionElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -247,9 +247,9 @@ impl<'a> PrivateHTMLTextAreaElementHelpers for &'a HTMLTextAreaElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLTextAreaElement {
|
impl VirtualMethods for HTMLTextAreaElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ impl<'a> VirtualMethods for &'a HTMLTextAreaElement {
|
||||||
|
|
||||||
match attr.local_name() {
|
match attr.local_name() {
|
||||||
&atom!("disabled") => {
|
&atom!("disabled") => {
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.set_disabled_state(true);
|
node.set_disabled_state(true);
|
||||||
node.set_enabled_state(false);
|
node.set_enabled_state(false);
|
||||||
},
|
},
|
||||||
|
@ -287,7 +287,7 @@ impl<'a> VirtualMethods for &'a HTMLTextAreaElement {
|
||||||
|
|
||||||
match attr.local_name() {
|
match attr.local_name() {
|
||||||
&atom!("disabled") => {
|
&atom!("disabled") => {
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.set_disabled_state(false);
|
node.set_disabled_state(false);
|
||||||
node.set_enabled_state(true);
|
node.set_enabled_state(true);
|
||||||
node.check_ancestors_disabled_state_for_form_control();
|
node.check_ancestors_disabled_state_for_form_control();
|
||||||
|
@ -307,7 +307,7 @@ impl<'a> VirtualMethods for &'a HTMLTextAreaElement {
|
||||||
s.bind_to_tree(tree_in_doc);
|
s.bind_to_tree(tree_in_doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.check_ancestors_disabled_state_for_form_control();
|
node.check_ancestors_disabled_state_for_form_control();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ impl<'a> VirtualMethods for &'a HTMLTextAreaElement {
|
||||||
s.unbind_from_tree(tree_in_doc);
|
s.unbind_from_tree(tree_in_doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
if node.ancestors().any(|ancestor| ancestor.r().is_htmlfieldsetelement()) {
|
if node.ancestors().any(|ancestor| ancestor.r().is_htmlfieldsetelement()) {
|
||||||
node.check_ancestors_disabled_state_for_form_control();
|
node.check_ancestors_disabled_state_for_form_control();
|
||||||
} else {
|
} else {
|
||||||
|
@ -350,8 +350,8 @@ impl<'a> VirtualMethods for &'a HTMLTextAreaElement {
|
||||||
if &*event.Type() == "click" && !event.DefaultPrevented() {
|
if &*event.Type() == "click" && !event.DefaultPrevented() {
|
||||||
//TODO: set the editing position for text inputs
|
//TODO: set the editing position for text inputs
|
||||||
|
|
||||||
let doc = document_from_node(*self);
|
let doc = document_from_node(self);
|
||||||
doc.r().request_focus(ElementCast::from_ref(*self));
|
doc.r().request_focus(ElementCast::from_ref(self));
|
||||||
} else if &*event.Type() == "keydown" && !event.DefaultPrevented() {
|
} else if &*event.Type() == "keydown" && !event.DefaultPrevented() {
|
||||||
let keyevent: Option<&KeyboardEvent> = KeyboardEventCast::to_ref(event);
|
let keyevent: Option<&KeyboardEvent> = KeyboardEventCast::to_ref(event);
|
||||||
keyevent.map(|kevent| {
|
keyevent.map(|kevent| {
|
||||||
|
@ -361,10 +361,10 @@ impl<'a> VirtualMethods for &'a HTMLTextAreaElement {
|
||||||
self.value_changed.set(true);
|
self.value_changed.set(true);
|
||||||
|
|
||||||
if event.IsTrusted() {
|
if event.IsTrusted() {
|
||||||
let window = window_from_node(*self);
|
let window = window_from_node(self);
|
||||||
let window = window.r();
|
let window = window.r();
|
||||||
let chan = window.script_chan();
|
let chan = window.script_chan();
|
||||||
let handler = Trusted::new(window.get_cx(), *self, chan.clone());
|
let handler = Trusted::new(window.get_cx(), self, chan.clone());
|
||||||
let dispatcher = ChangeEventRunnable {
|
let dispatcher = ChangeEventRunnable {
|
||||||
element: handler,
|
element: handler,
|
||||||
};
|
};
|
||||||
|
|
|
@ -70,9 +70,9 @@ impl<'a> HTMLTitleElementMethods for &'a HTMLTitleElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a HTMLTitleElement {
|
impl VirtualMethods for HTMLTitleElement {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let htmlelement: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,14 +80,14 @@ impl<'a> VirtualMethods for &'a HTMLTitleElement {
|
||||||
if let Some(ref s) = self.super_type() {
|
if let Some(ref s) = self.super_type() {
|
||||||
s.children_changed(mutation);
|
s.children_changed(mutation);
|
||||||
}
|
}
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
if node.is_in_doc() {
|
if node.is_in_doc() {
|
||||||
node.owner_doc().title_changed();
|
node.owner_doc().title_changed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bind_to_tree(&self, is_in_doc: bool) {
|
fn bind_to_tree(&self, is_in_doc: bool) {
|
||||||
let node = NodeCast::from_ref(*self);
|
let node = NodeCast::from_ref(self);
|
||||||
if is_in_doc {
|
if is_in_doc {
|
||||||
let document = node.owner_doc();
|
let document = node.owner_doc();
|
||||||
document.r().title_changed();
|
document.r().title_changed();
|
||||||
|
|
|
@ -2553,9 +2553,9 @@ pub fn window_from_node<T: NodeBase + Reflectable>(derived: &T) -> Root<Window>
|
||||||
document.r().window()
|
document.r().window()
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for &'a Node {
|
impl VirtualMethods for Node {
|
||||||
fn super_type(&self) -> Option<&VirtualMethods> {
|
fn super_type(&self) -> Option<&VirtualMethods> {
|
||||||
let eventtarget: &&EventTarget = EventTargetCast::from_borrowed_ref(self);
|
let eventtarget: &EventTarget = EventTargetCast::from_ref(self);
|
||||||
Some(eventtarget as &VirtualMethods)
|
Some(eventtarget as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ use util::resource_files::resources_dir_path;
|
||||||
|
|
||||||
pub fn load_script(head: &HTMLHeadElement) {
|
pub fn load_script(head: &HTMLHeadElement) {
|
||||||
if let Some(ref path_str) = opts::get().userscripts {
|
if let Some(ref path_str) = opts::get().userscripts {
|
||||||
let node = NodeCast::from_borrowed_ref(&head);
|
let node = NodeCast::from_ref(head);
|
||||||
let first_child = node.GetFirstChild();
|
let first_child = node.GetFirstChild();
|
||||||
let doc = node.owner_doc();
|
let doc = node.owner_doc();
|
||||||
let doc = doc.r();
|
let doc = doc.r();
|
||||||
|
@ -45,8 +45,8 @@ pub fn load_script(head: &HTMLHeadElement) {
|
||||||
let new_script = doc.CreateElement("script".to_owned()).unwrap();
|
let new_script = doc.CreateElement("script".to_owned()).unwrap();
|
||||||
let new_script = new_script.r();
|
let new_script = new_script.r();
|
||||||
new_script.set_string_attribute(&atom!("src"), name);
|
new_script.set_string_attribute(&atom!("src"), name);
|
||||||
let new_script_node = NodeCast::from_borrowed_ref(&new_script);
|
let new_script_node = NodeCast::from_ref(new_script);
|
||||||
node.InsertBefore(*new_script_node, first_child.r()).unwrap();
|
node.InsertBefore(new_script_node, first_child.r()).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,126 +126,126 @@ pub trait VirtualMethods {
|
||||||
/// method call on the trait object will invoke the corresponding method on the
|
/// method call on the trait object will invoke the corresponding method on the
|
||||||
/// concrete type, propagating up the parent hierarchy unless otherwise
|
/// concrete type, propagating up the parent hierarchy unless otherwise
|
||||||
/// interrupted.
|
/// interrupted.
|
||||||
pub fn vtable_for<'a>(node: &'a &'a Node) -> &'a (VirtualMethods + 'a) {
|
pub fn vtable_for<'a>(node: &'a Node) -> &'a (VirtualMethods + 'a) {
|
||||||
match node.type_id() {
|
match node.type_id() {
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) => {
|
||||||
let element = HTMLAnchorElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLAnchorElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAppletElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAppletElement)) => {
|
||||||
HTMLAppletElementCast::to_borrowed_ref(node).unwrap() as &'a (VirtualMethods + 'a)
|
HTMLAppletElementCast::to_ref(node).unwrap() as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)) => {
|
||||||
let element = HTMLAreaElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLAreaElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBaseElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBaseElement)) => {
|
||||||
let element = HTMLBaseElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLBaseElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement)) => {
|
||||||
let element = HTMLBodyElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLBodyElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) => {
|
||||||
let element = HTMLButtonElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLButtonElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLCanvasElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLCanvasElement)) => {
|
||||||
let element = HTMLCanvasElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLCanvasElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFieldSetElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFieldSetElement)) => {
|
||||||
let element = HTMLFieldSetElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLFieldSetElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFontElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFontElement)) => {
|
||||||
let element = HTMLFontElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLFontElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFormElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFormElement)) => {
|
||||||
let element = HTMLFormElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLFormElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHeadElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHeadElement)) => {
|
||||||
let element = HTMLHeadElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLHeadElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLImageElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLImageElement)) => {
|
||||||
let element = HTMLImageElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLImageElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLIFrameElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLIFrameElement)) => {
|
||||||
let element = HTMLIFrameElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLIFrameElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) => {
|
||||||
let element = HTMLInputElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLInputElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement)) => {
|
||||||
let element = HTMLLinkElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLLinkElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLObjectElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLObjectElement)) => {
|
||||||
let element = HTMLObjectElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLObjectElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptGroupElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptGroupElement)) => {
|
||||||
let element = HTMLOptGroupElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLOptGroupElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement)) => {
|
||||||
let element = HTMLOptionElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLOptionElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLScriptElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLScriptElement)) => {
|
||||||
let element = HTMLScriptElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLScriptElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) => {
|
||||||
let element = HTMLSelectElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLSelectElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLStyleElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLStyleElement)) => {
|
||||||
let element = HTMLStyleElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLStyleElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableElement)) => {
|
||||||
let element =
|
let element =
|
||||||
HTMLTableElementCast::to_borrowed_ref(node).unwrap();
|
HTMLTableElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCellElement(_))) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCellElement(_))) => {
|
||||||
let element =
|
let element =
|
||||||
HTMLTableCellElementCast::to_borrowed_ref(node).unwrap();
|
HTMLTableCellElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableRowElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableRowElement)) => {
|
||||||
let element =
|
let element =
|
||||||
HTMLTableRowElementCast::to_borrowed_ref(node).unwrap();
|
HTMLTableRowElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableSectionElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableSectionElement)) => {
|
||||||
let element =
|
let element =
|
||||||
HTMLTableSectionElementCast::to_borrowed_ref(node).unwrap();
|
HTMLTableSectionElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => {
|
||||||
let element = HTMLTextAreaElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLTextAreaElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTitleElement)) => {
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTitleElement)) => {
|
||||||
let element =
|
let element =
|
||||||
HTMLTitleElementCast::to_borrowed_ref(node).unwrap();
|
HTMLTitleElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(ElementTypeId::Element) => {
|
NodeTypeId::Element(ElementTypeId::Element) => {
|
||||||
let element = ElementCast::to_borrowed_ref(node).unwrap();
|
let element = ElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
NodeTypeId::Element(_) => {
|
NodeTypeId::Element(_) => {
|
||||||
let element = HTMLElementCast::to_borrowed_ref(node).unwrap();
|
let element = HTMLElementCast::to_ref(node).unwrap();
|
||||||
element as &'a (VirtualMethods + 'a)
|
element as &'a (VirtualMethods + 'a)
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue