Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement basic <media> infrastructure #8454

Merged
merged 13 commits into from May 4, 2016
Next

Stub out readyState and networkState attributes for HTMLMediaElement.

  • Loading branch information
jdm committed Apr 28, 2016
commit b8b4be34c0736da58ec99c471ede135b715635fd
@@ -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
@@ -2631,21 +2631,6 @@
[HTMLMediaElement interface: document.createElement("video") must inherit property "crossOrigin" with the proper type (3)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("video") must inherit property "NETWORK_EMPTY" with the proper type (4)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("video") must inherit property "NETWORK_IDLE" with the proper type (5)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("video") must inherit property "NETWORK_LOADING" with the proper type (6)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("video") must inherit property "NETWORK_NO_SOURCE" with the proper type (7)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("video") must inherit property "networkState" with the proper type (8)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("video") must inherit property "preload" with the proper type (9)]
expected: FAIL

@@ -2661,24 +2646,6 @@
[HTMLMediaElement interface: calling canPlayType(DOMString) on document.createElement("video") with too few arguments must throw TypeError]
expected: FAIL

[HTMLMediaElement interface: document.createElement("video") must inherit property "HAVE_NOTHING" with the proper type (13)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("video") must inherit property "HAVE_METADATA" with the proper type (14)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("video") must inherit property "HAVE_CURRENT_DATA" with the proper type (15)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("video") must inherit property "HAVE_FUTURE_DATA" with the proper type (16)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("video") must inherit property "HAVE_ENOUGH_DATA" with the proper type (17)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("video") must inherit property "readyState" with the proper type (18)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("video") must inherit property "seeking" with the proper type (19)]
expected: FAIL

@@ -2772,21 +2739,6 @@
[HTMLMediaElement interface: document.createElement("audio") must inherit property "crossOrigin" with the proper type (3)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("audio") must inherit property "NETWORK_EMPTY" with the proper type (4)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("audio") must inherit property "NETWORK_IDLE" with the proper type (5)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("audio") must inherit property "NETWORK_LOADING" with the proper type (6)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("audio") must inherit property "NETWORK_NO_SOURCE" with the proper type (7)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("audio") must inherit property "networkState" with the proper type (8)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("audio") must inherit property "preload" with the proper type (9)]
expected: FAIL

@@ -2802,24 +2754,6 @@
[HTMLMediaElement interface: calling canPlayType(DOMString) on document.createElement("audio") with too few arguments must throw TypeError]
expected: FAIL

[HTMLMediaElement interface: document.createElement("audio") must inherit property "HAVE_NOTHING" with the proper type (13)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("audio") must inherit property "HAVE_METADATA" with the proper type (14)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("audio") must inherit property "HAVE_CURRENT_DATA" with the proper type (15)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("audio") must inherit property "HAVE_FUTURE_DATA" with the proper type (16)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("audio") must inherit property "HAVE_ENOUGH_DATA" with the proper type (17)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("audio") must inherit property "readyState" with the proper type (18)]
expected: FAIL

[HTMLMediaElement interface: document.createElement("audio") must inherit property "seeking" with the proper type (19)]
expected: FAIL

@@ -3168,33 +3102,6 @@
[HTMLMediaElement interface: attribute crossOrigin]
expected: FAIL

[HTMLMediaElement interface: constant NETWORK_EMPTY on interface object]
expected: FAIL

[HTMLMediaElement interface: constant NETWORK_EMPTY on interface prototype object]
expected: FAIL

[HTMLMediaElement interface: constant NETWORK_IDLE on interface object]
expected: FAIL

[HTMLMediaElement interface: constant NETWORK_IDLE on interface prototype object]
expected: FAIL

[HTMLMediaElement interface: constant NETWORK_LOADING on interface object]
expected: FAIL

[HTMLMediaElement interface: constant NETWORK_LOADING on interface prototype object]
expected: FAIL

[HTMLMediaElement interface: constant NETWORK_NO_SOURCE on interface object]
expected: FAIL

[HTMLMediaElement interface: constant NETWORK_NO_SOURCE on interface prototype object]
expected: FAIL

[HTMLMediaElement interface: attribute networkState]
expected: FAIL

[HTMLMediaElement interface: attribute preload]
expected: FAIL

@@ -3207,39 +3114,6 @@
[HTMLMediaElement interface: operation canPlayType(DOMString)]
expected: FAIL

[HTMLMediaElement interface: constant HAVE_NOTHING on interface object]
expected: FAIL

[HTMLMediaElement interface: constant HAVE_NOTHING on interface prototype object]
expected: FAIL

[HTMLMediaElement interface: constant HAVE_METADATA on interface object]
expected: FAIL

[HTMLMediaElement interface: constant HAVE_METADATA on interface prototype object]
expected: FAIL

[HTMLMediaElement interface: constant HAVE_CURRENT_DATA on interface object]
expected: FAIL

[HTMLMediaElement interface: constant HAVE_CURRENT_DATA on interface prototype object]
expected: FAIL

[HTMLMediaElement interface: constant HAVE_FUTURE_DATA on interface object]
expected: FAIL

[HTMLMediaElement interface: constant HAVE_FUTURE_DATA on interface prototype object]
expected: FAIL

[HTMLMediaElement interface: constant HAVE_ENOUGH_DATA on interface object]
expected: FAIL

[HTMLMediaElement interface: constant HAVE_ENOUGH_DATA on interface prototype object]
expected: FAIL

[HTMLMediaElement interface: attribute readyState]
expected: FAIL

[HTMLMediaElement interface: attribute seeking]
expected: FAIL

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.