| 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) { |
| James Graham | 163424c | 2019-05-17 16:47:03 | [diff] [blame] | 10 | if (!window.PerformanceElementTiming) { |
| 11 | assert_unreached("PerformanceElementTiming is not implemented"); |
| 12 | } |
| Nicolás Peña Moreno | 5570bb2 | 2019-03-27 22:08:10 | [diff] [blame] | 13 | 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 Moreno | 66bb6b4 | 2019-05-01 17:40:58 | [diff] [blame] | 20 | checkElement(entry, pathname, 'my_svg', 'SVG', beforeRender, |
| 21 | document.getElementById('SVG')); |
| Nicolás Peña Moreno | 5570bb2 | 2019-03-27 22:08:10 | [diff] [blame] | 22 | // Image size is 200x200 but SVG size is 100x100 so it is clipped. |
| 23 | checkRect(entry, [0, 100, 0, 100]); |
| Nicolás Peña Moreno | cf8e881 | 2019-04-01 17:12:02 | [diff] [blame] | 24 | checkNaturalSize(entry, 200, 200); |
| Nicolás Peña Moreno | 5570bb2 | 2019-03-27 22:08:10 | [diff] [blame] | 25 | }) |
| 26 | ); |
| 27 | observer.observe({entryTypes: ['element']}); |
| 28 | beforeRender = performance.now(); |
| 29 | }, "Able to observe svg image."); |
| 30 | </script> |
| 31 | <style> |
| 32 | body { |
| 33 | margin: 0; |
| 34 | } |
| 35 | </style> |
| 36 | <svg width="100" height="100"> |
| Nicolás Peña Moreno | 15d2855 | 2019-04-01 19:03:08 | [diff] [blame] | 37 | <image href='resources/circle.svg' elementtiming='my_svg' id='SVG'/> |
| Nicolás Peña Moreno | 5570bb2 | 2019-03-27 22:08:10 | [diff] [blame] | 38 | </svg> |