| 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: check intersectionRect for element in iframe</title> |
| 4 | <body> |
| 5 | <style> |
| 6 | body { |
| 7 | margin: 50px; |
| 8 | } |
| 9 | </style> |
| 10 | <script src="/resources/testharness.js"></script> |
| 11 | <script src="/resources/testharnessreport.js"></script> |
| 12 | <script> |
| 13 | async_test((t) => { |
| James Graham | 163424c | 2019-05-17 16:47:03 | [diff] [blame] | 14 | if (!window.PerformanceElementTiming) { |
| 15 | assert_unreached("PerformanceElementTiming is not implemented"); |
| 16 | } |
| Nicolás Peña Moreno | 5570bb2 | 2019-03-27 22:08:10 | [diff] [blame] | 17 | on_event(window, 'message', e => { |
| 18 | assert_equals(e.data.length, 1); |
| 19 | assert_equals(e.data.entryType, 'element'); |
| 20 | const rect = e.data.rect; |
| 21 | // rect should start at (0,0) even though main frame has a margin. |
| 22 | assert_equals(rect.left, 0); |
| 23 | assert_equals(rect.right, 100); |
| 24 | assert_equals(rect.top, 0); |
| 25 | assert_equals(rect.bottom, 100); |
| Nicolás Peña Moreno | cf8e881 | 2019-04-01 17:12:02 | [diff] [blame] | 26 | assert_equals(e.data.naturalWidth, 100); |
| 27 | assert_equals(e.data.naturalHeight, 100); |
| Nicolás Peña Moreno | 15d2855 | 2019-04-01 19:03:08 | [diff] [blame] | 28 | assert_equals(e.data.id, 'iframe_img_id'); |
| Nicolás Peña Moreno | 66bb6b4 | 2019-05-01 17:40:58 | [diff] [blame] | 29 | assert_equals(e.data.elementId, 'iframe_img_id'); |
| Nicolás Peña Moreno | 5570bb2 | 2019-03-27 22:08:10 | [diff] [blame] | 30 | t.done(); |
| 31 | }); |
| 32 | }, 'Element Timing entry in iframe has coordinates relative to the iframe.'); |
| 33 | </script> |
| 34 | <iframe src="resources/iframe-with-square-sends-entry.html"/> |
| 35 | </body> |