diff options
Diffstat (limited to 'components/script/dom/virtualmethods.rs')
-rw-r--r-- | components/script/dom/virtualmethods.rs | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/components/script/dom/virtualmethods.rs b/components/script/dom/virtualmethods.rs index 3e28f02587d..7e0f5ce28c9 100644 --- a/components/script/dom/virtualmethods.rs +++ b/components/script/dom/virtualmethods.rs @@ -59,7 +59,7 @@ use style::attr::AttrValue; pub trait VirtualMethods { /// Returns self as the superclass of the implementation for this trait, /// if any. - fn super_type(&self) -> Option<&VirtualMethods>; + fn super_type(&self) -> Option<&dyn VirtualMethods>; /// Called when attributes of a node are mutated. /// <https://dom.spec.whatwg.org/#attribute-is-set> @@ -152,120 +152,120 @@ pub trait VirtualMethods { /// method call on the trait object will invoke the corresponding method on the /// concrete type, propagating up the parent hierarchy unless otherwise /// interrupted. -pub fn vtable_for(node: &Node) -> &VirtualMethods { +pub fn vtable_for(node: &Node) -> &dyn VirtualMethods { match node.type_id() { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) => { - node.downcast::<HTMLAnchorElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLAnchorElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)) => { - node.downcast::<HTMLAreaElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLAreaElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBaseElement)) => { - node.downcast::<HTMLBaseElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLBaseElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement)) => { - node.downcast::<HTMLBodyElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLBodyElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) => { - node.downcast::<HTMLButtonElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLButtonElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLCanvasElement)) => { - node.downcast::<HTMLCanvasElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLCanvasElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDetailsElement)) => { - node.downcast::<HTMLDetailsElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLDetailsElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFieldSetElement)) => { - node.downcast::<HTMLFieldSetElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLFieldSetElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFontElement)) => { - node.downcast::<HTMLFontElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLFontElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFormElement)) => { - node.downcast::<HTMLFormElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLFormElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHeadElement)) => { - node.downcast::<HTMLHeadElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLHeadElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHRElement)) => { - node.downcast::<HTMLHRElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLHRElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLImageElement)) => { - node.downcast::<HTMLImageElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLImageElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLIFrameElement)) => { - node.downcast::<HTMLIFrameElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLIFrameElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) => { - node.downcast::<HTMLInputElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLInputElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLabelElement)) => { - node.downcast::<HTMLLabelElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLLabelElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLIElement)) => { - node.downcast::<HTMLLIElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLLIElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement)) => { - node.downcast::<HTMLLinkElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLLinkElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMediaElement(_))) => { - node.downcast::<HTMLMediaElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLMediaElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMetaElement)) => { - node.downcast::<HTMLMetaElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLMetaElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLObjectElement)) => { - node.downcast::<HTMLObjectElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLObjectElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptGroupElement)) => { - node.downcast::<HTMLOptGroupElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLOptGroupElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement)) => { - node.downcast::<HTMLOptionElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLOptionElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOutputElement)) => { - node.downcast::<HTMLOutputElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLOutputElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLScriptElement)) => { - node.downcast::<HTMLScriptElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLScriptElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) => { - node.downcast::<HTMLSelectElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLSelectElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSourceElement)) => { - node.downcast::<HTMLSourceElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLSourceElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLStyleElement)) => { - node.downcast::<HTMLStyleElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLStyleElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableElement)) => { - node.downcast::<HTMLTableElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLTableElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement( HTMLElementTypeId::HTMLTableCellElement, - )) => node.downcast::<HTMLTableCellElement>().unwrap() as &VirtualMethods, + )) => node.downcast::<HTMLTableCellElement>().unwrap() as &dyn VirtualMethods, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableRowElement)) => { - node.downcast::<HTMLTableRowElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLTableRowElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement( HTMLElementTypeId::HTMLTableSectionElement, - )) => node.downcast::<HTMLTableSectionElement>().unwrap() as &VirtualMethods, + )) => node.downcast::<HTMLTableSectionElement>().unwrap() as &dyn VirtualMethods, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTemplateElement)) => { - node.downcast::<HTMLTemplateElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLTemplateElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => { - node.downcast::<HTMLTextAreaElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLTextAreaElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTitleElement)) => { - node.downcast::<HTMLTitleElement>().unwrap() as &VirtualMethods + node.downcast::<HTMLTitleElement>().unwrap() as &dyn VirtualMethods }, NodeTypeId::Element(ElementTypeId::SVGElement(SVGElementTypeId::SVGGraphicsElement( SVGGraphicsElementTypeId::SVGSVGElement, - ))) => node.downcast::<SVGSVGElement>().unwrap() as &VirtualMethods, + ))) => node.downcast::<SVGSVGElement>().unwrap() as &dyn VirtualMethods, NodeTypeId::Element(ElementTypeId::Element) => { - node.downcast::<Element>().unwrap() as &VirtualMethods + node.downcast::<Element>().unwrap() as &dyn VirtualMethods }, - NodeTypeId::Element(_) => node.downcast::<HTMLElement>().unwrap() as &VirtualMethods, - _ => node as &VirtualMethods, + NodeTypeId::Element(_) => node.downcast::<HTMLElement>().unwrap() as &dyn VirtualMethods, + _ => node as &dyn VirtualMethods, } } |