Bug 1598457 [wpt PR 20374] - [IntersectionObserver] Check containing block chain for stop node, a=testonly

Automatic update from web-platform-tests
[IntersectionObserver] Check containing block chain for stop node

When doing a hit test to measure occlusion, the code previously
assumed that the hit test logic would always prevent descending into
the subtree of the stop node. That's not the case when parent and
child positioned objects are in the same stacking context and the
parent positioned object is the stop node. In that case the subtree
of the child positioned object will be traversed before the parent
positioned object.

When a hit is identified, we need to explicitly check whether it's a
containing block descendant of the stop node; and if so, reject the
hit.

NOTE: this is a clone of
https://chromium-review.googlesource.com/c/chromium/src/+/1914537
that I'm committing on behalf of szager@

BUG=1020784

Change-Id: Ic9270d7b6491be1b3364131fb20cd120fbb6d272
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1929643
Reviewed-by: Stefan Zager <szager@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#717879}

--

wpt-commits: dff3a6865c67b469be3b9bc1f4b318554008931b
wpt-pr: 20374
This commit is contained in:
Chris Harrelson 2019-11-26 11:29:45 +00:00 коммит произвёл moz-wptsync-bot
Родитель bdce1ed3ca
Коммит 406beb86e9
1 изменённых файлов: 49 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,49 @@
<!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;
}
.relpos {
position: relative;
}
</style>
<div id="target" class="relpos">
<div class="relpos">
<img border="0" width="100" height="100" src=""/>
</div>
</div>
<script>
var delay = 100;
var entries = [];
var target;
runTestCycle(function() {
target = document.getElementById("target");
assert_true(!!target, "target exists");
var 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 observing a position:relative div containing a position:relative child");
function step0() {
assert_equals(entries.length, 1, "First notification.");
assert_true(entries[0].isVisible, "Target is visible.");
}
</script>