fune/servo/components/script/dom/htmlmediaelement.rs
Simon Sapin da87abc762 servo: Merge #4893 - Upgrade to rustc ba2f13ef0 2015-02-04 (from servo:rustup_2015-01-31); r=Ms2ger,glennw
Ready for review.

Final link step on android fails, but we know how to fix it and will add it to this branch soon.

Source-Repo: https://github.com/servo/servo
Source-Revision: 2cc08f289ab909de44fa09a07b2c43b70ce379b9

--HG--
rename : servo/ports/gonk/build.rs => servo/support/rust-task_info/build.rs
2015-02-11 17:24:45 -07:00

47 lines
1.5 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, PartialEq, Debug)]
#[jstraceable]
pub enum HTMLMediaElementTypeId {
HTMLAudioElement,
HTMLVideoElement,
}