OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <meta charset="utf-8"> |
3 <head> | 3 <script src="../../resources/testharness.js"></script> |
4 <meta http-equiv="content-type" content="text/html; charset=utf-8"> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 <style> .selected { color: blue; } </style> | |
6 </head> | |
7 <body> | |
8 <p>This tests horizontal caret movement in vertical writing mode. "は猫である。" and "
名前" must be selected.</p> | 5 <p>This tests horizontal caret movement in vertical writing mode. "は猫である。" and "
名前" must be selected.</p> |
9 <div id="test" style="-webkit-writing-mode: vertical-rl; outline: none;" content
editable> | 6 <div id="test" style="-webkit-writing-mode: vertical-rl; outline: none;" content
editable> |
10 <p>吾輩は猫である。名前はまだ無い。</p> | 7 <p id="p1">吾輩は猫である。名前はまだ無い。</p> |
11 </div> | 8 </div> |
12 | 9 |
13 <span id="span-for-height-calc" style="-webkit-writing-mode: vertical-rl; outlin
e: none;"> | 10 <span id="span-for-height-calc" style="-webkit-writing-mode: vertical-rl; outlin
e: none;"> |
14 <p>吾輩は猫である。<br>名前はまだ無い。</p> | 11 <p>吾輩は猫である。<br>名前はまだ無い。</p> |
15 </span> | 12 </span> |
16 <pre id="log"></pre> | 13 <div id="log"></div> |
17 <script> | 14 <script> |
| 15 test(function() { |
| 16 var desiredHeight = document.getElementById('span-for-height-calc'); |
| 17 var test = document.getElementById('test'); |
| 18 test.style.height = (desiredHeight.offsetHeight + 2) + 'px'; |
| 19 desiredHeight.style.display = 'none'; |
18 | 20 |
19 var desiredHeight = document.getElementById('span-for-height-calc'); | 21 var selection = window.getSelection(); |
20 var test = document.getElementById('test'); | 22 var p1 = document.getElementById('p1'); |
21 test.style.height = (desiredHeight.offsetHeight + 2) + 'px'; | 23 selection.collapse(p1.firstChild, 2); |
22 desiredHeight.style.display = 'none'; | 24 selection.modify('Extend', 'Forward', 'Line'); |
23 | 25 |
24 window.getSelection().collapse(test.getElementsByTagName('p')[0].firstChild, 2); | 26 assert_false(selection.isCollapsed, 'isCollapsed'); |
25 window.getSelection().modify('Extend', 'Forward', 'Line'); | 27 assert_equals(selection.anchorNode, p1.firstChild, 'anchorNode'); |
26 | 28 assert_equals(selection.anchorOffset, 2, 'anchorOffset'); |
| 29 assert_equals(selection.focusNode, p1.firstChild, 'focusNode'); |
| 30 assert_equals(selection.focusOffset, 10, 'focusOffset'); |
| 31 }); |
27 </script> | 32 </script> |
28 </body> | |
29 </html> | |
OLD | NEW |