Files
tubestation/testing/web-platform/tests/intersection-observer/display-none.html
Blink WPT Bot 0ab9839c39 Bug 1864098 [wpt PR 43073] - Allow intersectionObserver to calculate smaller fractions., a=testonly
Automatic update from web-platform-tests
Allow intersectionObserver to calculate smaller fractions. (#43073)

Previously, Intersection Observer used layout units for certain SVG
calculations, which caused a loss of accuracy. This patch replaces
layout units with gfx::RectF, leading to more precise results

Bug: 963246

Change-Id: I83be98bdfba166cb92e6ae1590da1d0913968151
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5019453
Reviewed-by: Philip Rogers <pdr@chromium.org>
Commit-Queue: Yotam Hacohen <yotha@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1229548}

Co-authored-by: Yotam Hacohen <yotha@chromium.org>
--

wpt-commits: 4c48fa3be88df1b67a766938e4ec0c5dc38d918b
wpt-pr: 43073
2023-12-01 09:23:58 +00:00

66 lines
1.4 KiB
HTML

<!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>
pre, #log {
position: absolute;
top: 0;
left: 200px;
}
#target {
background-color: green;
width: 100px;
height: 100px;
}
</style>
<div id="target"></div>
<script>
var vw = document.documentElement.clientWidth;
var vh = document.documentElement.clientHeight;
var entries = [];
promise_test(async function(t) {
var target = document.getElementById("target");
var root = document.getElementById("root");
var observer = new IntersectionObserver(function(changes) {
entries = entries.concat(changes)
});
observer.observe(target);
entries = entries.concat(observer.takeRecords());
assert_equals(entries.length, 0, "No initial notifications.");
await waitForNotification();
checkLastEntry(
entries,
0,
[8, 108, 8, 108, 8, 108, 8, 108, 0, vw, 0, vh, true],
);
target.style.display = "none";
await waitForNotification();
checkLastEntry(
entries,
1,
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false],
);
target.style.display = "";
await waitForNotification();
checkLastEntry(
entries,
2,
[8, 108, 8, 108, 8, 108, 8, 108, 0, vw, 0, vh, true],
);
});
</script>