Skip to content

Instantly share code, notes, and snippets.

@nox nox/InheritTypes.rs Secret

Created Oct 9, 2015
Embed
What would you like to do?
/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */
use dom::types::*;
use dom::bindings::conversions::get_dom_class;
use dom::bindings::js::{JS, LayoutJS, Root};
use dom::bindings::trace::JSTraceable;
use dom::bindings::utils::{Reflectable, TopDOMClass};
use js::jsapi::JSTracer;
use std::mem;
#[derive(Clone, Copy, Debug)]
pub enum TopTypeId {
Abstract,
Alone,
Blob(BlobTypeId),
DOMPointReadOnly(DOMPointReadOnlyTypeId),
Event(EventTypeId),
EventTarget(EventTargetTypeId),
TestBinding(TestBindingTypeId),
WebGLObject(WebGLObjectTypeId),
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum NodeTypeId {
CharacterData(CharacterDataTypeId),
Document,
DocumentFragment,
DocumentType,
Element(ElementTypeId),
}
#[derive(Clone, Copy, Debug)]
pub enum EventTargetTypeId {
FileReader,
Node(NodeTypeId),
WebSocket,
Window,
Worker,
WorkerGlobalScope(WorkerGlobalScopeTypeId),
XMLHttpRequestEventTarget(XMLHttpRequestEventTargetTypeId),
}
impl TopDOMClass for EventTarget {
type TypeId = EventTargetTypeId;
fn type_id(&self) -> &EventTargetTypeId {
let domclass = unsafe {
get_dom_class(self.reflector().get_jsobject().get()).unwrap()
};
match domclass.type_id {
TopTypeId::EventTarget(ref type_id) => type_id,
_ => unreachable!(),
}
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum XMLHttpRequestEventTargetTypeId {
XMLHttpRequest,
XMLHttpRequestUpload,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum HTMLTableCellElementTypeId {
HTMLTableDataCellElement,
HTMLTableHeaderCellElement,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum DOMPointReadOnlyTypeId {
DOMPointReadOnly,
DOMPoint,
}
impl TopDOMClass for DOMPointReadOnly {
type TypeId = DOMPointReadOnlyTypeId;
fn type_id(&self) -> &DOMPointReadOnlyTypeId {
let domclass = unsafe {
get_dom_class(self.reflector().get_jsobject().get()).unwrap()
};
match domclass.type_id {
TopTypeId::DOMPointReadOnly(ref type_id) => type_id,
_ => unreachable!(),
}
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum HTMLMediaElementTypeId {
HTMLAudioElement,
HTMLVideoElement,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum WorkerGlobalScopeTypeId {
DedicatedWorkerGlobalScope,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum UIEventTypeId {
UIEvent,
KeyboardEvent,
MouseEvent,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ElementTypeId {
Element,
HTMLElement(HTMLElementTypeId),
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CharacterDataTypeId {
Comment,
ProcessingInstruction,
Text,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BlobTypeId {
Blob,
File,
}
impl TopDOMClass for Blob {
type TypeId = BlobTypeId;
fn type_id(&self) -> &BlobTypeId {
let domclass = unsafe {
get_dom_class(self.reflector().get_jsobject().get()).unwrap()
};
match domclass.type_id {
TopTypeId::Blob(ref type_id) => type_id,
_ => unreachable!(),
}
}
}
#[derive(Clone, Copy, Debug)]
pub enum HTMLElementTypeId {
HTMLElement,
HTMLAnchorElement,
HTMLAppletElement,
HTMLAreaElement,
HTMLBRElement,
HTMLBaseElement,
HTMLBodyElement,
HTMLButtonElement,
HTMLCanvasElement,
HTMLDListElement,
HTMLDataElement,
HTMLDataListElement,
HTMLDialogElement,
HTMLDirectoryElement,
HTMLDivElement,
HTMLEmbedElement,
HTMLFieldSetElement,
HTMLFontElement,
HTMLFormElement,
HTMLFrameElement,
HTMLFrameSetElement,
HTMLHRElement,
HTMLHeadElement,
HTMLHeadingElement,
HTMLHtmlElement,
HTMLIFrameElement,
HTMLImageElement,
HTMLInputElement,
HTMLLIElement,
HTMLLabelElement,
HTMLLegendElement,
HTMLLinkElement,
HTMLMapElement,
HTMLMediaElement(HTMLMediaElementTypeId),
HTMLMetaElement,
HTMLMeterElement,
HTMLModElement,
HTMLOListElement,
HTMLObjectElement,
HTMLOptGroupElement,
HTMLOptionElement,
HTMLOutputElement,
HTMLParagraphElement,
HTMLParamElement,
HTMLPreElement,
HTMLProgressElement,
HTMLQuoteElement,
HTMLScriptElement,
HTMLSelectElement,
HTMLSourceElement,
HTMLSpanElement,
HTMLStyleElement,
HTMLTableCaptionElement,
HTMLTableCellElement(HTMLTableCellElementTypeId),
HTMLTableColElement,
HTMLTableElement,
HTMLTableRowElement,
HTMLTableSectionElement,
HTMLTemplateElement,
HTMLTextAreaElement,
HTMLTimeElement,
HTMLTitleElement,
HTMLTrackElement,
HTMLUListElement,
HTMLUnknownElement,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TestBindingTypeId {
TestBinding,
TestBindingProxy,
}
impl TopDOMClass for TestBinding {
type TypeId = TestBindingTypeId;
fn type_id(&self) -> &TestBindingTypeId {
let domclass = unsafe {
get_dom_class(self.reflector().get_jsobject().get()).unwrap()
};
match domclass.type_id {
TopTypeId::TestBinding(ref type_id) => type_id,
_ => unreachable!(),
}
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EventTypeId {
Event,
CloseEvent,
CustomEvent,
ErrorEvent,
MessageEvent,
ProgressEvent,
StorageEvent,
UIEvent(UIEventTypeId),
WebGLContextEvent,
}
impl TopDOMClass for Event {
type TypeId = EventTypeId;
fn type_id(&self) -> &EventTypeId {
let domclass = unsafe {
get_dom_class(self.reflector().get_jsobject().get()).unwrap()
};
match domclass.type_id {
TopTypeId::Event(ref type_id) => type_id,
_ => unreachable!(),
}
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum WebGLObjectTypeId {
WebGLObject,
WebGLBuffer,
WebGLFramebuffer,
WebGLProgram,
WebGLRenderbuffer,
WebGLShader,
WebGLTexture,
}
impl TopDOMClass for WebGLObject {
type TypeId = WebGLObjectTypeId;
fn type_id(&self) -> &WebGLObjectTypeId {
let domclass = unsafe {
get_dom_class(self.reflector().get_jsobject().get()).unwrap()
};
match domclass.type_id {
TopTypeId::WebGLObject(ref type_id) => type_id,
_ => unreachable!(),
}
}
}
pub struct BlobCast;
/// Types which are derived from `Blob` and can be freely converted
/// to `Blob`
pub trait BlobBase: Sized {}
impl BlobCast {
#[inline]
/// Upcast an instance of a derived class of `Blob` to `Blob`
pub fn from_ref<T: BlobBase + Reflectable>(derived: &T) -> &Blob {
unsafe { mem::transmute(derived) }
}
#[inline]
#[allow(unrooted_must_root)]
pub fn from_layout_js<T: BlobBase + Reflectable>(derived: &LayoutJS<T>) -> LayoutJS<Blob> {
unsafe { mem::transmute_copy(derived) }
}
#[inline]
pub fn from_root<T: BlobBase + Reflectable>(derived: Root<T>) -> Root<Blob> {
unsafe { mem::transmute(derived) }
}
}
impl BlobBase for Blob {}
pub struct CharacterDataCast;
/// Types which are derived from `CharacterData` and can be freely converted
/// to `CharacterData`
pub trait CharacterDataBase: Sized {}
impl CharacterDataCast {
#[inline]
/// Upcast an instance of a derived class of `CharacterData` to `CharacterData`
pub fn from_ref<T: CharacterDataBase + Reflectable>(derived: &T) -> &CharacterData {
unsafe { mem::transmute(derived) }
}
#[inline]
#[allow(unrooted_must_root)]
pub fn from_layout_js<T: CharacterDataBase + Reflectable>(derived: &LayoutJS<T>) -> LayoutJS<CharacterData> {
unsafe { mem::transmute_copy(derived) }
}
#[inline]
pub fn from_root<T: CharacterDataBase + Reflectable>(derived: Root<T>) -> Root<CharacterData> {
unsafe { mem::transmute(derived) }
}
}
impl EventTargetBase for CharacterData {}
impl NodeBase for CharacterData {}
impl CharacterDataBase for CharacterData {}
/// Types which `CharacterData` derives from
pub trait CharacterDataDerived: Sized {
fn is_characterdata(&self) -> bool;
}
impl CharacterDataCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: CharacterDataDerived + Reflectable>(base: &T) -> Option<&CharacterData> {
match base.is_characterdata() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: CharacterDataDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<CharacterData>> {
unsafe {
match (*base.unsafe_get()).is_characterdata() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: CharacterDataDerived + Reflectable>(base: Root<T>) -> Option<Root<CharacterData>> {
match base.is_characterdata() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl CharacterDataDerived for EventTarget {
fn is_characterdata(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::CharacterData(_)) => true,
_ => false,
}
}
}
impl CharacterDataDerived for Node {
#[inline]
fn is_characterdata(&self) -> bool {
EventTargetCast::from_ref(self).is_characterdata()
}
}
pub struct CloseEventCast;
impl EventBase for CloseEvent {}
/// Types which `CloseEvent` derives from
pub trait CloseEventDerived: Sized {
fn is_closeevent(&self) -> bool;
}
impl CloseEventCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: CloseEventDerived + Reflectable>(base: &T) -> Option<&CloseEvent> {
match base.is_closeevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: CloseEventDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<CloseEvent>> {
unsafe {
match (*base.unsafe_get()).is_closeevent() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: CloseEventDerived + Reflectable>(base: Root<T>) -> Option<Root<CloseEvent>> {
match base.is_closeevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl CloseEventDerived for Event {
fn is_closeevent(&self) -> bool {
match *self.type_id() {
EventTypeId::CloseEvent => true,
_ => false,
}
}
}
pub struct CommentCast;
impl EventTargetBase for Comment {}
impl NodeBase for Comment {}
impl CharacterDataBase for Comment {}
/// Types which `Comment` derives from
pub trait CommentDerived: Sized {
fn is_comment(&self) -> bool;
}
impl CommentCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: CommentDerived + Reflectable>(base: &T) -> Option<&Comment> {
match base.is_comment() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: CommentDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<Comment>> {
unsafe {
match (*base.unsafe_get()).is_comment() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: CommentDerived + Reflectable>(base: Root<T>) -> Option<Root<Comment>> {
match base.is_comment() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl CommentDerived for EventTarget {
fn is_comment(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::CharacterData(CharacterDataTypeId::Comment)) => true,
_ => false,
}
}
}
impl CommentDerived for Node {
#[inline]
fn is_comment(&self) -> bool {
EventTargetCast::from_ref(self).is_comment()
}
}
impl CommentDerived for CharacterData {
#[inline]
fn is_comment(&self) -> bool {
NodeCast::from_ref(self).is_comment()
}
}
pub struct CustomEventCast;
impl EventBase for CustomEvent {}
/// Types which `CustomEvent` derives from
pub trait CustomEventDerived: Sized {
fn is_customevent(&self) -> bool;
}
impl CustomEventCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: CustomEventDerived + Reflectable>(base: &T) -> Option<&CustomEvent> {
match base.is_customevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: CustomEventDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<CustomEvent>> {
unsafe {
match (*base.unsafe_get()).is_customevent() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: CustomEventDerived + Reflectable>(base: Root<T>) -> Option<Root<CustomEvent>> {
match base.is_customevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl CustomEventDerived for Event {
fn is_customevent(&self) -> bool {
match *self.type_id() {
EventTypeId::CustomEvent => true,
_ => false,
}
}
}
pub struct DOMPointCast;
impl DOMPointReadOnlyBase for DOMPoint {}
/// Types which `DOMPoint` derives from
pub trait DOMPointDerived: Sized {
fn is_dompoint(&self) -> bool;
}
impl DOMPointCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: DOMPointDerived + Reflectable>(base: &T) -> Option<&DOMPoint> {
match base.is_dompoint() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: DOMPointDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<DOMPoint>> {
unsafe {
match (*base.unsafe_get()).is_dompoint() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: DOMPointDerived + Reflectable>(base: Root<T>) -> Option<Root<DOMPoint>> {
match base.is_dompoint() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl DOMPointDerived for DOMPointReadOnly {
fn is_dompoint(&self) -> bool {
match *self.type_id() {
DOMPointReadOnlyTypeId::DOMPoint => true,
_ => false,
}
}
}
pub struct DOMPointReadOnlyCast;
/// Types which are derived from `DOMPointReadOnly` and can be freely converted
/// to `DOMPointReadOnly`
pub trait DOMPointReadOnlyBase: Sized {}
impl DOMPointReadOnlyCast {
#[inline]
/// Upcast an instance of a derived class of `DOMPointReadOnly` to `DOMPointReadOnly`
pub fn from_ref<T: DOMPointReadOnlyBase + Reflectable>(derived: &T) -> &DOMPointReadOnly {
unsafe { mem::transmute(derived) }
}
#[inline]
#[allow(unrooted_must_root)]
pub fn from_layout_js<T: DOMPointReadOnlyBase + Reflectable>(derived: &LayoutJS<T>) -> LayoutJS<DOMPointReadOnly> {
unsafe { mem::transmute_copy(derived) }
}
#[inline]
pub fn from_root<T: DOMPointReadOnlyBase + Reflectable>(derived: Root<T>) -> Root<DOMPointReadOnly> {
unsafe { mem::transmute(derived) }
}
}
impl DOMPointReadOnlyBase for DOMPointReadOnly {}
pub struct DedicatedWorkerGlobalScopeCast;
impl EventTargetBase for DedicatedWorkerGlobalScope {}
impl WorkerGlobalScopeBase for DedicatedWorkerGlobalScope {}
/// Types which `DedicatedWorkerGlobalScope` derives from
pub trait DedicatedWorkerGlobalScopeDerived: Sized {
fn is_dedicatedworkerglobalscope(&self) -> bool;
}
impl DedicatedWorkerGlobalScopeCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: DedicatedWorkerGlobalScopeDerived + Reflectable>(base: &T) -> Option<&DedicatedWorkerGlobalScope> {
match base.is_dedicatedworkerglobalscope() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: DedicatedWorkerGlobalScopeDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<DedicatedWorkerGlobalScope>> {
unsafe {
match (*base.unsafe_get()).is_dedicatedworkerglobalscope() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: DedicatedWorkerGlobalScopeDerived + Reflectable>(base: Root<T>) -> Option<Root<DedicatedWorkerGlobalScope>> {
match base.is_dedicatedworkerglobalscope() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl DedicatedWorkerGlobalScopeDerived for EventTarget {
fn is_dedicatedworkerglobalscope(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::WorkerGlobalScope(WorkerGlobalScopeTypeId::DedicatedWorkerGlobalScope) => true,
_ => false,
}
}
}
impl DedicatedWorkerGlobalScopeDerived for WorkerGlobalScope {
#[inline]
fn is_dedicatedworkerglobalscope(&self) -> bool {
EventTargetCast::from_ref(self).is_dedicatedworkerglobalscope()
}
}
pub struct DocumentCast;
impl EventTargetBase for Document {}
impl NodeBase for Document {}
/// Types which `Document` derives from
pub trait DocumentDerived: Sized {
fn is_document(&self) -> bool;
}
impl DocumentCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: DocumentDerived + Reflectable>(base: &T) -> Option<&Document> {
match base.is_document() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: DocumentDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<Document>> {
unsafe {
match (*base.unsafe_get()).is_document() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: DocumentDerived + Reflectable>(base: Root<T>) -> Option<Root<Document>> {
match base.is_document() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl DocumentDerived for EventTarget {
fn is_document(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Document) => true,
_ => false,
}
}
}
impl DocumentDerived for Node {
#[inline]
fn is_document(&self) -> bool {
EventTargetCast::from_ref(self).is_document()
}
}
pub struct DocumentFragmentCast;
impl EventTargetBase for DocumentFragment {}
impl NodeBase for DocumentFragment {}
/// Types which `DocumentFragment` derives from
pub trait DocumentFragmentDerived: Sized {
fn is_documentfragment(&self) -> bool;
}
impl DocumentFragmentCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: DocumentFragmentDerived + Reflectable>(base: &T) -> Option<&DocumentFragment> {
match base.is_documentfragment() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: DocumentFragmentDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<DocumentFragment>> {
unsafe {
match (*base.unsafe_get()).is_documentfragment() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: DocumentFragmentDerived + Reflectable>(base: Root<T>) -> Option<Root<DocumentFragment>> {
match base.is_documentfragment() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl DocumentFragmentDerived for EventTarget {
fn is_documentfragment(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::DocumentFragment) => true,
_ => false,
}
}
}
impl DocumentFragmentDerived for Node {
#[inline]
fn is_documentfragment(&self) -> bool {
EventTargetCast::from_ref(self).is_documentfragment()
}
}
pub struct DocumentTypeCast;
impl EventTargetBase for DocumentType {}
impl NodeBase for DocumentType {}
/// Types which `DocumentType` derives from
pub trait DocumentTypeDerived: Sized {
fn is_documenttype(&self) -> bool;
}
impl DocumentTypeCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: DocumentTypeDerived + Reflectable>(base: &T) -> Option<&DocumentType> {
match base.is_documenttype() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: DocumentTypeDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<DocumentType>> {
unsafe {
match (*base.unsafe_get()).is_documenttype() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: DocumentTypeDerived + Reflectable>(base: Root<T>) -> Option<Root<DocumentType>> {
match base.is_documenttype() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl DocumentTypeDerived for EventTarget {
fn is_documenttype(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::DocumentType) => true,
_ => false,
}
}
}
impl DocumentTypeDerived for Node {
#[inline]
fn is_documenttype(&self) -> bool {
EventTargetCast::from_ref(self).is_documenttype()
}
}
pub struct ElementCast;
/// Types which are derived from `Element` and can be freely converted
/// to `Element`
pub trait ElementBase: Sized {}
impl ElementCast {
#[inline]
/// Upcast an instance of a derived class of `Element` to `Element`
pub fn from_ref<T: ElementBase + Reflectable>(derived: &T) -> &Element {
unsafe { mem::transmute(derived) }
}
#[inline]
#[allow(unrooted_must_root)]
pub fn from_layout_js<T: ElementBase + Reflectable>(derived: &LayoutJS<T>) -> LayoutJS<Element> {
unsafe { mem::transmute_copy(derived) }
}
#[inline]
pub fn from_root<T: ElementBase + Reflectable>(derived: Root<T>) -> Root<Element> {
unsafe { mem::transmute(derived) }
}
}
impl EventTargetBase for Element {}
impl NodeBase for Element {}
impl ElementBase for Element {}
/// Types which `Element` derives from
pub trait ElementDerived: Sized {
fn is_element(&self) -> bool;
}
impl ElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: ElementDerived + Reflectable>(base: &T) -> Option<&Element> {
match base.is_element() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: ElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<Element>> {
unsafe {
match (*base.unsafe_get()).is_element() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: ElementDerived + Reflectable>(base: Root<T>) -> Option<Root<Element>> {
match base.is_element() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl ElementDerived for EventTarget {
fn is_element(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(_)) => true,
_ => false,
}
}
}
impl ElementDerived for Node {
#[inline]
fn is_element(&self) -> bool {
EventTargetCast::from_ref(self).is_element()
}
}
pub struct ErrorEventCast;
impl EventBase for ErrorEvent {}
/// Types which `ErrorEvent` derives from
pub trait ErrorEventDerived: Sized {
fn is_errorevent(&self) -> bool;
}
impl ErrorEventCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: ErrorEventDerived + Reflectable>(base: &T) -> Option<&ErrorEvent> {
match base.is_errorevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: ErrorEventDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<ErrorEvent>> {
unsafe {
match (*base.unsafe_get()).is_errorevent() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: ErrorEventDerived + Reflectable>(base: Root<T>) -> Option<Root<ErrorEvent>> {
match base.is_errorevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl ErrorEventDerived for Event {
fn is_errorevent(&self) -> bool {
match *self.type_id() {
EventTypeId::ErrorEvent => true,
_ => false,
}
}
}
pub struct EventCast;
/// Types which are derived from `Event` and can be freely converted
/// to `Event`
pub trait EventBase: Sized {}
impl EventCast {
#[inline]
/// Upcast an instance of a derived class of `Event` to `Event`
pub fn from_ref<T: EventBase + Reflectable>(derived: &T) -> &Event {
unsafe { mem::transmute(derived) }
}
#[inline]
#[allow(unrooted_must_root)]
pub fn from_layout_js<T: EventBase + Reflectable>(derived: &LayoutJS<T>) -> LayoutJS<Event> {
unsafe { mem::transmute_copy(derived) }
}
#[inline]
pub fn from_root<T: EventBase + Reflectable>(derived: Root<T>) -> Root<Event> {
unsafe { mem::transmute(derived) }
}
}
impl EventBase for Event {}
pub struct EventTargetCast;
/// Types which are derived from `EventTarget` and can be freely converted
/// to `EventTarget`
pub trait EventTargetBase: Sized {}
impl EventTargetCast {
#[inline]
/// Upcast an instance of a derived class of `EventTarget` to `EventTarget`
pub fn from_ref<T: EventTargetBase + Reflectable>(derived: &T) -> &EventTarget {
unsafe { mem::transmute(derived) }
}
#[inline]
#[allow(unrooted_must_root)]
pub fn from_layout_js<T: EventTargetBase + Reflectable>(derived: &LayoutJS<T>) -> LayoutJS<EventTarget> {
unsafe { mem::transmute_copy(derived) }
}
#[inline]
pub fn from_root<T: EventTargetBase + Reflectable>(derived: Root<T>) -> Root<EventTarget> {
unsafe { mem::transmute(derived) }
}
}
impl EventTargetBase for EventTarget {}
pub struct FileCast;
impl BlobBase for File {}
/// Types which `File` derives from
pub trait FileDerived: Sized {
fn is_file(&self) -> bool;
}
impl FileCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: FileDerived + Reflectable>(base: &T) -> Option<&File> {
match base.is_file() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: FileDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<File>> {
unsafe {
match (*base.unsafe_get()).is_file() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: FileDerived + Reflectable>(base: Root<T>) -> Option<Root<File>> {
match base.is_file() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl FileDerived for Blob {
fn is_file(&self) -> bool {
match *self.type_id() {
BlobTypeId::File => true,
_ => false,
}
}
}
pub struct FileReaderCast;
impl EventTargetBase for FileReader {}
/// Types which `FileReader` derives from
pub trait FileReaderDerived: Sized {
fn is_filereader(&self) -> bool;
}
impl FileReaderCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: FileReaderDerived + Reflectable>(base: &T) -> Option<&FileReader> {
match base.is_filereader() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: FileReaderDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<FileReader>> {
unsafe {
match (*base.unsafe_get()).is_filereader() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: FileReaderDerived + Reflectable>(base: Root<T>) -> Option<Root<FileReader>> {
match base.is_filereader() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl FileReaderDerived for EventTarget {
fn is_filereader(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::FileReader => true,
_ => false,
}
}
}
pub struct HTMLAnchorElementCast;
impl EventTargetBase for HTMLAnchorElement {}
impl NodeBase for HTMLAnchorElement {}
impl ElementBase for HTMLAnchorElement {}
impl HTMLElementBase for HTMLAnchorElement {}
/// Types which `HTMLAnchorElement` derives from
pub trait HTMLAnchorElementDerived: Sized {
fn is_htmlanchorelement(&self) -> bool;
}
impl HTMLAnchorElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLAnchorElementDerived + Reflectable>(base: &T) -> Option<&HTMLAnchorElement> {
match base.is_htmlanchorelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLAnchorElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLAnchorElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlanchorelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLAnchorElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLAnchorElement>> {
match base.is_htmlanchorelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLAnchorElementDerived for EventTarget {
fn is_htmlanchorelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement))) => true,
_ => false,
}
}
}
impl HTMLAnchorElementDerived for Node {
#[inline]
fn is_htmlanchorelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlanchorelement()
}
}
impl HTMLAnchorElementDerived for Element {
#[inline]
fn is_htmlanchorelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlanchorelement()
}
}
impl HTMLAnchorElementDerived for HTMLElement {
#[inline]
fn is_htmlanchorelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlanchorelement()
}
}
pub struct HTMLAppletElementCast;
impl EventTargetBase for HTMLAppletElement {}
impl NodeBase for HTMLAppletElement {}
impl ElementBase for HTMLAppletElement {}
impl HTMLElementBase for HTMLAppletElement {}
/// Types which `HTMLAppletElement` derives from
pub trait HTMLAppletElementDerived: Sized {
fn is_htmlappletelement(&self) -> bool;
}
impl HTMLAppletElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLAppletElementDerived + Reflectable>(base: &T) -> Option<&HTMLAppletElement> {
match base.is_htmlappletelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLAppletElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLAppletElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlappletelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLAppletElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLAppletElement>> {
match base.is_htmlappletelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLAppletElementDerived for EventTarget {
fn is_htmlappletelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAppletElement))) => true,
_ => false,
}
}
}
impl HTMLAppletElementDerived for Node {
#[inline]
fn is_htmlappletelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlappletelement()
}
}
impl HTMLAppletElementDerived for Element {
#[inline]
fn is_htmlappletelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlappletelement()
}
}
impl HTMLAppletElementDerived for HTMLElement {
#[inline]
fn is_htmlappletelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlappletelement()
}
}
pub struct HTMLAreaElementCast;
impl EventTargetBase for HTMLAreaElement {}
impl NodeBase for HTMLAreaElement {}
impl ElementBase for HTMLAreaElement {}
impl HTMLElementBase for HTMLAreaElement {}
/// Types which `HTMLAreaElement` derives from
pub trait HTMLAreaElementDerived: Sized {
fn is_htmlareaelement(&self) -> bool;
}
impl HTMLAreaElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLAreaElementDerived + Reflectable>(base: &T) -> Option<&HTMLAreaElement> {
match base.is_htmlareaelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLAreaElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLAreaElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlareaelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLAreaElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLAreaElement>> {
match base.is_htmlareaelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLAreaElementDerived for EventTarget {
fn is_htmlareaelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement))) => true,
_ => false,
}
}
}
impl HTMLAreaElementDerived for Node {
#[inline]
fn is_htmlareaelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlareaelement()
}
}
impl HTMLAreaElementDerived for Element {
#[inline]
fn is_htmlareaelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlareaelement()
}
}
impl HTMLAreaElementDerived for HTMLElement {
#[inline]
fn is_htmlareaelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlareaelement()
}
}
pub struct HTMLAudioElementCast;
impl EventTargetBase for HTMLAudioElement {}
impl NodeBase for HTMLAudioElement {}
impl ElementBase for HTMLAudioElement {}
impl HTMLElementBase for HTMLAudioElement {}
impl HTMLMediaElementBase for HTMLAudioElement {}
/// Types which `HTMLAudioElement` derives from
pub trait HTMLAudioElementDerived: Sized {
fn is_htmlaudioelement(&self) -> bool;
}
impl HTMLAudioElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLAudioElementDerived + Reflectable>(base: &T) -> Option<&HTMLAudioElement> {
match base.is_htmlaudioelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLAudioElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLAudioElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlaudioelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLAudioElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLAudioElement>> {
match base.is_htmlaudioelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLAudioElementDerived for EventTarget {
fn is_htmlaudioelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMediaElement(HTMLMediaElementTypeId::HTMLAudioElement)))) => true,
_ => false,
}
}
}
impl HTMLAudioElementDerived for Node {
#[inline]
fn is_htmlaudioelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlaudioelement()
}
}
impl HTMLAudioElementDerived for Element {
#[inline]
fn is_htmlaudioelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlaudioelement()
}
}
impl HTMLAudioElementDerived for HTMLElement {
#[inline]
fn is_htmlaudioelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlaudioelement()
}
}
impl HTMLAudioElementDerived for HTMLMediaElement {
#[inline]
fn is_htmlaudioelement(&self) -> bool {
HTMLElementCast::from_ref(self).is_htmlaudioelement()
}
}
pub struct HTMLBRElementCast;
impl EventTargetBase for HTMLBRElement {}
impl NodeBase for HTMLBRElement {}
impl ElementBase for HTMLBRElement {}
impl HTMLElementBase for HTMLBRElement {}
/// Types which `HTMLBRElement` derives from
pub trait HTMLBRElementDerived: Sized {
fn is_htmlbrelement(&self) -> bool;
}
impl HTMLBRElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLBRElementDerived + Reflectable>(base: &T) -> Option<&HTMLBRElement> {
match base.is_htmlbrelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLBRElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLBRElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlbrelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLBRElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLBRElement>> {
match base.is_htmlbrelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLBRElementDerived for EventTarget {
fn is_htmlbrelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBRElement))) => true,
_ => false,
}
}
}
impl HTMLBRElementDerived for Node {
#[inline]
fn is_htmlbrelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlbrelement()
}
}
impl HTMLBRElementDerived for Element {
#[inline]
fn is_htmlbrelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlbrelement()
}
}
impl HTMLBRElementDerived for HTMLElement {
#[inline]
fn is_htmlbrelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlbrelement()
}
}
pub struct HTMLBaseElementCast;
impl EventTargetBase for HTMLBaseElement {}
impl NodeBase for HTMLBaseElement {}
impl ElementBase for HTMLBaseElement {}
impl HTMLElementBase for HTMLBaseElement {}
/// Types which `HTMLBaseElement` derives from
pub trait HTMLBaseElementDerived: Sized {
fn is_htmlbaseelement(&self) -> bool;
}
impl HTMLBaseElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLBaseElementDerived + Reflectable>(base: &T) -> Option<&HTMLBaseElement> {
match base.is_htmlbaseelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLBaseElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLBaseElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlbaseelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLBaseElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLBaseElement>> {
match base.is_htmlbaseelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLBaseElementDerived for EventTarget {
fn is_htmlbaseelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBaseElement))) => true,
_ => false,
}
}
}
impl HTMLBaseElementDerived for Node {
#[inline]
fn is_htmlbaseelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlbaseelement()
}
}
impl HTMLBaseElementDerived for Element {
#[inline]
fn is_htmlbaseelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlbaseelement()
}
}
impl HTMLBaseElementDerived for HTMLElement {
#[inline]
fn is_htmlbaseelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlbaseelement()
}
}
pub struct HTMLBodyElementCast;
impl EventTargetBase for HTMLBodyElement {}
impl NodeBase for HTMLBodyElement {}
impl ElementBase for HTMLBodyElement {}
impl HTMLElementBase for HTMLBodyElement {}
/// Types which `HTMLBodyElement` derives from
pub trait HTMLBodyElementDerived: Sized {
fn is_htmlbodyelement(&self) -> bool;
}
impl HTMLBodyElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLBodyElementDerived + Reflectable>(base: &T) -> Option<&HTMLBodyElement> {
match base.is_htmlbodyelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLBodyElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLBodyElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlbodyelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLBodyElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLBodyElement>> {
match base.is_htmlbodyelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLBodyElementDerived for EventTarget {
fn is_htmlbodyelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement))) => true,
_ => false,
}
}
}
impl HTMLBodyElementDerived for Node {
#[inline]
fn is_htmlbodyelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlbodyelement()
}
}
impl HTMLBodyElementDerived for Element {
#[inline]
fn is_htmlbodyelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlbodyelement()
}
}
impl HTMLBodyElementDerived for HTMLElement {
#[inline]
fn is_htmlbodyelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlbodyelement()
}
}
pub struct HTMLButtonElementCast;
impl EventTargetBase for HTMLButtonElement {}
impl NodeBase for HTMLButtonElement {}
impl ElementBase for HTMLButtonElement {}
impl HTMLElementBase for HTMLButtonElement {}
/// Types which `HTMLButtonElement` derives from
pub trait HTMLButtonElementDerived: Sized {
fn is_htmlbuttonelement(&self) -> bool;
}
impl HTMLButtonElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLButtonElementDerived + Reflectable>(base: &T) -> Option<&HTMLButtonElement> {
match base.is_htmlbuttonelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLButtonElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLButtonElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlbuttonelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLButtonElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLButtonElement>> {
match base.is_htmlbuttonelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLButtonElementDerived for EventTarget {
fn is_htmlbuttonelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement))) => true,
_ => false,
}
}
}
impl HTMLButtonElementDerived for Node {
#[inline]
fn is_htmlbuttonelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlbuttonelement()
}
}
impl HTMLButtonElementDerived for Element {
#[inline]
fn is_htmlbuttonelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlbuttonelement()
}
}
impl HTMLButtonElementDerived for HTMLElement {
#[inline]
fn is_htmlbuttonelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlbuttonelement()
}
}
pub struct HTMLCanvasElementCast;
impl EventTargetBase for HTMLCanvasElement {}
impl NodeBase for HTMLCanvasElement {}
impl ElementBase for HTMLCanvasElement {}
impl HTMLElementBase for HTMLCanvasElement {}
/// Types which `HTMLCanvasElement` derives from
pub trait HTMLCanvasElementDerived: Sized {
fn is_htmlcanvaselement(&self) -> bool;
}
impl HTMLCanvasElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLCanvasElementDerived + Reflectable>(base: &T) -> Option<&HTMLCanvasElement> {
match base.is_htmlcanvaselement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLCanvasElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLCanvasElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlcanvaselement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLCanvasElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLCanvasElement>> {
match base.is_htmlcanvaselement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLCanvasElementDerived for EventTarget {
fn is_htmlcanvaselement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLCanvasElement))) => true,
_ => false,
}
}
}
impl HTMLCanvasElementDerived for Node {
#[inline]
fn is_htmlcanvaselement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlcanvaselement()
}
}
impl HTMLCanvasElementDerived for Element {
#[inline]
fn is_htmlcanvaselement(&self) -> bool {
NodeCast::from_ref(self).is_htmlcanvaselement()
}
}
impl HTMLCanvasElementDerived for HTMLElement {
#[inline]
fn is_htmlcanvaselement(&self) -> bool {
ElementCast::from_ref(self).is_htmlcanvaselement()
}
}
pub struct HTMLDListElementCast;
impl EventTargetBase for HTMLDListElement {}
impl NodeBase for HTMLDListElement {}
impl ElementBase for HTMLDListElement {}
impl HTMLElementBase for HTMLDListElement {}
/// Types which `HTMLDListElement` derives from
pub trait HTMLDListElementDerived: Sized {
fn is_htmldlistelement(&self) -> bool;
}
impl HTMLDListElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLDListElementDerived + Reflectable>(base: &T) -> Option<&HTMLDListElement> {
match base.is_htmldlistelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLDListElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLDListElement>> {
unsafe {
match (*base.unsafe_get()).is_htmldlistelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLDListElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLDListElement>> {
match base.is_htmldlistelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLDListElementDerived for EventTarget {
fn is_htmldlistelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDListElement))) => true,
_ => false,
}
}
}
impl HTMLDListElementDerived for Node {
#[inline]
fn is_htmldlistelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmldlistelement()
}
}
impl HTMLDListElementDerived for Element {
#[inline]
fn is_htmldlistelement(&self) -> bool {
NodeCast::from_ref(self).is_htmldlistelement()
}
}
impl HTMLDListElementDerived for HTMLElement {
#[inline]
fn is_htmldlistelement(&self) -> bool {
ElementCast::from_ref(self).is_htmldlistelement()
}
}
pub struct HTMLDataElementCast;
impl EventTargetBase for HTMLDataElement {}
impl NodeBase for HTMLDataElement {}
impl ElementBase for HTMLDataElement {}
impl HTMLElementBase for HTMLDataElement {}
/// Types which `HTMLDataElement` derives from
pub trait HTMLDataElementDerived: Sized {
fn is_htmldataelement(&self) -> bool;
}
impl HTMLDataElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLDataElementDerived + Reflectable>(base: &T) -> Option<&HTMLDataElement> {
match base.is_htmldataelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLDataElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLDataElement>> {
unsafe {
match (*base.unsafe_get()).is_htmldataelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLDataElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLDataElement>> {
match base.is_htmldataelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLDataElementDerived for EventTarget {
fn is_htmldataelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDataElement))) => true,
_ => false,
}
}
}
impl HTMLDataElementDerived for Node {
#[inline]
fn is_htmldataelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmldataelement()
}
}
impl HTMLDataElementDerived for Element {
#[inline]
fn is_htmldataelement(&self) -> bool {
NodeCast::from_ref(self).is_htmldataelement()
}
}
impl HTMLDataElementDerived for HTMLElement {
#[inline]
fn is_htmldataelement(&self) -> bool {
ElementCast::from_ref(self).is_htmldataelement()
}
}
pub struct HTMLDataListElementCast;
impl EventTargetBase for HTMLDataListElement {}
impl NodeBase for HTMLDataListElement {}
impl ElementBase for HTMLDataListElement {}
impl HTMLElementBase for HTMLDataListElement {}
/// Types which `HTMLDataListElement` derives from
pub trait HTMLDataListElementDerived: Sized {
fn is_htmldatalistelement(&self) -> bool;
}
impl HTMLDataListElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLDataListElementDerived + Reflectable>(base: &T) -> Option<&HTMLDataListElement> {
match base.is_htmldatalistelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLDataListElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLDataListElement>> {
unsafe {
match (*base.unsafe_get()).is_htmldatalistelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLDataListElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLDataListElement>> {
match base.is_htmldatalistelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLDataListElementDerived for EventTarget {
fn is_htmldatalistelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDataListElement))) => true,
_ => false,
}
}
}
impl HTMLDataListElementDerived for Node {
#[inline]
fn is_htmldatalistelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmldatalistelement()
}
}
impl HTMLDataListElementDerived for Element {
#[inline]
fn is_htmldatalistelement(&self) -> bool {
NodeCast::from_ref(self).is_htmldatalistelement()
}
}
impl HTMLDataListElementDerived for HTMLElement {
#[inline]
fn is_htmldatalistelement(&self) -> bool {
ElementCast::from_ref(self).is_htmldatalistelement()
}
}
pub struct HTMLDialogElementCast;
impl EventTargetBase for HTMLDialogElement {}
impl NodeBase for HTMLDialogElement {}
impl ElementBase for HTMLDialogElement {}
impl HTMLElementBase for HTMLDialogElement {}
/// Types which `HTMLDialogElement` derives from
pub trait HTMLDialogElementDerived: Sized {
fn is_htmldialogelement(&self) -> bool;
}
impl HTMLDialogElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLDialogElementDerived + Reflectable>(base: &T) -> Option<&HTMLDialogElement> {
match base.is_htmldialogelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLDialogElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLDialogElement>> {
unsafe {
match (*base.unsafe_get()).is_htmldialogelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLDialogElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLDialogElement>> {
match base.is_htmldialogelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLDialogElementDerived for EventTarget {
fn is_htmldialogelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDialogElement))) => true,
_ => false,
}
}
}
impl HTMLDialogElementDerived for Node {
#[inline]
fn is_htmldialogelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmldialogelement()
}
}
impl HTMLDialogElementDerived for Element {
#[inline]
fn is_htmldialogelement(&self) -> bool {
NodeCast::from_ref(self).is_htmldialogelement()
}
}
impl HTMLDialogElementDerived for HTMLElement {
#[inline]
fn is_htmldialogelement(&self) -> bool {
ElementCast::from_ref(self).is_htmldialogelement()
}
}
pub struct HTMLDirectoryElementCast;
impl EventTargetBase for HTMLDirectoryElement {}
impl NodeBase for HTMLDirectoryElement {}
impl ElementBase for HTMLDirectoryElement {}
impl HTMLElementBase for HTMLDirectoryElement {}
/// Types which `HTMLDirectoryElement` derives from
pub trait HTMLDirectoryElementDerived: Sized {
fn is_htmldirectoryelement(&self) -> bool;
}
impl HTMLDirectoryElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLDirectoryElementDerived + Reflectable>(base: &T) -> Option<&HTMLDirectoryElement> {
match base.is_htmldirectoryelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLDirectoryElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLDirectoryElement>> {
unsafe {
match (*base.unsafe_get()).is_htmldirectoryelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLDirectoryElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLDirectoryElement>> {
match base.is_htmldirectoryelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLDirectoryElementDerived for EventTarget {
fn is_htmldirectoryelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDirectoryElement))) => true,
_ => false,
}
}
}
impl HTMLDirectoryElementDerived for Node {
#[inline]
fn is_htmldirectoryelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmldirectoryelement()
}
}
impl HTMLDirectoryElementDerived for Element {
#[inline]
fn is_htmldirectoryelement(&self) -> bool {
NodeCast::from_ref(self).is_htmldirectoryelement()
}
}
impl HTMLDirectoryElementDerived for HTMLElement {
#[inline]
fn is_htmldirectoryelement(&self) -> bool {
ElementCast::from_ref(self).is_htmldirectoryelement()
}
}
pub struct HTMLDivElementCast;
impl EventTargetBase for HTMLDivElement {}
impl NodeBase for HTMLDivElement {}
impl ElementBase for HTMLDivElement {}
impl HTMLElementBase for HTMLDivElement {}
/// Types which `HTMLDivElement` derives from
pub trait HTMLDivElementDerived: Sized {
fn is_htmldivelement(&self) -> bool;
}
impl HTMLDivElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLDivElementDerived + Reflectable>(base: &T) -> Option<&HTMLDivElement> {
match base.is_htmldivelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLDivElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLDivElement>> {
unsafe {
match (*base.unsafe_get()).is_htmldivelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLDivElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLDivElement>> {
match base.is_htmldivelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLDivElementDerived for EventTarget {
fn is_htmldivelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDivElement))) => true,
_ => false,
}
}
}
impl HTMLDivElementDerived for Node {
#[inline]
fn is_htmldivelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmldivelement()
}
}
impl HTMLDivElementDerived for Element {
#[inline]
fn is_htmldivelement(&self) -> bool {
NodeCast::from_ref(self).is_htmldivelement()
}
}
impl HTMLDivElementDerived for HTMLElement {
#[inline]
fn is_htmldivelement(&self) -> bool {
ElementCast::from_ref(self).is_htmldivelement()
}
}
pub struct HTMLElementCast;
/// Types which are derived from `HTMLElement` and can be freely converted
/// to `HTMLElement`
pub trait HTMLElementBase: Sized {}
impl HTMLElementCast {
#[inline]
/// Upcast an instance of a derived class of `HTMLElement` to `HTMLElement`
pub fn from_ref<T: HTMLElementBase + Reflectable>(derived: &T) -> &HTMLElement {
unsafe { mem::transmute(derived) }
}
#[inline]
#[allow(unrooted_must_root)]
pub fn from_layout_js<T: HTMLElementBase + Reflectable>(derived: &LayoutJS<T>) -> LayoutJS<HTMLElement> {
unsafe { mem::transmute_copy(derived) }
}
#[inline]
pub fn from_root<T: HTMLElementBase + Reflectable>(derived: Root<T>) -> Root<HTMLElement> {
unsafe { mem::transmute(derived) }
}
}
impl EventTargetBase for HTMLElement {}
impl NodeBase for HTMLElement {}
impl ElementBase for HTMLElement {}
impl HTMLElementBase for HTMLElement {}
/// Types which `HTMLElement` derives from
pub trait HTMLElementDerived: Sized {
fn is_htmlelement(&self) -> bool;
}
impl HTMLElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLElementDerived + Reflectable>(base: &T) -> Option<&HTMLElement> {
match base.is_htmlelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLElement>> {
match base.is_htmlelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLElementDerived for EventTarget {
fn is_htmlelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(_))) => true,
_ => false,
}
}
}
impl HTMLElementDerived for Node {
#[inline]
fn is_htmlelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlelement()
}
}
impl HTMLElementDerived for Element {
#[inline]
fn is_htmlelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlelement()
}
}
pub struct HTMLEmbedElementCast;
impl EventTargetBase for HTMLEmbedElement {}
impl NodeBase for HTMLEmbedElement {}
impl ElementBase for HTMLEmbedElement {}
impl HTMLElementBase for HTMLEmbedElement {}
/// Types which `HTMLEmbedElement` derives from
pub trait HTMLEmbedElementDerived: Sized {
fn is_htmlembedelement(&self) -> bool;
}
impl HTMLEmbedElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLEmbedElementDerived + Reflectable>(base: &T) -> Option<&HTMLEmbedElement> {
match base.is_htmlembedelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLEmbedElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLEmbedElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlembedelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLEmbedElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLEmbedElement>> {
match base.is_htmlembedelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLEmbedElementDerived for EventTarget {
fn is_htmlembedelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLEmbedElement))) => true,
_ => false,
}
}
}
impl HTMLEmbedElementDerived for Node {
#[inline]
fn is_htmlembedelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlembedelement()
}
}
impl HTMLEmbedElementDerived for Element {
#[inline]
fn is_htmlembedelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlembedelement()
}
}
impl HTMLEmbedElementDerived for HTMLElement {
#[inline]
fn is_htmlembedelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlembedelement()
}
}
pub struct HTMLFieldSetElementCast;
impl EventTargetBase for HTMLFieldSetElement {}
impl NodeBase for HTMLFieldSetElement {}
impl ElementBase for HTMLFieldSetElement {}
impl HTMLElementBase for HTMLFieldSetElement {}
/// Types which `HTMLFieldSetElement` derives from
pub trait HTMLFieldSetElementDerived: Sized {
fn is_htmlfieldsetelement(&self) -> bool;
}
impl HTMLFieldSetElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLFieldSetElementDerived + Reflectable>(base: &T) -> Option<&HTMLFieldSetElement> {
match base.is_htmlfieldsetelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLFieldSetElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLFieldSetElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlfieldsetelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLFieldSetElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLFieldSetElement>> {
match base.is_htmlfieldsetelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLFieldSetElementDerived for EventTarget {
fn is_htmlfieldsetelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFieldSetElement))) => true,
_ => false,
}
}
}
impl HTMLFieldSetElementDerived for Node {
#[inline]
fn is_htmlfieldsetelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlfieldsetelement()
}
}
impl HTMLFieldSetElementDerived for Element {
#[inline]
fn is_htmlfieldsetelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlfieldsetelement()
}
}
impl HTMLFieldSetElementDerived for HTMLElement {
#[inline]
fn is_htmlfieldsetelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlfieldsetelement()
}
}
pub struct HTMLFontElementCast;
impl EventTargetBase for HTMLFontElement {}
impl NodeBase for HTMLFontElement {}
impl ElementBase for HTMLFontElement {}
impl HTMLElementBase for HTMLFontElement {}
/// Types which `HTMLFontElement` derives from
pub trait HTMLFontElementDerived: Sized {
fn is_htmlfontelement(&self) -> bool;
}
impl HTMLFontElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLFontElementDerived + Reflectable>(base: &T) -> Option<&HTMLFontElement> {
match base.is_htmlfontelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLFontElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLFontElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlfontelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLFontElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLFontElement>> {
match base.is_htmlfontelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLFontElementDerived for EventTarget {
fn is_htmlfontelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFontElement))) => true,
_ => false,
}
}
}
impl HTMLFontElementDerived for Node {
#[inline]
fn is_htmlfontelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlfontelement()
}
}
impl HTMLFontElementDerived for Element {
#[inline]
fn is_htmlfontelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlfontelement()
}
}
impl HTMLFontElementDerived for HTMLElement {
#[inline]
fn is_htmlfontelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlfontelement()
}
}
pub struct HTMLFormElementCast;
impl EventTargetBase for HTMLFormElement {}
impl NodeBase for HTMLFormElement {}
impl ElementBase for HTMLFormElement {}
impl HTMLElementBase for HTMLFormElement {}
/// Types which `HTMLFormElement` derives from
pub trait HTMLFormElementDerived: Sized {
fn is_htmlformelement(&self) -> bool;
}
impl HTMLFormElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLFormElementDerived + Reflectable>(base: &T) -> Option<&HTMLFormElement> {
match base.is_htmlformelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLFormElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLFormElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlformelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLFormElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLFormElement>> {
match base.is_htmlformelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLFormElementDerived for EventTarget {
fn is_htmlformelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFormElement))) => true,
_ => false,
}
}
}
impl HTMLFormElementDerived for Node {
#[inline]
fn is_htmlformelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlformelement()
}
}
impl HTMLFormElementDerived for Element {
#[inline]
fn is_htmlformelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlformelement()
}
}
impl HTMLFormElementDerived for HTMLElement {
#[inline]
fn is_htmlformelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlformelement()
}
}
pub struct HTMLFrameElementCast;
impl EventTargetBase for HTMLFrameElement {}
impl NodeBase for HTMLFrameElement {}
impl ElementBase for HTMLFrameElement {}
impl HTMLElementBase for HTMLFrameElement {}
/// Types which `HTMLFrameElement` derives from
pub trait HTMLFrameElementDerived: Sized {
fn is_htmlframeelement(&self) -> bool;
}
impl HTMLFrameElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLFrameElementDerived + Reflectable>(base: &T) -> Option<&HTMLFrameElement> {
match base.is_htmlframeelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLFrameElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLFrameElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlframeelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLFrameElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLFrameElement>> {
match base.is_htmlframeelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLFrameElementDerived for EventTarget {
fn is_htmlframeelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFrameElement))) => true,
_ => false,
}
}
}
impl HTMLFrameElementDerived for Node {
#[inline]
fn is_htmlframeelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlframeelement()
}
}
impl HTMLFrameElementDerived for Element {
#[inline]
fn is_htmlframeelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlframeelement()
}
}
impl HTMLFrameElementDerived for HTMLElement {
#[inline]
fn is_htmlframeelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlframeelement()
}
}
pub struct HTMLFrameSetElementCast;
impl EventTargetBase for HTMLFrameSetElement {}
impl NodeBase for HTMLFrameSetElement {}
impl ElementBase for HTMLFrameSetElement {}
impl HTMLElementBase for HTMLFrameSetElement {}
/// Types which `HTMLFrameSetElement` derives from
pub trait HTMLFrameSetElementDerived: Sized {
fn is_htmlframesetelement(&self) -> bool;
}
impl HTMLFrameSetElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLFrameSetElementDerived + Reflectable>(base: &T) -> Option<&HTMLFrameSetElement> {
match base.is_htmlframesetelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLFrameSetElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLFrameSetElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlframesetelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLFrameSetElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLFrameSetElement>> {
match base.is_htmlframesetelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLFrameSetElementDerived for EventTarget {
fn is_htmlframesetelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFrameSetElement))) => true,
_ => false,
}
}
}
impl HTMLFrameSetElementDerived for Node {
#[inline]
fn is_htmlframesetelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlframesetelement()
}
}
impl HTMLFrameSetElementDerived for Element {
#[inline]
fn is_htmlframesetelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlframesetelement()
}
}
impl HTMLFrameSetElementDerived for HTMLElement {
#[inline]
fn is_htmlframesetelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlframesetelement()
}
}
pub struct HTMLHRElementCast;
impl EventTargetBase for HTMLHRElement {}
impl NodeBase for HTMLHRElement {}
impl ElementBase for HTMLHRElement {}
impl HTMLElementBase for HTMLHRElement {}
/// Types which `HTMLHRElement` derives from
pub trait HTMLHRElementDerived: Sized {
fn is_htmlhrelement(&self) -> bool;
}
impl HTMLHRElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLHRElementDerived + Reflectable>(base: &T) -> Option<&HTMLHRElement> {
match base.is_htmlhrelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLHRElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLHRElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlhrelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLHRElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLHRElement>> {
match base.is_htmlhrelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLHRElementDerived for EventTarget {
fn is_htmlhrelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHRElement))) => true,
_ => false,
}
}
}
impl HTMLHRElementDerived for Node {
#[inline]
fn is_htmlhrelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlhrelement()
}
}
impl HTMLHRElementDerived for Element {
#[inline]
fn is_htmlhrelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlhrelement()
}
}
impl HTMLHRElementDerived for HTMLElement {
#[inline]
fn is_htmlhrelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlhrelement()
}
}
pub struct HTMLHeadElementCast;
impl EventTargetBase for HTMLHeadElement {}
impl NodeBase for HTMLHeadElement {}
impl ElementBase for HTMLHeadElement {}
impl HTMLElementBase for HTMLHeadElement {}
/// Types which `HTMLHeadElement` derives from
pub trait HTMLHeadElementDerived: Sized {
fn is_htmlheadelement(&self) -> bool;
}
impl HTMLHeadElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLHeadElementDerived + Reflectable>(base: &T) -> Option<&HTMLHeadElement> {
match base.is_htmlheadelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLHeadElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLHeadElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlheadelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLHeadElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLHeadElement>> {
match base.is_htmlheadelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLHeadElementDerived for EventTarget {
fn is_htmlheadelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHeadElement))) => true,
_ => false,
}
}
}
impl HTMLHeadElementDerived for Node {
#[inline]
fn is_htmlheadelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlheadelement()
}
}
impl HTMLHeadElementDerived for Element {
#[inline]
fn is_htmlheadelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlheadelement()
}
}
impl HTMLHeadElementDerived for HTMLElement {
#[inline]
fn is_htmlheadelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlheadelement()
}
}
pub struct HTMLHeadingElementCast;
impl EventTargetBase for HTMLHeadingElement {}
impl NodeBase for HTMLHeadingElement {}
impl ElementBase for HTMLHeadingElement {}
impl HTMLElementBase for HTMLHeadingElement {}
/// Types which `HTMLHeadingElement` derives from
pub trait HTMLHeadingElementDerived: Sized {
fn is_htmlheadingelement(&self) -> bool;
}
impl HTMLHeadingElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLHeadingElementDerived + Reflectable>(base: &T) -> Option<&HTMLHeadingElement> {
match base.is_htmlheadingelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLHeadingElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLHeadingElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlheadingelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLHeadingElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLHeadingElement>> {
match base.is_htmlheadingelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLHeadingElementDerived for EventTarget {
fn is_htmlheadingelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHeadingElement))) => true,
_ => false,
}
}
}
impl HTMLHeadingElementDerived for Node {
#[inline]
fn is_htmlheadingelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlheadingelement()
}
}
impl HTMLHeadingElementDerived for Element {
#[inline]
fn is_htmlheadingelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlheadingelement()
}
}
impl HTMLHeadingElementDerived for HTMLElement {
#[inline]
fn is_htmlheadingelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlheadingelement()
}
}
pub struct HTMLHtmlElementCast;
impl EventTargetBase for HTMLHtmlElement {}
impl NodeBase for HTMLHtmlElement {}
impl ElementBase for HTMLHtmlElement {}
impl HTMLElementBase for HTMLHtmlElement {}
/// Types which `HTMLHtmlElement` derives from
pub trait HTMLHtmlElementDerived: Sized {
fn is_htmlhtmlelement(&self) -> bool;
}
impl HTMLHtmlElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLHtmlElementDerived + Reflectable>(base: &T) -> Option<&HTMLHtmlElement> {
match base.is_htmlhtmlelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLHtmlElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLHtmlElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlhtmlelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLHtmlElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLHtmlElement>> {
match base.is_htmlhtmlelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLHtmlElementDerived for EventTarget {
fn is_htmlhtmlelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHtmlElement))) => true,
_ => false,
}
}
}
impl HTMLHtmlElementDerived for Node {
#[inline]
fn is_htmlhtmlelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlhtmlelement()
}
}
impl HTMLHtmlElementDerived for Element {
#[inline]
fn is_htmlhtmlelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlhtmlelement()
}
}
impl HTMLHtmlElementDerived for HTMLElement {
#[inline]
fn is_htmlhtmlelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlhtmlelement()
}
}
pub struct HTMLIFrameElementCast;
impl EventTargetBase for HTMLIFrameElement {}
impl NodeBase for HTMLIFrameElement {}
impl ElementBase for HTMLIFrameElement {}
impl HTMLElementBase for HTMLIFrameElement {}
/// Types which `HTMLIFrameElement` derives from
pub trait HTMLIFrameElementDerived: Sized {
fn is_htmliframeelement(&self) -> bool;
}
impl HTMLIFrameElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLIFrameElementDerived + Reflectable>(base: &T) -> Option<&HTMLIFrameElement> {
match base.is_htmliframeelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLIFrameElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLIFrameElement>> {
unsafe {
match (*base.unsafe_get()).is_htmliframeelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLIFrameElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLIFrameElement>> {
match base.is_htmliframeelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLIFrameElementDerived for EventTarget {
fn is_htmliframeelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLIFrameElement))) => true,
_ => false,
}
}
}
impl HTMLIFrameElementDerived for Node {
#[inline]
fn is_htmliframeelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmliframeelement()
}
}
impl HTMLIFrameElementDerived for Element {
#[inline]
fn is_htmliframeelement(&self) -> bool {
NodeCast::from_ref(self).is_htmliframeelement()
}
}
impl HTMLIFrameElementDerived for HTMLElement {
#[inline]
fn is_htmliframeelement(&self) -> bool {
ElementCast::from_ref(self).is_htmliframeelement()
}
}
pub struct HTMLImageElementCast;
impl EventTargetBase for HTMLImageElement {}
impl NodeBase for HTMLImageElement {}
impl ElementBase for HTMLImageElement {}
impl HTMLElementBase for HTMLImageElement {}
/// Types which `HTMLImageElement` derives from
pub trait HTMLImageElementDerived: Sized {
fn is_htmlimageelement(&self) -> bool;
}
impl HTMLImageElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLImageElementDerived + Reflectable>(base: &T) -> Option<&HTMLImageElement> {
match base.is_htmlimageelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLImageElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLImageElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlimageelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLImageElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLImageElement>> {
match base.is_htmlimageelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLImageElementDerived for EventTarget {
fn is_htmlimageelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLImageElement))) => true,
_ => false,
}
}
}
impl HTMLImageElementDerived for Node {
#[inline]
fn is_htmlimageelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlimageelement()
}
}
impl HTMLImageElementDerived for Element {
#[inline]
fn is_htmlimageelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlimageelement()
}
}
impl HTMLImageElementDerived for HTMLElement {
#[inline]
fn is_htmlimageelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlimageelement()
}
}
pub struct HTMLInputElementCast;
impl EventTargetBase for HTMLInputElement {}
impl NodeBase for HTMLInputElement {}
impl ElementBase for HTMLInputElement {}
impl HTMLElementBase for HTMLInputElement {}
/// Types which `HTMLInputElement` derives from
pub trait HTMLInputElementDerived: Sized {
fn is_htmlinputelement(&self) -> bool;
}
impl HTMLInputElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLInputElementDerived + Reflectable>(base: &T) -> Option<&HTMLInputElement> {
match base.is_htmlinputelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLInputElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLInputElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlinputelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLInputElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLInputElement>> {
match base.is_htmlinputelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLInputElementDerived for EventTarget {
fn is_htmlinputelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement))) => true,
_ => false,
}
}
}
impl HTMLInputElementDerived for Node {
#[inline]
fn is_htmlinputelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlinputelement()
}
}
impl HTMLInputElementDerived for Element {
#[inline]
fn is_htmlinputelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlinputelement()
}
}
impl HTMLInputElementDerived for HTMLElement {
#[inline]
fn is_htmlinputelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlinputelement()
}
}
pub struct HTMLLIElementCast;
impl EventTargetBase for HTMLLIElement {}
impl NodeBase for HTMLLIElement {}
impl ElementBase for HTMLLIElement {}
impl HTMLElementBase for HTMLLIElement {}
/// Types which `HTMLLIElement` derives from
pub trait HTMLLIElementDerived: Sized {
fn is_htmllielement(&self) -> bool;
}
impl HTMLLIElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLLIElementDerived + Reflectable>(base: &T) -> Option<&HTMLLIElement> {
match base.is_htmllielement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLLIElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLLIElement>> {
unsafe {
match (*base.unsafe_get()).is_htmllielement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLLIElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLLIElement>> {
match base.is_htmllielement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLLIElementDerived for EventTarget {
fn is_htmllielement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLIElement))) => true,
_ => false,
}
}
}
impl HTMLLIElementDerived for Node {
#[inline]
fn is_htmllielement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmllielement()
}
}
impl HTMLLIElementDerived for Element {
#[inline]
fn is_htmllielement(&self) -> bool {
NodeCast::from_ref(self).is_htmllielement()
}
}
impl HTMLLIElementDerived for HTMLElement {
#[inline]
fn is_htmllielement(&self) -> bool {
ElementCast::from_ref(self).is_htmllielement()
}
}
pub struct HTMLLabelElementCast;
impl EventTargetBase for HTMLLabelElement {}
impl NodeBase for HTMLLabelElement {}
impl ElementBase for HTMLLabelElement {}
impl HTMLElementBase for HTMLLabelElement {}
/// Types which `HTMLLabelElement` derives from
pub trait HTMLLabelElementDerived: Sized {
fn is_htmllabelelement(&self) -> bool;
}
impl HTMLLabelElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLLabelElementDerived + Reflectable>(base: &T) -> Option<&HTMLLabelElement> {
match base.is_htmllabelelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLLabelElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLLabelElement>> {
unsafe {
match (*base.unsafe_get()).is_htmllabelelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLLabelElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLLabelElement>> {
match base.is_htmllabelelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLLabelElementDerived for EventTarget {
fn is_htmllabelelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLabelElement))) => true,
_ => false,
}
}
}
impl HTMLLabelElementDerived for Node {
#[inline]
fn is_htmllabelelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmllabelelement()
}
}
impl HTMLLabelElementDerived for Element {
#[inline]
fn is_htmllabelelement(&self) -> bool {
NodeCast::from_ref(self).is_htmllabelelement()
}
}
impl HTMLLabelElementDerived for HTMLElement {
#[inline]
fn is_htmllabelelement(&self) -> bool {
ElementCast::from_ref(self).is_htmllabelelement()
}
}
pub struct HTMLLegendElementCast;
impl EventTargetBase for HTMLLegendElement {}
impl NodeBase for HTMLLegendElement {}
impl ElementBase for HTMLLegendElement {}
impl HTMLElementBase for HTMLLegendElement {}
/// Types which `HTMLLegendElement` derives from
pub trait HTMLLegendElementDerived: Sized {
fn is_htmllegendelement(&self) -> bool;
}
impl HTMLLegendElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLLegendElementDerived + Reflectable>(base: &T) -> Option<&HTMLLegendElement> {
match base.is_htmllegendelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLLegendElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLLegendElement>> {
unsafe {
match (*base.unsafe_get()).is_htmllegendelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLLegendElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLLegendElement>> {
match base.is_htmllegendelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLLegendElementDerived for EventTarget {
fn is_htmllegendelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLegendElement))) => true,
_ => false,
}
}
}
impl HTMLLegendElementDerived for Node {
#[inline]
fn is_htmllegendelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmllegendelement()
}
}
impl HTMLLegendElementDerived for Element {
#[inline]
fn is_htmllegendelement(&self) -> bool {
NodeCast::from_ref(self).is_htmllegendelement()
}
}
impl HTMLLegendElementDerived for HTMLElement {
#[inline]
fn is_htmllegendelement(&self) -> bool {
ElementCast::from_ref(self).is_htmllegendelement()
}
}
pub struct HTMLLinkElementCast;
impl EventTargetBase for HTMLLinkElement {}
impl NodeBase for HTMLLinkElement {}
impl ElementBase for HTMLLinkElement {}
impl HTMLElementBase for HTMLLinkElement {}
/// Types which `HTMLLinkElement` derives from
pub trait HTMLLinkElementDerived: Sized {
fn is_htmllinkelement(&self) -> bool;
}
impl HTMLLinkElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLLinkElementDerived + Reflectable>(base: &T) -> Option<&HTMLLinkElement> {
match base.is_htmllinkelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLLinkElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLLinkElement>> {
unsafe {
match (*base.unsafe_get()).is_htmllinkelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLLinkElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLLinkElement>> {
match base.is_htmllinkelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLLinkElementDerived for EventTarget {
fn is_htmllinkelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement))) => true,
_ => false,
}
}
}
impl HTMLLinkElementDerived for Node {
#[inline]
fn is_htmllinkelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmllinkelement()
}
}
impl HTMLLinkElementDerived for Element {
#[inline]
fn is_htmllinkelement(&self) -> bool {
NodeCast::from_ref(self).is_htmllinkelement()
}
}
impl HTMLLinkElementDerived for HTMLElement {
#[inline]
fn is_htmllinkelement(&self) -> bool {
ElementCast::from_ref(self).is_htmllinkelement()
}
}
pub struct HTMLMapElementCast;
impl EventTargetBase for HTMLMapElement {}
impl NodeBase for HTMLMapElement {}
impl ElementBase for HTMLMapElement {}
impl HTMLElementBase for HTMLMapElement {}
/// Types which `HTMLMapElement` derives from
pub trait HTMLMapElementDerived: Sized {
fn is_htmlmapelement(&self) -> bool;
}
impl HTMLMapElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLMapElementDerived + Reflectable>(base: &T) -> Option<&HTMLMapElement> {
match base.is_htmlmapelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLMapElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLMapElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlmapelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLMapElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLMapElement>> {
match base.is_htmlmapelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLMapElementDerived for EventTarget {
fn is_htmlmapelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMapElement))) => true,
_ => false,
}
}
}
impl HTMLMapElementDerived for Node {
#[inline]
fn is_htmlmapelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlmapelement()
}
}
impl HTMLMapElementDerived for Element {
#[inline]
fn is_htmlmapelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlmapelement()
}
}
impl HTMLMapElementDerived for HTMLElement {
#[inline]
fn is_htmlmapelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlmapelement()
}
}
pub struct HTMLMediaElementCast;
/// Types which are derived from `HTMLMediaElement` and can be freely converted
/// to `HTMLMediaElement`
pub trait HTMLMediaElementBase: Sized {}
impl HTMLMediaElementCast {
#[inline]
/// Upcast an instance of a derived class of `HTMLMediaElement` to `HTMLMediaElement`
pub fn from_ref<T: HTMLMediaElementBase + Reflectable>(derived: &T) -> &HTMLMediaElement {
unsafe { mem::transmute(derived) }
}
#[inline]
#[allow(unrooted_must_root)]
pub fn from_layout_js<T: HTMLMediaElementBase + Reflectable>(derived: &LayoutJS<T>) -> LayoutJS<HTMLMediaElement> {
unsafe { mem::transmute_copy(derived) }
}
#[inline]
pub fn from_root<T: HTMLMediaElementBase + Reflectable>(derived: Root<T>) -> Root<HTMLMediaElement> {
unsafe { mem::transmute(derived) }
}
}
impl EventTargetBase for HTMLMediaElement {}
impl NodeBase for HTMLMediaElement {}
impl ElementBase for HTMLMediaElement {}
impl HTMLElementBase for HTMLMediaElement {}
impl HTMLMediaElementBase for HTMLMediaElement {}
/// Types which `HTMLMediaElement` derives from
pub trait HTMLMediaElementDerived: Sized {
fn is_htmlmediaelement(&self) -> bool;
}
impl HTMLMediaElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLMediaElementDerived + Reflectable>(base: &T) -> Option<&HTMLMediaElement> {
match base.is_htmlmediaelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLMediaElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLMediaElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlmediaelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLMediaElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLMediaElement>> {
match base.is_htmlmediaelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLMediaElementDerived for EventTarget {
fn is_htmlmediaelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMediaElement(_)))) => true,
_ => false,
}
}
}
impl HTMLMediaElementDerived for Node {
#[inline]
fn is_htmlmediaelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlmediaelement()
}
}
impl HTMLMediaElementDerived for Element {
#[inline]
fn is_htmlmediaelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlmediaelement()
}
}
impl HTMLMediaElementDerived for HTMLElement {
#[inline]
fn is_htmlmediaelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlmediaelement()
}
}
pub struct HTMLMetaElementCast;
impl EventTargetBase for HTMLMetaElement {}
impl NodeBase for HTMLMetaElement {}
impl ElementBase for HTMLMetaElement {}
impl HTMLElementBase for HTMLMetaElement {}
/// Types which `HTMLMetaElement` derives from
pub trait HTMLMetaElementDerived: Sized {
fn is_htmlmetaelement(&self) -> bool;
}
impl HTMLMetaElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLMetaElementDerived + Reflectable>(base: &T) -> Option<&HTMLMetaElement> {
match base.is_htmlmetaelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLMetaElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLMetaElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlmetaelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLMetaElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLMetaElement>> {
match base.is_htmlmetaelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLMetaElementDerived for EventTarget {
fn is_htmlmetaelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMetaElement))) => true,
_ => false,
}
}
}
impl HTMLMetaElementDerived for Node {
#[inline]
fn is_htmlmetaelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlmetaelement()
}
}
impl HTMLMetaElementDerived for Element {
#[inline]
fn is_htmlmetaelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlmetaelement()
}
}
impl HTMLMetaElementDerived for HTMLElement {
#[inline]
fn is_htmlmetaelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlmetaelement()
}
}
pub struct HTMLMeterElementCast;
impl EventTargetBase for HTMLMeterElement {}
impl NodeBase for HTMLMeterElement {}
impl ElementBase for HTMLMeterElement {}
impl HTMLElementBase for HTMLMeterElement {}
/// Types which `HTMLMeterElement` derives from
pub trait HTMLMeterElementDerived: Sized {
fn is_htmlmeterelement(&self) -> bool;
}
impl HTMLMeterElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLMeterElementDerived + Reflectable>(base: &T) -> Option<&HTMLMeterElement> {
match base.is_htmlmeterelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLMeterElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLMeterElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlmeterelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLMeterElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLMeterElement>> {
match base.is_htmlmeterelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLMeterElementDerived for EventTarget {
fn is_htmlmeterelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMeterElement))) => true,
_ => false,
}
}
}
impl HTMLMeterElementDerived for Node {
#[inline]
fn is_htmlmeterelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlmeterelement()
}
}
impl HTMLMeterElementDerived for Element {
#[inline]
fn is_htmlmeterelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlmeterelement()
}
}
impl HTMLMeterElementDerived for HTMLElement {
#[inline]
fn is_htmlmeterelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlmeterelement()
}
}
pub struct HTMLModElementCast;
impl EventTargetBase for HTMLModElement {}
impl NodeBase for HTMLModElement {}
impl ElementBase for HTMLModElement {}
impl HTMLElementBase for HTMLModElement {}
/// Types which `HTMLModElement` derives from
pub trait HTMLModElementDerived: Sized {
fn is_htmlmodelement(&self) -> bool;
}
impl HTMLModElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLModElementDerived + Reflectable>(base: &T) -> Option<&HTMLModElement> {
match base.is_htmlmodelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLModElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLModElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlmodelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLModElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLModElement>> {
match base.is_htmlmodelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLModElementDerived for EventTarget {
fn is_htmlmodelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLModElement))) => true,
_ => false,
}
}
}
impl HTMLModElementDerived for Node {
#[inline]
fn is_htmlmodelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlmodelement()
}
}
impl HTMLModElementDerived for Element {
#[inline]
fn is_htmlmodelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlmodelement()
}
}
impl HTMLModElementDerived for HTMLElement {
#[inline]
fn is_htmlmodelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlmodelement()
}
}
pub struct HTMLOListElementCast;
impl EventTargetBase for HTMLOListElement {}
impl NodeBase for HTMLOListElement {}
impl ElementBase for HTMLOListElement {}
impl HTMLElementBase for HTMLOListElement {}
/// Types which `HTMLOListElement` derives from
pub trait HTMLOListElementDerived: Sized {
fn is_htmlolistelement(&self) -> bool;
}
impl HTMLOListElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLOListElementDerived + Reflectable>(base: &T) -> Option<&HTMLOListElement> {
match base.is_htmlolistelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLOListElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLOListElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlolistelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLOListElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLOListElement>> {
match base.is_htmlolistelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLOListElementDerived for EventTarget {
fn is_htmlolistelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOListElement))) => true,
_ => false,
}
}
}
impl HTMLOListElementDerived for Node {
#[inline]
fn is_htmlolistelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlolistelement()
}
}
impl HTMLOListElementDerived for Element {
#[inline]
fn is_htmlolistelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlolistelement()
}
}
impl HTMLOListElementDerived for HTMLElement {
#[inline]
fn is_htmlolistelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlolistelement()
}
}
pub struct HTMLObjectElementCast;
impl EventTargetBase for HTMLObjectElement {}
impl NodeBase for HTMLObjectElement {}
impl ElementBase for HTMLObjectElement {}
impl HTMLElementBase for HTMLObjectElement {}
/// Types which `HTMLObjectElement` derives from
pub trait HTMLObjectElementDerived: Sized {
fn is_htmlobjectelement(&self) -> bool;
}
impl HTMLObjectElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLObjectElementDerived + Reflectable>(base: &T) -> Option<&HTMLObjectElement> {
match base.is_htmlobjectelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLObjectElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLObjectElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlobjectelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLObjectElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLObjectElement>> {
match base.is_htmlobjectelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLObjectElementDerived for EventTarget {
fn is_htmlobjectelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLObjectElement))) => true,
_ => false,
}
}
}
impl HTMLObjectElementDerived for Node {
#[inline]
fn is_htmlobjectelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlobjectelement()
}
}
impl HTMLObjectElementDerived for Element {
#[inline]
fn is_htmlobjectelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlobjectelement()
}
}
impl HTMLObjectElementDerived for HTMLElement {
#[inline]
fn is_htmlobjectelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlobjectelement()
}
}
pub struct HTMLOptGroupElementCast;
impl EventTargetBase for HTMLOptGroupElement {}
impl NodeBase for HTMLOptGroupElement {}
impl ElementBase for HTMLOptGroupElement {}
impl HTMLElementBase for HTMLOptGroupElement {}
/// Types which `HTMLOptGroupElement` derives from
pub trait HTMLOptGroupElementDerived: Sized {
fn is_htmloptgroupelement(&self) -> bool;
}
impl HTMLOptGroupElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLOptGroupElementDerived + Reflectable>(base: &T) -> Option<&HTMLOptGroupElement> {
match base.is_htmloptgroupelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLOptGroupElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLOptGroupElement>> {
unsafe {
match (*base.unsafe_get()).is_htmloptgroupelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLOptGroupElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLOptGroupElement>> {
match base.is_htmloptgroupelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLOptGroupElementDerived for EventTarget {
fn is_htmloptgroupelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptGroupElement))) => true,
_ => false,
}
}
}
impl HTMLOptGroupElementDerived for Node {
#[inline]
fn is_htmloptgroupelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmloptgroupelement()
}
}
impl HTMLOptGroupElementDerived for Element {
#[inline]
fn is_htmloptgroupelement(&self) -> bool {
NodeCast::from_ref(self).is_htmloptgroupelement()
}
}
impl HTMLOptGroupElementDerived for HTMLElement {
#[inline]
fn is_htmloptgroupelement(&self) -> bool {
ElementCast::from_ref(self).is_htmloptgroupelement()
}
}
pub struct HTMLOptionElementCast;
impl EventTargetBase for HTMLOptionElement {}
impl NodeBase for HTMLOptionElement {}
impl ElementBase for HTMLOptionElement {}
impl HTMLElementBase for HTMLOptionElement {}
/// Types which `HTMLOptionElement` derives from
pub trait HTMLOptionElementDerived: Sized {
fn is_htmloptionelement(&self) -> bool;
}
impl HTMLOptionElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLOptionElementDerived + Reflectable>(base: &T) -> Option<&HTMLOptionElement> {
match base.is_htmloptionelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLOptionElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLOptionElement>> {
unsafe {
match (*base.unsafe_get()).is_htmloptionelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLOptionElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLOptionElement>> {
match base.is_htmloptionelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLOptionElementDerived for EventTarget {
fn is_htmloptionelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement))) => true,
_ => false,
}
}
}
impl HTMLOptionElementDerived for Node {
#[inline]
fn is_htmloptionelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmloptionelement()
}
}
impl HTMLOptionElementDerived for Element {
#[inline]
fn is_htmloptionelement(&self) -> bool {
NodeCast::from_ref(self).is_htmloptionelement()
}
}
impl HTMLOptionElementDerived for HTMLElement {
#[inline]
fn is_htmloptionelement(&self) -> bool {
ElementCast::from_ref(self).is_htmloptionelement()
}
}
pub struct HTMLOutputElementCast;
impl EventTargetBase for HTMLOutputElement {}
impl NodeBase for HTMLOutputElement {}
impl ElementBase for HTMLOutputElement {}
impl HTMLElementBase for HTMLOutputElement {}
/// Types which `HTMLOutputElement` derives from
pub trait HTMLOutputElementDerived: Sized {
fn is_htmloutputelement(&self) -> bool;
}
impl HTMLOutputElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLOutputElementDerived + Reflectable>(base: &T) -> Option<&HTMLOutputElement> {
match base.is_htmloutputelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLOutputElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLOutputElement>> {
unsafe {
match (*base.unsafe_get()).is_htmloutputelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLOutputElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLOutputElement>> {
match base.is_htmloutputelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLOutputElementDerived for EventTarget {
fn is_htmloutputelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOutputElement))) => true,
_ => false,
}
}
}
impl HTMLOutputElementDerived for Node {
#[inline]
fn is_htmloutputelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmloutputelement()
}
}
impl HTMLOutputElementDerived for Element {
#[inline]
fn is_htmloutputelement(&self) -> bool {
NodeCast::from_ref(self).is_htmloutputelement()
}
}
impl HTMLOutputElementDerived for HTMLElement {
#[inline]
fn is_htmloutputelement(&self) -> bool {
ElementCast::from_ref(self).is_htmloutputelement()
}
}
pub struct HTMLParagraphElementCast;
impl EventTargetBase for HTMLParagraphElement {}
impl NodeBase for HTMLParagraphElement {}
impl ElementBase for HTMLParagraphElement {}
impl HTMLElementBase for HTMLParagraphElement {}
/// Types which `HTMLParagraphElement` derives from
pub trait HTMLParagraphElementDerived: Sized {
fn is_htmlparagraphelement(&self) -> bool;
}
impl HTMLParagraphElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLParagraphElementDerived + Reflectable>(base: &T) -> Option<&HTMLParagraphElement> {
match base.is_htmlparagraphelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLParagraphElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLParagraphElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlparagraphelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLParagraphElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLParagraphElement>> {
match base.is_htmlparagraphelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLParagraphElementDerived for EventTarget {
fn is_htmlparagraphelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLParagraphElement))) => true,
_ => false,
}
}
}
impl HTMLParagraphElementDerived for Node {
#[inline]
fn is_htmlparagraphelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlparagraphelement()
}
}
impl HTMLParagraphElementDerived for Element {
#[inline]
fn is_htmlparagraphelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlparagraphelement()
}
}
impl HTMLParagraphElementDerived for HTMLElement {
#[inline]
fn is_htmlparagraphelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlparagraphelement()
}
}
pub struct HTMLParamElementCast;
impl EventTargetBase for HTMLParamElement {}
impl NodeBase for HTMLParamElement {}
impl ElementBase for HTMLParamElement {}
impl HTMLElementBase for HTMLParamElement {}
/// Types which `HTMLParamElement` derives from
pub trait HTMLParamElementDerived: Sized {
fn is_htmlparamelement(&self) -> bool;
}
impl HTMLParamElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLParamElementDerived + Reflectable>(base: &T) -> Option<&HTMLParamElement> {
match base.is_htmlparamelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLParamElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLParamElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlparamelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLParamElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLParamElement>> {
match base.is_htmlparamelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLParamElementDerived for EventTarget {
fn is_htmlparamelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLParamElement))) => true,
_ => false,
}
}
}
impl HTMLParamElementDerived for Node {
#[inline]
fn is_htmlparamelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlparamelement()
}
}
impl HTMLParamElementDerived for Element {
#[inline]
fn is_htmlparamelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlparamelement()
}
}
impl HTMLParamElementDerived for HTMLElement {
#[inline]
fn is_htmlparamelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlparamelement()
}
}
pub struct HTMLPreElementCast;
impl EventTargetBase for HTMLPreElement {}
impl NodeBase for HTMLPreElement {}
impl ElementBase for HTMLPreElement {}
impl HTMLElementBase for HTMLPreElement {}
/// Types which `HTMLPreElement` derives from
pub trait HTMLPreElementDerived: Sized {
fn is_htmlpreelement(&self) -> bool;
}
impl HTMLPreElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLPreElementDerived + Reflectable>(base: &T) -> Option<&HTMLPreElement> {
match base.is_htmlpreelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLPreElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLPreElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlpreelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLPreElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLPreElement>> {
match base.is_htmlpreelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLPreElementDerived for EventTarget {
fn is_htmlpreelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLPreElement))) => true,
_ => false,
}
}
}
impl HTMLPreElementDerived for Node {
#[inline]
fn is_htmlpreelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlpreelement()
}
}
impl HTMLPreElementDerived for Element {
#[inline]
fn is_htmlpreelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlpreelement()
}
}
impl HTMLPreElementDerived for HTMLElement {
#[inline]
fn is_htmlpreelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlpreelement()
}
}
pub struct HTMLProgressElementCast;
impl EventTargetBase for HTMLProgressElement {}
impl NodeBase for HTMLProgressElement {}
impl ElementBase for HTMLProgressElement {}
impl HTMLElementBase for HTMLProgressElement {}
/// Types which `HTMLProgressElement` derives from
pub trait HTMLProgressElementDerived: Sized {
fn is_htmlprogresselement(&self) -> bool;
}
impl HTMLProgressElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLProgressElementDerived + Reflectable>(base: &T) -> Option<&HTMLProgressElement> {
match base.is_htmlprogresselement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLProgressElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLProgressElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlprogresselement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLProgressElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLProgressElement>> {
match base.is_htmlprogresselement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLProgressElementDerived for EventTarget {
fn is_htmlprogresselement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLProgressElement))) => true,
_ => false,
}
}
}
impl HTMLProgressElementDerived for Node {
#[inline]
fn is_htmlprogresselement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlprogresselement()
}
}
impl HTMLProgressElementDerived for Element {
#[inline]
fn is_htmlprogresselement(&self) -> bool {
NodeCast::from_ref(self).is_htmlprogresselement()
}
}
impl HTMLProgressElementDerived for HTMLElement {
#[inline]
fn is_htmlprogresselement(&self) -> bool {
ElementCast::from_ref(self).is_htmlprogresselement()
}
}
pub struct HTMLQuoteElementCast;
impl EventTargetBase for HTMLQuoteElement {}
impl NodeBase for HTMLQuoteElement {}
impl ElementBase for HTMLQuoteElement {}
impl HTMLElementBase for HTMLQuoteElement {}
/// Types which `HTMLQuoteElement` derives from
pub trait HTMLQuoteElementDerived: Sized {
fn is_htmlquoteelement(&self) -> bool;
}
impl HTMLQuoteElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLQuoteElementDerived + Reflectable>(base: &T) -> Option<&HTMLQuoteElement> {
match base.is_htmlquoteelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLQuoteElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLQuoteElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlquoteelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLQuoteElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLQuoteElement>> {
match base.is_htmlquoteelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLQuoteElementDerived for EventTarget {
fn is_htmlquoteelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLQuoteElement))) => true,
_ => false,
}
}
}
impl HTMLQuoteElementDerived for Node {
#[inline]
fn is_htmlquoteelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlquoteelement()
}
}
impl HTMLQuoteElementDerived for Element {
#[inline]
fn is_htmlquoteelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlquoteelement()
}
}
impl HTMLQuoteElementDerived for HTMLElement {
#[inline]
fn is_htmlquoteelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlquoteelement()
}
}
pub struct HTMLScriptElementCast;
impl EventTargetBase for HTMLScriptElement {}
impl NodeBase for HTMLScriptElement {}
impl ElementBase for HTMLScriptElement {}
impl HTMLElementBase for HTMLScriptElement {}
/// Types which `HTMLScriptElement` derives from
pub trait HTMLScriptElementDerived: Sized {
fn is_htmlscriptelement(&self) -> bool;
}
impl HTMLScriptElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLScriptElementDerived + Reflectable>(base: &T) -> Option<&HTMLScriptElement> {
match base.is_htmlscriptelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLScriptElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLScriptElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlscriptelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLScriptElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLScriptElement>> {
match base.is_htmlscriptelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLScriptElementDerived for EventTarget {
fn is_htmlscriptelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLScriptElement))) => true,
_ => false,
}
}
}
impl HTMLScriptElementDerived for Node {
#[inline]
fn is_htmlscriptelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlscriptelement()
}
}
impl HTMLScriptElementDerived for Element {
#[inline]
fn is_htmlscriptelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlscriptelement()
}
}
impl HTMLScriptElementDerived for HTMLElement {
#[inline]
fn is_htmlscriptelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlscriptelement()
}
}
pub struct HTMLSelectElementCast;
impl EventTargetBase for HTMLSelectElement {}
impl NodeBase for HTMLSelectElement {}
impl ElementBase for HTMLSelectElement {}
impl HTMLElementBase for HTMLSelectElement {}
/// Types which `HTMLSelectElement` derives from
pub trait HTMLSelectElementDerived: Sized {
fn is_htmlselectelement(&self) -> bool;
}
impl HTMLSelectElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLSelectElementDerived + Reflectable>(base: &T) -> Option<&HTMLSelectElement> {
match base.is_htmlselectelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLSelectElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLSelectElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlselectelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLSelectElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLSelectElement>> {
match base.is_htmlselectelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLSelectElementDerived for EventTarget {
fn is_htmlselectelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement))) => true,
_ => false,
}
}
}
impl HTMLSelectElementDerived for Node {
#[inline]
fn is_htmlselectelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlselectelement()
}
}
impl HTMLSelectElementDerived for Element {
#[inline]
fn is_htmlselectelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlselectelement()
}
}
impl HTMLSelectElementDerived for HTMLElement {
#[inline]
fn is_htmlselectelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlselectelement()
}
}
pub struct HTMLSourceElementCast;
impl EventTargetBase for HTMLSourceElement {}
impl NodeBase for HTMLSourceElement {}
impl ElementBase for HTMLSourceElement {}
impl HTMLElementBase for HTMLSourceElement {}
/// Types which `HTMLSourceElement` derives from
pub trait HTMLSourceElementDerived: Sized {
fn is_htmlsourceelement(&self) -> bool;
}
impl HTMLSourceElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLSourceElementDerived + Reflectable>(base: &T) -> Option<&HTMLSourceElement> {
match base.is_htmlsourceelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLSourceElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLSourceElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlsourceelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLSourceElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLSourceElement>> {
match base.is_htmlsourceelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLSourceElementDerived for EventTarget {
fn is_htmlsourceelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSourceElement))) => true,
_ => false,
}
}
}
impl HTMLSourceElementDerived for Node {
#[inline]
fn is_htmlsourceelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlsourceelement()
}
}
impl HTMLSourceElementDerived for Element {
#[inline]
fn is_htmlsourceelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlsourceelement()
}
}
impl HTMLSourceElementDerived for HTMLElement {
#[inline]
fn is_htmlsourceelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlsourceelement()
}
}
pub struct HTMLSpanElementCast;
impl EventTargetBase for HTMLSpanElement {}
impl NodeBase for HTMLSpanElement {}
impl ElementBase for HTMLSpanElement {}
impl HTMLElementBase for HTMLSpanElement {}
/// Types which `HTMLSpanElement` derives from
pub trait HTMLSpanElementDerived: Sized {
fn is_htmlspanelement(&self) -> bool;
}
impl HTMLSpanElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLSpanElementDerived + Reflectable>(base: &T) -> Option<&HTMLSpanElement> {
match base.is_htmlspanelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLSpanElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLSpanElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlspanelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLSpanElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLSpanElement>> {
match base.is_htmlspanelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLSpanElementDerived for EventTarget {
fn is_htmlspanelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSpanElement))) => true,
_ => false,
}
}
}
impl HTMLSpanElementDerived for Node {
#[inline]
fn is_htmlspanelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlspanelement()
}
}
impl HTMLSpanElementDerived for Element {
#[inline]
fn is_htmlspanelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlspanelement()
}
}
impl HTMLSpanElementDerived for HTMLElement {
#[inline]
fn is_htmlspanelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlspanelement()
}
}
pub struct HTMLStyleElementCast;
impl EventTargetBase for HTMLStyleElement {}
impl NodeBase for HTMLStyleElement {}
impl ElementBase for HTMLStyleElement {}
impl HTMLElementBase for HTMLStyleElement {}
/// Types which `HTMLStyleElement` derives from
pub trait HTMLStyleElementDerived: Sized {
fn is_htmlstyleelement(&self) -> bool;
}
impl HTMLStyleElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLStyleElementDerived + Reflectable>(base: &T) -> Option<&HTMLStyleElement> {
match base.is_htmlstyleelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLStyleElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLStyleElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlstyleelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLStyleElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLStyleElement>> {
match base.is_htmlstyleelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLStyleElementDerived for EventTarget {
fn is_htmlstyleelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLStyleElement))) => true,
_ => false,
}
}
}
impl HTMLStyleElementDerived for Node {
#[inline]
fn is_htmlstyleelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlstyleelement()
}
}
impl HTMLStyleElementDerived for Element {
#[inline]
fn is_htmlstyleelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlstyleelement()
}
}
impl HTMLStyleElementDerived for HTMLElement {
#[inline]
fn is_htmlstyleelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlstyleelement()
}
}
pub struct HTMLTableCaptionElementCast;
impl EventTargetBase for HTMLTableCaptionElement {}
impl NodeBase for HTMLTableCaptionElement {}
impl ElementBase for HTMLTableCaptionElement {}
impl HTMLElementBase for HTMLTableCaptionElement {}
/// Types which `HTMLTableCaptionElement` derives from
pub trait HTMLTableCaptionElementDerived: Sized {
fn is_htmltablecaptionelement(&self) -> bool;
}
impl HTMLTableCaptionElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLTableCaptionElementDerived + Reflectable>(base: &T) -> Option<&HTMLTableCaptionElement> {
match base.is_htmltablecaptionelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLTableCaptionElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLTableCaptionElement>> {
unsafe {
match (*base.unsafe_get()).is_htmltablecaptionelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLTableCaptionElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLTableCaptionElement>> {
match base.is_htmltablecaptionelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLTableCaptionElementDerived for EventTarget {
fn is_htmltablecaptionelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCaptionElement))) => true,
_ => false,
}
}
}
impl HTMLTableCaptionElementDerived for Node {
#[inline]
fn is_htmltablecaptionelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmltablecaptionelement()
}
}
impl HTMLTableCaptionElementDerived for Element {
#[inline]
fn is_htmltablecaptionelement(&self) -> bool {
NodeCast::from_ref(self).is_htmltablecaptionelement()
}
}
impl HTMLTableCaptionElementDerived for HTMLElement {
#[inline]
fn is_htmltablecaptionelement(&self) -> bool {
ElementCast::from_ref(self).is_htmltablecaptionelement()
}
}
pub struct HTMLTableCellElementCast;
/// Types which are derived from `HTMLTableCellElement` and can be freely converted
/// to `HTMLTableCellElement`
pub trait HTMLTableCellElementBase: Sized {}
impl HTMLTableCellElementCast {
#[inline]
/// Upcast an instance of a derived class of `HTMLTableCellElement` to `HTMLTableCellElement`
pub fn from_ref<T: HTMLTableCellElementBase + Reflectable>(derived: &T) -> &HTMLTableCellElement {
unsafe { mem::transmute(derived) }
}
#[inline]
#[allow(unrooted_must_root)]
pub fn from_layout_js<T: HTMLTableCellElementBase + Reflectable>(derived: &LayoutJS<T>) -> LayoutJS<HTMLTableCellElement> {
unsafe { mem::transmute_copy(derived) }
}
#[inline]
pub fn from_root<T: HTMLTableCellElementBase + Reflectable>(derived: Root<T>) -> Root<HTMLTableCellElement> {
unsafe { mem::transmute(derived) }
}
}
impl EventTargetBase for HTMLTableCellElement {}
impl NodeBase for HTMLTableCellElement {}
impl ElementBase for HTMLTableCellElement {}
impl HTMLElementBase for HTMLTableCellElement {}
impl HTMLTableCellElementBase for HTMLTableCellElement {}
/// Types which `HTMLTableCellElement` derives from
pub trait HTMLTableCellElementDerived: Sized {
fn is_htmltablecellelement(&self) -> bool;
}
impl HTMLTableCellElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLTableCellElementDerived + Reflectable>(base: &T) -> Option<&HTMLTableCellElement> {
match base.is_htmltablecellelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLTableCellElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLTableCellElement>> {
unsafe {
match (*base.unsafe_get()).is_htmltablecellelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLTableCellElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLTableCellElement>> {
match base.is_htmltablecellelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLTableCellElementDerived for EventTarget {
fn is_htmltablecellelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCellElement(_)))) => true,
_ => false,
}
}
}
impl HTMLTableCellElementDerived for Node {
#[inline]
fn is_htmltablecellelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmltablecellelement()
}
}
impl HTMLTableCellElementDerived for Element {
#[inline]
fn is_htmltablecellelement(&self) -> bool {
NodeCast::from_ref(self).is_htmltablecellelement()
}
}
impl HTMLTableCellElementDerived for HTMLElement {
#[inline]
fn is_htmltablecellelement(&self) -> bool {
ElementCast::from_ref(self).is_htmltablecellelement()
}
}
pub struct HTMLTableColElementCast;
impl EventTargetBase for HTMLTableColElement {}
impl NodeBase for HTMLTableColElement {}
impl ElementBase for HTMLTableColElement {}
impl HTMLElementBase for HTMLTableColElement {}
/// Types which `HTMLTableColElement` derives from
pub trait HTMLTableColElementDerived: Sized {
fn is_htmltablecolelement(&self) -> bool;
}
impl HTMLTableColElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLTableColElementDerived + Reflectable>(base: &T) -> Option<&HTMLTableColElement> {
match base.is_htmltablecolelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLTableColElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLTableColElement>> {
unsafe {
match (*base.unsafe_get()).is_htmltablecolelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLTableColElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLTableColElement>> {
match base.is_htmltablecolelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLTableColElementDerived for EventTarget {
fn is_htmltablecolelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableColElement))) => true,
_ => false,
}
}
}
impl HTMLTableColElementDerived for Node {
#[inline]
fn is_htmltablecolelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmltablecolelement()
}
}
impl HTMLTableColElementDerived for Element {
#[inline]
fn is_htmltablecolelement(&self) -> bool {
NodeCast::from_ref(self).is_htmltablecolelement()
}
}
impl HTMLTableColElementDerived for HTMLElement {
#[inline]
fn is_htmltablecolelement(&self) -> bool {
ElementCast::from_ref(self).is_htmltablecolelement()
}
}
pub struct HTMLTableDataCellElementCast;
impl EventTargetBase for HTMLTableDataCellElement {}
impl NodeBase for HTMLTableDataCellElement {}
impl ElementBase for HTMLTableDataCellElement {}
impl HTMLElementBase for HTMLTableDataCellElement {}
impl HTMLTableCellElementBase for HTMLTableDataCellElement {}
/// Types which `HTMLTableDataCellElement` derives from
pub trait HTMLTableDataCellElementDerived: Sized {
fn is_htmltabledatacellelement(&self) -> bool;
}
impl HTMLTableDataCellElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLTableDataCellElementDerived + Reflectable>(base: &T) -> Option<&HTMLTableDataCellElement> {
match base.is_htmltabledatacellelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLTableDataCellElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLTableDataCellElement>> {
unsafe {
match (*base.unsafe_get()).is_htmltabledatacellelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLTableDataCellElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLTableDataCellElement>> {
match base.is_htmltabledatacellelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLTableDataCellElementDerived for EventTarget {
fn is_htmltabledatacellelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCellElement(HTMLTableCellElementTypeId::HTMLTableDataCellElement)))) => true,
_ => false,
}
}
}
impl HTMLTableDataCellElementDerived for Node {
#[inline]
fn is_htmltabledatacellelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmltabledatacellelement()
}
}
impl HTMLTableDataCellElementDerived for Element {
#[inline]
fn is_htmltabledatacellelement(&self) -> bool {
NodeCast::from_ref(self).is_htmltabledatacellelement()
}
}
impl HTMLTableDataCellElementDerived for HTMLElement {
#[inline]
fn is_htmltabledatacellelement(&self) -> bool {
ElementCast::from_ref(self).is_htmltabledatacellelement()
}
}
impl HTMLTableDataCellElementDerived for HTMLTableCellElement {
#[inline]
fn is_htmltabledatacellelement(&self) -> bool {
HTMLElementCast::from_ref(self).is_htmltabledatacellelement()
}
}
pub struct HTMLTableElementCast;
impl EventTargetBase for HTMLTableElement {}
impl NodeBase for HTMLTableElement {}
impl ElementBase for HTMLTableElement {}
impl HTMLElementBase for HTMLTableElement {}
/// Types which `HTMLTableElement` derives from
pub trait HTMLTableElementDerived: Sized {
fn is_htmltableelement(&self) -> bool;
}
impl HTMLTableElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLTableElementDerived + Reflectable>(base: &T) -> Option<&HTMLTableElement> {
match base.is_htmltableelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLTableElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLTableElement>> {
unsafe {
match (*base.unsafe_get()).is_htmltableelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLTableElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLTableElement>> {
match base.is_htmltableelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLTableElementDerived for EventTarget {
fn is_htmltableelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableElement))) => true,
_ => false,
}
}
}
impl HTMLTableElementDerived for Node {
#[inline]
fn is_htmltableelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmltableelement()
}
}
impl HTMLTableElementDerived for Element {
#[inline]
fn is_htmltableelement(&self) -> bool {
NodeCast::from_ref(self).is_htmltableelement()
}
}
impl HTMLTableElementDerived for HTMLElement {
#[inline]
fn is_htmltableelement(&self) -> bool {
ElementCast::from_ref(self).is_htmltableelement()
}
}
pub struct HTMLTableHeaderCellElementCast;
impl EventTargetBase for HTMLTableHeaderCellElement {}
impl NodeBase for HTMLTableHeaderCellElement {}
impl ElementBase for HTMLTableHeaderCellElement {}
impl HTMLElementBase for HTMLTableHeaderCellElement {}
impl HTMLTableCellElementBase for HTMLTableHeaderCellElement {}
/// Types which `HTMLTableHeaderCellElement` derives from
pub trait HTMLTableHeaderCellElementDerived: Sized {
fn is_htmltableheadercellelement(&self) -> bool;
}
impl HTMLTableHeaderCellElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLTableHeaderCellElementDerived + Reflectable>(base: &T) -> Option<&HTMLTableHeaderCellElement> {
match base.is_htmltableheadercellelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLTableHeaderCellElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLTableHeaderCellElement>> {
unsafe {
match (*base.unsafe_get()).is_htmltableheadercellelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLTableHeaderCellElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLTableHeaderCellElement>> {
match base.is_htmltableheadercellelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLTableHeaderCellElementDerived for EventTarget {
fn is_htmltableheadercellelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCellElement(HTMLTableCellElementTypeId::HTMLTableHeaderCellElement)))) => true,
_ => false,
}
}
}
impl HTMLTableHeaderCellElementDerived for Node {
#[inline]
fn is_htmltableheadercellelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmltableheadercellelement()
}
}
impl HTMLTableHeaderCellElementDerived for Element {
#[inline]
fn is_htmltableheadercellelement(&self) -> bool {
NodeCast::from_ref(self).is_htmltableheadercellelement()
}
}
impl HTMLTableHeaderCellElementDerived for HTMLElement {
#[inline]
fn is_htmltableheadercellelement(&self) -> bool {
ElementCast::from_ref(self).is_htmltableheadercellelement()
}
}
impl HTMLTableHeaderCellElementDerived for HTMLTableCellElement {
#[inline]
fn is_htmltableheadercellelement(&self) -> bool {
HTMLElementCast::from_ref(self).is_htmltableheadercellelement()
}
}
pub struct HTMLTableRowElementCast;
impl EventTargetBase for HTMLTableRowElement {}
impl NodeBase for HTMLTableRowElement {}
impl ElementBase for HTMLTableRowElement {}
impl HTMLElementBase for HTMLTableRowElement {}
/// Types which `HTMLTableRowElement` derives from
pub trait HTMLTableRowElementDerived: Sized {
fn is_htmltablerowelement(&self) -> bool;
}
impl HTMLTableRowElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLTableRowElementDerived + Reflectable>(base: &T) -> Option<&HTMLTableRowElement> {
match base.is_htmltablerowelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLTableRowElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLTableRowElement>> {
unsafe {
match (*base.unsafe_get()).is_htmltablerowelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLTableRowElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLTableRowElement>> {
match base.is_htmltablerowelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLTableRowElementDerived for EventTarget {
fn is_htmltablerowelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableRowElement))) => true,
_ => false,
}
}
}
impl HTMLTableRowElementDerived for Node {
#[inline]
fn is_htmltablerowelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmltablerowelement()
}
}
impl HTMLTableRowElementDerived for Element {
#[inline]
fn is_htmltablerowelement(&self) -> bool {
NodeCast::from_ref(self).is_htmltablerowelement()
}
}
impl HTMLTableRowElementDerived for HTMLElement {
#[inline]
fn is_htmltablerowelement(&self) -> bool {
ElementCast::from_ref(self).is_htmltablerowelement()
}
}
pub struct HTMLTableSectionElementCast;
impl EventTargetBase for HTMLTableSectionElement {}
impl NodeBase for HTMLTableSectionElement {}
impl ElementBase for HTMLTableSectionElement {}
impl HTMLElementBase for HTMLTableSectionElement {}
/// Types which `HTMLTableSectionElement` derives from
pub trait HTMLTableSectionElementDerived: Sized {
fn is_htmltablesectionelement(&self) -> bool;
}
impl HTMLTableSectionElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLTableSectionElementDerived + Reflectable>(base: &T) -> Option<&HTMLTableSectionElement> {
match base.is_htmltablesectionelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLTableSectionElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLTableSectionElement>> {
unsafe {
match (*base.unsafe_get()).is_htmltablesectionelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLTableSectionElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLTableSectionElement>> {
match base.is_htmltablesectionelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLTableSectionElementDerived for EventTarget {
fn is_htmltablesectionelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableSectionElement))) => true,
_ => false,
}
}
}
impl HTMLTableSectionElementDerived for Node {
#[inline]
fn is_htmltablesectionelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmltablesectionelement()
}
}
impl HTMLTableSectionElementDerived for Element {
#[inline]
fn is_htmltablesectionelement(&self) -> bool {
NodeCast::from_ref(self).is_htmltablesectionelement()
}
}
impl HTMLTableSectionElementDerived for HTMLElement {
#[inline]
fn is_htmltablesectionelement(&self) -> bool {
ElementCast::from_ref(self).is_htmltablesectionelement()
}
}
pub struct HTMLTemplateElementCast;
impl EventTargetBase for HTMLTemplateElement {}
impl NodeBase for HTMLTemplateElement {}
impl ElementBase for HTMLTemplateElement {}
impl HTMLElementBase for HTMLTemplateElement {}
/// Types which `HTMLTemplateElement` derives from
pub trait HTMLTemplateElementDerived: Sized {
fn is_htmltemplateelement(&self) -> bool;
}
impl HTMLTemplateElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLTemplateElementDerived + Reflectable>(base: &T) -> Option<&HTMLTemplateElement> {
match base.is_htmltemplateelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLTemplateElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLTemplateElement>> {
unsafe {
match (*base.unsafe_get()).is_htmltemplateelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLTemplateElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLTemplateElement>> {
match base.is_htmltemplateelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLTemplateElementDerived for EventTarget {
fn is_htmltemplateelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTemplateElement))) => true,
_ => false,
}
}
}
impl HTMLTemplateElementDerived for Node {
#[inline]
fn is_htmltemplateelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmltemplateelement()
}
}
impl HTMLTemplateElementDerived for Element {
#[inline]
fn is_htmltemplateelement(&self) -> bool {
NodeCast::from_ref(self).is_htmltemplateelement()
}
}
impl HTMLTemplateElementDerived for HTMLElement {
#[inline]
fn is_htmltemplateelement(&self) -> bool {
ElementCast::from_ref(self).is_htmltemplateelement()
}
}
pub struct HTMLTextAreaElementCast;
impl EventTargetBase for HTMLTextAreaElement {}
impl NodeBase for HTMLTextAreaElement {}
impl ElementBase for HTMLTextAreaElement {}
impl HTMLElementBase for HTMLTextAreaElement {}
/// Types which `HTMLTextAreaElement` derives from
pub trait HTMLTextAreaElementDerived: Sized {
fn is_htmltextareaelement(&self) -> bool;
}
impl HTMLTextAreaElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLTextAreaElementDerived + Reflectable>(base: &T) -> Option<&HTMLTextAreaElement> {
match base.is_htmltextareaelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLTextAreaElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLTextAreaElement>> {
unsafe {
match (*base.unsafe_get()).is_htmltextareaelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLTextAreaElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLTextAreaElement>> {
match base.is_htmltextareaelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLTextAreaElementDerived for EventTarget {
fn is_htmltextareaelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement))) => true,
_ => false,
}
}
}
impl HTMLTextAreaElementDerived for Node {
#[inline]
fn is_htmltextareaelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmltextareaelement()
}
}
impl HTMLTextAreaElementDerived for Element {
#[inline]
fn is_htmltextareaelement(&self) -> bool {
NodeCast::from_ref(self).is_htmltextareaelement()
}
}
impl HTMLTextAreaElementDerived for HTMLElement {
#[inline]
fn is_htmltextareaelement(&self) -> bool {
ElementCast::from_ref(self).is_htmltextareaelement()
}
}
pub struct HTMLTimeElementCast;
impl EventTargetBase for HTMLTimeElement {}
impl NodeBase for HTMLTimeElement {}
impl ElementBase for HTMLTimeElement {}
impl HTMLElementBase for HTMLTimeElement {}
/// Types which `HTMLTimeElement` derives from
pub trait HTMLTimeElementDerived: Sized {
fn is_htmltimeelement(&self) -> bool;
}
impl HTMLTimeElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLTimeElementDerived + Reflectable>(base: &T) -> Option<&HTMLTimeElement> {
match base.is_htmltimeelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLTimeElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLTimeElement>> {
unsafe {
match (*base.unsafe_get()).is_htmltimeelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLTimeElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLTimeElement>> {
match base.is_htmltimeelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLTimeElementDerived for EventTarget {
fn is_htmltimeelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTimeElement))) => true,
_ => false,
}
}
}
impl HTMLTimeElementDerived for Node {
#[inline]
fn is_htmltimeelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmltimeelement()
}
}
impl HTMLTimeElementDerived for Element {
#[inline]
fn is_htmltimeelement(&self) -> bool {
NodeCast::from_ref(self).is_htmltimeelement()
}
}
impl HTMLTimeElementDerived for HTMLElement {
#[inline]
fn is_htmltimeelement(&self) -> bool {
ElementCast::from_ref(self).is_htmltimeelement()
}
}
pub struct HTMLTitleElementCast;
impl EventTargetBase for HTMLTitleElement {}
impl NodeBase for HTMLTitleElement {}
impl ElementBase for HTMLTitleElement {}
impl HTMLElementBase for HTMLTitleElement {}
/// Types which `HTMLTitleElement` derives from
pub trait HTMLTitleElementDerived: Sized {
fn is_htmltitleelement(&self) -> bool;
}
impl HTMLTitleElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLTitleElementDerived + Reflectable>(base: &T) -> Option<&HTMLTitleElement> {
match base.is_htmltitleelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLTitleElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLTitleElement>> {
unsafe {
match (*base.unsafe_get()).is_htmltitleelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLTitleElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLTitleElement>> {
match base.is_htmltitleelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLTitleElementDerived for EventTarget {
fn is_htmltitleelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTitleElement))) => true,
_ => false,
}
}
}
impl HTMLTitleElementDerived for Node {
#[inline]
fn is_htmltitleelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmltitleelement()
}
}
impl HTMLTitleElementDerived for Element {
#[inline]
fn is_htmltitleelement(&self) -> bool {
NodeCast::from_ref(self).is_htmltitleelement()
}
}
impl HTMLTitleElementDerived for HTMLElement {
#[inline]
fn is_htmltitleelement(&self) -> bool {
ElementCast::from_ref(self).is_htmltitleelement()
}
}
pub struct HTMLTrackElementCast;
impl EventTargetBase for HTMLTrackElement {}
impl NodeBase for HTMLTrackElement {}
impl ElementBase for HTMLTrackElement {}
impl HTMLElementBase for HTMLTrackElement {}
/// Types which `HTMLTrackElement` derives from
pub trait HTMLTrackElementDerived: Sized {
fn is_htmltrackelement(&self) -> bool;
}
impl HTMLTrackElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLTrackElementDerived + Reflectable>(base: &T) -> Option<&HTMLTrackElement> {
match base.is_htmltrackelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLTrackElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLTrackElement>> {
unsafe {
match (*base.unsafe_get()).is_htmltrackelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLTrackElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLTrackElement>> {
match base.is_htmltrackelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLTrackElementDerived for EventTarget {
fn is_htmltrackelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTrackElement))) => true,
_ => false,
}
}
}
impl HTMLTrackElementDerived for Node {
#[inline]
fn is_htmltrackelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmltrackelement()
}
}
impl HTMLTrackElementDerived for Element {
#[inline]
fn is_htmltrackelement(&self) -> bool {
NodeCast::from_ref(self).is_htmltrackelement()
}
}
impl HTMLTrackElementDerived for HTMLElement {
#[inline]
fn is_htmltrackelement(&self) -> bool {
ElementCast::from_ref(self).is_htmltrackelement()
}
}
pub struct HTMLUListElementCast;
impl EventTargetBase for HTMLUListElement {}
impl NodeBase for HTMLUListElement {}
impl ElementBase for HTMLUListElement {}
impl HTMLElementBase for HTMLUListElement {}
/// Types which `HTMLUListElement` derives from
pub trait HTMLUListElementDerived: Sized {
fn is_htmlulistelement(&self) -> bool;
}
impl HTMLUListElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLUListElementDerived + Reflectable>(base: &T) -> Option<&HTMLUListElement> {
match base.is_htmlulistelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLUListElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLUListElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlulistelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLUListElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLUListElement>> {
match base.is_htmlulistelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLUListElementDerived for EventTarget {
fn is_htmlulistelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLUListElement))) => true,
_ => false,
}
}
}
impl HTMLUListElementDerived for Node {
#[inline]
fn is_htmlulistelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlulistelement()
}
}
impl HTMLUListElementDerived for Element {
#[inline]
fn is_htmlulistelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlulistelement()
}
}
impl HTMLUListElementDerived for HTMLElement {
#[inline]
fn is_htmlulistelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlulistelement()
}
}
pub struct HTMLUnknownElementCast;
impl EventTargetBase for HTMLUnknownElement {}
impl NodeBase for HTMLUnknownElement {}
impl ElementBase for HTMLUnknownElement {}
impl HTMLElementBase for HTMLUnknownElement {}
/// Types which `HTMLUnknownElement` derives from
pub trait HTMLUnknownElementDerived: Sized {
fn is_htmlunknownelement(&self) -> bool;
}
impl HTMLUnknownElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLUnknownElementDerived + Reflectable>(base: &T) -> Option<&HTMLUnknownElement> {
match base.is_htmlunknownelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLUnknownElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLUnknownElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlunknownelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLUnknownElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLUnknownElement>> {
match base.is_htmlunknownelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLUnknownElementDerived for EventTarget {
fn is_htmlunknownelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLUnknownElement))) => true,
_ => false,
}
}
}
impl HTMLUnknownElementDerived for Node {
#[inline]
fn is_htmlunknownelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlunknownelement()
}
}
impl HTMLUnknownElementDerived for Element {
#[inline]
fn is_htmlunknownelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlunknownelement()
}
}
impl HTMLUnknownElementDerived for HTMLElement {
#[inline]
fn is_htmlunknownelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlunknownelement()
}
}
pub struct HTMLVideoElementCast;
impl EventTargetBase for HTMLVideoElement {}
impl NodeBase for HTMLVideoElement {}
impl ElementBase for HTMLVideoElement {}
impl HTMLElementBase for HTMLVideoElement {}
impl HTMLMediaElementBase for HTMLVideoElement {}
/// Types which `HTMLVideoElement` derives from
pub trait HTMLVideoElementDerived: Sized {
fn is_htmlvideoelement(&self) -> bool;
}
impl HTMLVideoElementCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: HTMLVideoElementDerived + Reflectable>(base: &T) -> Option<&HTMLVideoElement> {
match base.is_htmlvideoelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: HTMLVideoElementDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<HTMLVideoElement>> {
unsafe {
match (*base.unsafe_get()).is_htmlvideoelement() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: HTMLVideoElementDerived + Reflectable>(base: Root<T>) -> Option<Root<HTMLVideoElement>> {
match base.is_htmlvideoelement() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl HTMLVideoElementDerived for EventTarget {
fn is_htmlvideoelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMediaElement(HTMLMediaElementTypeId::HTMLVideoElement)))) => true,
_ => false,
}
}
}
impl HTMLVideoElementDerived for Node {
#[inline]
fn is_htmlvideoelement(&self) -> bool {
EventTargetCast::from_ref(self).is_htmlvideoelement()
}
}
impl HTMLVideoElementDerived for Element {
#[inline]
fn is_htmlvideoelement(&self) -> bool {
NodeCast::from_ref(self).is_htmlvideoelement()
}
}
impl HTMLVideoElementDerived for HTMLElement {
#[inline]
fn is_htmlvideoelement(&self) -> bool {
ElementCast::from_ref(self).is_htmlvideoelement()
}
}
impl HTMLVideoElementDerived for HTMLMediaElement {
#[inline]
fn is_htmlvideoelement(&self) -> bool {
HTMLElementCast::from_ref(self).is_htmlvideoelement()
}
}
pub struct KeyboardEventCast;
impl EventBase for KeyboardEvent {}
impl UIEventBase for KeyboardEvent {}
/// Types which `KeyboardEvent` derives from
pub trait KeyboardEventDerived: Sized {
fn is_keyboardevent(&self) -> bool;
}
impl KeyboardEventCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: KeyboardEventDerived + Reflectable>(base: &T) -> Option<&KeyboardEvent> {
match base.is_keyboardevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: KeyboardEventDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<KeyboardEvent>> {
unsafe {
match (*base.unsafe_get()).is_keyboardevent() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: KeyboardEventDerived + Reflectable>(base: Root<T>) -> Option<Root<KeyboardEvent>> {
match base.is_keyboardevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl KeyboardEventDerived for Event {
fn is_keyboardevent(&self) -> bool {
match *self.type_id() {
EventTypeId::UIEvent(UIEventTypeId::KeyboardEvent) => true,
_ => false,
}
}
}
impl KeyboardEventDerived for UIEvent {
#[inline]
fn is_keyboardevent(&self) -> bool {
EventCast::from_ref(self).is_keyboardevent()
}
}
pub struct MessageEventCast;
impl EventBase for MessageEvent {}
/// Types which `MessageEvent` derives from
pub trait MessageEventDerived: Sized {
fn is_messageevent(&self) -> bool;
}
impl MessageEventCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: MessageEventDerived + Reflectable>(base: &T) -> Option<&MessageEvent> {
match base.is_messageevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: MessageEventDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<MessageEvent>> {
unsafe {
match (*base.unsafe_get()).is_messageevent() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: MessageEventDerived + Reflectable>(base: Root<T>) -> Option<Root<MessageEvent>> {
match base.is_messageevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl MessageEventDerived for Event {
fn is_messageevent(&self) -> bool {
match *self.type_id() {
EventTypeId::MessageEvent => true,
_ => false,
}
}
}
pub struct MouseEventCast;
impl EventBase for MouseEvent {}
impl UIEventBase for MouseEvent {}
/// Types which `MouseEvent` derives from
pub trait MouseEventDerived: Sized {
fn is_mouseevent(&self) -> bool;
}
impl MouseEventCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: MouseEventDerived + Reflectable>(base: &T) -> Option<&MouseEvent> {
match base.is_mouseevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: MouseEventDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<MouseEvent>> {
unsafe {
match (*base.unsafe_get()).is_mouseevent() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: MouseEventDerived + Reflectable>(base: Root<T>) -> Option<Root<MouseEvent>> {
match base.is_mouseevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl MouseEventDerived for Event {
fn is_mouseevent(&self) -> bool {
match *self.type_id() {
EventTypeId::UIEvent(UIEventTypeId::MouseEvent) => true,
_ => false,
}
}
}
impl MouseEventDerived for UIEvent {
#[inline]
fn is_mouseevent(&self) -> bool {
EventCast::from_ref(self).is_mouseevent()
}
}
pub struct NodeCast;
/// Types which are derived from `Node` and can be freely converted
/// to `Node`
pub trait NodeBase: Sized {}
impl NodeCast {
#[inline]
/// Upcast an instance of a derived class of `Node` to `Node`
pub fn from_ref<T: NodeBase + Reflectable>(derived: &T) -> &Node {
unsafe { mem::transmute(derived) }
}
#[inline]
#[allow(unrooted_must_root)]
pub fn from_layout_js<T: NodeBase + Reflectable>(derived: &LayoutJS<T>) -> LayoutJS<Node> {
unsafe { mem::transmute_copy(derived) }
}
#[inline]
pub fn from_root<T: NodeBase + Reflectable>(derived: Root<T>) -> Root<Node> {
unsafe { mem::transmute(derived) }
}
}
impl EventTargetBase for Node {}
impl NodeBase for Node {}
/// Types which `Node` derives from
pub trait NodeDerived: Sized {
fn is_node(&self) -> bool;
}
impl NodeCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: NodeDerived + Reflectable>(base: &T) -> Option<&Node> {
match base.is_node() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: NodeDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<Node>> {
unsafe {
match (*base.unsafe_get()).is_node() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: NodeDerived + Reflectable>(base: Root<T>) -> Option<Root<Node>> {
match base.is_node() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl NodeDerived for EventTarget {
fn is_node(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(_) => true,
_ => false,
}
}
}
pub struct ProcessingInstructionCast;
impl EventTargetBase for ProcessingInstruction {}
impl NodeBase for ProcessingInstruction {}
impl CharacterDataBase for ProcessingInstruction {}
/// Types which `ProcessingInstruction` derives from
pub trait ProcessingInstructionDerived: Sized {
fn is_processinginstruction(&self) -> bool;
}
impl ProcessingInstructionCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: ProcessingInstructionDerived + Reflectable>(base: &T) -> Option<&ProcessingInstruction> {
match base.is_processinginstruction() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: ProcessingInstructionDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<ProcessingInstruction>> {
unsafe {
match (*base.unsafe_get()).is_processinginstruction() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: ProcessingInstructionDerived + Reflectable>(base: Root<T>) -> Option<Root<ProcessingInstruction>> {
match base.is_processinginstruction() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl ProcessingInstructionDerived for EventTarget {
fn is_processinginstruction(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction)) => true,
_ => false,
}
}
}
impl ProcessingInstructionDerived for Node {
#[inline]
fn is_processinginstruction(&self) -> bool {
EventTargetCast::from_ref(self).is_processinginstruction()
}
}
impl ProcessingInstructionDerived for CharacterData {
#[inline]
fn is_processinginstruction(&self) -> bool {
NodeCast::from_ref(self).is_processinginstruction()
}
}
pub struct ProgressEventCast;
impl EventBase for ProgressEvent {}
/// Types which `ProgressEvent` derives from
pub trait ProgressEventDerived: Sized {
fn is_progressevent(&self) -> bool;
}
impl ProgressEventCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: ProgressEventDerived + Reflectable>(base: &T) -> Option<&ProgressEvent> {
match base.is_progressevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: ProgressEventDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<ProgressEvent>> {
unsafe {
match (*base.unsafe_get()).is_progressevent() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: ProgressEventDerived + Reflectable>(base: Root<T>) -> Option<Root<ProgressEvent>> {
match base.is_progressevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl ProgressEventDerived for Event {
fn is_progressevent(&self) -> bool {
match *self.type_id() {
EventTypeId::ProgressEvent => true,
_ => false,
}
}
}
pub struct StorageEventCast;
impl EventBase for StorageEvent {}
/// Types which `StorageEvent` derives from
pub trait StorageEventDerived: Sized {
fn is_storageevent(&self) -> bool;
}
impl StorageEventCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: StorageEventDerived + Reflectable>(base: &T) -> Option<&StorageEvent> {
match base.is_storageevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: StorageEventDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<StorageEvent>> {
unsafe {
match (*base.unsafe_get()).is_storageevent() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: StorageEventDerived + Reflectable>(base: Root<T>) -> Option<Root<StorageEvent>> {
match base.is_storageevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl StorageEventDerived for Event {
fn is_storageevent(&self) -> bool {
match *self.type_id() {
EventTypeId::StorageEvent => true,
_ => false,
}
}
}
pub struct TestBindingCast;
/// Types which are derived from `TestBinding` and can be freely converted
/// to `TestBinding`
pub trait TestBindingBase: Sized {}
impl TestBindingCast {
#[inline]
/// Upcast an instance of a derived class of `TestBinding` to `TestBinding`
pub fn from_ref<T: TestBindingBase + Reflectable>(derived: &T) -> &TestBinding {
unsafe { mem::transmute(derived) }
}
#[inline]
#[allow(unrooted_must_root)]
pub fn from_layout_js<T: TestBindingBase + Reflectable>(derived: &LayoutJS<T>) -> LayoutJS<TestBinding> {
unsafe { mem::transmute_copy(derived) }
}
#[inline]
pub fn from_root<T: TestBindingBase + Reflectable>(derived: Root<T>) -> Root<TestBinding> {
unsafe { mem::transmute(derived) }
}
}
impl TestBindingBase for TestBinding {}
pub struct TestBindingProxyCast;
impl TestBindingBase for TestBindingProxy {}
/// Types which `TestBindingProxy` derives from
pub trait TestBindingProxyDerived: Sized {
fn is_testbindingproxy(&self) -> bool;
}
impl TestBindingProxyCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: TestBindingProxyDerived + Reflectable>(base: &T) -> Option<&TestBindingProxy> {
match base.is_testbindingproxy() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: TestBindingProxyDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<TestBindingProxy>> {
unsafe {
match (*base.unsafe_get()).is_testbindingproxy() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: TestBindingProxyDerived + Reflectable>(base: Root<T>) -> Option<Root<TestBindingProxy>> {
match base.is_testbindingproxy() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl TestBindingProxyDerived for TestBinding {
fn is_testbindingproxy(&self) -> bool {
match *self.type_id() {
TestBindingTypeId::TestBindingProxy => true,
_ => false,
}
}
}
pub struct TextCast;
impl EventTargetBase for Text {}
impl NodeBase for Text {}
impl CharacterDataBase for Text {}
/// Types which `Text` derives from
pub trait TextDerived: Sized {
fn is_text(&self) -> bool;
}
impl TextCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: TextDerived + Reflectable>(base: &T) -> Option<&Text> {
match base.is_text() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: TextDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<Text>> {
unsafe {
match (*base.unsafe_get()).is_text() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: TextDerived + Reflectable>(base: Root<T>) -> Option<Root<Text>> {
match base.is_text() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl TextDerived for EventTarget {
fn is_text(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::CharacterData(CharacterDataTypeId::Text)) => true,
_ => false,
}
}
}
impl TextDerived for Node {
#[inline]
fn is_text(&self) -> bool {
EventTargetCast::from_ref(self).is_text()
}
}
impl TextDerived for CharacterData {
#[inline]
fn is_text(&self) -> bool {
NodeCast::from_ref(self).is_text()
}
}
pub struct UIEventCast;
/// Types which are derived from `UIEvent` and can be freely converted
/// to `UIEvent`
pub trait UIEventBase: Sized {}
impl UIEventCast {
#[inline]
/// Upcast an instance of a derived class of `UIEvent` to `UIEvent`
pub fn from_ref<T: UIEventBase + Reflectable>(derived: &T) -> &UIEvent {
unsafe { mem::transmute(derived) }
}
#[inline]
#[allow(unrooted_must_root)]
pub fn from_layout_js<T: UIEventBase + Reflectable>(derived: &LayoutJS<T>) -> LayoutJS<UIEvent> {
unsafe { mem::transmute_copy(derived) }
}
#[inline]
pub fn from_root<T: UIEventBase + Reflectable>(derived: Root<T>) -> Root<UIEvent> {
unsafe { mem::transmute(derived) }
}
}
impl EventBase for UIEvent {}
impl UIEventBase for UIEvent {}
/// Types which `UIEvent` derives from
pub trait UIEventDerived: Sized {
fn is_uievent(&self) -> bool;
}
impl UIEventCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: UIEventDerived + Reflectable>(base: &T) -> Option<&UIEvent> {
match base.is_uievent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: UIEventDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<UIEvent>> {
unsafe {
match (*base.unsafe_get()).is_uievent() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: UIEventDerived + Reflectable>(base: Root<T>) -> Option<Root<UIEvent>> {
match base.is_uievent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl UIEventDerived for Event {
fn is_uievent(&self) -> bool {
match *self.type_id() {
EventTypeId::UIEvent(_) => true,
_ => false,
}
}
}
pub struct WebGLBufferCast;
impl WebGLObjectBase for WebGLBuffer {}
/// Types which `WebGLBuffer` derives from
pub trait WebGLBufferDerived: Sized {
fn is_webglbuffer(&self) -> bool;
}
impl WebGLBufferCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: WebGLBufferDerived + Reflectable>(base: &T) -> Option<&WebGLBuffer> {
match base.is_webglbuffer() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: WebGLBufferDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<WebGLBuffer>> {
unsafe {
match (*base.unsafe_get()).is_webglbuffer() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: WebGLBufferDerived + Reflectable>(base: Root<T>) -> Option<Root<WebGLBuffer>> {
match base.is_webglbuffer() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl WebGLBufferDerived for WebGLObject {
fn is_webglbuffer(&self) -> bool {
match *self.type_id() {
WebGLObjectTypeId::WebGLBuffer => true,
_ => false,
}
}
}
pub struct WebGLContextEventCast;
impl EventBase for WebGLContextEvent {}
/// Types which `WebGLContextEvent` derives from
pub trait WebGLContextEventDerived: Sized {
fn is_webglcontextevent(&self) -> bool;
}
impl WebGLContextEventCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: WebGLContextEventDerived + Reflectable>(base: &T) -> Option<&WebGLContextEvent> {
match base.is_webglcontextevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: WebGLContextEventDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<WebGLContextEvent>> {
unsafe {
match (*base.unsafe_get()).is_webglcontextevent() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: WebGLContextEventDerived + Reflectable>(base: Root<T>) -> Option<Root<WebGLContextEvent>> {
match base.is_webglcontextevent() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl WebGLContextEventDerived for Event {
fn is_webglcontextevent(&self) -> bool {
match *self.type_id() {
EventTypeId::WebGLContextEvent => true,
_ => false,
}
}
}
pub struct WebGLFramebufferCast;
impl WebGLObjectBase for WebGLFramebuffer {}
/// Types which `WebGLFramebuffer` derives from
pub trait WebGLFramebufferDerived: Sized {
fn is_webglframebuffer(&self) -> bool;
}
impl WebGLFramebufferCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: WebGLFramebufferDerived + Reflectable>(base: &T) -> Option<&WebGLFramebuffer> {
match base.is_webglframebuffer() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: WebGLFramebufferDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<WebGLFramebuffer>> {
unsafe {
match (*base.unsafe_get()).is_webglframebuffer() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: WebGLFramebufferDerived + Reflectable>(base: Root<T>) -> Option<Root<WebGLFramebuffer>> {
match base.is_webglframebuffer() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl WebGLFramebufferDerived for WebGLObject {
fn is_webglframebuffer(&self) -> bool {
match *self.type_id() {
WebGLObjectTypeId::WebGLFramebuffer => true,
_ => false,
}
}
}
pub struct WebGLObjectCast;
/// Types which are derived from `WebGLObject` and can be freely converted
/// to `WebGLObject`
pub trait WebGLObjectBase: Sized {}
impl WebGLObjectCast {
#[inline]
/// Upcast an instance of a derived class of `WebGLObject` to `WebGLObject`
pub fn from_ref<T: WebGLObjectBase + Reflectable>(derived: &T) -> &WebGLObject {
unsafe { mem::transmute(derived) }
}
#[inline]
#[allow(unrooted_must_root)]
pub fn from_layout_js<T: WebGLObjectBase + Reflectable>(derived: &LayoutJS<T>) -> LayoutJS<WebGLObject> {
unsafe { mem::transmute_copy(derived) }
}
#[inline]
pub fn from_root<T: WebGLObjectBase + Reflectable>(derived: Root<T>) -> Root<WebGLObject> {
unsafe { mem::transmute(derived) }
}
}
impl WebGLObjectBase for WebGLObject {}
pub struct WebGLProgramCast;
impl WebGLObjectBase for WebGLProgram {}
/// Types which `WebGLProgram` derives from
pub trait WebGLProgramDerived: Sized {
fn is_webglprogram(&self) -> bool;
}
impl WebGLProgramCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: WebGLProgramDerived + Reflectable>(base: &T) -> Option<&WebGLProgram> {
match base.is_webglprogram() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: WebGLProgramDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<WebGLProgram>> {
unsafe {
match (*base.unsafe_get()).is_webglprogram() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: WebGLProgramDerived + Reflectable>(base: Root<T>) -> Option<Root<WebGLProgram>> {
match base.is_webglprogram() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl WebGLProgramDerived for WebGLObject {
fn is_webglprogram(&self) -> bool {
match *self.type_id() {
WebGLObjectTypeId::WebGLProgram => true,
_ => false,
}
}
}
pub struct WebGLRenderbufferCast;
impl WebGLObjectBase for WebGLRenderbuffer {}
/// Types which `WebGLRenderbuffer` derives from
pub trait WebGLRenderbufferDerived: Sized {
fn is_webglrenderbuffer(&self) -> bool;
}
impl WebGLRenderbufferCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: WebGLRenderbufferDerived + Reflectable>(base: &T) -> Option<&WebGLRenderbuffer> {
match base.is_webglrenderbuffer() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: WebGLRenderbufferDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<WebGLRenderbuffer>> {
unsafe {
match (*base.unsafe_get()).is_webglrenderbuffer() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: WebGLRenderbufferDerived + Reflectable>(base: Root<T>) -> Option<Root<WebGLRenderbuffer>> {
match base.is_webglrenderbuffer() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl WebGLRenderbufferDerived for WebGLObject {
fn is_webglrenderbuffer(&self) -> bool {
match *self.type_id() {
WebGLObjectTypeId::WebGLRenderbuffer => true,
_ => false,
}
}
}
pub struct WebGLShaderCast;
impl WebGLObjectBase for WebGLShader {}
/// Types which `WebGLShader` derives from
pub trait WebGLShaderDerived: Sized {
fn is_webglshader(&self) -> bool;
}
impl WebGLShaderCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: WebGLShaderDerived + Reflectable>(base: &T) -> Option<&WebGLShader> {
match base.is_webglshader() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: WebGLShaderDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<WebGLShader>> {
unsafe {
match (*base.unsafe_get()).is_webglshader() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: WebGLShaderDerived + Reflectable>(base: Root<T>) -> Option<Root<WebGLShader>> {
match base.is_webglshader() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl WebGLShaderDerived for WebGLObject {
fn is_webglshader(&self) -> bool {
match *self.type_id() {
WebGLObjectTypeId::WebGLShader => true,
_ => false,
}
}
}
pub struct WebGLTextureCast;
impl WebGLObjectBase for WebGLTexture {}
/// Types which `WebGLTexture` derives from
pub trait WebGLTextureDerived: Sized {
fn is_webgltexture(&self) -> bool;
}
impl WebGLTextureCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: WebGLTextureDerived + Reflectable>(base: &T) -> Option<&WebGLTexture> {
match base.is_webgltexture() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: WebGLTextureDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<WebGLTexture>> {
unsafe {
match (*base.unsafe_get()).is_webgltexture() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: WebGLTextureDerived + Reflectable>(base: Root<T>) -> Option<Root<WebGLTexture>> {
match base.is_webgltexture() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl WebGLTextureDerived for WebGLObject {
fn is_webgltexture(&self) -> bool {
match *self.type_id() {
WebGLObjectTypeId::WebGLTexture => true,
_ => false,
}
}
}
pub struct WebSocketCast;
impl EventTargetBase for WebSocket {}
/// Types which `WebSocket` derives from
pub trait WebSocketDerived: Sized {
fn is_websocket(&self) -> bool;
}
impl WebSocketCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: WebSocketDerived + Reflectable>(base: &T) -> Option<&WebSocket> {
match base.is_websocket() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: WebSocketDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<WebSocket>> {
unsafe {
match (*base.unsafe_get()).is_websocket() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: WebSocketDerived + Reflectable>(base: Root<T>) -> Option<Root<WebSocket>> {
match base.is_websocket() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl WebSocketDerived for EventTarget {
fn is_websocket(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::WebSocket => true,
_ => false,
}
}
}
pub struct WindowCast;
impl EventTargetBase for Window {}
/// Types which `Window` derives from
pub trait WindowDerived: Sized {
fn is_window(&self) -> bool;
}
impl WindowCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: WindowDerived + Reflectable>(base: &T) -> Option<&Window> {
match base.is_window() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: WindowDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<Window>> {
unsafe {
match (*base.unsafe_get()).is_window() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: WindowDerived + Reflectable>(base: Root<T>) -> Option<Root<Window>> {
match base.is_window() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl WindowDerived for EventTarget {
fn is_window(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Window => true,
_ => false,
}
}
}
pub struct WorkerCast;
impl EventTargetBase for Worker {}
/// Types which `Worker` derives from
pub trait WorkerDerived: Sized {
fn is_worker(&self) -> bool;
}
impl WorkerCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: WorkerDerived + Reflectable>(base: &T) -> Option<&Worker> {
match base.is_worker() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: WorkerDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<Worker>> {
unsafe {
match (*base.unsafe_get()).is_worker() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: WorkerDerived + Reflectable>(base: Root<T>) -> Option<Root<Worker>> {
match base.is_worker() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl WorkerDerived for EventTarget {
fn is_worker(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Worker => true,
_ => false,
}
}
}
pub struct WorkerGlobalScopeCast;
/// Types which are derived from `WorkerGlobalScope` and can be freely converted
/// to `WorkerGlobalScope`
pub trait WorkerGlobalScopeBase: Sized {}
impl WorkerGlobalScopeCast {
#[inline]
/// Upcast an instance of a derived class of `WorkerGlobalScope` to `WorkerGlobalScope`
pub fn from_ref<T: WorkerGlobalScopeBase + Reflectable>(derived: &T) -> &WorkerGlobalScope {
unsafe { mem::transmute(derived) }
}
#[inline]
#[allow(unrooted_must_root)]
pub fn from_layout_js<T: WorkerGlobalScopeBase + Reflectable>(derived: &LayoutJS<T>) -> LayoutJS<WorkerGlobalScope> {
unsafe { mem::transmute_copy(derived) }
}
#[inline]
pub fn from_root<T: WorkerGlobalScopeBase + Reflectable>(derived: Root<T>) -> Root<WorkerGlobalScope> {
unsafe { mem::transmute(derived) }
}
}
impl EventTargetBase for WorkerGlobalScope {}
impl WorkerGlobalScopeBase for WorkerGlobalScope {}
/// Types which `WorkerGlobalScope` derives from
pub trait WorkerGlobalScopeDerived: Sized {
fn is_workerglobalscope(&self) -> bool;
}
impl WorkerGlobalScopeCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: WorkerGlobalScopeDerived + Reflectable>(base: &T) -> Option<&WorkerGlobalScope> {
match base.is_workerglobalscope() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: WorkerGlobalScopeDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<WorkerGlobalScope>> {
unsafe {
match (*base.unsafe_get()).is_workerglobalscope() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: WorkerGlobalScopeDerived + Reflectable>(base: Root<T>) -> Option<Root<WorkerGlobalScope>> {
match base.is_workerglobalscope() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl WorkerGlobalScopeDerived for EventTarget {
fn is_workerglobalscope(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::WorkerGlobalScope(_) => true,
_ => false,
}
}
}
pub struct XMLHttpRequestCast;
impl EventTargetBase for XMLHttpRequest {}
impl XMLHttpRequestEventTargetBase for XMLHttpRequest {}
/// Types which `XMLHttpRequest` derives from
pub trait XMLHttpRequestDerived: Sized {
fn is_xmlhttprequest(&self) -> bool;
}
impl XMLHttpRequestCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: XMLHttpRequestDerived + Reflectable>(base: &T) -> Option<&XMLHttpRequest> {
match base.is_xmlhttprequest() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: XMLHttpRequestDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<XMLHttpRequest>> {
unsafe {
match (*base.unsafe_get()).is_xmlhttprequest() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: XMLHttpRequestDerived + Reflectable>(base: Root<T>) -> Option<Root<XMLHttpRequest>> {
match base.is_xmlhttprequest() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl XMLHttpRequestDerived for EventTarget {
fn is_xmlhttprequest(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::XMLHttpRequestEventTarget(XMLHttpRequestEventTargetTypeId::XMLHttpRequest) => true,
_ => false,
}
}
}
impl XMLHttpRequestDerived for XMLHttpRequestEventTarget {
#[inline]
fn is_xmlhttprequest(&self) -> bool {
EventTargetCast::from_ref(self).is_xmlhttprequest()
}
}
pub struct XMLHttpRequestEventTargetCast;
/// Types which are derived from `XMLHttpRequestEventTarget` and can be freely converted
/// to `XMLHttpRequestEventTarget`
pub trait XMLHttpRequestEventTargetBase: Sized {}
impl XMLHttpRequestEventTargetCast {
#[inline]
/// Upcast an instance of a derived class of `XMLHttpRequestEventTarget` to `XMLHttpRequestEventTarget`
pub fn from_ref<T: XMLHttpRequestEventTargetBase + Reflectable>(derived: &T) -> &XMLHttpRequestEventTarget {
unsafe { mem::transmute(derived) }
}
#[inline]
#[allow(unrooted_must_root)]
pub fn from_layout_js<T: XMLHttpRequestEventTargetBase + Reflectable>(derived: &LayoutJS<T>) -> LayoutJS<XMLHttpRequestEventTarget> {
unsafe { mem::transmute_copy(derived) }
}
#[inline]
pub fn from_root<T: XMLHttpRequestEventTargetBase + Reflectable>(derived: Root<T>) -> Root<XMLHttpRequestEventTarget> {
unsafe { mem::transmute(derived) }
}
}
impl EventTargetBase for XMLHttpRequestEventTarget {}
impl XMLHttpRequestEventTargetBase for XMLHttpRequestEventTarget {}
/// Types which `XMLHttpRequestEventTarget` derives from
pub trait XMLHttpRequestEventTargetDerived: Sized {
fn is_xmlhttprequesteventtarget(&self) -> bool;
}
impl XMLHttpRequestEventTargetCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: XMLHttpRequestEventTargetDerived + Reflectable>(base: &T) -> Option<&XMLHttpRequestEventTarget> {
match base.is_xmlhttprequesteventtarget() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: XMLHttpRequestEventTargetDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<XMLHttpRequestEventTarget>> {
unsafe {
match (*base.unsafe_get()).is_xmlhttprequesteventtarget() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: XMLHttpRequestEventTargetDerived + Reflectable>(base: Root<T>) -> Option<Root<XMLHttpRequestEventTarget>> {
match base.is_xmlhttprequesteventtarget() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl XMLHttpRequestEventTargetDerived for EventTarget {
fn is_xmlhttprequesteventtarget(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::XMLHttpRequestEventTarget(_) => true,
_ => false,
}
}
}
pub struct XMLHttpRequestUploadCast;
impl EventTargetBase for XMLHttpRequestUpload {}
impl XMLHttpRequestEventTargetBase for XMLHttpRequestUpload {}
/// Types which `XMLHttpRequestUpload` derives from
pub trait XMLHttpRequestUploadDerived: Sized {
fn is_xmlhttprequestupload(&self) -> bool;
}
impl XMLHttpRequestUploadCast {
#[inline]
/// Downcast an instance of a base class of `${name}` to an instance of
/// `${name}`, if it internally is an instance of `${name}`
pub fn to_ref<T: XMLHttpRequestUploadDerived + Reflectable>(base: &T) -> Option<&XMLHttpRequestUpload> {
match base.is_xmlhttprequestupload() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
#[inline]
#[allow(unrooted_must_root)]
pub fn to_layout_js<T: XMLHttpRequestUploadDerived + Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<XMLHttpRequestUpload>> {
unsafe {
match (*base.unsafe_get()).is_xmlhttprequestupload() {
true => Some(mem::transmute_copy(base)),
false => None
}
}
}
#[inline]
pub fn to_root<T: XMLHttpRequestUploadDerived + Reflectable>(base: Root<T>) -> Option<Root<XMLHttpRequestUpload>> {
match base.is_xmlhttprequestupload() {
true => Some(unsafe { mem::transmute(base) }),
false => None
}
}
}
impl XMLHttpRequestUploadDerived for EventTarget {
fn is_xmlhttprequestupload(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::XMLHttpRequestEventTarget(XMLHttpRequestEventTargetTypeId::XMLHttpRequestUpload) => true,
_ => false,
}
}
}
impl XMLHttpRequestUploadDerived for XMLHttpRequestEventTarget {
#[inline]
fn is_xmlhttprequestupload(&self) -> bool {
EventTargetCast::from_ref(self).is_xmlhttprequestupload()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.