blob: 1e9971c8a8df75274480f2bd11fa2c730dc79adb [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) {
James Graham163424c2019-05-17 16:47:0310 if (!window.PerformanceElementTiming) {
11 assert_unreached("PerformanceElementTiming is not implemented");
12 }
Nicolás Peña Moreno5570bb22019-03-27 22:08:1013 const observer = new PerformanceObserver(
14 t.step_func_done(function(entryList) {
15 assert_equals(entryList.getEntries().length, 1);
16 const entry = entryList.getEntries()[0];
17 const index = window.location.href.lastIndexOf('/');
18 const pathname = window.location.href.substring(0, index) +
19 '/resources/circle.svg';
Nicolás Peña Moreno66bb6b42019-05-01 17:40:5820 checkElement(entry, pathname, 'my_svg', 'SVG', beforeRender,
21 document.getElementById('SVG'));
Nicolás Peña Moreno5570bb22019-03-27 22:08:1022 // Image size is 200x200 but SVG size is 100x100 so it is clipped.
23 checkRect(entry, [0, 100, 0, 100]);
Nicolás Peña Morenocf8e8812019-04-01 17:12:0224 checkNaturalSize(entry, 200, 200);
Nicolás Peña Moreno5570bb22019-03-27 22:08:1025 })
26 );
27 observer.observe({entryTypes: ['element']});
28 beforeRender = performance.now();
29}, "Able to observe svg image.");
30</script>
31<style>
32body {
33 margin: 0;
34}
35</style>
36<svg width="100" height="100">
Nicolás Peña Moreno15d28552019-04-01 19:03:0837 <image href='resources/circle.svg' elementtiming='my_svg' id='SVG'/>
Nicolás Peña Moreno5570bb22019-03-27 22:08:1038</svg>