forked from mirrors/gecko-dev
Automatic update from web-platform-tests [css-scroll-snap-2] Rename scroll-start tests with 'tentative' Also, scroll-start-with-text-fragment-navigation.html is adjusted to the new scroll-start directory added in crrev.com/c/4628128. Bug: 1439807 Change-Id: Idfa8b0dd447bb621d0261780e3b6b93b9f952e82 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4629866 Reviewed-by: Robert Flack <flackr@chromium.org> Commit-Queue: David Awogbemila <awogbemila@chromium.org> Cr-Commit-Position: refs/heads/main@{#1161712} -- wpt-commits: 9f1dfeb0175b413db001ca619b0711efeada930b wpt-pr: 40656
74 lines
No EOL
1.6 KiB
HTML
74 lines
No EOL
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="spacer"></div>
|
|
<div id="box"></div>
|
|
<div id="text_fragment_target">
|
|
<p>Target</p>
|
|
</div>
|
|
<style>
|
|
:root {
|
|
margin: 0px;
|
|
scroll-start: 100px;
|
|
}
|
|
|
|
#spacer {
|
|
height: 100vh;
|
|
width: 100vw;
|
|
}
|
|
|
|
#box {
|
|
width: 100px;
|
|
height: 100px;
|
|
background-color: blue;
|
|
}
|
|
|
|
#fragment_target {
|
|
width: 100px;
|
|
height: 100px;
|
|
background-color: red;
|
|
}
|
|
</style>
|
|
<script>
|
|
function stashResult(key, results) {
|
|
fetch(`/css/css-scroll-snap-2/scroll-start/stash.py?key=${key}`, {
|
|
method: "POST",
|
|
body: JSON.stringify(results)
|
|
}).then(() => {
|
|
window.close();
|
|
});
|
|
}
|
|
function record() {
|
|
let scroll_position = "UNKNOWN";
|
|
// Expect page is scrolled all the way down as the text is at the bottom of
|
|
// the page.
|
|
const expected_scroll_top = document.scrollingElement.scrollHeight -
|
|
document.scrollingElement.clientHeight;
|
|
|
|
if (document.scrollingElement.scrollTop == 100) {
|
|
scroll_position = "AT_SCROLL_START";
|
|
} else if (document.scrollingElement.scrollTop == expected_scroll_top) {
|
|
scroll_position = "AT_TEXT_FRAGMENT";
|
|
}
|
|
|
|
const result = {
|
|
scroll_position: scroll_position
|
|
};
|
|
|
|
let key = (new URL(document.location)).searchParams.get("key");
|
|
stashResult(key, result);
|
|
}
|
|
|
|
window.onload = () => {
|
|
window.requestAnimationFrame(function () {
|
|
window.requestAnimationFrame(record);
|
|
})
|
|
}
|
|
</script>
|
|
</body>
|
|
|
|
</html> |