1 CONSOLE MESSAGE: line 48: Wrong focus offset: 5 instead of 4
2 CONSOLE MESSAGE: line 44: Wrong node selected.
3 CONSOLE MESSAGE: line 46: Wrong anchor offset: 8 instead of 0
4 CONSOLE MESSAGE: line 48: Wrong focus offset: 5 instead of 4
5 CONSOLE MESSAGE: line 41: Wrong end node type: [object HTMLBRElement]
6 CONSOLE MESSAGE: line 44: Wrong node selected.
11 | "This test tries to indent lines within pre tags. This test passes if it
20 | style="margin: 0 0 0 40px; border: none; padding: 0px;"
29 | style="margin: 0 0 0 40px; border: none; padding: 0px;"
44 | style="margin: 0 0 0 40px; border: none; padding: 0px;"
61 | "table one<#selection-anchor>
64 | style="margin: 0 0 0 40px; border: none; padding: 0px;"
68 | "table three<#selection-focus>"
76 | "PASSED (did not crash)"
83 | href="javascript:document.execCommand('indent')"
88 | href="javascript:document.execCommand('outdent')"
93 | src="../../resources/dump-as-markup.js"
102 function setSelection(node)
104 var textNode = node.firstChild;
105 if (textNode.nodeType != Node.TEXT_NODE)
106 throw "Wrong node type: " + textNode;
107 execSetSelectionCommand(textNode, 0, 0);
110 function verifyTextSelection(startNode, startOffset, endNode, endOffset)
112 if (startNode.nodeType != Node.TEXT_NODE)
113 console.log("Wrong start node type: " + startNode);
114 if (endNode.nodeType != Node.TEXT_NODE)
115 console.log("Wrong end node type: " + endNode);
116 var sel = window.getSelection();
117 if (sel.anchorNode != startNode || sel.focusNode != endNode)
118 console.log("Wrong node selected.");
119 if (sel.anchorOffset != startOffset)
120 console.log("Wrong anchor offset: " + sel.anchorOffset + " instead of " + startOffset);
121 if (sel.focusOffset != endOffset)
122 console.log("Wrong focus offset: " + sel.focusOffset + " instead of " + endOffset);
125 // Indent a single line in a pre and make sure the selection is correctly preserved.
126 var pre = document.getElementById("pre-basic");
128 execMoveSelectionForwardByCharacterCommand();
129 execExtendSelectionForwardByWordCommand();
130 document.execCommand("indent");
131 verifyTextSelection(document.getElementsByTagName("pre")[0].firstChild, 1,
132 document.getElementsByTagName("pre")[0].firstChild, 4);
136 execMoveSelectionForwardByLineCommand();
137 execExtendSelectionForwardByLineCommand();
138 execExtendSelectionForwardByWordCommand();
139 document.execCommand("indent");
140 if (document.getElementsByTagName("pre").length > 3) {
141 // FIXME: The selection for the anchorNode is wrong. It should stay at
142 // the beginning of "line three", but it moves to the end of "line 2".
143 verifyTextSelection(document.getElementsByTagName("pre")[2].firstChild, 0,
144 document.getElementsByTagName("pre")[3].firstChild, 4);
146 console.log("Wrong number of pre nodes.");
149 // Indent <pre> lines in a list.
150 pre = document.getElementById("pre-list");
152 execMoveSelectionForwardByLineCommand();
153 execExtendSelectionForwardByLineCommand();
154 execExtendSelectionForwardByLineCommand();
155 document.execCommand("indent");
156 verifyTextSelection(document.getElementsByTagName("blockquote")[2].firstChild, 0,
157 document.getElementsByTagName("blockquote")[2].firstChild.nextSibling, 10);
158 // Indenting <pre> lines in a table.
159 pre = document.getElementById("pre-table");
161 execMoveSelectionForwardByLineCommand();
162 execExtendSelectionForwardByLineCommand();
163 execExtendSelectionForwardByLineCommand();
164 // FIXME: This is wrong. The pre tags get copied when they shouldn't be.
165 // See https://bugs.webkit.org/show_bug.cgi?id=42009
166 document.execCommand("indent");
167 document.getElementById("results").innerText = "PASSED (did not crash)";