Skip to content

Commit

Permalink
[ElementTiming] Allow timing for video poster image
Browse files Browse the repository at this point in the history
This CL allows ElementTiming to observe video poster images. Since
VideoPainter delegates the poster image painting to ImagePainter, this
is just a matter of allowing the node used to be a video element. A test
showing that the video poster image is observed is added.

Bug: 879270
Change-Id: Ic5f354180343cb5e3763d715a87290a540fd8e64
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1516782
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#639978}
  • Loading branch information
npm1 authored and chromium-wpt-export-bot committed Mar 12, 2019
1 parent 328607f commit c706443
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions element-timing/observe-video-poster.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Element Timing: observe video poster image</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/element-timing-helpers.js"></script>
<script>
let beforeRender;
async_test(function (t) {
const observer = new PerformanceObserver(
t.step_func_done(function(entryList) {
assert_equals(entryList.getEntries().length, 1);
const entry = entryList.getEntries()[0];
const index = window.location.href.lastIndexOf('/');
const pathname = window.location.href.substring(0, index) +
'/resources/circle.svg';
checkElement(entry, pathname, 'my_poster', beforeRender);
// Assume viewport has size at least 200, so the element is fully visible.
checkRect(entry, [0, 200, 0, 200]);
})
);
observer.observe({entryTypes: ['element']});
beforeRender = performance.now();
}, "Able to observe a video's poster image.");
</script>
<style>
body {
margin: 0;
}
</style>
<video elementtiming='my_poster' src='/media/test.mp4' poster='resources/circle.svg'/>

0 comments on commit c706443

Please sign in to comment.