mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Implement partial spec-recommended preload=none support.
This commit is contained in:
parent
ef10393ba6
commit
f78d88acbe
5 changed files with 20 additions and 247 deletions
|
@ -387,7 +387,19 @@ impl HTMLMediaElement {
|
|||
|
||||
// Step 4
|
||||
if let Resource::Url(url) = resource {
|
||||
// TODO 4.1 (preload=none)
|
||||
// 4.1
|
||||
if self.Preload() == "none" && !self.autoplaying.get(){
|
||||
// 4.1.1
|
||||
self.network_state.set(NETWORK_IDLE);
|
||||
|
||||
// 4.1.2
|
||||
self.queue_fire_simple_event("suspend");
|
||||
|
||||
// TODO 4.1.3 (delay load flag)
|
||||
|
||||
// TODO 4.1.5-7 (state for load that initiates later)
|
||||
return;
|
||||
}
|
||||
|
||||
// 4.2
|
||||
let context = Arc::new(Mutex::new(HTMLMediaElementContext::new(self, url.clone())));
|
||||
|
@ -509,6 +521,12 @@ impl HTMLMediaElementMethods for HTMLMediaElement {
|
|||
// https://html.spec.whatwg.org/multipage/#dom-media-src
|
||||
make_setter!(SetSrc, "src");
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#attr-media-preload
|
||||
// Missing value default is user-agent defined.
|
||||
make_enumerated_getter!(Preload, "preload", "", ("none") | ("metadata") | ("auto"));
|
||||
// https://html.spec.whatwg.org/multipage/#attr-media-preload
|
||||
make_setter!(SetPreload, "preload");
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-media-currentsrc
|
||||
fn CurrentSrc(&self) -> DOMString {
|
||||
DOMString::from(self.current_src.borrow().clone())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue