Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / ManualTests / harfbuzz-mouse-selection-crash.html
bloba7e85a1ef83111d504c7f01c02263544132ae29f
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4 <style type="text/css">
5 #telugu {
6 font-size: 2cm;
7 line-height: 1.5em;
8 font-family: "Lohit Telugu";
10 </style>
11 <script>
12 var ITERATIONS = 10000;
14 if (window.testRunner)
15 testRunner.waitUntilDone();
17 function mouseSelection() {
18 var body = document.body;
19 body.focus();
21 xStart = 0;
22 yStart = 0;
24 if (window.eventSender) {
25 eventSender.mouseMoveTo(xStart, yStart);
26 eventSender.mouseDown();
27 for(i=0;i<ITERATIONS;i++) {
28 randomCoord = randomCoordinate();
29 eventSender.mouseMoveTo(randomCoord.x, randomCoord.y);
32 if (window.testRunnder)
33 testRunner.notifyDone();
36 function randomCoordinate(axis) {
37 return { x: Math.floor(Math.random()*window.innerWidth),
38 y: Math.floor(Math.random()* window.innerHeight) }
41 </script>
42 </head>
43 <body onload="mouseSelection()"><p>
44 This test fuzzes HarfBuzzShaper::offsetForPosition to trigger an assertion in the downstream function characterIndexForXPosition().
45 See https://bugs.webkit.org/show_bug.cgi?id=92376 - reason of the assertion being hit is a minuscule floating point inaccuracy
46 between an if condition that gates the call to characterIndexForXPosition and the actual argument that's then given to the function.
47 This test works on WebKit EFL, with the Ubuntu Telugu Lohit font installed to the EFL jhbuild font directory, like:</p>
48 <pre>$ cp /usr/share/fonts/truetype/ttf-telugu-fonts/lohit_te.ttf WebKitBuild/Dependencies/Source/webkitgtk-test-fonts-0.0.3</pre>
49 <p>Run with:</p>
50 <pre>$ WebKitBuild/Debug/bin/DumpRenderTree ManualTests/harfbuzz-mouse-selection-crash.html</pre>
51 <p>Before the change, this would crash 10/10 times. Test passes if it does not crash.</p>
52 <p id="telugu">చేనేత కార్మికుల సమస్యలను ప్రభుత్వం దృష్టికి తీసుకువెళ్లేందుకు సిరిసిల్లలో వైఎస్ఆర్ సిపి గౌరవాధ్యక్షురాలు విజయమ్మ చేపట్టినదీక్ష విజయవంతమైంది.</p>
53 </body>
54 </html>