mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Reftest for video poster frame
This commit is contained in:
parent
5c5b5aae0f
commit
9d5499bbfb
10 changed files with 88 additions and 1 deletions
|
@ -64,6 +64,7 @@ pause
|
||||||
play
|
play
|
||||||
playing
|
playing
|
||||||
popstate
|
popstate
|
||||||
|
postershown
|
||||||
print
|
print
|
||||||
progress
|
progress
|
||||||
radio
|
radio
|
||||||
|
|
|
@ -57,6 +57,7 @@ use net_traits::request::{CredentialsMode, Destination, RequestInit};
|
||||||
use net_traits::{CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseListener, Metadata};
|
use net_traits::{CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseListener, Metadata};
|
||||||
use net_traits::{NetworkError, ResourceFetchTiming, ResourceTimingType};
|
use net_traits::{NetworkError, ResourceFetchTiming, ResourceTimingType};
|
||||||
use script_layout_interface::HTMLMediaData;
|
use script_layout_interface::HTMLMediaData;
|
||||||
|
use servo_config::prefs::PREFS;
|
||||||
use servo_media::player::frame::{Frame, FrameRenderer};
|
use servo_media::player::frame::{Frame, FrameRenderer};
|
||||||
use servo_media::player::{PlaybackState, Player, PlayerError, PlayerEvent, StreamType};
|
use servo_media::player::{PlaybackState, Player, PlayerError, PlayerEvent, StreamType};
|
||||||
use servo_media::ServoMedia;
|
use servo_media::ServoMedia;
|
||||||
|
@ -1098,6 +1099,14 @@ impl HTMLMediaElement {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.render_poster_frame(image);
|
.render_poster_frame(image);
|
||||||
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
||||||
|
if let Some(testing_on) = PREFS.get("media.testing.enabled").as_boolean() {
|
||||||
|
if !testing_on {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let window = window_from_node(self);
|
||||||
|
let task_source = window.task_manager().media_element_task_source();
|
||||||
|
task_source.queue_simple_event(self.upcast(), atom!("postershown"), &window);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ use crate::dom::attr::Attr;
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::HTMLVideoElementBinding;
|
use crate::dom::bindings::codegen::Bindings::HTMLVideoElementBinding;
|
||||||
use crate::dom::bindings::codegen::Bindings::HTMLVideoElementBinding::HTMLVideoElementMethods;
|
use crate::dom::bindings::codegen::Bindings::HTMLVideoElementBinding::HTMLVideoElementMethods;
|
||||||
|
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::refcounted::Trusted;
|
use crate::dom::bindings::refcounted::Trusted;
|
||||||
use crate::dom::bindings::reflector::DomObject;
|
use crate::dom::bindings::reflector::DomObject;
|
||||||
|
@ -113,6 +114,11 @@ impl HTMLVideoElement {
|
||||||
// Step 3.
|
// Step 3.
|
||||||
let poster_url = match ServoUrl::parse(poster_url) {
|
let poster_url = match ServoUrl::parse(poster_url) {
|
||||||
Ok(url) => url,
|
Ok(url) => url,
|
||||||
|
Err(url::ParseError::RelativeUrlWithoutBase) => {
|
||||||
|
let window = window_from_node(self);
|
||||||
|
let url = window.Location().get_url();
|
||||||
|
url.join(&poster_url).unwrap()
|
||||||
|
},
|
||||||
Err(_) => return,
|
Err(_) => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -219,6 +225,10 @@ impl HTMLVideoElementMethods for HTMLVideoElement {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-video-poster
|
// https://html.spec.whatwg.org/multipage/#dom-video-poster
|
||||||
make_setter!(SetPoster, "poster");
|
make_setter!(SetPoster, "poster");
|
||||||
|
|
||||||
|
// For testing purposes only. This is not an event from
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-video-poster
|
||||||
|
event_handler!(postershown, GetOnpostershown, SetOnpostershown);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VirtualMethods for HTMLVideoElement {
|
impl VirtualMethods for HTMLVideoElement {
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl Location {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_url(&self) -> ServoUrl {
|
pub fn get_url(&self) -> ServoUrl {
|
||||||
self.window.get_url()
|
self.window.get_url()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,3 +13,8 @@ interface HTMLVideoElement : HTMLMediaElement {
|
||||||
readonly attribute unsigned long videoHeight;
|
readonly attribute unsigned long videoHeight;
|
||||||
[CEReactions] attribute DOMString poster;
|
[CEReactions] attribute DOMString poster;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
partial interface HTMLVideoElement {
|
||||||
|
[Pref="media.testing.enabled"]
|
||||||
|
attribute EventHandler onpostershown;
|
||||||
|
};
|
||||||
|
|
|
@ -7157,6 +7157,18 @@
|
||||||
{}
|
{}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
"mozilla/video_poster_frame.html": [
|
||||||
|
[
|
||||||
|
"/_mozilla/mozilla/video_poster_frame.html",
|
||||||
|
[
|
||||||
|
[
|
||||||
|
"/_mozilla/mozilla/video_poster_frame_ref.html",
|
||||||
|
"=="
|
||||||
|
]
|
||||||
|
],
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
],
|
||||||
"mozilla/webgl/clearcolor.html": [
|
"mozilla/webgl/clearcolor.html": [
|
||||||
[
|
[
|
||||||
"/_mozilla/mozilla/webgl/clearcolor.html",
|
"/_mozilla/mozilla/webgl/clearcolor.html",
|
||||||
|
@ -10368,6 +10380,11 @@
|
||||||
{}
|
{}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
"mozilla/poster.png": [
|
||||||
|
[
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
],
|
||||||
"mozilla/referrer-policy/OWNERS": [
|
"mozilla/referrer-policy/OWNERS": [
|
||||||
[
|
[
|
||||||
{}
|
{}
|
||||||
|
@ -11813,6 +11830,11 @@
|
||||||
{}
|
{}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
"mozilla/video_poster_frame_ref.html": [
|
||||||
|
[
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
],
|
||||||
"mozilla/webgl/clearcolor_ref.html": [
|
"mozilla/webgl/clearcolor_ref.html": [
|
||||||
[
|
[
|
||||||
{}
|
{}
|
||||||
|
@ -27227,6 +27249,10 @@
|
||||||
"5aff666995fe6cd1d4e84e63a9f6019d04387f8e",
|
"5aff666995fe6cd1d4e84e63a9f6019d04387f8e",
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
|
"mozilla/poster.png": [
|
||||||
|
"33834c3ef095fa9c0080017e1b65b2eb8413eac4",
|
||||||
|
"support"
|
||||||
|
],
|
||||||
"mozilla/postmessage_closed.html": [
|
"mozilla/postmessage_closed.html": [
|
||||||
"c54e371b270cd2e34558dfb7994785d697330534",
|
"c54e371b270cd2e34558dfb7994785d697330534",
|
||||||
"testharness"
|
"testharness"
|
||||||
|
@ -32811,6 +32837,14 @@
|
||||||
"5ab0557c5e02828c38f5c58edde5425e40dcb4b1",
|
"5ab0557c5e02828c38f5c58edde5425e40dcb4b1",
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
|
"mozilla/video_poster_frame.html": [
|
||||||
|
"2f4af97720c40fbbde8d1cad660b1018d88367e5",
|
||||||
|
"reftest"
|
||||||
|
],
|
||||||
|
"mozilla/video_poster_frame_ref.html": [
|
||||||
|
"b45a87aa614eef6cbe21a77a7b75e81e9a9f8c95",
|
||||||
|
"support"
|
||||||
|
],
|
||||||
"mozilla/weakref.html": [
|
"mozilla/weakref.html": [
|
||||||
"4deccbe1e26a3f921eea85a4395394a55cc88be4",
|
"4deccbe1e26a3f921eea85a4395394a55cc88be4",
|
||||||
"testharness"
|
"testharness"
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
[video_poster_frame.html]
|
||||||
|
prefs: [media.testing.enabled:true]
|
BIN
tests/wpt/mozilla/tests/mozilla/poster.png
Normal file
BIN
tests/wpt/mozilla/tests/mozilla/poster.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 196 KiB |
22
tests/wpt/mozilla/tests/mozilla/video_poster_frame.html
Normal file
22
tests/wpt/mozilla/tests/mozilla/video_poster_frame.html
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html class="reftest-wait">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title></title>
|
||||||
|
<link rel="match" href="video_poster_frame_ref.html">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<video src="" poster="poster.png"></video>
|
||||||
|
<script>
|
||||||
|
let video = document.querySelector("video");
|
||||||
|
video.addEventListener("postershown", function() {
|
||||||
|
// Apart from removing the `reftest-wait` class we need to get
|
||||||
|
// the `load` event to signal that it's ok to take the reftest
|
||||||
|
// screenshot. Video loading delays the document `load` event,
|
||||||
|
// so we garantee that we get this event by setting an invaid
|
||||||
|
// src attribute to the video tag.
|
||||||
|
document.documentElement.classList.remove("reftest-wait");
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,4 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title></title>
|
||||||
|
<img src="poster.png"/>
|
Loading…
Add table
Add a link
Reference in a new issue