diff options
Diffstat (limited to 'components/script/dom/htmlelement.rs')
-rw-r--r-- | components/script/dom/htmlelement.rs | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index ffa13308375..9a0a0dbf808 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -36,6 +36,7 @@ use string_cache::Atom; use std::borrow::ToOwned; use std::default::Default; +use std::intrinsics; #[dom_struct] pub struct HTMLElement { @@ -303,7 +304,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLElement> { } } -#[derive(Copy, Clone, PartialEq, Debug)] +#[derive(Copy, Clone, Debug)] #[jstraceable] pub enum HTMLElementTypeId { HTMLElement, @@ -374,3 +375,25 @@ pub enum HTMLElementTypeId { HTMLUnknownElement, } +impl PartialEq for HTMLElementTypeId { + #[inline] + #[allow(unsafe_code)] + fn eq(&self, other: &HTMLElementTypeId) -> bool { + match (*self, *other) { + (HTMLElementTypeId::HTMLMediaElement(this_type), + HTMLElementTypeId::HTMLMediaElement(other_type)) => { + this_type == other_type + } + (HTMLElementTypeId::HTMLTableCellElement(this_type), + HTMLElementTypeId::HTMLTableCellElement(other_type)) => { + this_type == other_type + } + (_, _) => { + unsafe { + intrinsics::discriminant_value(self) == intrinsics::discriminant_value(other) + } + } + } + } +} + |