-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathhit-test-in-vertical-rl.html
More file actions
43 lines (41 loc) · 1.54 KB
/
hit-test-in-vertical-rl.html
File metadata and controls
43 lines (41 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<link rel="help" href="https://un5neav4tjf40.julianrbryant.com/1457423">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>body { margin: 0; }</style>
<div style="
column-count: 2;
column-gap: 14px;
writing-mode: vertical-rl;
inline-size: 200px;
block-size: 100px;
padding: 10px;">
<div style="block-size: 20px;"></div>
<div style="column-span: all; block-size: 20px;"></div>
<div id="child1" style="block-size: 70px; break-inside: avoid;"></div>
<div id="child2" style="block-size: 70px; break-inside: avoid;"></div>
</div>
<script>
const t = async_test('Hit-testing in vertical-rl writing-mode');
t.step(() => {
assert_equals(document.elementFromPoint(15, 20), child1);
assert_equals(document.elementFromPoint(15, 130), child2);
const PADDING = 10;
const e1 = new MouseEvent('click', {clientX:15, clientY:20, bubbles:true, cancelable:true});
document.onclick = t.step_func(e => {
assert_equals(e.target, child1);
assert_equals(e.offsetX, e.clientX - PADDING);
assert_equals(e.offsetY, e.clientY - PADDING);
});
child1.dispatchEvent(e1);
const e2 = new MouseEvent('click', {clientX:15, clientY:130, bubbles:true, cancelable:true});
document.onclick = t.step_func_done(e => {
const COLUMN_GAP = 14;
const COLUMN_INLINE_SIZE = (200 - COLUMN_GAP) / 2;
assert_equals(e.target, child2);
assert_equals(e.offsetX, e.clientX - PADDING);
assert_equals(e.offsetY, e.clientY - PADDING - COLUMN_INLINE_SIZE - COLUMN_GAP);
});
child2.dispatchEvent(e2);
});
</script>