Bug 1609733 [wpt PR 21222] - [IntersectionObserver] Allow Document argument to constructor, a=testonly

Automatic update from web-platform-tests
[IntersectionObserver] Allow Document argument to constructor

This implements a behavioral change as described in:

https://github.com/w3c/IntersectionObserver/issues/372

If the 'root' argument to the IntersectionObserver constructor is a
Document, then the observer will clip to the Document's root
scroller. For the top Document, this is the same behavior as the
implicit root. For an iframe Document, this is new behavior which is
unobtainable by other means.

BUG=1015183

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

--

wpt-commits: aebf5e72a429c448637c388512bcadd4d4e3fa65
wpt-pr: 21222
This commit is contained in:
Stefan Zager 2020-01-23 22:55:11 +00:00 committed by moz-wptsync-bot
parent a3a41fba12
commit e0608393f7
2 changed files with 15 additions and 4 deletions

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<title>A height: 100% descendant should trigger a relayout when stretching.</title>
<link rel="help" href="https://drafts.csswg.org/css-flexbox-1/#definite-sizes" />
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1043071" />
<link rel="match" href="../reference/ref-filled-green-100px-square.xht" />
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="display: flex; width: 100px;">
<div style="display: flex; flex-direction: column; flex: 1; min-height: 100px;">
<div style="flex: 1; background: red;">
<div style="height: 100%; background-color: green;"></div>
</div>
</div>
</div>

View File

@ -28,18 +28,16 @@ iframe.onload = function() {
runTestCycle(function() {
assert_true(!!iframe, "iframe exists");
root = iframe.contentDocument.scrollingElement;
assert_true(!!root, "Root element exists.");
target = iframe.contentDocument.getElementById("target");
assert_true(!!target, "Target element exists.");
var observer = new IntersectionObserver(function(changes) {
entries = entries.concat(changes)
}, { root: root });
}, { root: iframe.contentDocument });
observer.observe(target);
entries = entries.concat(observer.takeRecords());
assert_equals(entries.length, 0, "No initial notifications.");
runTestCycle(step0, "First rAF.");
}, "Observer with explicit root which is the document's scrolling element.");
}, "Observer with explicit root which is the document.");
};
function step0() {