Update web-platform-tests to revision e426a6933a05bf144eba06a1d4c47ba876a4e2d1

This commit is contained in:
WPT Sync Bot 2019-05-22 10:24:35 +00:00
parent 415b26e4f1
commit 5e5eccabf8
495 changed files with 14920 additions and 784 deletions

View file

@ -0,0 +1,37 @@
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Layout Instability: observe layout shift value via PerformanceObserver</title>
<body>
<style>
#myDiv { position: relative; width: 300px; height: 100px; }
</style>
<div id='myDiv'></div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(function (t) {
const startTime = performance.now();
const observer = new PerformanceObserver(
t.step_func_done(function(entryList) {
const endTime = performance.now();
assert_equals(entryList.getEntries().length, 1);
const entry = entryList.getEntries()[0];
assert_equals(entry.entryType, "layoutShift");
assert_equals(entry.name, "");
assert_greater_than_equal(entry.startTime, startTime)
assert_less_than_equal(entry.startTime, endTime)
assert_equals(entry.duration, 0.0);
// The layout shift value should be: 300 * (100 + 60) / viewport size.
assert_equals(entry.value, 300 * (100 + 60) /
(document.documentElement.clientWidth * document.documentElement.clientHeight));
})
);
observer.observe({entryTypes: ['layoutShift']});
window.onload = () => {
// Modify the position of the div.
document.getElementById('myDiv').style = "top: 60px";
};
}, 'Layout shift is observable via PerformanceObserver.');
</script>
</body>