summaryrefslogtreecommitdiffstats
path: root/layout/reftests/scrolling/fractional-scroll-area.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /layout/reftests/scrolling/fractional-scroll-area.html
parentInitial commit. (diff)
downloadfirefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz
firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/reftests/scrolling/fractional-scroll-area.html')
-rw-r--r--layout/reftests/scrolling/fractional-scroll-area.html74
1 files changed, 74 insertions, 0 deletions
diff --git a/layout/reftests/scrolling/fractional-scroll-area.html b/layout/reftests/scrolling/fractional-scroll-area.html
new file mode 100644
index 0000000000..cba421499c
--- /dev/null
+++ b/layout/reftests/scrolling/fractional-scroll-area.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<meta charset="utf-8">
+<title>Fractional scroll area position / size</title>
+
+<style>
+
+body {
+ margin: 0;
+}
+
+#scrollbox {
+ width: 200px;
+ overflow: hidden;
+ background: red;
+}
+
+#scrolled-content {
+ background: lime;
+ box-sizing: border-box;
+ border: solid black;
+ border-width: 1px 0;
+}
+
+</style>
+
+<div id="scrollbox">
+ <div id="scrolled-content"></div>
+</div>
+
+<script>
+
+function getFloatQueryParams(defaultValues) {
+ let result = Object.assign({}, defaultValues);
+ for (let chunk of location.search.substr(1).split("&")) {
+ let parts = chunk.split("=");
+ result[parts[0]] = parseFloat(parts[1]);
+ }
+ return result;
+}
+
+let params = getFloatQueryParams({
+ top: 0,
+ outerBottom: 100,
+ innerBottom: 100,
+ borderTop: 0,
+ borderBottom: 0,
+ scrollBefore: 0,
+ scrollAfter: undefined,
+ offsetAfter: undefined,
+});
+
+let scrollArea = document.getElementById("scrollbox");
+let scrolledContent = document.getElementById("scrolled-content");
+
+scrollArea.style.marginTop = params.top + "px";
+scrollArea.style.height = (params.outerBottom - params.top) + "px";
+scrolledContent.style.height = (params.innerBottom - params.top) + "px";
+
+scrollArea.scrollTop = 1;
+scrollArea.scrollTop = 2;
+scrollArea.scrollTop = params.scrollBefore;
+
+window.addEventListener("MozReftestInvalidate", function () {
+ if (params.scrollAfter !== undefined) {
+ scrollArea.scrollTop = params.scrollAfter;
+ }
+ if (params.offsetAfter !== undefined) {
+ document.body.style.marginTop = params.offsetAfter + "px";
+ }
+ document.documentElement.className = "";
+});
+
+</script>