Skip to content

Commit

Permalink
Check for box reflection when hit testing visual overflow
Browse files Browse the repository at this point in the history
Bug: chromium:347588491
Change-Id: I491153f26829c6e9d19957ae8116019cac447da6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5704205
Reviewed-by: Xianzhu Wang <[email protected]>
Commit-Queue: Stefan Zager <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1327191}
  • Loading branch information
szager-chromium authored and chromium-wpt-export-bot committed Jul 13, 2024
1 parent 3202257 commit f3dd9cb
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions intersection-observer/v2/box-reflect.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<meta name="viewport" content="width=device-width,initial-scale=1">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/intersection-observer-test-utils.js"></script>

<style>
body, html {
margin: 0;
}
pre, #log {
position: absolute;
top: 0;
left: 200px;
}
#reflect {
width: 100px;
height: 100px;
background-color: hotpink;
-webkit-box-reflect: below 10px;
margin: 10px 0;
}
</style>

<div id="reflect"></div>
<div id="target">Hello, world!</div>

<script>
var delay = 100;
var entries = [];
var target;
var supported = CSS.supports("-webkit-box-reflect", "below 10px");

runTestCycle(function() {
target = document.getElementById("target");
assert_true(!!target, "target exists");
let observer = new IntersectionObserver(function(changes) {
entries = entries.concat(changes)
}, {trackVisibility: true, delay: delay});
observer.observe(target);
entries = entries.concat(observer.takeRecords());
assert_equals(entries.length, 0, "No initial notifications.");
runTestCycle(step0, "First rAF.", delay);
}, "IntersectionObserverV2 detects occlusion from -webkit-box-reflect (if supported).", delay);

function step0() {
assert_equals(entries.length, 1, "Initial notification.");
assert_equals(entries[0].isVisible, !supported, "Occluded if -webkit-box-reflect is supported.");
}
</script>

0 comments on commit f3dd9cb

Please sign in to comment.