Spelling dots are drawn in the wrong place
[WebKit-https.git] / LayoutTests / editing / spelling / spelling-dots-position-2.html
1 <!DOCTYPE html><!-- webkit-test-runner [ spellCheckingDots=true ] -->
2 <html>
3 <head>
4
5 <style>
6 .editing {
7     font-family: 'Times New Roman';
8     font-size: 36px;
9     color: transparent;
10 }
11 </style>
12 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
13
14 <script>
15 function editingTest() {
16     typeCharacterCommand('w');
17     typeCharacterCommand('a');
18     typeCharacterCommand('f');
19     typeCharacterCommand('e');
20     typeCharacterCommand('w');
21     typeCharacterCommand('e');
22     typeCharacterCommand('r');
23     typeCharacterCommand('e');
24     typeCharacterCommand('w');
25     typeCharacterCommand('d');
26     typeCharacterCommand('f');
27     typeCharacterCommand('e');
28     typeCharacterCommand('a');
29     typeCharacterCommand(' ');
30     let ascentSetter = document.createElement("div");
31     ascentSetter.style.width = "1px";
32     ascentSetter.style.height = "150px";
33     ascentSetter.style.display = "inline-block";
34     let root = document.getElementById("root");
35     root.appendChild(ascentSetter);
36     let baseline = ascentSetter.offsetTop + ascentSetter.offsetHeight;
37     let left = root.offsetLeft;
38     let width = ascentSetter.offsetLeft - left;
39     let fontSize = Number.parseInt(window.getComputedStyle(root).getPropertyValue("font-size"));
40     let blocker = document.createElement("div");
41     blocker.style.background = "white";
42     blocker.style.position = "absolute";
43     blocker.style.left = `${left}px`;
44     blocker.style.top = `${baseline + 1 + fontSize * 0.11035}px`;
45     blocker.style.width = `${width}px`;
46     blocker.style.height = `${fontSize * 0.13247}px`;
47     document.body.appendChild(blocker);
48     root.blur();
49 }
50
51 </script>
52
53 <title>Editing Test</title>
54 </head>
55 <body>
56 <div contenteditable id="root" class="editing">
57 <span id="test"></span>
58 </div>
59
60 <script>
61     if (window.internals)
62         internals.setContinuousSpellCheckingEnabled(true);
63     runEditingTest();
64 </script>
65
66 </body>
67 </html>