diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-overlapping-highlights-002.html | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-overlapping-highlights-002.html')
-rw-r--r-- | testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-overlapping-highlights-002.html | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-overlapping-highlights-002.html b/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-overlapping-highlights-002.html new file mode 100644 index 0000000000..2dda273abf --- /dev/null +++ b/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-overlapping-highlights-002.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>CSS Highlight API Test: Overlapping Highlights</title> +<link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/"> +<link rel="match" href="custom-highlight-painting-overlapping-highlights-002-ref.html"> +<meta name="assert" value="UAs must not define any styles for custom highlight pseudo-elements in the default UA stylesheet."> +<style> + div { + font-size: 3em; + font-weight: bolder; + } + #affected1::highlight(highlight1) { + color: green; + background-color: rgb(0, 255, 0, 0.5); + } + #affected2::highlight(highlight2) { + color: red; + background-color: rgba(100, 0, 100, 0.5); + } +</style> +<body><div><span id="affected1">Green on lime.</span><span id="affected2">Red on maroon.</span></div> +<script> + /* + This test is meant to verify that: + - UAs must not define any styles for custom highlight pseudo-elements in + the default UA stylesheet. + - UAs do not paint unstyled custom highlights. + + In this test, highlight1 has higher priority, so it is painted over + highlight2. This includes painting for span#affected2, where there is no CSS + rule for highlight1. But since unstyled custom highlights are not painted, + span#affected2 is still painted with the styles for highlight2. + + See https://drafts.csswg.org/css-highlight-api-1/#default-styles + */ + + const div = document.querySelector("div"); + + let r = new Range(); + r.setStart(div, 0); + r.setEnd(div, 2); + let r2 = new Range(); + r2.setStart(div, 0); + r2.setEnd(div, 2); + + let h = new Highlight(r); + h.priority = 3; + let h2 = new Highlight(r2); + h2.priority = 2; + + CSS.highlights.set("highlight1", h); + CSS.highlights.set("highlight2", h2); +</script>
\ No newline at end of file |