forked from mirrors/gecko-dev
		
	 d2ff8bc1ff
			
		
	
	
		d2ff8bc1ff
		
	
	
	
	
		
			
			This makes the difference between selector matching scaling on the ARM Cortex-A9 and not, because the auto-derived `PartialEq` implementation blows out the 32KB I-cache. With this change, there is a 2x improvement in selector matching over sequential when using all 8 cores. (More work needs to be done; this is a start.) r? any DOM expert Source-Repo: https://github.com/servo/servo Source-Revision: c3d242544e809aca945cf0ca6c2bf0f45ce6a602
		
			
				
	
	
		
			58 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
| /* This Source Code Form is subject to the terms of the Mozilla Public
 | |
|  * License, v. 2.0. If a copy of the MPL was not distributed with this
 | |
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 | |
| 
 | |
| use dom::bindings::js::{JSRef};
 | |
| use dom::bindings::codegen::InheritTypes::HTMLMediaElementDerived;
 | |
| use dom::document::Document;
 | |
| use dom::eventtarget::{EventTarget, EventTargetTypeId};
 | |
| use dom::element::ElementTypeId;
 | |
| use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
 | |
| use dom::node::NodeTypeId;
 | |
| use util::str::DOMString;
 | |
| 
 | |
| #[dom_struct]
 | |
| pub struct HTMLMediaElement {
 | |
|     htmlelement: HTMLElement,
 | |
| }
 | |
| 
 | |
| impl HTMLMediaElementDerived for EventTarget {
 | |
|     fn is_htmlmediaelement(&self) -> bool {
 | |
|         match *self.type_id() {
 | |
|             EventTargetTypeId::Node(
 | |
|                 NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMediaElement(_)))) => true,
 | |
|             _ => false
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| impl HTMLMediaElement {
 | |
|     pub fn new_inherited(type_id: HTMLMediaElementTypeId, tag_name: DOMString,
 | |
|                          prefix: Option<DOMString>, document: JSRef<Document>)
 | |
|                          -> HTMLMediaElement {
 | |
|         HTMLMediaElement {
 | |
|             htmlelement:
 | |
|                 HTMLElement::new_inherited(HTMLElementTypeId::HTMLMediaElement(type_id), tag_name, prefix, document)
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     #[inline]
 | |
|     pub fn htmlelement<'a>(&'a self) -> &'a HTMLElement {
 | |
|         &self.htmlelement
 | |
|     }
 | |
| }
 | |
| 
 | |
| #[derive(Copy, Clone, Debug)]
 | |
| #[jstraceable]
 | |
| pub enum HTMLMediaElementTypeId {
 | |
|     HTMLAudioElement = 0,
 | |
|     HTMLVideoElement = 1,
 | |
| }
 | |
| 
 | |
| impl PartialEq for HTMLMediaElementTypeId {
 | |
|     #[inline]
 | |
|     fn eq(&self, other: &HTMLMediaElementTypeId) -> bool {
 | |
|         (*self as u8) == (*other as u8)
 | |
|     }
 | |
| }
 | |
| 
 |