Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / text / select-text-svgfont.html
blobb3dae37fe5c2e401dd08e832a84358e8f2db5de0
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Test for per-character selection with SVG font</title>
5 <style>
7 @font-face {
8 font-family: 'ABCFont';
9 src: local('☺'), url('../custom/resources/ABCFont.svg#ABCFont') format('svg');
10 font-weight: normal;
11 font-style: normal;
14 .svgfont {
15 font-family: 'ABCFont';
18 .pass {
19 background: #0f0;
22 .fail {
23 background: #f00;
26 </style>
27 </head>
28 <body>
29 This test checks that individual characters can be selected correctly when using an SVG font.
30 <div>
31 <span id="text" class="svgfont">aaaaaaaaaa</span>
32 </div>
33 <div id="passfail">
34 </div>
35 <script type="text/javascript">
36 function runTest() {
37 var text = document.getElementById('text');
39 if (!window.testRunner)
40 return;
42 var textWidth = text.offsetWidth;
43 var estCharWidth = textWidth / 10;
44 eventSender.mouseMoveTo(text.offsetLeft + (estCharWidth * 3) + 2, text.offsetTop + text.offsetHeight / 2);
45 eventSender.leapForward(200);
46 eventSender.mouseDown();
47 eventSender.mouseMoveTo(text.offsetLeft + (estCharWidth * 3) + 2, text.offsetTop + text.offsetHeight / 2);
48 eventSender.leapForward(200);
49 eventSender.mouseMoveTo(text.offsetLeft + (estCharWidth * 6) + 2, text.offsetTop + text.offsetHeight / 2);
50 eventSender.leapForward(200);
51 eventSender.mouseUp();
52 verify();
55 function verify() {
56 var text = document.getElementById('text');
58 if (!window.testRunner)
59 return;
61 var range = window.getSelection().getRangeAt(0);
62 if (range.startOffset === 3 && range.endOffset === 6)
63 return pass("PASS");
65 return fail("FAIL: range was [" + range.startOffset + ", " + range.endOffset + "]; expected [3, 6]");
68 function pass(message) {
69 log(true, message);
72 function fail(message) {
73 log(false, message);
76 function log(passed, message) {
77 var passfail = document.getElementById('passfail');
78 passfail.innerHTML = message;
79 passfail.className = (passed ? "pass" : "fail");
80 testRunner.dumpAsText();
83 runTest();
84 </script>
85 </body>
86 </html>