//-------------------------------------------------------------------------------------------------------
+function execMoveSelectionForwardByWordCommand() {
+ selection.modify("move", "forward", "word");
+}
+function moveSelectionForwardByWordCommand() {
+ if (commandDelay > 0) {
+ window.setTimeout(execMoveSelectionForwardByWordCommand, commandCount * commandDelay);
+ commandCount++;
+ }
+ else {
+ execMoveSelectionForwardByWordCommand();
+ }
+}
+
+//-------------------------------------------------------------------------------------------------------
+
+function execExtendSelectionForwardByWordCommand() {
+ selection.modify("extend", "forward", "word");
+}
+function extendSelectionForwardByWordCommand() {
+ if (commandDelay > 0) {
+ window.setTimeout(execExtendSelectionForwardByWordCommand, commandCount * commandDelay);
+ commandCount++;
+ }
+ else {
+ execExtendSelectionForwardByWordCommand();
+ }
+}
+
+//-------------------------------------------------------------------------------------------------------
+
function execMoveSelectionForwardByLineCommand() {
selection.modify("move", "forward", "line");
}
//-------------------------------------------------------------------------------------------------------
+function execMoveSelectionBackwardByWordCommand() {
+ selection.modify("move", "backward", "word");
+}
+function moveSelectionBackwardByWordCommand() {
+ if (commandDelay > 0) {
+ window.setTimeout(execMoveSelectionBackwardByWordCommand, commandCount * commandDelay);
+ commandCount++;
+ }
+ else {
+ execMoveSelectionBackwardByWordCommand();
+ }
+}
+
+//-------------------------------------------------------------------------------------------------------
+
+function execExtendSelectionBackwardByWordCommand() {
+ selection.modify("extend", "backward", "word");
+}
+function extendSelectionBackwardByWordCommand() {
+ if (commandDelay > 0) {
+ window.setTimeout(execExtendSelectionBackwardByWordCommand, commandCount * commandDelay);
+ commandCount++;
+ }
+ else {
+ execExtendSelectionBackwardByWordCommand();
+ }
+}
+
+//-------------------------------------------------------------------------------------------------------
+
function execMoveSelectionBackwardByLineCommand() {
selection.modify("move", "backward", "line");
}
--- /dev/null
+layer at (0,0) size 800x600
+ RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (0,0) size 784x84 [border: (2px solid #FF0000)]
+ RenderInline {SPAN} at (0,0) size 71x56
+ RenderText {TEXT} at (14,14) size 32x28
+ text run at (14,14) width 32: "foo"
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (14,42) size 71x28
+ text run at (14,42) width 71: "bar baz"
+ RenderText {TEXT} at (0,0) size 0x0
+selection is CARET:
+start: position 0 of child 3 {TEXT} of child 2 {SPAN} of root {DIV}
+upstream: position 1 of child 2 {BR} of child 2 {SPAN} of root {DIV}
+downstream: position 0 of child 3 {TEXT} of child 2 {SPAN} of root {DIV}
--- /dev/null
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ padding: 12px;
+ font-size: 24px;
+}
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+ for (i = 0; i < 10; i++)
+ moveSelectionForwardByCharacterCommand();
+ moveSelectionBackwardByWordCommand();
+ moveSelectionBackwardByWordCommand();
+}
+
+</script>
+
+<!-- Note that this tests the fix for this bug:
+<rdar://problem/3765519> REGRESSION (Mail): word movement goes too far upstream at start of line
+-->
+
+<title>Editing Test</title>
+</head>
+<body>
+<div contenteditable id="root" class="editing">
+<span id="test">foo<BR>bar baz</span>
+</div>
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
--- /dev/null
+layer at (0,0) size 800x600
+ RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (0,0) size 784x71 [border: (2px solid #FF0000)]
+ RenderBlock {DIV} at (14,14) size 756x43
+ RenderInline {SPAN} at (0,0) size 0x0
+ RenderBR {BR} at (0,0) size 0x28
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 33x15
+ RenderText {TEXT} at (0,28) size 33x15
+ text run at (0,28) width 33: "- Ken"
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 0x0
+ RenderText {TEXT} at (0,0) size 0x0
+selection is CARET:
+start: position 5 of child 1 {TEXT} of child 4 {SPAN} of child 2 {DIV} of root {DIV}
+upstream: position 5 of child 1 {TEXT} of child 4 {SPAN} of child 2 {DIV} of root {DIV}
+downstream: position 0 of child 5 {BR} of child 2 {DIV} of root {DIV}
--- /dev/null
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ padding: 12px;
+ font-size: 24px;
+}
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+ for (i = 0; i < 20; i++)
+ moveSelectionForwardByCharacterCommand();
+}
+
+</script>
+
+<title>Editing Test</title>
+</head>
+<body>
+<div contenteditable id="root" class="editing">
+<DIV id="test">
+<SPAN style="font: 12.0px Lucida Grande"></SPAN><BR>
+<SPAN style="font: 12.0px Lucida Grande">- Ken</SPAN><BR>
+<SPAN style="font: 12.0px Lucida Grande"></SPAN>
+</DIV>
+</div>
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
+2004-09-13 Ken Kocienda <kocienda@apple.com>
+
+ Reviewed by me
+
+ Added a couple new layout tests to cover recent changes.
+
+ * layout-tests/editing/editing.js: Added some new functions to do by-word selection movement.
+ * layout-tests/editing/selection/move-backwords-by-word-001-expected.txt: Added.
+ * layout-tests/editing/selection/move-backwords-by-word-001.html: Added.
+ * layout-tests/editing/selection/selection-3748164-fix-expected.txt: Added.
+ * layout-tests/editing/selection/selection-3748164-fix.html: Added.
+
2004-09-13 Ken Kocienda <kocienda@apple.com>
Reviewed by John