blob: 7441405d7475b4a300962dc21dd9b50d52250c38 [file] [log] [blame]
Nicolás Peña Moreno5570bb22019-03-27 22:08:101<!DOCTYPE HTML>
2<meta charset=utf-8>
3<title>Element Timing: check intersectionRect for element in iframe</title>
4<body>
5<style>
6body {
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 Graham163424c2019-05-17 16:47:0314 if (!window.PerformanceElementTiming) {
15 assert_unreached("PerformanceElementTiming is not implemented");
16 }
Nicolás Peña Moreno5570bb22019-03-27 22:08:1017 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 Morenocf8e8812019-04-01 17:12:0226 assert_equals(e.data.naturalWidth, 100);
27 assert_equals(e.data.naturalHeight, 100);
Nicolás Peña Moreno15d28552019-04-01 19:03:0828 assert_equals(e.data.id, 'iframe_img_id');
Nicolás Peña Moreno66bb6b42019-05-01 17:40:5829 assert_equals(e.data.elementId, 'iframe_img_id');
Nicolás Peña Moreno5570bb22019-03-27 22:08:1030 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>