Generate bindings for HTMLAudioElement, HTMLVideoElement.

This commit is contained in:
Tetsuharu OHZEKI 2013-08-31 19:46:55 +09:00
parent a76e46416a
commit 17e888bfea
10 changed files with 174 additions and 1 deletions

View file

@ -58,6 +58,19 @@ macro_rules! handle_htmlelement(
}
)
)
macro_rules! handle_htmlmediaelement(
($cx: expr, $tag:expr, $string:expr, $type_id:expr, $ctor:ident) => (
if eq_slice($tag, $string) {
let _element = @$ctor {
parent: HTMLMediaElement::new($type_id, ($tag).to_str())
};
unsafe {
return Node::as_abstract_node(cx, _element);
}
}
)
)
type JSResult = ~[~[u8]];
@ -262,6 +275,9 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
handle_htmlelement!(cx, tag, "section", HTMLElementTypeId, HTMLElement);
handle_htmlelement!(cx, tag, "small", HTMLElementTypeId, HTMLElement);
handle_htmlmediaelement!(cx, tag, "audio", HTMLAudioElementTypeId, HTMLAudioElement);
handle_htmlmediaelement!(cx, tag, "video", HTMLVideoElementTypeId, HTMLVideoElement);
unsafe {
let element = @HTMLUnknownElement {
parent: HTMLElement::new(HTMLUnknownElementTypeId, tag.to_str())