Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / legal-positions.html
blob679f6ec57dbb548ee4727cf9810060bf095a713f
1 <script>
2 if (window.testRunner)
3 testRunner.dumpEditingCallbacks();
4 </script>
6 <script>
7 function log(str) {
8 var li = document.createElement("li");
9 li.appendChild(document.createTextNode(str));
10 var console = document.getElementById("console");
11 console.appendChild(li);
14 function assert(bool) {
15 if (!bool)
16 log("Failure");
17 else
18 log("Success");
20 </script>
21 <p>This tests the endpoints of a DOM Range object made from a selection around certain types elements. These endpoints shouldn't be at offsets inside nodes that aren't containers or text nodes.</p>
22 <div id="test">Hello <img src="../resources/abe.png"><object width="100"></object>world!<br>Hello World!</div>
23 <ul id="console"></ul>
25 <script>
26 var s = window.getSelection();
27 var e = document.getElementById("test");
28 var r;
30 if (window.testRunner)
31 window.testRunner.dumpAsText();
33 // The textnode
34 s.setBaseAndExtent(e, 0, e, 1);
35 r = s.getRangeAt(0);
36 assert(r.startContainer == e.childNodes[0]);
37 assert(r.startOffset == 0);
38 assert(r.endContainer == e.childNodes[0]);
39 assert(r.endOffset == r.endContainer.length);
41 // The image
42 s.setBaseAndExtent(e, 1, e, 2);
43 r = s.getRangeAt(0);
44 assert(r.startContainer == e);
45 assert(r.startOffset == 1);
46 assert(r.endContainer == e);
47 assert(r.endOffset == 2);
49 // The <object>
50 s.setBaseAndExtent(e, 2, e, 3);
51 r = s.getRangeAt(0);
52 assert(r.startContainer == e);
53 assert(r.startOffset == 2);
54 assert(r.endContainer == e);
55 assert(r.endOffset == 3);
57 // The <br>
58 s.setBaseAndExtent(e, 4, e, 5);
59 r = s.getRangeAt(0);
60 assert(r.startContainer == e);
61 assert(r.startOffset == 4);
62 assert(r.endContainer == e);
63 assert(r.endOffset == 5);
65 </script>