summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/resize-observer/devicepixel2-ref.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testing/web-platform/tests/resize-observer/devicepixel2-ref.html21
1 files changed, 21 insertions, 0 deletions
diff --git a/testing/web-platform/tests/resize-observer/devicepixel2-ref.html b/testing/web-platform/tests/resize-observer/devicepixel2-ref.html
new file mode 100644
index 0000000000..7674eb0ab8
--- /dev/null
+++ b/testing/web-platform/tests/resize-observer/devicepixel2-ref.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<body>
+<script type="module">
+import createPatternDataURL from './create-pattern-data-url.js';
+
+const { patternSize, dataURL } = createPatternDataURL();
+document.body.style.backgroundImage = `url("${dataURL}")`;
+
+function setBackgroundPatternTo1DevicePixel() {
+ const oneDevicePixel = 1 / devicePixelRatio;
+ const patternPixels = oneDevicePixel * patternSize;
+ document.body.style.backgroundSize = `${patternPixels}px ${patternPixels}px`;
+}
+setBackgroundPatternTo1DevicePixel();
+
+// If we're viewed interactively and the user activates
+// full-page-zoom, changes the page zoom level, or resizes
+// the window, update the rendering to account for that:
+window.addEventListener('resize', setBackgroundPatternTo1DevicePixel);
+</script>
+</body>