Reviewed by John
[WebKit-https.git] / LayoutTests / editing / editing.js
index 51b9825..ff3da95 100644 (file)
@@ -39,18 +39,64 @@ function extendSelectionForwardByCharacterCommand() {
 
 //-------------------------------------------------------------------------------------------------------
 
+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 moveSelectionForwardByLineCommand() {
+    if (commandDelay > 0) {
+        window.setTimeout(execMoveSelectionForwardByLineCommand, commandCount * commandDelay);
+        commandCount++;
+    }
+    else {
+        execMoveSelectionForwardByLineCommand();
+    }
+}
+
+//-------------------------------------------------------------------------------------------------------
+
 function execExtendSelectionForwardByLineCommand() {
     selection.modify("extend", "forward", "line");
 }
-function extendSelectionForwardByCharacterCommand() {
+function extendSelectionForwardByLineCommand() {
     if (commandDelay > 0) {
-        window.setTimeout(execExtendSelectionForwardByCharacterCommand, commandCount * commandDelay);
+        window.setTimeout(execExtendSelectionForwardByLineCommand, commandCount * commandDelay);
         commandCount++;
     }
     else {
-        execExtendSelectionForwardByCharacterCommand();
+        execExtendSelectionForwardByLineCommand();
     }
 }
+
 //-------------------------------------------------------------------------------------------------------
 
 function execMoveSelectionBackwardByCharacterCommand() {
@@ -83,6 +129,66 @@ function extendSelectionBackwardByCharacterCommand() {
 
 //-------------------------------------------------------------------------------------------------------
 
+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");
+}
+function moveSelectionBackwardByLineCommand() {
+    if (commandDelay > 0) {
+        window.setTimeout(execMoveSelectionBackwardByLineCommand, commandCount * commandDelay);
+        commandCount++;
+    }
+    else {
+        execMoveSelectionBackwardByLineCommand();
+    }
+}
+
+//-------------------------------------------------------------------------------------------------------
+
+function execExtendSelectionBackwardByLineCommand() {
+    selection.modify("extend", "backward", "line");
+}
+function extendSelectionBackwardByLineCommand() {
+    if (commandDelay > 0) {
+        window.setTimeout(execExtendSelectionBackwardByLineCommand, commandCount * commandDelay);
+        commandCount++;
+    }
+    else {
+        execExtendSelectionBackwardByLineCommand();
+    }
+}
+
+//-------------------------------------------------------------------------------------------------------
+
 function execBoldCommand() {
     document.execCommand("Bold");
 }
@@ -115,16 +221,79 @@ function italicCommand() {
 
 //-------------------------------------------------------------------------------------------------------
 
-function execInsertNewlineCommand() {
-    document.execCommand("InsertNewline");
+function execJustifyCenterCommand() {
+    document.execCommand("JustifyCenter");
+}
+function justifyCenterCommand() {
+    if (commandDelay > 0) {
+        window.setTimeout(execJustifyCenterCommand, commandCount * commandDelay);
+        commandCount++;
+    }
+    else {
+        execJustifyCenterCommand();
+    }
+}
+
+
+//-------------------------------------------------------------------------------------------------------
+
+function execJustifyLeftCommand() {
+    document.execCommand("JustifyLeft");
+}
+function justifyLeftCommand() {
+    if (commandDelay > 0) {
+        window.setTimeout(execJustifyLeftCommand, commandCount * commandDelay);
+        commandCount++;
+    }
+    else {
+        execJustifyLeftCommand();
+    }
+}
+
+
+//-------------------------------------------------------------------------------------------------------
+
+function execJustifyRightCommand() {
+    document.execCommand("JustifyRight");
+}
+function justifyRightCommand() {
+    if (commandDelay > 0) {
+        window.setTimeout(execJustifyRightCommand, commandCount * commandDelay);
+        commandCount++;
+    }
+    else {
+        execJustifyRightCommand();
+    }
+}
+
+
+//-------------------------------------------------------------------------------------------------------
+
+function execInsertLineBreakCommand() {
+    document.execCommand("InsertLineBreak");
+}
+function insertLineBreakCommand() {
+    if (commandDelay > 0) {
+        window.setTimeout(execInsertLineBreakCommand, commandCount * commandDelay);
+        commandCount++;
+    }
+    else {
+        execInsertLineBreakCommand();
+    }
+}
+
+//-------------------------------------------------------------------------------------------------------
+function execInsertParagraphCommand() {
+    document.execCommand("InsertParagraph");
 }
-function insertNewlineCommand() {
+function insertParagraphCommand() {
     if (commandDelay > 0) {
-        window.setTimeout(execInsertNewlineCommand, commandCount * commandDelay);
+        window.setTimeout(execInsertParagraphCommand, commandCount * commandDelay);
         commandCount++;
     }
     else {
-        execInsertNewlineCommand();
+        execInsertParagraphCommand();
     }
 }
 
@@ -137,7 +306,7 @@ function execTypeCharacterCommand(c) {
 }
 function typeCharacterCommand(c) {
     if (commandDelay > 0) {
-        window.setTimeout(execTypeCharacterCommand, commandCount * commandDelay);
+        window.setTimeout(execTypeCharacterCommand, commandCount * commandDelay, c);
         commandCount++;
     }
     else {