-
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.
Check for box reflection when hit testing visual overflow
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
1 parent
3202257
commit f3dd9cb
Showing
1 changed file
with
50 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,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> |