summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-003.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-003.html')
-rw-r--r--testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-003.html48
1 files changed, 48 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-003.html b/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-003.html
new file mode 100644
index 0000000000..38246a15af
--- /dev/null
+++ b/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-003.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<title>CSS Highlight API Test: Highlights using dynamic container sizes</title>
+<link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/">
+<link rel="help" href="https://drafts.csswg.org/css-pseudo/#highlight-styling">
+<link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-lengths">
+<link rel="match" href="custom-highlight-container-metrics-003-ref.html">
+<meta name="assert" value="lengths depending on containers update correctly for a highlight defined only inside a container query">
+<head>
+ <style>
+ .wrapper {
+ container: wrapper / size;
+ width: 400px;
+ height: 200px;
+ }
+ .resize {
+ width: 200px;
+ height: 100px;
+ }
+ @container (width < 300px) {
+ ::highlight(highlight1) {
+ text-underline-offset: 2cqw;
+ text-decoration-line: underline;
+ text-decoration-color: green;
+ text-decoration-thickness: 4cqh;
+ }
+ }
+ </style>
+</head>
+<body>
+ <div id="container" class="wrapper">
+ <div id="h1">With container size</div>
+ </div>
+ <div id="h2">Should be no highlight</div>
+ <script>
+ let r1 = new Range();
+ r1.setStart(h1, 0);
+ r1.setEnd(h1, 1);
+ let r2 = new Range();
+ r2.setStart(h2, 0);
+ r2.setEnd(h2, 1);
+ CSS.highlights.set("highlight1", new Highlight(r1, r2));
+ requestAnimationFrame(() => {
+ container.classList.add('resize');
+ requestAnimationFrame(() => takeScreenshot());
+ });
+ </script>
+</body>