auto merge of #837 : saneyuki/servo/webidl, r=jdm

This commit is contained in:
bors-servo 2013-09-03 10:46:00 -07:00
commit 4cfcad0a0e
24 changed files with 859 additions and 2 deletions

View file

@ -556,6 +556,7 @@ addHTMLElement('Text')
addHTMLElement('HTMLAnchorElement')
addHTMLElement('HTMLAppletElement')
addHTMLElement('HTMLAreaElement')
addHTMLElement('HTMLAudioElement')
addHTMLElement('HTMLButtonElement')
addHTMLElement('HTMLBaseElement')
addHTMLElement('HTMLBodyElement')
@ -580,9 +581,12 @@ addHTMLElement('HTMLHRElement')
addHTMLElement('HTMLIFrameElement')
addHTMLElement('HTMLImageElement')
addHTMLElement('HTMLInputElement')
addHTMLElement('HTMLLabelElement')
addHTMLElement('HTMLLegendElement')
addHTMLElement('HTMLLIElement')
addHTMLElement('HTMLLinkElement')
addHTMLElement('HTMLMapElement')
addHTMLElement('HTMLMediaElement')
addHTMLElement('HTMLMetaElement')
addHTMLElement('HTMLMeterElement')
addHTMLElement('HTMLModElement')
@ -593,6 +597,7 @@ addHTMLElement('HTMLOptionElement')
addHTMLElement('HTMLOutputElement')
addHTMLElement('HTMLParagraphElement')
addHTMLElement('HTMLParamElement')
addHTMLElement('HTMLPreElement')
addHTMLElement('HTMLProgressElement')
addHTMLElement('HTMLQuoteElement')
addHTMLElement('HTMLScriptElement')
@ -606,10 +611,13 @@ addHTMLElement('HTMLTableCellElement')
addHTMLElement('HTMLTableColElement')
addHTMLElement('HTMLTableRowElement')
addHTMLElement('HTMLTableSectionElement')
addHTMLElement('HTMLTemplateElement')
addHTMLElement('HTMLTextAreaElement')
addHTMLElement('HTMLTimeElement')
addHTMLElement('HTMLTitleElement')
addHTMLElement('HTMLTrackElement')
addHTMLElement('HTMLUListElement')
addHTMLElement('HTMLVideoElement')
addHTMLElement('HTMLUnknownElement')
# If you add one of these, you need to make sure nsDOMQS.h has the relevant
@ -619,7 +627,6 @@ def addExternalHTMLElement(element):
addExternalIface(element, nativeType=nativeElement,
headerFile=nativeElement + '.h')
addExternalHTMLElement('HTMLVideoElement')
addExternalIface('CanvasGradient', headerFile='nsIDOMCanvasRenderingContext2D.h')
addExternalIface('CanvasPattern', headerFile='nsIDOMCanvasRenderingContext2D.h')
addExternalIface('CSSRule')

View file

@ -0,0 +1,37 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/#the-audio-element
*
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
// import from http://mxr.mozilla.org/mozilla-central/source/dom/webidl/
[NamedConstructor=Audio(optional DOMString src)]
interface HTMLAudioElement : HTMLMediaElement {};
partial interface HTMLAudioElement
{
/*
// Setup the audio stream for writing
[Pref="media.audio_data.enabled", Throws]
void mozSetup(unsigned long channels, unsigned long rate);
// Write audio to the audio stream
[Pref="media.audio_data.enabled", Throws]
unsigned long mozWriteAudio(Float32Array data);
[Pref="media.audio_data.enabled", Throws]
unsigned long mozWriteAudio(sequence<unrestricted float> data);
// Get the current offset (measured in samples since the start) of the audio
// stream created using mozWriteAudio().
[Pref="media.audio_data.enabled", Throws]
unsigned long long mozCurrentSampleOffset();
*/
};

View file

@ -0,0 +1,24 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/
*
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
// import from http://mxr.mozilla.org/mozilla-central/source/dom/webidl/
interface HTMLLabelElement : HTMLElement {
/* FIXME:
readonly attribute HTMLFormElement? form;
*/
attribute DOMString htmlFor;
/*
readonly attribute HTMLElement? control;
*/
};

View file

@ -0,0 +1,29 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/#the-legend-element
* http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
*
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
// import from http://mxr.mozilla.org/mozilla-central/source/dom/webidl/
// http://www.whatwg.org/specs/web-apps/current-work/#the-legend-element
interface HTMLLegendElement : HTMLElement {
/*
FIXME:
readonly attribute HTMLFormElement? form;
*/
};
// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
partial interface HTMLLegendElement {
[SetterThrows]
attribute DOMString align;
};

View file

@ -0,0 +1,188 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/#media-elements
*
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
interface HTMLMediaElement : HTMLElement {
/*
// error state
readonly attribute MediaError? error;
*/
// network state
[SetterThrows]
attribute DOMString src;
readonly attribute DOMString currentSrc;
[SetterThrows]
attribute DOMString crossOrigin;
const unsigned short NETWORK_EMPTY = 0;
const unsigned short NETWORK_IDLE = 1;
const unsigned short NETWORK_LOADING = 2;
const unsigned short NETWORK_NO_SOURCE = 3;
/*
TODO:
readonly attribute unsigned short networkState;
*/
[SetterThrows]
attribute DOMString preload;
/*
[Creator]
readonly attribute TimeRanges buffered;
*/
void load();
DOMString canPlayType(DOMString type);
// ready state
const unsigned short HAVE_NOTHING = 0;
const unsigned short HAVE_METADATA = 1;
const unsigned short HAVE_CURRENT_DATA = 2;
const unsigned short HAVE_FUTURE_DATA = 3;
const unsigned short HAVE_ENOUGH_DATA = 4;
readonly attribute unsigned short readyState;
readonly attribute boolean seeking;
// playback state
[SetterThrows]
attribute double currentTime;
// TODO: Bug 847375 - void fastSeek(double time);
/*
TODO:
readonly attribute unrestricted double duration;
*/
// TODO: Bug 847376 - readonly attribute any startDate;
readonly attribute boolean paused;
[SetterThrows]
attribute double defaultPlaybackRate;
[SetterThrows]
attribute double playbackRate;
/*
[Creator]
readonly attribute TimeRanges played;
[Creator]
readonly attribute TimeRanges seekable;
*/
readonly attribute boolean ended;
[SetterThrows]
attribute boolean autoplay;
[SetterThrows]
attribute boolean loop;
[Throws]
void play();
[Throws]
void pause();
// TODO: Bug 847377 - mediaGroup and MediaController
// media controller
// attribute DOMString mediaGroup;
// attribute MediaController? controller;
// controls
[SetterThrows]
attribute boolean controls;
[SetterThrows]
attribute double volume;
attribute boolean muted;
[SetterThrows]
attribute boolean defaultMuted;
// TODO: Bug 847379
// tracks
//readonly attribute AudioTrackList audioTracks;
//readonly attribute VideoTrackList videoTracks;
/*
[Pref="media.webvtt.enabled"]
readonly attribute TextTrackList textTracks;
[Pref="media.webvtt.enabled"]
TextTrack addTextTrack(TextTrackKind kind,
optional DOMString label = "",
optional DOMString language = "");
*/
};
/*
// Mozilla extensions:
partial interface HTMLMediaElement {
attribute MediaStream? mozSrcObject;
attribute boolean mozPreservesPitch;
readonly attribute boolean mozAutoplayEnabled;
// Mozilla extension: stream capture
[Throws]
MediaStream mozCaptureStream();
[Throws]
MediaStream mozCaptureStreamUntilEnded();
readonly attribute boolean mozAudioCaptured;
// Mozilla extension: extra stream metadata information, used as part
// of MozAudioAvailable events and the mozWriteAudio() method. The
// mozFrameBufferLength method allows for the size of the framebuffer
// used within MozAudioAvailable events to be changed. The new size must
// be between 512 and 16384. The default size, for a media element with
// audio is (mozChannels * 1024).
[GetterThrows]
readonly attribute unsigned long mozChannels;
[GetterThrows]
readonly attribute unsigned long mozSampleRate;
[Throws]
attribute unsigned long mozFrameBufferLength;
// Mozilla extension: return embedded metadata from the stream as a
// JSObject with key:value pairs for each tag. This can be used by
// player interfaces to display the song title, artist, etc.
[Throws]
object? mozGetMetadata();
// Mozilla extension: provides access to the fragment end time if
// the media element has a fragment URI for the currentSrc, otherwise
// it is equal to the media duration.
readonly attribute double mozFragmentEnd;
// Mozilla extension: an audio channel type for media elements.
// An exception is thrown if the app tries to change the audio channel type
// without the permission (manifest file for B2G apps).
// The supported values are:
// * normal (default value)
// Automatically paused if "notification" or higher priority channel
// is played
// Use case: normal applications
// * content
// Automatically paused if "notification" or higher priority channel
// is played. Also paused if another app starts using "content"
// channel. Using this channel never affects applications using
// the "normal" channel.
// Use case: video/audio players
// * notification
// Automatically paused if "alarm" or higher priority channel is played.
// Use case: New email, incoming SMS
// * alarm
// Automatically paused if "telephony" or higher priority channel is
// played.
// User case: Alarm clock, calendar alarms
// * telephony
// Automatically paused if "ringer" or higher priority
// channel is played.
// Use case: dialer, voip
// * ringer
// Automatically paused if "publicnotification" or higher priority
// channel is played.
// Use case: dialer, voip
// * publicnotification
// Always plays in speaker, even when headphones are plugged in.
// Use case: Camera shutter sound.
[SetterThrows]
attribute DOMString mozAudioChannelType;
// In addition the media element has this new events:
// * onmozinterruptbegin - called when the media element is interrupted
// because of the audiochannel manager.
// * onmozinterruptend - called when the interruption is concluded
};
*/

View file

@ -0,0 +1,24 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/#the-pre-element
* http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
// import from http://mxr.mozilla.org/mozilla-central/source/dom/webidl/
// http://www.whatwg.org/specs/web-apps/current-work/#the-pre-element
interface HTMLPreElement : HTMLElement {
};
// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
partial interface HTMLPreElement {
[SetterThrows]
attribute long width;
};

View file

@ -0,0 +1,19 @@
/* 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/.
*
* The origin of this IDL file is
* https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
// import from http://mxr.mozilla.org/mozilla-central/source/dom/webidl/HTMLTemplateElement.webidl
interface HTMLTemplateElement : HTMLElement {
/* FIXME:
readonly attribute DocumentFragment content;
*/
};

View file

@ -0,0 +1,36 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/#the-track-element
*/
// import from http://mxr.mozilla.org/mozilla-central/source/dom/webidl/
/*
[Pref="media.webvtt.enabled"]
*/
interface HTMLTrackElement : HTMLElement {
[SetterThrows, Pure]
attribute DOMString kind;
[SetterThrows, Pure]
attribute DOMString src;
[SetterThrows, Pure]
attribute DOMString srclang;
[SetterThrows, Pure]
attribute DOMString label;
[SetterThrows, Pure]
attribute boolean default;
const unsigned short NONE = 0;
const unsigned short LOADING = 1;
const unsigned short LOADED = 2;
const unsigned short ERROR = 3;
readonly attribute unsigned short readyState;
/*
TODO:
readonly attribute TextTrack track;
*/
};

View file

@ -0,0 +1,56 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/#the-video-element
*
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
// import from http://mxr.mozilla.org/mozilla-central/source/dom/webidl/
interface HTMLVideoElement : HTMLMediaElement {
[SetterThrows]
attribute unsigned long width;
[SetterThrows]
attribute unsigned long height;
readonly attribute unsigned long videoWidth;
readonly attribute unsigned long videoHeight;
[SetterThrows]
attribute DOMString poster;
};
/*
partial interface HTMLVideoElement {
// A count of the number of video frames that have demuxed from the media
// resource. If we were playing perfectly, we'd be able to paint this many
// frames.
readonly attribute unsigned long mozParsedFrames;
// A count of the number of frames that have been decoded. We may drop
// frames if the decode is taking too much time.
readonly attribute unsigned long mozDecodedFrames;
// A count of the number of frames that have been presented to the rendering
// pipeline. We may drop frames if they arrive late at the renderer.
readonly attribute unsigned long mozPresentedFrames;
// Number of presented frames which were painted on screen.
readonly attribute unsigned long mozPaintedFrames;
// Time which the last painted video frame was late by, in seconds.
readonly attribute double mozFrameDelay;
// True if the video has an audio track available.
readonly attribute boolean mozHasAudio;
};
// https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#idl-def-HTMLVideoElement
partial interface HTMLVideoElement {
[Pref="media.mediasource.enabled", Creator]
VideoPlaybackQuality getVideoPlaybackQuality();
};
*/

View file

@ -48,6 +48,8 @@ generate_cacheable_wrapper!(HTMLAppletElement, HTMLAppletElementBinding::Wrap)
generate_binding_object!(HTMLAppletElement)
generate_cacheable_wrapper!(HTMLAreaElement, HTMLAreaElementBinding::Wrap)
generate_binding_object!(HTMLAreaElement)
generate_cacheable_wrapper!(HTMLAudioElement, HTMLAudioElementBinding::Wrap)
generate_binding_object!(HTMLAudioElement)
generate_cacheable_wrapper!(HTMLBaseElement, HTMLBaseElementBinding::Wrap)
generate_binding_object!(HTMLBaseElement)
generate_cacheable_wrapper!(HTMLBodyElement, HTMLBodyElementBinding::Wrap)
@ -92,12 +94,18 @@ generate_cacheable_wrapper!(HTMLImageElement, HTMLImageElementBinding::Wrap)
generate_binding_object!(HTMLImageElement)
generate_cacheable_wrapper!(HTMLInputElement, HTMLInputElementBinding::Wrap)
generate_binding_object!(HTMLInputElement)
generate_cacheable_wrapper!(HTMLLabelElement, HTMLLabelElementBinding::Wrap)
generate_binding_object!(HTMLLabelElement)
generate_cacheable_wrapper!(HTMLLegendElement, HTMLLegendElementBinding::Wrap)
generate_binding_object!(HTMLLegendElement)
generate_cacheable_wrapper!(HTMLLIElement, HTMLLIElementBinding::Wrap)
generate_binding_object!(HTMLLIElement)
generate_cacheable_wrapper!(HTMLLinkElement, HTMLLinkElementBinding::Wrap)
generate_binding_object!(HTMLLinkElement)
generate_cacheable_wrapper!(HTMLMapElement, HTMLMapElementBinding::Wrap)
generate_binding_object!(HTMLMapElement)
generate_cacheable_wrapper!(HTMLMediaElement, HTMLMediaElementBinding::Wrap)
generate_binding_object!(HTMLMediaElement)
generate_cacheable_wrapper!(HTMLMetaElement, HTMLMetaElementBinding::Wrap)
generate_binding_object!(HTMLMetaElement)
generate_cacheable_wrapper!(HTMLMeterElement, HTMLMeterElementBinding::Wrap)
@ -118,6 +126,8 @@ generate_cacheable_wrapper!(HTMLParagraphElement, HTMLParagraphElementBinding::W
generate_binding_object!(HTMLParagraphElement)
generate_cacheable_wrapper!(HTMLParamElement, HTMLParamElementBinding::Wrap)
generate_binding_object!(HTMLParamElement)
generate_cacheable_wrapper!(HTMLPreElement, HTMLPreElementBinding::Wrap)
generate_binding_object!(HTMLPreElement)
generate_cacheable_wrapper!(HTMLProgressElement, HTMLProgressElementBinding::Wrap)
generate_binding_object!(HTMLProgressElement)
generate_cacheable_wrapper!(HTMLQuoteElement, HTMLQuoteElementBinding::Wrap)
@ -144,13 +154,19 @@ generate_cacheable_wrapper!(HTMLTableRowElement, HTMLTableRowElementBinding::Wra
generate_binding_object!(HTMLTableRowElement)
generate_cacheable_wrapper!(HTMLTableSectionElement, HTMLTableSectionElementBinding::Wrap)
generate_binding_object!(HTMLTableSectionElement)
generate_cacheable_wrapper!(HTMLTemplateElement, HTMLTemplateElementBinding::Wrap)
generate_binding_object!(HTMLTemplateElement)
generate_cacheable_wrapper!(HTMLTextAreaElement, HTMLTextAreaElementBinding::Wrap)
generate_binding_object!(HTMLTextAreaElement)
generate_cacheable_wrapper!(HTMLTitleElement, HTMLTitleElementBinding::Wrap)
generate_binding_object!(HTMLTitleElement)
generate_cacheable_wrapper!(HTMLTimeElement, HTMLTimeElementBinding::Wrap)
generate_binding_object!(HTMLTimeElement)
generate_cacheable_wrapper!(HTMLTrackElement, HTMLTrackElementBinding::Wrap)
generate_binding_object!(HTMLTrackElement)
generate_cacheable_wrapper!(HTMLUListElement, HTMLUListElementBinding::Wrap)
generate_binding_object!(HTMLUListElement)
generate_cacheable_wrapper!(HTMLVideoElement, HTMLVideoElementBinding::Wrap)
generate_binding_object!(HTMLVideoElement)
generate_cacheable_wrapper!(HTMLUnknownElement, HTMLUnknownElementBinding::Wrap)
generate_binding_object!(HTMLUnknownElement)

View file

@ -26,6 +26,7 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
ElementNodeTypeId(HTMLAnchorElementTypeId) => generate_element!(HTMLAnchorElement),
ElementNodeTypeId(HTMLAppletElementTypeId) => generate_element!(HTMLAppletElement),
ElementNodeTypeId(HTMLAreaElementTypeId) => generate_element!(HTMLAreaElement),
ElementNodeTypeId(HTMLAudioElementTypeId) => generate_element!(HTMLAudioElement),
ElementNodeTypeId(HTMLBaseElementTypeId) => generate_element!(HTMLBaseElement),
ElementNodeTypeId(HTMLBodyElementTypeId) => generate_element!(HTMLBodyElement),
ElementNodeTypeId(HTMLBRElementTypeId) => generate_element!(HTMLBRElement),
@ -49,9 +50,12 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
ElementNodeTypeId(HTMLIframeElementTypeId) => generate_element!(HTMLIFrameElement),
ElementNodeTypeId(HTMLImageElementTypeId) => generate_element!(HTMLImageElement),
ElementNodeTypeId(HTMLInputElementTypeId) => generate_element!(HTMLInputElement),
ElementNodeTypeId(HTMLLabelElementTypeId) => generate_element!(HTMLLabelElement),
ElementNodeTypeId(HTMLLegendElementTypeId) => generate_element!(HTMLLegendElement),
ElementNodeTypeId(HTMLLIElementTypeId) => generate_element!(HTMLLIElement),
ElementNodeTypeId(HTMLLinkElementTypeId) => generate_element!(HTMLLinkElement),
ElementNodeTypeId(HTMLMapElementTypeId) => generate_element!(HTMLMapElement),
ElementNodeTypeId(HTMLMediaElementTypeId) => generate_element!(HTMLMediaElement),
ElementNodeTypeId(HTMLMetaElementTypeId) => generate_element!(HTMLMetaElement),
ElementNodeTypeId(HTMLMeterElementTypeId) => generate_element!(HTMLMeterElement),
ElementNodeTypeId(HTMLModElementTypeId) => generate_element!(HTMLModElement),
@ -62,6 +66,7 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
ElementNodeTypeId(HTMLOutputElementTypeId) => generate_element!(HTMLOutputElement),
ElementNodeTypeId(HTMLParagraphElementTypeId) => generate_element!(HTMLParagraphElement),
ElementNodeTypeId(HTMLParamElementTypeId) => generate_element!(HTMLParamElement),
ElementNodeTypeId(HTMLPreElementTypeId) => generate_element!(HTMLPreElement),
ElementNodeTypeId(HTMLProgressElementTypeId) => generate_element!(HTMLProgressElement),
ElementNodeTypeId(HTMLQuoteElementTypeId) => generate_element!(HTMLQuoteElement),
ElementNodeTypeId(HTMLScriptElementTypeId) => generate_element!(HTMLScriptElement),
@ -75,10 +80,13 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
ElementNodeTypeId(HTMLTableColElementTypeId) => generate_element!(HTMLTableColElement),
ElementNodeTypeId(HTMLTableRowElementTypeId) => generate_element!(HTMLTableRowElement),
ElementNodeTypeId(HTMLTableSectionElementTypeId) => generate_element!(HTMLTableSectionElement),
ElementNodeTypeId(HTMLTemplateElementTypeId) => generate_element!(HTMLTemplateElement),
ElementNodeTypeId(HTMLTextAreaElementTypeId) => generate_element!(HTMLTextAreaElement),
ElementNodeTypeId(HTMLTimeElementTypeId) => generate_element!(HTMLTimeElement),
ElementNodeTypeId(HTMLTitleElementTypeId) => generate_element!(HTMLTitleElement),
ElementNodeTypeId(HTMLTrackElementTypeId) => generate_element!(HTMLTrackElement),
ElementNodeTypeId(HTMLUListElementTypeId) => generate_element!(HTMLUListElement),
ElementNodeTypeId(HTMLVideoElementTypeId) => generate_element!(HTMLVideoElement),
ElementNodeTypeId(HTMLUnknownElementTypeId) => generate_element!(HTMLUnknownElement),
CommentNodeTypeId => generate_element!(Comment),
DoctypeNodeTypeId => generate_element!(DocumentType<ScriptView>),

View file

@ -51,6 +51,7 @@ pub enum ElementTypeId {
HTMLAnchorElementTypeId,
HTMLAppletElementTypeId,
HTMLAreaElementTypeId,
HTMLAudioElementTypeId,
HTMLBaseElementTypeId,
HTMLBRElementTypeId,
HTMLBodyElementTypeId,
@ -74,9 +75,12 @@ pub enum ElementTypeId {
HTMLIframeElementTypeId,
HTMLImageElementTypeId,
HTMLInputElementTypeId,
HTMLLabelElementTypeId,
HTMLLegendElementTypeId,
HTMLLinkElementTypeId,
HTMLLIElementTypeId,
HTMLMapElementTypeId,
HTMLMediaElementTypeId,
HTMLMetaElementTypeId,
HTMLMeterElementTypeId,
HTMLModElementTypeId,
@ -87,6 +91,7 @@ pub enum ElementTypeId {
HTMLOutputElementTypeId,
HTMLParagraphElementTypeId,
HTMLParamElementTypeId,
HTMLPreElementTypeId,
HTMLProgressElementTypeId,
HTMLQuoteElementTypeId,
HTMLScriptElementTypeId,
@ -100,10 +105,13 @@ pub enum ElementTypeId {
HTMLTableColElementTypeId,
HTMLTableRowElementTypeId,
HTMLTableSectionElementTypeId,
HTMLTemplateElementTypeId,
HTMLTextAreaElementTypeId,
HTMLTimeElementTypeId,
HTMLTitleElementTypeId,
HTMLTrackElementTypeId,
HTMLUListElementTypeId,
HTMLVideoElementTypeId,
HTMLUnknownElementTypeId,
}

View file

@ -0,0 +1,12 @@
/* 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::htmlmediaelement::HTMLMediaElement;
pub struct HTMLAudioElement {
parent: HTMLMediaElement
}
impl HTMLAudioElement {
}

View file

@ -0,0 +1,19 @@
/* 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::utils::{DOMString, null_string};
use dom::htmlelement::HTMLElement;
pub struct HTMLLabelElement {
parent: HTMLElement,
}
impl HTMLLabelElement {
pub fn HtmlFor(&self) -> DOMString {
null_string
}
pub fn SetHtmlFor(&mut self, _html_for: &DOMString) {
}
}

View file

@ -0,0 +1,19 @@
/* 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::utils::{DOMString, null_string, ErrorResult};
use dom::htmlelement::HTMLElement;
pub struct HTMLLegendElement {
parent: HTMLElement,
}
impl HTMLLegendElement {
pub fn Align(&self) -> DOMString {
null_string
}
pub fn SetAlign(&mut self, _align: &DOMString, _rv: &mut ErrorResult) {
}
}

View file

@ -0,0 +1,142 @@
/* 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::utils::{DOMString, null_string, ErrorResult};
use dom::element::ElementTypeId;
use dom::htmlelement::HTMLElement;
pub struct HTMLMediaElement {
parent: HTMLElement,
}
impl HTMLMediaElement {
pub fn new(type_id: ElementTypeId, tag_name: ~str) -> HTMLMediaElement {
HTMLMediaElement {
parent: HTMLElement::new(type_id, tag_name)
}
}
}
impl HTMLMediaElement {
pub fn Src(&self) -> DOMString {
null_string
}
pub fn SetSrc(&mut self, _src: &DOMString, _rv: &mut ErrorResult) {
}
pub fn CurrentSrc(&self) -> DOMString {
null_string
}
pub fn CrossOrigin(&self) -> DOMString {
null_string
}
pub fn SetCrossOrigin(&mut self, _cross_origin: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Preload(&self) -> DOMString {
null_string
}
pub fn SetPreload(&mut self, _preload: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Load(&self) {
}
pub fn CanPlayType(&self, _type: &DOMString) -> DOMString {
null_string
}
pub fn ReadyState(&self) -> u16 {
0
}
pub fn Seeking(&self) -> bool {
false
}
pub fn CurrentTime(&self) -> f64 {
0f64
}
pub fn SetCurrentTime(&mut self, _current_time: f64, _rv: &mut ErrorResult) {
}
pub fn GetDuration(&self) -> f64 {
0f64
}
pub fn Paused(&self) -> bool {
false
}
pub fn DefaultPlaybackRate(&self) -> f64 {
0f64
}
pub fn SetDefaultPlaybackRate(&mut self, _default_playback_rate: f64, _rv: &mut ErrorResult) {
}
pub fn PlaybackRate(&self) -> f64 {
0f64
}
pub fn SetPlaybackRate(&mut self, _playback_rate: f64, _rv: &mut ErrorResult) {
}
pub fn Ended(&self) -> bool {
false
}
pub fn Autoplay(&self) -> bool {
false
}
pub fn SetAutoplay(&mut self, _autoplay: bool, _rv: &mut ErrorResult) {
}
pub fn Loop(&self) -> bool {
false
}
pub fn SetLoop(&mut self, _loop: bool, _rv: &mut ErrorResult) {
}
pub fn Play(&self, _rv: &mut ErrorResult) {
}
pub fn Pause(&self, _rv: &mut ErrorResult) {
}
pub fn Controls(&self) -> bool {
false
}
pub fn SetControls(&mut self, _controls: bool, _rv: &mut ErrorResult) {
}
pub fn Volume(&self) -> f64 {
0f64
}
pub fn SetVolume(&mut self, _volume: f64, _rv: &mut ErrorResult) {
}
pub fn Muted(&self) -> bool {
false
}
pub fn SetMuted(&mut self, _muted: bool) {
}
pub fn DefaultMuted(&self) -> bool {
false
}
pub fn SetDefaultMuted(&mut self, _default_muted: bool, _rv: &mut ErrorResult) {
}
}

View file

@ -0,0 +1,19 @@
/* 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::utils::{ErrorResult};
use dom::htmlelement::HTMLElement;
pub struct HTMLPreElement {
parent: HTMLElement,
}
impl HTMLPreElement {
pub fn Width(&self) -> i32 {
0
}
pub fn SetWidth(&mut self, _width: i32, _rv: &mut ErrorResult) {
}
}

View file

@ -0,0 +1,12 @@
/* 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::htmlelement::HTMLElement;
pub struct HTMLTemplateElement {
parent: HTMLElement,
}
impl HTMLTemplateElement {
}

View file

@ -0,0 +1,51 @@
/* 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::utils::{DOMString, null_string, ErrorResult};
use dom::htmlelement::HTMLElement;
pub struct HTMLTrackElement {
parent: HTMLElement,
}
impl HTMLTrackElement {
pub fn Kind(&self) -> DOMString {
null_string
}
pub fn SetKind(&mut self, _kind: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Src(&self) -> DOMString {
null_string
}
pub fn SetSrc(&mut self, _src: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Srclang(&self) -> DOMString {
null_string
}
pub fn SetSrclang(&mut self, _srclang: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Label(&self) -> DOMString {
null_string
}
pub fn SetLabel(&mut self, _label: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Default(&self) -> bool {
false
}
pub fn SetDefault(&mut self, _default: bool, _rv: &mut ErrorResult) {
}
pub fn ReadyState(&self) -> u16 {
0
}
}

View file

@ -0,0 +1,41 @@
/* 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::utils::{DOMString, null_string, ErrorResult};
use dom::htmlmediaelement::HTMLMediaElement;
pub struct HTMLVideoElement {
parent: HTMLMediaElement
}
impl HTMLVideoElement {
pub fn Width(&self) -> u32 {
0
}
pub fn SetWidth(&mut self, _width: u32, _rv: &ErrorResult) {
}
pub fn Height(&self) -> u32 {
0
}
pub fn SetHeight(&mut self, _height: u32, _rv: &ErrorResult) {
}
pub fn VideoWidth(&self) -> u32 {
0
}
pub fn VideoHeight(&self) -> u32 {
0
}
pub fn Poster(&self) -> DOMString {
null_string
}
pub fn SetPoster(&mut self, _poster: &DOMString, _rv: &ErrorResult) {
}
}

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);
}
}
)
)
pub struct JSFile {
data: ~[u8],
@ -217,6 +230,8 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
handle_element!(cx, tag, "head", HTMLHeadElementTypeId, HTMLHeadElement, []);
handle_element!(cx, tag, "html", HTMLHtmlElementTypeId, HTMLHtmlElement, []);
handle_element!(cx, tag, "input", HTMLInputElementTypeId, HTMLInputElement, []);
handle_element!(cx, tag, "label", HTMLLabelElementTypeId, HTMLLabelElement, []);
handle_element!(cx, tag, "legend", HTMLLegendElementTypeId, HTMLLegendElement, []);
handle_element!(cx, tag, "link", HTMLLinkElementTypeId, HTMLLinkElement, []);
handle_element!(cx, tag, "li", HTMLLIElementTypeId, HTMLLIElement, []);
handle_element!(cx, tag, "map", HTMLMapElementTypeId, HTMLMapElement, []);
@ -230,6 +245,7 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
handle_element!(cx, tag, "output", HTMLOutputElementTypeId, HTMLOutputElement, []);
handle_element!(cx, tag, "p", HTMLParagraphElementTypeId, HTMLParagraphElement, []);
handle_element!(cx, tag, "param", HTMLParamElementTypeId, HTMLParamElement, []);
handle_element!(cx, tag, "pre", HTMLPreElementTypeId, HTMLPreElement, []);
handle_element!(cx, tag, "progress",HTMLProgressElementTypeId, HTMLProgressElement, []);
handle_element!(cx, tag, "q", HTMLQuoteElementTypeId, HTMLQuoteElement, []);
handle_element!(cx, tag, "script", HTMLScriptElementTypeId, HTMLScriptElement, []);
@ -243,10 +259,12 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
handle_element!(cx, tag, "col", HTMLTableColElementTypeId, HTMLTableColElement, []);
handle_element!(cx, tag, "colgroup",HTMLTableColElementTypeId, HTMLTableColElement, []);
handle_element!(cx, tag, "tbody", HTMLTableSectionElementTypeId, HTMLTableSectionElement, []);
handle_element!(cx, tag, "template",HTMLTemplateElementTypeId, HTMLTemplateElement, []);
handle_element!(cx, tag, "textarea",HTMLTextAreaElementTypeId, HTMLTextAreaElement, []);
handle_element!(cx, tag, "time", HTMLTimeElementTypeId, HTMLTimeElement, []);
handle_element!(cx, tag, "title", HTMLTitleElementTypeId, HTMLTitleElement, []);
handle_element!(cx, tag, "tr", HTMLTableRowElementTypeId, HTMLTableRowElement, []);
handle_element!(cx, tag, "track", HTMLTrackElementTypeId, HTMLTrackElement, []);
handle_element!(cx, tag, "ul", HTMLUListElementTypeId, HTMLUListElement, []);
handle_element!(cx, tag, "img", HTMLImageElementTypeId, HTMLImageElement, [(image: None)]);
@ -266,6 +284,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())

View file

@ -58,6 +58,7 @@ pub mod dom {
pub mod htmlanchorelement;
pub mod htmlappletelement;
pub mod htmlareaelement;
pub mod htmlaudioelement;
pub mod htmlbaseelement;
pub mod htmlbodyelement;
pub mod htmlbrelement;
@ -84,9 +85,12 @@ pub mod dom {
pub mod htmliframeelement;
pub mod htmlimageelement;
pub mod htmlinputelement;
pub mod htmllabelelement;
pub mod htmllegendelement;
pub mod htmllielement;
pub mod htmllinkelement;
pub mod htmlmapelement;
pub mod htmlmediaelement;
pub mod htmlmetaelement;
pub mod htmlmeterelement;
pub mod htmlmodelement;
@ -97,6 +101,7 @@ pub mod dom {
pub mod htmloutputelement;
pub mod htmlparagraphelement;
pub mod htmlparamelement;
pub mod htmlpreelement;
pub mod htmlprogresselement;
pub mod htmlquoteelement;
pub mod htmlscriptelement;
@ -110,10 +115,13 @@ pub mod dom {
pub mod htmltablecolelement;
pub mod htmltablerowelement;
pub mod htmltablesectionelement;
pub mod htmltemplateelement;
pub mod htmltextareaelement;
pub mod htmltimeelement;
pub mod htmltitleelement;
pub mod htmltrackelement;
pub mod htmlulistelement;
pub mod htmlvideoelement;
pub mod htmlunknownelement;
pub mod mouseevent;
pub mod node;

View file

@ -15,7 +15,12 @@
<a href="http://www.mozilla.org"></a>
<img src="test.jpg"/>
<embed></embed>
<form></form>
<form>
<fieldset>
<legend>legend</legend>
<label for="">label<input type="text" value="input" /></label>
</fieldset>
</form>
<hr />
<canvas/>
<p>pppppppppp</p>
@ -50,5 +55,10 @@
</audio>
<area></area>
<data></data>
<template></template>
<pre>pre</pre>
<video src="">
<track></track>
</video>
</body>
</html>

View file

@ -241,6 +241,57 @@ window.alert(tags.length);
window.alert(tags[0].tagName);
window.alert(tags[0] instanceof HTMLProgressElement);
window.alert("HTMLTemplateElement:");
let tags = document.getElementsByTagName("template");
window.alert(tags);
window.alert(tags.length);
window.alert(tags[0].tagName);
window.alert(tags[0] instanceof HTMLTemplateElement);
window.alert("HTMLPreElement:");
let tags = document.getElementsByTagName("pre");
window.alert(tags);
window.alert(tags.length);
window.alert(tags[0].tagName);
window.alert(tags[0] instanceof HTMLPreElement);
window.alert("HTMLLegendElement:");
let tags = document.getElementsByTagName("legend");
window.alert(tags);
window.alert(tags.length);
window.alert(tags[0].tagName);
window.alert(tags[0] instanceof HTMLLegendElement);
window.alert("HTMLLabelElement:");
let tags = document.getElementsByTagName("label");
window.alert(tags);
window.alert(tags.length);
window.alert(tags[0].tagName);
window.alert(tags[0] instanceof HTMLLabelElement);
window.alert("HTMLTrackElement:");
let tags = document.getElementsByTagName("track");
window.alert(tags);
window.alert(tags.length);
window.alert(tags[0].tagName);
window.alert(tags[0] instanceof HTMLTrackElement);
window.alert("HTMLAudioElement:");
let tags = document.getElementsByTagName("audio");
window.alert(tags);
window.alert(tags.length);
window.alert(tags[0].tagName);
window.alert(tags[0] instanceof HTMLMediaElement);
window.alert(tags[0] instanceof HTMLAudioElement);
window.alert("HTMLVideoElement:");
let tags = document.getElementsByTagName("video");
window.alert(tags);
window.alert(tags.length);
window.alert(tags[0].tagName);
window.alert(tags[0] instanceof HTMLMediaElement);
window.alert(tags[0] instanceof HTMLVideoElement);
//TODO: Doesn't work until we throw proper exceptions instead of returning 0 on
// unwrap failure.
/*try {