mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1638503 [wpt PR 23651] - Update interfaces/layout-instability.idl and test, a=testonly
Automatic update from web-platform-tests Update interfaces/layout-instability.idl and test (#23651) Closes https://github.com/web-platform-tests/wpt/pull/22499 -- wpt-commits: 71fe70cbd0c74e8273c351546be3e1e695b31ab1 wpt-pr: 23651
This commit is contained in:
parent
324a8d2ebb
commit
e361bd0f1c
@ -5,8 +5,16 @@
|
||||
|
||||
[Exposed=Window]
|
||||
interface LayoutShift : PerformanceEntry {
|
||||
readonly attribute long value;
|
||||
readonly attribute double value;
|
||||
readonly attribute boolean hadRecentInput;
|
||||
readonly attribute DOMHighResTimeStamp lastInputTime;
|
||||
readonly attribute FrozenArray<LayoutShiftAttribution> sources;
|
||||
[Default] object toJSON();
|
||||
};
|
||||
|
||||
[Exposed=Window]
|
||||
interface LayoutShiftAttribution {
|
||||
readonly attribute Node? node;
|
||||
readonly attribute DOMRectReadOnly previousRect;
|
||||
readonly attribute DOMRectReadOnly currentRect;
|
||||
};
|
||||
|
@ -0,0 +1,45 @@
|
||||
<!doctype html>
|
||||
<title>Layout Instability IDL tests</title>
|
||||
<meta name="timeout" content="long">
|
||||
<link rel="help" href="https://wicg.github.io/layout-instability/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/WebIDLParser.js"></script>
|
||||
<script src="/resources/idlharness.js"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
idl_test(
|
||||
['layout-instability'],
|
||||
['performance-timeline', 'geometry', 'dom', 'hr-time'],
|
||||
async (idl_array, t) => {
|
||||
idl_array.add_objects({
|
||||
LayoutShift: ['layoutShift'],
|
||||
LayoutShiftAttribution: ['layoutShiftAttribution'],
|
||||
});
|
||||
|
||||
// If LayoutShift isn't supported, avoid the timeout below and just let the
|
||||
// objects declared above be null. The tests will still fail, but we will
|
||||
// consistently generate the same set of subtests on all platforms.
|
||||
if (!PerformanceObserver ||
|
||||
!PerformanceObserver.supportedEntryTypes ||
|
||||
!PerformanceObserver.supportedEntryTypes.includes('layout-shift')) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.layoutShift = await new Promise((resolve, reject) => {
|
||||
const observer = new PerformanceObserver(entryList => {
|
||||
resolve(entryList.getEntries()[0]);
|
||||
});
|
||||
observer.observe({type: 'layout-shift', buffered: true});
|
||||
t.step_timeout(() => reject('Timed out waiting for LayoutShift entry'), 3000);
|
||||
|
||||
// Move the image, to cause layout shift.
|
||||
image.style.marginTop = '100px';
|
||||
});
|
||||
self.layoutShiftAttribution = layoutShift.sources[0];
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<img id="image" src="/images/green-100x50.png">
|
@ -1,16 +0,0 @@
|
||||
// META: script=/resources/WebIDLParser.js
|
||||
// META: script=/resources/idlharness.js
|
||||
|
||||
// https://wicg.github.io/layout-instability/
|
||||
|
||||
'use strict';
|
||||
|
||||
idl_test(
|
||||
['layout-instability'],
|
||||
['performance-timeline'],
|
||||
idl_array => {
|
||||
idl_array.add_objects({
|
||||
// LayoutShift: [ TODO ]
|
||||
});
|
||||
}
|
||||
);
|
Loading…
Reference in New Issue
Block a user