Reviewed by me
authorkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Sep 2004 18:39:31 +0000 (18:39 +0000)
committerkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Sep 2004 18:39:31 +0000 (18:39 +0000)
        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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7529 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/editing/editing.js
LayoutTests/editing/selection/move-backwords-by-word-001-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/move-backwords-by-word-001.html [new file with mode: 0644]
LayoutTests/editing/selection/selection-3748164-fix-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/selection-3748164-fix.html [new file with mode: 0644]
WebCore/ChangeLog-2005-08-23

index ede0c58d0045649d9cebffee583c4a59ca7c016b..fab1f41c145f40b5d8f3034db9c2aae2006fefbc 100644 (file)
@@ -39,6 +39,36 @@ 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");
 }
@@ -99,6 +129,36 @@ 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");
 }
diff --git a/LayoutTests/editing/selection/move-backwords-by-word-001-expected.txt b/LayoutTests/editing/selection/move-backwords-by-word-001-expected.txt
new file mode 100644 (file)
index 0000000..3472e08
--- /dev/null
@@ -0,0 +1,17 @@
+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}
diff --git a/LayoutTests/editing/selection/move-backwords-by-word-001.html b/LayoutTests/editing/selection/move-backwords-by-word-001.html
new file mode 100644 (file)
index 0000000..feafc86
--- /dev/null
@@ -0,0 +1,40 @@
+<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>
diff --git a/LayoutTests/editing/selection/selection-3748164-fix-expected.txt b/LayoutTests/editing/selection/selection-3748164-fix-expected.txt
new file mode 100644 (file)
index 0000000..a9ac720
--- /dev/null
@@ -0,0 +1,21 @@
+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}
diff --git a/LayoutTests/editing/selection/selection-3748164-fix.html b/LayoutTests/editing/selection/selection-3748164-fix.html
new file mode 100644 (file)
index 0000000..5a23151
--- /dev/null
@@ -0,0 +1,38 @@
+<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>
index 01c6605c92482d739a43548aa4267a99e1dd2588..235f8fd6b0c0a9cf860ec2f148f10d61af0c15b5 100644 (file)
@@ -1,3 +1,15 @@
+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