Files
sousa-gecko/testing/web-platform/tests/svg/interact/scripted/text-hittest-002.html
T
Fredrik Söderquist 6d10602b41 Bug 2009811 [wpt PR 57129] - Export some SVG hit-testing tests to WPT, a=testonly
Automatic update from web-platform-tests
Export some SVG hit-testing tests to WPT

Move:

 * svg/hittest/text-overlapped.html
 * svg/hittest/text-fill-none-with-nested-tspan.html
 * svg/hittest/text-visibility-hidden-with-nested-tspan.html

to svg/interact/scripted/text-hittest-00[1-3].html with minimal
adjustments (Ahem from script to stylesheet loading).

Fixed: 474612195
Change-Id: I5ea6eefdd2f0767df7ad2c31345d2e4d8982c6a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7451360
Reviewed-by: Philip Rogers <pdr@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/main@{#1568304}

--

wpt-commits: 1fe7c4f4f4c5f541d6b8d3c117a90fb8ea2262fa
wpt-pr: 57129
2026-01-16 07:55:01 +00:00

30 lines
973 B
HTML

<!DOCTYPE html>
<title>elementFromPoint(...) on &lt;svg:text> with fill=none but fill=black descendants</title>
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
body, html {
padding: 0;
margin: 0;
}
</style>
<svg width="400" height="400">
<text x="50" y="50" font-family="Ahem" font-size="50" fill="none">
MM<tspan fill="black">MM</tspan>MM
</text>
</svg>
<script>
test(function() {
let root = document.querySelector('svg');
let tspan = document.querySelector('tspan');
let x = 75;
for (; x < 175; x += 50)
assert_equals(document.elementFromPoint(x, 25), root, `element @ (${x}, 25)`);
for (; x < 275; x += 50)
assert_equals(document.elementFromPoint(x, 25), tspan, `element @ (${x}, 25)`);
for (; x < 375; x += 50)
assert_equals(document.elementFromPoint(x, 25), root, `element @ (${x}, 25)`);
});
</script>