mirror of
https://github.com/servo/servo.git
synced 2025-07-02 21:13:39 +01:00
Stub out readyState and networkState attributes for HTMLMediaElement.
This commit is contained in:
parent
3d38a60cee
commit
b8b4be34c0
3 changed files with 29 additions and 138 deletions
|
@ -2,14 +2,19 @@
|
|||
* 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::codegen::Bindings::HTMLMediaElementBinding::HTMLMediaElementMethods;
|
||||
use dom::bindings::codegen::Bindings::HTMLMediaElementBinding::HTMLMediaElementConstants;
|
||||
use dom::document::Document;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use std::cell::Cell;
|
||||
use string_cache::Atom;
|
||||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLMediaElement {
|
||||
htmlelement: HTMLElement,
|
||||
network_state: Cell<u16>,
|
||||
ready_state: Cell<u16>,
|
||||
}
|
||||
|
||||
impl HTMLMediaElement {
|
||||
|
@ -18,7 +23,9 @@ impl HTMLMediaElement {
|
|||
-> HTMLMediaElement {
|
||||
HTMLMediaElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited(tag_name, prefix, document)
|
||||
HTMLElement::new_inherited(tag_name, prefix, document),
|
||||
network_state: Cell::new(HTMLMediaElementConstants::NETWORK_EMPTY),
|
||||
ready_state: Cell::new(HTMLMediaElementConstants::HAVE_NOTHING),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,3 +34,13 @@ impl HTMLMediaElement {
|
|||
&self.htmlelement
|
||||
}
|
||||
}
|
||||
|
||||
impl HTMLMediaElementMethods for HTMLMediaElement {
|
||||
fn NetworkState(&self) -> u16 {
|
||||
self.network_state.get()
|
||||
}
|
||||
|
||||
fn ReadyState(&self) -> u16 {
|
||||
self.ready_state.get()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,23 +14,23 @@ interface HTMLMediaElement : HTMLElement {
|
|||
// attribute DOMString src;
|
||||
//readonly attribute DOMString currentSrc;
|
||||
// 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;
|
||||
//readonly attribute unsigned short networkState;
|
||||
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;
|
||||
readonly attribute unsigned short networkState;
|
||||
// attribute DOMString preload;
|
||||
//readonly attribute TimeRanges buffered;
|
||||
//void load();
|
||||
//CanPlayTypeResult 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;
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue