Skip to content

Commit

Permalink
Bug 1845770 [wpt PR 41205] - CV: Add a test for first visibility dete…
Browse files Browse the repository at this point in the history
…rmination, a=testonly

Automatic update from web-platform-tests
CV: Add a test for first visibility determination (#41205)

This adds a test which directly tests the changes in
whatwg/html#9312

[email protected]

Change-Id: I2108e67d0444220cb75e43121dbe6076052a2b5b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4725605
Reviewed-by: Chris Harrelson <[email protected]>
Commit-Queue: Vladimir Levin <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1176127}

Co-authored-by: Vladimir Levin <[email protected]>
--

wpt-commits: 45dca2414d3e73cc0329e1e6f1ae3e9abfb43021
wpt-pr: 41205
  • Loading branch information
chromium-wpt-export-bot authored and moz-wptsync-bot committed Aug 2, 2023
1 parent b248d9b commit 3d4e5b5
Showing 1 changed file with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!doctype HTML>
<html>
<meta charset="utf8">
<title>Content Visibility: first visibility determination happens before resize observer.</title>
<link rel="author" title="Vladimir Levin" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/css-contain/#content-visibility">
<meta name="assert" content="first visibility determination happens before resize observer">

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<style>
#target {
content-visibility: auto;
contain-intrinsic-size: 10px;
}
#child {
height: 100px;
}
</style>

<div id=container></div>

<script>
promise_test(t => new Promise(async (resolve, reject) => {
requestAnimationFrame(() => {
let target = document.createElement("div");
target.id = "target";

let child = document.createElement("div");
child.id = "child";
target.appendChild(child);

const resizeObserver = new ResizeObserver((entries) => {
for (const entry of entries) {
if (entry.contentBoxSize) {
if (entry.contentBoxSize[0].blockSize == 100) {
resolve();
return;
} else {
reject(`unexpected size ${entry.contentBoxSize[0].blockSize}`);
return;
}
}
}
reject("no content boxes or no entries");
});

container.appendChild(target);
resizeObserver.observe(target);
});
}), "Target is sized and laid out before resize observer");
</script>

0 comments on commit 3d4e5b5

Please sign in to comment.