Skip to content

Commit

Permalink
checkVisibility: Add extra parameters as aliases and c-v auto
Browse files Browse the repository at this point in the history
This is to implement
w3c/csswg-drafts#9549

[email protected]

Change-Id: Id5d8c700019a257d8dc3fc79436eefc427e8aac3
  • Loading branch information
vmpstr authored and chromium-wpt-export-bot committed Nov 2, 2023
1 parent edffd95 commit 411f9c6
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions css/cssom-view/checkVisibilityNewPattern.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<!DOCTYPE html>
<link rel=author href="mailto:[email protected]">
<link rel=help href="https://github.com/w3c/csswg-drafts/issues/9487">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<div id=cvauto style="content-visibility:auto">
<div id=cvautochild>hello</div>
</div>

<div id=opacityzero style="opacity:0">hello</div>
<div id=visibilityhidden style="visibility:hidden">hello</div>

<div style="height:10000px">spacer</div>

<div id=cvautooffscreen style="content-visibility:auto">
<div id=cvautooffscreenchild>hello</div>
</div>

<script>
promise_test(() => {
return new Promise(resolve => {
requestAnimationFrame(() => requestAnimationFrame(() => {
assert_true(cvauto.checkVisibility({
contentVisibilityAuto: true
}), 'contentVisibilityAuto:true');

assert_true(cvautochild.checkVisibility({
contentVisibilityAuto: true
}), 'contentVisibilityAuto:true');

assert_true(cvautooffscreen.checkVisibility({
contentVisibilityAuto: true
}), 'contentVisibilityAuto:true');

assert_false(cvautooffscreenchild.checkVisibility({
contentVisibilityAuto: true
}), 'contentVisibilityAuto:true');

resolve();
}));
});
}, 'checkVisibility on content-visibility: auto.');

test(() => {
assert_true(visibilityhidden.checkVisibility());
assert_false(visibilityhidden.checkVisibility({ visibilityProperty: true }));
}, 'checkVisibility on visibility: hidden.');

test(() => {
assert_true(opacityzero.checkVisibility());
assert_false(opacityzero.checkVisibility({ opacityProperty: true }));
}, 'checkVisibility on opacity: 0');
</script>

0 comments on commit 411f9c6

Please sign in to comment.