diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/css/CSS2/normal-flow/block-in-inline-hittest-relpos-zindex.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/CSS2/normal-flow/block-in-inline-hittest-relpos-zindex.html')
-rw-r--r-- | testing/web-platform/tests/css/CSS2/normal-flow/block-in-inline-hittest-relpos-zindex.html | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/CSS2/normal-flow/block-in-inline-hittest-relpos-zindex.html b/testing/web-platform/tests/css/CSS2/normal-flow/block-in-inline-hittest-relpos-zindex.html new file mode 100644 index 0000000000..221b70d44b --- /dev/null +++ b/testing/web-platform/tests/css/CSS2/normal-flow/block-in-inline-hittest-relpos-zindex.html @@ -0,0 +1,69 @@ +<!DOCTYPE html> +<link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level"> +<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-document-elementfrompoint"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> +section { + margin-bottom: 5px; +} +.target { + background: blue; + width: 100px; + height: 10px; +} +</style> +<body> + <section> + <a href="#"> + <div class="target"></div> + </a> + </section> + <section> + <a href="#"> + <div class="target" style="z-index: 1"></div> + </a> + </section> + <section> + <a href="#"> + <div class="target" style="z-index: -1"></div> + </a> + </section> + <section> + <a href="#"> + <div class="target" style="position: relative"></div> + </a> + </section> + <section> + <a href="#"> + <div class="target" style="position: relative; z-index: 1"></div> + </a> + </section> + <section> + <a href="#"> + <div class="target" style="position: relative; z-index: -1"></div> + </a> + </section> +<script> +function isAncestorOf(target, ancestor) { + for (; target; target = target.parentElement) { + if (target === ancestor) + return true; + } + return false; +} + +for (const root of document.getElementsByTagName('section')) { + const target = root.querySelector('.target'); + const target_bounds = target.getBoundingClientRect(); + const x = target_bounds.x + target_bounds.width / 2; + const y = target_bounds.y + target_bounds.height / 2; + const result = document.elementFromPoint(x, y); + const a = root.querySelector('a'); + test(() => { + // For the `<a>` link to work, the `result` must be `a` or its descendant. + assert_true(isAncestorOf(result, a)); + }, target.style.cssText); +} +</script> +</body> |