2 Test offset for position computation across complex runs with font
3 fallbacks, in this case due to a font (Arial) lacking a newline glyph.
8 <div id=
"target" style=
"display: inline; font-family: Arial; text-rendering: optimizeLegibility;">
9 Jus
­ti
­fi
­ca
­tion
11 be used sparingly and cautiously on Web pages.
14 if (window
.testRunner
) {
15 testRunner
.dumpAsText();
17 var target
= document
.getElementById("target");
18 var result
= document
.getElementById("result");
19 var x
= target
.offsetLeft
+ target
.offsetWidth
/ 2;
20 var y
= target
.offsetTop
+ target
.offsetHeight
/ 2;
22 eventSender
.leapForward(1000);
23 eventSender
.mouseMoveTo(x
, y
);
24 eventSender
.mouseDown();
25 eventSender
.mouseUp();
26 eventSender
.leapForward(1);
27 eventSender
.mouseDown();
28 eventSender
.mouseUp();
29 eventSender
.leapForward(1000);
31 var selectedText
= getSelection().toString();
32 if (selectedText
== "sparingly")
33 result
.innerText
= "PASS";
35 result
.innerText
= "FAIL: Selected text is \"" + selectedText
+ "\"";