-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checkVisibility: Add extra parameters as aliases and c-v auto
This is to implement w3c/csswg-drafts#9549 [email protected] Change-Id: Id5d8c700019a257d8dc3fc79436eefc427e8aac3
- Loading branch information
1 parent
edffd95
commit 411f9c6
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |