2011-02-02 Levi Weintraub <leviw@chromium.org>
authorleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Feb 2011 19:31:16 +0000 (19:31 +0000)
committerleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Feb 2011 19:31:16 +0000 (19:31 +0000)
        Reviewed by Ryosuke Niwa.

        Moving cursor down in table cycles at the end of a row
        https://bugs.webkit.org/show_bug.cgi?id=50012

        Tests downward caret-navigation for tables at the end of a document.

        * editing/selection/move-by-line-cycles-in-table-expected.txt: Added.
        * editing/selection/move-by-line-cycles-in-table.html: Added.
2011-02-02  Levi Weintraub  <leviw@chromium.org>

        Reviewed by Ryosuke Niwa.

        Moving cursor down in table cycles at the end of a row
        https://bugs.webkit.org/show_bug.cgi?id=50012

        Avoids a caret cycling issue with certain content (e.g. tables) found at the very
        end of a document due to a bug in nextLeafWithSameEditability.

        Test: editing/selection/move-by-line-cycles-in-table.html

        * editing/visible_units.cpp:
        (WebCore::nextLeafWithSameEditability): Properly avoid descending back into the
        original leaf node.

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

LayoutTests/ChangeLog
LayoutTests/editing/selection/move-by-line-cycles-in-table-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/move-by-line-cycles-in-table.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/editing/visible_units.cpp

index 2c3168b..35031c5 100644 (file)
@@ -1,3 +1,15 @@
+2011-02-02  Levi Weintraub  <leviw@chromium.org>
+
+        Reviewed by Ryosuke Niwa.
+
+        Moving cursor down in table cycles at the end of a row
+        https://bugs.webkit.org/show_bug.cgi?id=50012
+        
+        Tests downward caret-navigation for tables at the end of a document.
+
+        * editing/selection/move-by-line-cycles-in-table-expected.txt: Added.
+        * editing/selection/move-by-line-cycles-in-table.html: Added.
+
 2011-02-03  Dimitri Glazkov  <dglazkov@chromium.org>
 
         [Chromium] One more update SVG baselines after r77485 for Linux.
diff --git a/LayoutTests/editing/selection/move-by-line-cycles-in-table-expected.txt b/LayoutTests/editing/selection/move-by-line-cycles-in-table-expected.txt
new file mode 100644 (file)
index 0000000..626d437
--- /dev/null
@@ -0,0 +1,4 @@
+Test for http://bugs.webkit.org/show_bug.cgi?id=50012 Moving cursor down in table cycles at the end of a row
+
+Cursor should be at the end
+PASS
diff --git a/LayoutTests/editing/selection/move-by-line-cycles-in-table.html b/LayoutTests/editing/selection/move-by-line-cycles-in-table.html
new file mode 100644 (file)
index 0000000..46a7fd2
--- /dev/null
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<body style="-webkit-user-modify: read-write">
+<p>
+ Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=50012">http://bugs.webkit.org/show_bug.cgi?id=50012</a>
+ Moving cursor down in table cycles at the end of a row</i>
+</p>
+<table id="table"><tr><td id="target">Cursor should be at the end</td></tr></table>
+<div style="-webkit-user-modify: read-only">
+<script src=../editing.js></script>
+<script>
+if (window.layoutTestController)
+  layoutTestController.dumpAsText();
+
+var target = document.getElementById("target");
+getSelection().setBaseAndExtent(target.firstChild, 0, target.firstChild, 0);
+for (var i=0; i < 2; i++)
+  moveSelectionForwardByLineCommand();
+
+document.write(getSelection().baseOffset == 4 ? "PASS" : "FAIL: selection.baseOffset = " + getSelection().baseOffset);
+</script>
+</div>
+</body>
+</html>
+
index 888e1ae..6bf7e9d 100644 (file)
@@ -1,3 +1,19 @@
+2011-02-02  Levi Weintraub  <leviw@chromium.org>
+
+        Reviewed by Ryosuke Niwa.
+
+        Moving cursor down in table cycles at the end of a row
+        https://bugs.webkit.org/show_bug.cgi?id=50012
+
+        Avoids a caret cycling issue with certain content (e.g. tables) found at the very
+        end of a document due to a bug in nextLeafWithSameEditability.
+
+        Test: editing/selection/move-by-line-cycles-in-table.html
+
+        * editing/visible_units.cpp:
+        (WebCore::nextLeafWithSameEditability): Properly avoid descending back into the
+        original leaf node.
+
 2011-02-03  Pavel Podivilov  <podivilov@chromium.org>
 
         Reviewed by Pavel Feldman.
index 33d76ec..391d6e6 100644 (file)
@@ -583,7 +583,7 @@ static Node* nextLeafWithSameEditability(Node* node, int offset)
     bool editable = node->isContentEditable();
     ASSERT(offset >= 0);
     Node* child = node->childNode(offset);
-    Node* n = child ? child->nextLeafNode() : node->nextLeafNode();
+    Node* n = child ? child->nextLeafNode() : node->lastDescendant()->nextLeafNode();
     while (n) {
         if (editable == n->isContentEditable())
             return n;