mirror of
https://github.com/servo/servo.git
synced 2025-08-21 21:35:32 +01:00
Update web-platform-tests to revision ac12b3e9488edb436f063b11213e954ae62d5a5e
This commit is contained in:
parent
65370f17c9
commit
b56a3b8e69
111 changed files with 3122 additions and 68 deletions
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE HTML>
|
||||
<meta charset=utf-8>
|
||||
<title>Element Timing: intersectionRect when image overflows</title>
|
||||
<body>
|
||||
<style>
|
||||
body {
|
||||
margin: 200px 100px;
|
||||
}
|
||||
</style>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/element-timing-helpers.js"></script>
|
||||
<script>
|
||||
let beforeRender;
|
||||
async_test(function (t) {
|
||||
const observer = new PerformanceObserver(
|
||||
t.step_func_done(function(entryList) {
|
||||
assert_equals(entryList.getEntries().length, 1);
|
||||
const entry = entryList.getEntries()[0];
|
||||
checkElement(entry, 'not_fully_visible', beforeRender);
|
||||
// Image will not be fully visible. It should start from the top left part
|
||||
// of the document, excluding the margin, and then overflow.
|
||||
checkRect(entry,
|
||||
[100, document.documentElement.clientWidth, 200, document.documentElement.clientHeight]);
|
||||
})
|
||||
);
|
||||
observer.observe({entryTypes: ['element']});
|
||||
// We add the image during onload to be sure that the observer is registered
|
||||
// in time for it to observe the element timing.
|
||||
window.onload = () => {
|
||||
// Add an image setting width and height equal to viewport.
|
||||
const img = document.createElement('img');
|
||||
img.src = 'resources/square20.png';
|
||||
img.setAttribute('elementtiming', 'not_fully_visible');
|
||||
img.width = document.documentElement.clientWidth;
|
||||
img.height = document.documentElement.clientHeight;
|
||||
document.body.appendChild(img);
|
||||
beforeRender = performance.now();
|
||||
};
|
||||
}, 'The intersectionRect of an img element overflowing is computed correctly');
|
||||
</script>
|
||||
|
||||
</body>
|
Loading…
Add table
Add a link
Reference in a new issue