blob: 4c2bb36079432fda085ba44d7d534cf6ac8ee033 [file] [log] [blame]
Nicolás Peña Moreno5570bb22019-03-27 22:08:101<!DOCTYPE HTML>
2<meta charset=utf-8>
3<title>Element Timing: observe image inside SVG with small dimensions</title>
4<script src="/resources/testharness.js"></script>
5<script src="/resources/testharnessreport.js"></script>
6<script src="resources/element-timing-helpers.js"></script>
7<script>
8let beforeRender;
9async_test(function (t) {
Stephen McGruerdcfc14d2020-04-16 13:23:0310 assert_implements(window.PerformanceElementTiming, "PerformanceElementTiming is not implemented");
Nicolás Peña Moreno5570bb22019-03-27 22:08:1011 const observer = new PerformanceObserver(
12 t.step_func_done(function(entryList) {
13 assert_equals(entryList.getEntries().length, 1);
14 const entry = entryList.getEntries()[0];
Nicolás Peña Morenoe42570f2019-10-21 21:23:0915 const pathname = window.location.origin + '/element-timing/resources/circle.svg';
Nicolás Peña Moreno66bb6b42019-05-01 17:40:5816 checkElement(entry, pathname, 'my_svg', 'SVG', beforeRender,
17 document.getElementById('SVG'));
Nicolás Peña Moreno5570bb22019-03-27 22:08:1018 // Image size is 200x200 but SVG size is 100x100 so it is clipped.
19 checkRect(entry, [0, 100, 0, 100]);
Nicolás Peña Morenocf8e8812019-04-01 17:12:0220 checkNaturalSize(entry, 200, 200);
Nicolás Peña Moreno5570bb22019-03-27 22:08:1021 })
22 );
23 observer.observe({entryTypes: ['element']});
24 beforeRender = performance.now();
25}, "Able to observe svg image.");
26</script>
27<style>
28body {
29 margin: 0;
30}
31</style>
32<svg width="100" height="100">
Nicolás Peña Moreno15d28552019-04-01 19:03:0833 <image href='resources/circle.svg' elementtiming='my_svg' id='SVG'/>
Nicolás Peña Moreno5570bb22019-03-27 22:08:1034</svg>