Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / selection-start-end-readonly.html
blob84663c7083403fc13b4bc0f45b672ac191700cbc
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <script src="../../resources/js-test.js"></script>
6 </head>
7 <body>
8 <p id="description"></p>
9 <input id="text" readonly="readonly" value="2009-04-29"/><br/>
10 <textarea id="area" readonly="readonly">2009-04-29</textarea></div>
11 <div id="console"></div>
12 <div>
13 <script type="text/javascript">
14 description('Tests for selectionStart and selectionEnd on read-only INPUT and TEXTAREA. <br/> <a href="https://bugs.webkit.org/show_bug.cgi?id=25444">bug 25444</a>: SelectionStart, selectionEnd properties return wrong values when the selection is in a form input.');
16 function startTest(element, start, end) {
17 element.setSelectionRange(start, end);
19 start = start < 0 ? 0 : start;
20 end = end > 10 ? 10 : end;
21 start = start > end ? end : start;
23 if (element.selectionStart != start)
24 testFailed('element.selectionStart' + ' should be ' + start + ' but it is ' + element.selectionStart);
25 else
26 testPassed('element.selectionStart' + ' is ' + element.selectionStart);
28 if (element.selectionEnd != end)
29 testFailed('element.selectionEnd' + ' should be ' + end + ' but it is ' + element.selectionEnd);
30 else
31 testPassed('element.selectionEnd' + ' is ' + element.selectionEnd);
34 function testHandler(element) {
35 var offsets = [[0, 10], [0, 9], [1, 10], [5,5], [8,5], [-1,0], [-1,50]];
36 for (var i = 0; i < offsets.length; i++)
37 startTest(element, offsets[i][0], offsets[i][1]);
40 testHandler(document.getElementById('text'));
41 testHandler(document.getElementById('area'));
43 </script>
44 </body>
45 </html>