| OLD | NEW |
| 1 <p>This test tries to indent lines within pre tags. This test passes if it | 1 <p>This test tries to indent lines within pre tags. This test passes if it |
| 2 does not crash.</p> | 2 does not crash.</p> |
| 3 <div contentEditable> | 3 <div contentEditable> |
| 4 <pre id="pre-basic">line one | 4 <pre id="pre-basic">line one |
| 5 line two | 5 line two |
| 6 line three | 6 line three |
| 7 line four</pre> | 7 line four</pre> |
| 8 | 8 |
| 9 <ul><li><pre id="pre-list">list one | 9 <ul><li><pre id="pre-list">list one |
| 10 list two | 10 list two |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 <a href="javascript:document.execCommand('indent')">indent</a> | 23 <a href="javascript:document.execCommand('indent')">indent</a> |
| 24 <a href="javascript:document.execCommand('outdent')">outdent</a> | 24 <a href="javascript:document.execCommand('outdent')">outdent</a> |
| 25 <script src="../../resources/dump-as-markup.js"></script> | 25 <script src="../../resources/dump-as-markup.js"></script> |
| 26 <script src="../editing.js"></script> | 26 <script src="../editing.js"></script> |
| 27 <script> | 27 <script> |
| 28 function setSelection(node) | 28 function setSelection(node) |
| 29 { | 29 { |
| 30 var textNode = node.firstChild; | 30 var textNode = node.firstChild; |
| 31 if (textNode.nodeType != Node.TEXT_NODE) | 31 if (textNode.nodeType != Node.TEXT_NODE) |
| 32 throw "Wrong node type: " + textNode; | 32 throw "Wrong node type: " + textNode; |
| 33 execSetSelectionCommand(textNode, 0, 0); | 33 execSetSelectionCommand(textNode, 0, textNode, 0); |
| 34 } | 34 } |
| 35 | 35 |
| 36 function verifyTextSelection(startNode, startOffset, endNode, endOffset) | 36 function verifyTextSelection(startNode, startOffset, endNode, endOffset) |
| 37 { | 37 { |
| 38 if (startNode.nodeType != Node.TEXT_NODE) | 38 if (startNode.nodeType != Node.TEXT_NODE) |
| 39 console.log("Wrong start node type: " + startNode); | 39 console.log("Wrong start node type: " + startNode); |
| 40 if (endNode.nodeType != Node.TEXT_NODE) | 40 if (endNode.nodeType != Node.TEXT_NODE) |
| 41 console.log("Wrong end node type: " + endNode); | 41 console.log("Wrong end node type: " + endNode); |
| 42 var sel = window.getSelection(); | 42 var sel = window.getSelection(); |
| 43 if (sel.anchorNode != startNode || sel.focusNode != endNode) | 43 if (sel.anchorNode != startNode || sel.focusNode != endNode) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 execExtendSelectionForwardByLineCommand(); | 80 execExtendSelectionForwardByLineCommand(); |
| 81 document.execCommand("indent"); | 81 document.execCommand("indent"); |
| 82 verifyTextSelection(document.getElementsByTagName("blockquote")[2].firstChild, 0
, | 82 verifyTextSelection(document.getElementsByTagName("blockquote")[2].firstChild, 0
, |
| 83 document.getElementsByTagName("blockquote")[2].firstChild.ne
xtSibling, 10); | 83 document.getElementsByTagName("blockquote")[2].firstChild.ne
xtSibling, 10); |
| 84 // Indenting <pre> lines in a table. | 84 // Indenting <pre> lines in a table. |
| 85 pre = document.getElementById("pre-table"); | 85 pre = document.getElementById("pre-table"); |
| 86 setSelection(pre); | 86 setSelection(pre); |
| 87 execMoveSelectionForwardByLineCommand(); | 87 execMoveSelectionForwardByLineCommand(); |
| 88 execExtendSelectionForwardByLineCommand(); | 88 execExtendSelectionForwardByLineCommand(); |
| 89 execExtendSelectionForwardByLineCommand(); | 89 execExtendSelectionForwardByLineCommand(); |
| 90 // FIXME: This is wrong. The pre tags get copied when they shouldn't be. | 90 // FIXME: This is wrong. The pre tags get copied when they shouldn't be. |
| 91 // See https://bugs.webkit.org/show_bug.cgi?id=42009 | 91 // See https://bugs.webkit.org/show_bug.cgi?id=42009 |
| 92 document.execCommand("indent"); | 92 document.execCommand("indent"); |
| 93 document.getElementById("results").innerText = "PASSED (did not crash)"; | 93 document.getElementById("results").innerText = "PASSED (did not crash)"; |
| 94 </script> | 94 </script> |
| OLD | NEW |