| Nicolás Peña Moreno | 5570bb2 | 2019-03-27 22:08:10 | [diff] [blame] | 1 | <!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> |
| 8 | let beforeRender; |
| 9 | async_test(function (t) { |
| Stephen McGruer | dcfc14d | 2020-04-16 13:23:03 | [diff] [blame] | 10 | assert_implements(window.PerformanceElementTiming, "PerformanceElementTiming is not implemented"); |
| Nicolás Peña Moreno | 5570bb2 | 2019-03-27 22:08:10 | [diff] [blame] | 11 | 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 Moreno | e42570f | 2019-10-21 21:23:09 | [diff] [blame] | 15 | const pathname = window.location.origin + '/element-timing/resources/circle.svg'; |
| Nicolás Peña Moreno | 66bb6b4 | 2019-05-01 17:40:58 | [diff] [blame] | 16 | checkElement(entry, pathname, 'my_svg', 'SVG', beforeRender, |
| 17 | document.getElementById('SVG')); |
| Nicolás Peña Moreno | 5570bb2 | 2019-03-27 22:08:10 | [diff] [blame] | 18 | // Image size is 200x200 but SVG size is 100x100 so it is clipped. |
| 19 | checkRect(entry, [0, 100, 0, 100]); |
| Nicolás Peña Moreno | cf8e881 | 2019-04-01 17:12:02 | [diff] [blame] | 20 | checkNaturalSize(entry, 200, 200); |
| Nicolás Peña Moreno | 5570bb2 | 2019-03-27 22:08:10 | [diff] [blame] | 21 | }) |
| 22 | ); |
| 23 | observer.observe({entryTypes: ['element']}); |
| 24 | beforeRender = performance.now(); |
| 25 | }, "Able to observe svg image."); |
| 26 | </script> |
| 27 | <style> |
| 28 | body { |
| 29 | margin: 0; |
| 30 | } |
| 31 | </style> |
| 32 | <svg width="100" height="100"> |
| Nicolás Peña Moreno | 15d2855 | 2019-04-01 19:03:08 | [diff] [blame] | 33 | <image href='resources/circle.svg' elementtiming='my_svg' id='SVG'/> |
| Nicolás Peña Moreno | 5570bb2 | 2019-03-27 22:08:10 | [diff] [blame] | 34 | </svg> |