Title: [98428] trunk
Revision
98428
Author
x...@chromium.org
Date
2011-10-25 21:57:39 -0700 (Tue, 25 Oct 2011)

Log Message

--webkit-visual-word does not work in multi-line
https://bugs.webkit.org/show_bug.cgi?id=61344

Reviewed by Ryosuke Niwa.

Source/WebCore: 

Get next or previous root inline box (which is not in the same
render object as the current root inline box) by traversing DOM node.

Test: editing/selection/move-by-word-visually-inline-block-positioned-element.html

* editing/visible_units.cpp:
(WebCore::previousRootInlineBox):
(WebCore::nextRootInlineBox):
(WebCore::leftInlineBox):
(WebCore::rightInlineBox):

LayoutTests: 

* editing/selection/move-by-word-visually-inline-block-positioned-element-expected.txt: Added.
* editing/selection/move-by-word-visually-inline-block-positioned-element.html: Added.
* editing/selection/move-by-word-visually-multi-line-expected.txt:
* editing/selection/move-by-word-visually-single-space-one-element-expected.txt:
* editing/selection/move-by-word-visually-single-space-one-element.html:
* platform/gtk/editing/selection/move-by-word-visually-multi-line-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (98427 => 98428)


--- trunk/LayoutTests/ChangeLog	2011-10-26 03:06:58 UTC (rev 98427)
+++ trunk/LayoutTests/ChangeLog	2011-10-26 04:57:39 UTC (rev 98428)
@@ -1,3 +1,17 @@
+2011-10-25  Xiaomei Ji  <x...@chromium.org>
+
+        --webkit-visual-word does not work in multi-line
+        https://bugs.webkit.org/show_bug.cgi?id=61344
+
+        Reviewed by Ryosuke Niwa.
+
+        * editing/selection/move-by-word-visually-inline-block-positioned-element-expected.txt: Added.
+        * editing/selection/move-by-word-visually-inline-block-positioned-element.html: Added.
+        * editing/selection/move-by-word-visually-multi-line-expected.txt:
+        * editing/selection/move-by-word-visually-single-space-one-element-expected.txt:
+        * editing/selection/move-by-word-visually-single-space-one-element.html:
+        * platform/gtk/editing/selection/move-by-word-visually-multi-line-expected.txt:
+
 2011-10-25  Erik Arvidsson  <a...@chromium.org>
 
         Fix ad hoc test.

Added: trunk/LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element-expected.txt (0 => 98428)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element-expected.txt	2011-10-26 04:57:39 UTC (rev 98428)
@@ -0,0 +1,38 @@
+
+======== Move By Word ====
+Test 1, LTR:
+Move right by one word
+"begin start"[0, 6, 11], "abc def"[0, 4, 7], "end ing"[0, 4, 7], "this is float"[0, 5, 8, 13], "this is fixed"[5, 8, 13], "this is relative"[0, 5, 8, 16], "this is absolute"[0, 5, 8, 16]
+Move left by one word
+"this is absolute"[16, 8, 5, 0], "this is relative"[8, 5, 0], "this is fixed"[8, 5], "this is float"[8, 5, 0], "end ing"[4, 0], "abc def"[4, 0], "begin start"[6, 0]
+Test 2, LTR:
+Move right by one word
+"abc def"[0, 4, 7], "end ing"[0, 4, 7], "this is float"[0, 5, 8, 13], "this is fixed"[5, 8, 13], "this is relative"[0, 5, 8, 16], "this is absolute"[0, 5, 8, 16]
+Move left by one word
+"this is absolute"[16, 8, 5, 0], "this is relative"[8, 5, 0], "this is fixed"[8, 5], "this is float"[8, 5, 0], "end ing"[4, 0], "abc def"[4, 0], "begin start"[6, 0]
+Test 3, LTR:
+Move right by one word
+"end ing"[0, 4, 7], "this is float"[0, 5, 8, 13], "this is fixed"[5, 8, 13], "this is relative"[0, 5, 8, 16], "this is absolute"[0, 5, 8, 16]
+Move left by one word
+"this is absolute"[16, 8, 5, 0], "this is relative"[8, 5, 0], "this is fixed"[8, 5], "this is float"[8, 5, 0], "end ing"[4, 0], "abc def"[4, 0], "begin start"[6, 0]
+Test 4, LTR:
+Move right by one word
+"this is float"[0, 5, 8, 13], "this is fixed"[5, 8, 13], "this is relative"[0, 5, 8, 16], "this is absolute"[0, 5, 8, 16]
+Move left by one word
+"this is absolute"[16, 8, 5, 0], "this is relative"[8, 5, 0], "this is fixed"[8, 5], "this is float"[8, 5, 0], "end ing"[4, 0], "abc def"[4, 0], "begin start"[6, 0]
+Test 5, LTR:
+Move right by one word
+"this is fixed"[0, 5, 8, 13], "this is relative"[0, 5, 8, 16], "this is absolute"[0, 5, 8, 16]
+Move left by one word
+"this is absolute"[16, 8, 5, 0], "this is relative"[8, 5, 0], "this is fixed"[8, 5], "this is float"[8, 5, 0], "end ing"[4, 0], "abc def"[4, 0], "begin start"[6, 0]
+Test 6, LTR:
+Move right by one word
+"this is relative"[0, 5, 8, 16], "this is absolute"[0, 5, 8, 16]
+Move left by one word
+"this is absolute"[16, 8, 5, 0], "this is relative"[8, 5, 0], "this is fixed"[8, 5], "this is float"[8, 5, 0], "end ing"[4, 0], "abc def"[4, 0], "begin start"[6, 0]
+Test 7, LTR:
+Move right by one word
+"this is absolute"[0, 5, 8, 16]
+Move left by one word
+"this is absolute"[16, 8, 5, 0], "this is relative"[8, 5, 0], "this is fixed"[8, 5], "this is float"[8, 5, 0], "end ing"[4, 0], "abc def"[4, 0], "begin start"[6, 0]
+

Added: trunk/LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element.html (0 => 98428)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element.html	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element.html	2011-10-26 04:57:39 UTC (rev 98428)
@@ -0,0 +1,56 @@
+<script src=""
+<script>
+
+_onload_ = function() {
+    try {
+        runTest();
+    } finally {
+        flushLog();
+    }
+};
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+
+<div id="testMoveByWord" contenteditable style="width:2000px; height:2000px">
+<div id="d_1" dir=ltr 
+title="[d_1, 0][d_1, 6][d_1, 11][d_2, 0][d_2, 4][d_2, 7][d_3, 0][d_3, 4][d_3, 7][d_4, 0][d_4, 5][d_4, 8][d_4, 13][d_5, 5][d_5, 8][d_5, 13][d_6, 0][d_6, 5][d_6, 8][d_6, 16][d_7, 0][d_7, 5][d_7, 8][d_7, 16]|
+[d_7, 16][d_7, 8][d_7, 5][d_7, 0][d_6, 8][d_6, 5][d_6, 0][d_5, 8][d_5, 5][d_4, 8][d_4, 5][d_4, 0][d_3, 4][d_3, 0][d_2, 4][d_2, 0][d_1, 6][d_1, 0]" 
+class="test_move_by_word">begin start</div>
+
+<div id="d_2" dir=ltr 
+title="[d_2, 0][d_2, 4][d_2, 7][d_3, 0][d_3, 4][d_3, 7][d_4, 0][d_4, 5][d_4, 8][d_4, 13][d_5, 5][d_5, 8][d_5, 13][d_6, 0][d_6, 5][d_6, 8][d_6, 16][d_7, 0][d_7, 5][d_7, 8][d_7, 16]|
+[d_7, 16][d_7, 8][d_7, 5][d_7, 0][d_6, 8][d_6, 5][d_6, 0][d_5, 8][d_5, 5][d_4, 8][d_4, 5][d_4, 0][d_3, 4][d_3, 0][d_2, 4][d_2, 0][d_1, 6][d_1, 0]" 
+class="test_move_by_word" style="display:inline-block">abc def</div>
+
+<div id="d_3" dir=ltr 
+title="[d_3, 0][d_3, 4][d_3, 7][d_4, 0][d_4, 5][d_4, 8][d_4, 13][d_5, 5][d_5, 8][d_5, 13][d_6, 0][d_6, 5][d_6, 8][d_6, 16][d_7, 0][d_7, 5][d_7, 8][d_7, 16]|
+[d_7, 16][d_7, 8][d_7, 5][d_7, 0][d_6, 8][d_6, 5][d_6, 0][d_5, 8][d_5, 5][d_4, 8][d_4, 5][d_4, 0][d_3, 4][d_3, 0][d_2, 4][d_2, 0][d_1, 6][d_1, 0]" 
+class="test_move_by_word">end ing</div>
+
+<div id="d_4" dir=ltr 
+title="[d_4, 0][d_4, 5][d_4, 8][d_4, 13][d_5, 5][d_5, 8][d_5, 13][d_6, 0][d_6, 5][d_6, 8][d_6, 16][d_7, 0][d_7, 5][d_7, 8][d_7, 16]|
+[d_7, 16][d_7, 8][d_7, 5][d_7, 0][d_6, 8][d_6, 5][d_6, 0][d_5, 8][d_5, 5][d_4, 8][d_4, 5][d_4, 0][d_3, 4][d_3, 0][d_2, 4][d_2, 0][d_1, 6][d_1, 0]" 
+class="test_move_by_word" style="float:left">this is float</div>
+
+<div id="d_5" dir=ltr 
+title="[d_5, 0][d_5, 5][d_5, 8][d_5, 13][d_6, 0][d_6, 5][d_6, 8][d_6, 16][d_7, 0][d_7, 5][d_7, 8][d_7, 16]|
+[d_7, 16][d_7, 8][d_7, 5][d_7, 0][d_6, 8][d_6, 5][d_6, 0][d_5, 8][d_5, 5][d_4, 8][d_4, 5][d_4, 0][d_3, 4][d_3, 0][d_2, 4][d_2, 0][d_1, 6][d_1, 0]" 
+class="test_move_by_word" style="position:fixed; top:30px; right:5px">this is fixed</div>
+
+<div id="d_6" dir=ltr 
+title="[d_6, 0][d_6, 5][d_6, 8][d_6, 16][d_7, 0][d_7, 5][d_7, 8][d_7, 16]|
+[d_7, 16][d_7, 8][d_7, 5][d_7, 0][d_6, 8][d_6, 5][d_6, 0][d_5, 8][d_5, 5][d_4, 8][d_4, 5][d_4, 0][d_3, 4][d_3, 0][d_2, 4][d_2, 0][d_1, 6][d_1, 0]" 
+class="test_move_by_word" style="position:relative; left:20px">this is relative</div>
+
+<div id="d_7" dir=ltr 
+title="[d_7, 0][d_7, 5][d_7, 8][d_7, 16]|
+[d_7, 16][d_7, 8][d_7, 5][d_7, 0][d_6, 8][d_6, 5][d_6, 0][d_5, 8][d_5, 5][d_4, 8][d_4, 5][d_4, 0][d_3, 4][d_3, 0][d_2, 4][d_2, 0][d_1, 6][d_1, 0]" 
+class="test_move_by_word" style="position:absolute; left:100px; top:150px">this is absolute</div>
+
+</div>
+
+<pre id="console"></pre>
+</body>
+</html>

Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-multi-line-expected.txt (98427 => 98428)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-multi-line-expected.txt	2011-10-26 03:06:58 UTC (rev 98427)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-multi-line-expected.txt	2011-10-26 04:57:39 UTC (rev 98428)
@@ -7,17 +7,9 @@
 "opq rst uvw xyz"[15, 12, 8, 4, 0], "abc def ghi jkl mn "[16, 12, 8, 4, 0]
 Test 2, LTR:
 Move right by one word
-"abc def ghi jkl mn "[0, 4, 8, 12, 16, 18]    FAIL expected: ["abc def ghi jkl mn "[ 0,  4,  8,  12,  16,  18, ]"opq rst uvw xyz"[ 0,  4,  8,  12,  15]
-"abc def ghi jkl mn "[18, 18]   FAIL expected "opq rst uvw xyz"[ 0]
-<DIV>[0, 0]   FAIL expected "opq rst uvw xyz"[ 0]
-<DIV>[0, 0]   FAIL expected "opq rst uvw xyz"[ 0]
-<DIV>[0, 0]   FAIL expected "opq rst uvw xyz"[ 0]
+"abc def ghi jkl mn "[0, 4, 8, 12, 16, 18], "opq rst uvw xyz"[0, 4, 8, 12, 15]
 Move left by one word
-"opq rst uvw xyz"[15, 12, 8, 4, 0]    FAIL expected: ["opq rst uvw xyz"[ 15,  12,  8,  4,  0, ]"abc def ghi jkl mn "[ 16,  12,  8,  4,  0]
-"opq rst uvw xyz"[0, 0]   FAIL expected "abc def ghi jkl mn "[ 16]
-<DIV>[0, 0]   FAIL expected "abc def ghi jkl mn "[ 16]
-<DIV>[0, 0]   FAIL expected "abc def ghi jkl mn "[ 16]
-<DIV>[0, 0]   FAIL expected "abc def ghi jkl mn "[ 16]
+"opq rst uvw xyz"[15, 12, 8, 4, 0], "abc def ghi jkl mn "[16, 12, 8, 4, 0]
 Test 3, LTR:
 Move right by one word
 "AAA AAA AAA AAA "[0, 3, 8, 11, 16], "AAA AAA AAA AAA"[0, 3, 8, 11, 15]
@@ -25,17 +17,9 @@
 "AAA AAA AAA AAA"[15, 11, 8, 3, 0], "AAA AAA AAA AAA "[11, 8, 3, 0]
 Test 4, LTR:
 Move right by one word
-"AAA AAA AAA AAA "[0, 3, 8, 11, 16]    FAIL expected: ["AAA AAA AAA AAA "[ 0,  3,  8,  11,  16, ]"AAA AAA AAA AAA"[ 0,  3,  8,  11,  15]
-"AAA AAA AAA AAA "[16, 16]   FAIL expected "AAA AAA AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA"[ 0]
+"AAA AAA AAA AAA "[0, 3, 8, 11, 16], "AAA AAA AAA AAA"[0, 3, 8, 11, 15]
 Move left by one word
-"AAA AAA AAA AAA"[15, 11, 8, 3, 0]    FAIL expected: ["AAA AAA AAA AAA"[ 15,  11,  8,  3,  0, ]"AAA AAA AAA AAA "[ 11,  8,  3,  0]
-"AAA AAA AAA AAA"[0, 0]   FAIL expected "AAA AAA AAA AAA "[ 11]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA "[ 11]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA "[ 11]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA "[ 11]
+"AAA AAA AAA AAA"[15, 11, 8, 3, 0], "AAA AAA AAA AAA "[11, 8, 3, 0]
 Test 5, LTR:
 Move right by one word
 " abc def AAA AAA hij AAA AAA uvw xyz "[1, 5, 9, 12, 17, 21, 25, 29, 33, 37], "AAA kj AAA mn opq AAA AAA"[0, 4, 7, 11, 14, 18, 22, 25]
@@ -43,17 +27,9 @@
 "AAA kj AAA mn opq AAA AAA"[25, 22, 18, 14, 11, 7, 4, 0], " abc def AAA AAA hij AAA AAA uvw xyz "[33, 29, 25, 21, 17, 12, 9, 5, 1]
 Test 6, LTR:
 Move right by one word
-" abc def AAA AAA hij AAA AAA uvw xyz "[1, 5, 9, 12, 17, 21, 25, 29, 33, 36]    FAIL expected: [" abc def AAA AAA hij AAA AAA uvw xyz "[ 1,  5,  9,  12,  17,  21,  25,  29,  33,  36, ]"AAA kj AAA mn opq AAA AAA"[ 0,  4,  7,  11,  14,  18,  22,  25]
-" abc def AAA AAA hij AAA AAA uvw xyz "[36, 36]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
+" abc def AAA AAA hij AAA AAA uvw xyz "[1, 5, 9, 12, 17, 21, 25, 29, 33, 36], "AAA kj AAA mn opq AAA AAA"[0, 4, 7, 11, 14, 18, 22, 25]
 Move left by one word
-"AAA kj AAA mn opq AAA AAA"[25, 22, 18, 14, 11, 7, 4, 0]    FAIL expected: ["AAA kj AAA mn opq AAA AAA"[ 25,  22,  18,  14,  11,  7,  4,  0, ]" abc def AAA AAA hij AAA AAA uvw xyz "[ 33,  29,  25,  21,  17,  12,  9,  5,  1]
-"AAA kj AAA mn opq AAA AAA"[0, 0]   FAIL expected " abc def AAA AAA hij AAA AAA uvw xyz "[ 33]
-<DIV>[0, 0]   FAIL expected " abc def AAA AAA hij AAA AAA uvw xyz "[ 33]
-<DIV>[0, 0]   FAIL expected " abc def AAA AAA hij AAA AAA uvw xyz "[ 33]
-<DIV>[0, 0]   FAIL expected " abc def AAA AAA hij AAA AAA uvw xyz "[ 33]
+"AAA kj AAA mn opq AAA AAA"[25, 22, 18, 14, 11, 7, 4, 0], " abc def AAA AAA hij AAA AAA uvw xyz "[33, 29, 25, 21, 17, 12, 9, 5, 1]
 Test 7, RTL:
 Move left by one word
 "abc def ghi jkl mn "[0, 3, 8, 11, 16, 19], "opq rst uvw xyz"[0, 3, 8, 11, 15]
@@ -61,17 +37,9 @@
 "opq rst uvw xyz"[15, 11, 8, 3, 0], "abc def ghi jkl mn "[16, 11, 8, 3, 0]
 Test 8, RTL:
 Move left by one word
-"abc def ghi jkl mn "[0, 3, 8, 11, 16, 18]    FAIL expected: ["abc def ghi jkl mn "[ 0,  3,  8,  11,  16,  18, ]"opq rst uvw xyz"[ 0,  3,  8,  11,  15]
-"abc def ghi jkl mn "[18, 18]   FAIL expected "opq rst uvw xyz"[ 0]
-<DIV>[0, 0]   FAIL expected "opq rst uvw xyz"[ 0]
-<DIV>[0, 0]   FAIL expected "opq rst uvw xyz"[ 0]
-<DIV>[0, 0]   FAIL expected "opq rst uvw xyz"[ 0]
+"abc def ghi jkl mn "[0, 3, 8, 11, 16, 18], "opq rst uvw xyz"[0, 3, 8, 11, 15]
 Move right by one word
-"opq rst uvw xyz"[15, 11, 8, 3, 0]    FAIL expected: ["opq rst uvw xyz"[ 15,  11,  8,  3,  0, ]"abc def ghi jkl mn "[ 18,  16,  11,  8,  3,  0]
-"opq rst uvw xyz"[0, 0]   FAIL expected "abc def ghi jkl mn "[ 18]
-<DIV>[0, 0]   FAIL expected "abc def ghi jkl mn "[ 18]
-<DIV>[0, 0]   FAIL expected "abc def ghi jkl mn "[ 18]
-<DIV>[0, 0]   FAIL expected "abc def ghi jkl mn "[ 18]
+"opq rst uvw xyz"[15, 11, 8, 3, 0], "abc def ghi jkl mn "[18, 16, 11, 8, 3, 0]
 Test 9, RTL:
 Move left by one word
 "AAA AAA AAA AAA "[0, 4, 8, 12, 16], "AAA AAA AAA AAA"[0, 4, 8, 12, 15]
@@ -79,17 +47,9 @@
 "AAA AAA AAA AAA"[15, 12, 8, 4, 0], "AAA AAA AAA AAA "[12, 8, 4, 0]
 Test 10, RTL:
 Move left by one word
-"AAA AAA AAA AAA "[0, 4, 8, 12, 16]    FAIL expected: ["AAA AAA AAA AAA "[ 0,  4,  8,  12,  16, ]"AAA AAA AAA AAA"[ 0,  4,  8,  12,  15]
-"AAA AAA AAA AAA "[16, 16]   FAIL expected "AAA AAA AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA"[ 0]
+"AAA AAA AAA AAA "[0, 4, 8, 12, 16], "AAA AAA AAA AAA"[0, 4, 8, 12, 15]
 Move right by one word
-"AAA AAA AAA AAA"[15, 12, 8, 4, 0]    FAIL expected: ["AAA AAA AAA AAA"[ 15,  12,  8,  4,  0, ]"AAA AAA AAA AAA "[ 12,  8,  4,  0]
-"AAA AAA AAA AAA"[0, 0]   FAIL expected "AAA AAA AAA AAA "[ 12]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA "[ 12]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA "[ 12]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA "[ 12]
+"AAA AAA AAA AAA"[15, 12, 8, 4, 0], "AAA AAA AAA AAA "[12, 8, 4, 0]
 Test 11, RTL:
 Move left by one word
 " abc def AAA AAA hij AAA AAA uvw xyz "[1, 4, 9, 13, 17, 21, 25, 29, 33, 37], "AAA kj AAA mn opq AAA AAA"[0, 4, 7, 11, 14, 18, 22, 25]
@@ -97,17 +57,9 @@
 "AAA kj AAA mn opq AAA AAA"[25, 22, 18, 14, 11, 7, 4, 0], " abc def AAA AAA hij AAA AAA uvw xyz "[33, 29, 25, 21, 17, 13, 9, 4, 1]
 Test 12, RTL:
 Move left by one word
-" abc def AAA AAA hij AAA AAA uvw xyz "[1, 4, 9, 13, 17, 21, 25, 29, 33, 36]    FAIL expected: [" abc def AAA AAA hij AAA AAA uvw xyz "[ 1,  4,  9,  13,  17,  21,  25,  29,  33,  36, ]"AAA kj AAA mn opq AAA AAA"[ 0,  4,  7,  11,  14,  18,  22,  25]
-" abc def AAA AAA hij AAA AAA uvw xyz "[36, 36]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
+" abc def AAA AAA hij AAA AAA uvw xyz "[1, 4, 9, 13, 17, 21, 25, 29, 33, 36], "AAA kj AAA mn opq AAA AAA"[0, 4, 7, 11, 14, 18, 22, 25]
 Move right by one word
-"AAA kj AAA mn opq AAA AAA"[25, 22, 18, 14, 11, 7, 4, 0]    FAIL expected: ["AAA kj AAA mn opq AAA AAA"[ 25,  22,  18,  14,  11,  7,  4,  0, ]" abc def AAA AAA hij AAA AAA uvw xyz "[ 36,  33,  29,  25,  21,  17,  13,  9,  4,  1]
-"AAA kj AAA mn opq AAA AAA"[0, 0]   FAIL expected " abc def AAA AAA hij AAA AAA uvw xyz "[ 36]
-<DIV>[0, 0]   FAIL expected " abc def AAA AAA hij AAA AAA uvw xyz "[ 36]
-<DIV>[0, 0]   FAIL expected " abc def AAA AAA hij AAA AAA uvw xyz "[ 36]
-<DIV>[0, 0]   FAIL expected " abc def AAA AAA hij AAA AAA uvw xyz "[ 36]
+"AAA kj AAA mn opq AAA AAA"[25, 22, 18, 14, 11, 7, 4, 0], " abc def AAA AAA hij AAA AAA uvw xyz "[36, 33, 29, 25, 21, 17, 13, 9, 4, 1]
 Test 13, LTR:
 Move right by one word
 "abc def "[0, 4]

Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-one-element-expected.txt (98427 => 98428)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-one-element-expected.txt	2011-10-26 03:06:58 UTC (rev 98427)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-one-element-expected.txt	2011-10-26 04:57:39 UTC (rev 98428)
@@ -80,4 +80,9 @@
 "ZQB abc RIG"[0, 4, 8, 11]
 Move right by one word
 "ZQB abc RIG"[11, 8, 4, 0]
+Test 17, LTR:
+Move right by one word
+<DIV>[0]
+Move left by one word
+<DIV>[0]
 

Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-one-element.html (98427 => 98428)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-one-element.html	2011-10-26 03:06:58 UTC (rev 98427)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-one-element.html	2011-10-26 04:57:39 UTC (rev 98428)
@@ -63,6 +63,9 @@
 <div dir=ltr class="test_move_by_word" title="0 4 8 11|11 8 4 0" contenteditable>שנב abc סטז</div>
 <div dir=rtl class="test_move_by_word" title="11 8 4 0|0 4 8 11" contenteditable>שנב abc סטז</div>
 
+<!-- empty div -->
+<div dir=ltr class="test_move_by_word" title="0|0" contenteditable></div>
+
 </div>
 <pre id="console"></pre>
 </body>

Modified: trunk/LayoutTests/platform/gtk/editing/selection/move-by-word-visually-multi-line-expected.txt (98427 => 98428)


--- trunk/LayoutTests/platform/gtk/editing/selection/move-by-word-visually-multi-line-expected.txt	2011-10-26 03:06:58 UTC (rev 98427)
+++ trunk/LayoutTests/platform/gtk/editing/selection/move-by-word-visually-multi-line-expected.txt	2011-10-26 04:57:39 UTC (rev 98428)
@@ -7,17 +7,9 @@
 "opq rst uvw xyz"[15, 12, 8, 4, 0], "abc def ghi jkl mn "[16, 12, 8, 4, 0]
 Test 2, LTR:
 Move right by one word
-"abc def ghi jkl mn "[0, 4, 8, 12, 16, 18]    FAIL expected: ["abc def ghi jkl mn "[ 0,  4,  8,  12,  16,  18, ]"opq rst uvw xyz"[ 0,  4,  8,  12,  15]
-"abc def ghi jkl mn "[18, 18]   FAIL expected "opq rst uvw xyz"[ 0]
-<DIV>[0, 0]   FAIL expected "opq rst uvw xyz"[ 0]
-<DIV>[0, 0]   FAIL expected "opq rst uvw xyz"[ 0]
-<DIV>[0, 0]   FAIL expected "opq rst uvw xyz"[ 0]
+"abc def ghi jkl mn "[0, 4, 8, 12, 16, 18], "opq rst uvw xyz"[0, 4, 8, 12, 15]
 Move left by one word
-"opq rst uvw xyz"[15, 12, 8, 4, 0]    FAIL expected: ["opq rst uvw xyz"[ 15,  12,  8,  4,  0, ]"abc def ghi jkl mn "[ 16,  12,  8,  4,  0]
-"opq rst uvw xyz"[0, 0]   FAIL expected "abc def ghi jkl mn "[ 16]
-<DIV>[0, 0]   FAIL expected "abc def ghi jkl mn "[ 16]
-<DIV>[0, 0]   FAIL expected "abc def ghi jkl mn "[ 16]
-<DIV>[0, 0]   FAIL expected "abc def ghi jkl mn "[ 16]
+"opq rst uvw xyz"[15, 12, 8, 4, 0], "abc def ghi jkl mn "[16, 12, 8, 4, 0]
 Test 3, LTR:
 Move right by one word
 "AAA AAA AAA AAA "[0, 3, 8, 11, 16], "AAA AAA AAA AAA"[0, 3, 8, 11, 15]
@@ -25,17 +17,9 @@
 "AAA AAA AAA AAA"[15, 11, 8, 3, 0], "AAA AAA AAA AAA "[11, 8, 3, 0]
 Test 4, LTR:
 Move right by one word
-"AAA AAA AAA AAA "[0, 3, 8, 11, 16]    FAIL expected: ["AAA AAA AAA AAA "[ 0,  3,  8,  11,  16, ]"AAA AAA AAA AAA"[ 0,  3,  8,  11,  15]
-"AAA AAA AAA AAA "[16, 16]   FAIL expected "AAA AAA AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA"[ 0]
+"AAA AAA AAA AAA "[0, 3, 8, 11, 16], "AAA AAA AAA AAA"[0, 3, 8, 11, 15]
 Move left by one word
-"AAA AAA AAA AAA"[15, 11, 8, 3, 0]    FAIL expected: ["AAA AAA AAA AAA"[ 15,  11,  8,  3,  0, ]"AAA AAA AAA AAA "[ 11,  8,  3,  0]
-"AAA AAA AAA AAA"[0, 0]   FAIL expected "AAA AAA AAA AAA "[ 11]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA "[ 11]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA "[ 11]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA "[ 11]
+"AAA AAA AAA AAA"[15, 11, 8, 3, 0], "AAA AAA AAA AAA "[11, 8, 3, 0]
 Test 5, LTR:
 Move right by one word
 " abc def AAA AAA hij AAA AAA uvw xyz "[1, 5, 9, 12, 17, 21, 25, 29, 33, 37], "AAA kj AAA mn opq AAA AAA"[0, 4, 7, 11, 14, 18, 22, 25]
@@ -43,17 +27,9 @@
 "AAA kj AAA mn opq AAA AAA"[25, 22, 18, 14, 11, 7, 4, 0], " abc def AAA AAA hij AAA AAA uvw xyz "[33, 29, 25, 21, 17, 12, 9, 5, 1]
 Test 6, LTR:
 Move right by one word
-" abc def AAA AAA hij AAA AAA uvw xyz "[1, 5, 9, 12, 17, 21, 25, 29, 33, 36]    FAIL expected: [" abc def AAA AAA hij AAA AAA uvw xyz "[ 1,  5,  9,  12,  17,  21,  25,  29,  33,  36, ]"AAA kj AAA mn opq AAA AAA"[ 0,  4,  7,  11,  14,  18,  22,  25]
-" abc def AAA AAA hij AAA AAA uvw xyz "[36, 36]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
+" abc def AAA AAA hij AAA AAA uvw xyz "[1, 5, 9, 12, 17, 21, 25, 29, 33, 36], "AAA kj AAA mn opq AAA AAA"[0, 4, 7, 11, 14, 18, 22, 25]
 Move left by one word
-"AAA kj AAA mn opq AAA AAA"[25, 22, 18, 14, 11, 7, 4, 0]    FAIL expected: ["AAA kj AAA mn opq AAA AAA"[ 25,  22,  18,  14,  11,  7,  4,  0, ]" abc def AAA AAA hij AAA AAA uvw xyz "[ 33,  29,  25,  21,  17,  12,  9,  5,  1]
-"AAA kj AAA mn opq AAA AAA"[0, 0]   FAIL expected " abc def AAA AAA hij AAA AAA uvw xyz "[ 33]
-<DIV>[0, 0]   FAIL expected " abc def AAA AAA hij AAA AAA uvw xyz "[ 33]
-<DIV>[0, 0]   FAIL expected " abc def AAA AAA hij AAA AAA uvw xyz "[ 33]
-<DIV>[0, 0]   FAIL expected " abc def AAA AAA hij AAA AAA uvw xyz "[ 33]
+"AAA kj AAA mn opq AAA AAA"[25, 22, 18, 14, 11, 7, 4, 0], " abc def AAA AAA hij AAA AAA uvw xyz "[33, 29, 25, 21, 17, 12, 9, 5, 1]
 Test 7, RTL:
 Move left by one word
 "abc def ghi jkl mn "[0, 3, 8, 11, 16, 19], "opq rst uvw xyz"[0, 3, 8, 11, 15]
@@ -61,17 +37,9 @@
 "opq rst uvw xyz"[15, 11, 8, 3, 0], "abc def ghi jkl mn "[16, 11, 8, 3, 0]
 Test 8, RTL:
 Move left by one word
-"abc def ghi jkl mn "[0, 3, 8, 11, 16, 18]    FAIL expected: ["abc def ghi jkl mn "[ 0,  3,  8,  11,  16,  18, ]"opq rst uvw xyz"[ 0,  3,  8,  11,  15]
-"abc def ghi jkl mn "[18, 18]   FAIL expected "opq rst uvw xyz"[ 0]
-<DIV>[0, 0]   FAIL expected "opq rst uvw xyz"[ 0]
-<DIV>[0, 0]   FAIL expected "opq rst uvw xyz"[ 0]
-<DIV>[0, 0]   FAIL expected "opq rst uvw xyz"[ 0]
+"abc def ghi jkl mn "[0, 3, 8, 11, 16, 18], "opq rst uvw xyz"[0, 3, 8, 11, 15]
 Move right by one word
-"opq rst uvw xyz"[15, 11, 8, 3, 0]    FAIL expected: ["opq rst uvw xyz"[ 15,  11,  8,  3,  0, ]"abc def ghi jkl mn "[ 18,  16,  11,  8,  3,  0]
-"opq rst uvw xyz"[0, 0]   FAIL expected "abc def ghi jkl mn "[ 18]
-<DIV>[0, 0]   FAIL expected "abc def ghi jkl mn "[ 18]
-<DIV>[0, 0]   FAIL expected "abc def ghi jkl mn "[ 18]
-<DIV>[0, 0]   FAIL expected "abc def ghi jkl mn "[ 18]
+"opq rst uvw xyz"[15, 11, 8, 3, 0], "abc def ghi jkl mn "[18, 16, 11, 8, 3, 0]
 Test 9, RTL:
 Move left by one word
 "AAA AAA AAA AAA "[0, 4, 8, 12, 16], "AAA AAA AAA AAA"[0, 4, 8, 12, 15]
@@ -79,17 +47,9 @@
 "AAA AAA AAA AAA"[15, 12, 8, 4, 0], "AAA AAA AAA AAA "[12, 8, 4, 0]
 Test 10, RTL:
 Move left by one word
-"AAA AAA AAA AAA "[0, 4, 8, 12, 16]    FAIL expected: ["AAA AAA AAA AAA "[ 0,  4,  8,  12,  16, ]"AAA AAA AAA AAA"[ 0,  4,  8,  12,  15]
-"AAA AAA AAA AAA "[16, 16]   FAIL expected "AAA AAA AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA"[ 0]
+"AAA AAA AAA AAA "[0, 4, 8, 12, 16], "AAA AAA AAA AAA"[0, 4, 8, 12, 15]
 Move right by one word
-"AAA AAA AAA AAA"[15, 12, 8, 4, 0]    FAIL expected: ["AAA AAA AAA AAA"[ 15,  12,  8,  4,  0, ]"AAA AAA AAA AAA "[ 12,  8,  4,  0]
-"AAA AAA AAA AAA"[0, 0]   FAIL expected "AAA AAA AAA AAA "[ 12]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA "[ 12]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA "[ 12]
-<DIV>[0, 0]   FAIL expected "AAA AAA AAA AAA "[ 12]
+"AAA AAA AAA AAA"[15, 12, 8, 4, 0], "AAA AAA AAA AAA "[12, 8, 4, 0]
 Test 11, RTL:
 Move left by one word
 " abc def AAA AAA hij AAA AAA uvw xyz "[1, 4, 9, 13, 17, 21, 25, 29, 33, 37], "AAA kj AAA mn opq AAA AAA"[0, 4, 7, 11, 14, 18, 22, 25]
@@ -97,17 +57,9 @@
 "AAA kj AAA mn opq AAA AAA"[25, 22, 18, 14, 11, 7, 4, 0], " abc def AAA AAA hij AAA AAA uvw xyz "[33, 29, 25, 21, 17, 13, 9, 4, 1]
 Test 12, RTL:
 Move left by one word
-" abc def AAA AAA hij AAA AAA uvw xyz "[1, 4, 9, 13, 17, 21, 25, 29, 33, 36]    FAIL expected: [" abc def AAA AAA hij AAA AAA uvw xyz "[ 1,  4,  9,  13,  17,  21,  25,  29,  33,  36, ]"AAA kj AAA mn opq AAA AAA"[ 0,  4,  7,  11,  14,  18,  22,  25]
-" abc def AAA AAA hij AAA AAA uvw xyz "[36, 36]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
-<DIV>[0, 0]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
+" abc def AAA AAA hij AAA AAA uvw xyz "[1, 4, 9, 13, 17, 21, 25, 29, 33, 36], "AAA kj AAA mn opq AAA AAA"[0, 4, 7, 11, 14, 18, 22, 25]
 Move right by one word
-"AAA kj AAA mn opq AAA AAA"[25, 22, 18, 14, 11, 7, 4, 0]    FAIL expected: ["AAA kj AAA mn opq AAA AAA"[ 25,  22,  18,  14,  11,  7,  4,  0, ]" abc def AAA AAA hij AAA AAA uvw xyz "[ 36,  33,  29,  25,  21,  17,  13,  9,  4,  1]
-"AAA kj AAA mn opq AAA AAA"[0, 0]   FAIL expected " abc def AAA AAA hij AAA AAA uvw xyz "[ 36]
-<DIV>[0, 0]   FAIL expected " abc def AAA AAA hij AAA AAA uvw xyz "[ 36]
-<DIV>[0, 0]   FAIL expected " abc def AAA AAA hij AAA AAA uvw xyz "[ 36]
-<DIV>[0, 0]   FAIL expected " abc def AAA AAA hij AAA AAA uvw xyz "[ 36]
+"AAA kj AAA mn opq AAA AAA"[25, 22, 18, 14, 11, 7, 4, 0], " abc def AAA AAA hij AAA AAA uvw xyz "[36, 33, 29, 25, 21, 17, 13, 9, 4, 1]
 Test 13, LTR:
 Move right by one word
 "abc def "[0, 4]

Modified: trunk/Source/WebCore/ChangeLog (98427 => 98428)


--- trunk/Source/WebCore/ChangeLog	2011-10-26 03:06:58 UTC (rev 98427)
+++ trunk/Source/WebCore/ChangeLog	2011-10-26 04:57:39 UTC (rev 98428)
@@ -1,3 +1,21 @@
+2011-10-25  Xiaomei Ji  <x...@chromium.org>
+
+        --webkit-visual-word does not work in multi-line
+        https://bugs.webkit.org/show_bug.cgi?id=61344
+
+        Reviewed by Ryosuke Niwa.
+
+        Get next or previous root inline box (which is not in the same
+        render object as the current root inline box) by traversing DOM node.
+
+        Test: editing/selection/move-by-word-visually-inline-block-positioned-element.html
+
+        * editing/visible_units.cpp:
+        (WebCore::previousRootInlineBox):
+        (WebCore::nextRootInlineBox):
+        (WebCore::leftInlineBox):
+        (WebCore::rightInlineBox):
+
 2011-10-25  Adam Barth  <aba...@webkit.org>
 
         JSEventTarget.cpp has a bunch of unnessary includes

Modified: trunk/Source/WebCore/editing/visible_units.cpp (98427 => 98428)


--- trunk/Source/WebCore/editing/visible_units.cpp	2011-10-26 03:06:58 UTC (rev 98427)
+++ trunk/Source/WebCore/editing/visible_units.cpp	2011-10-26 04:57:39 UTC (rev 98428)
@@ -1426,6 +1426,53 @@
     return offsetNotFound;
 }
 
+static const RootInlineBox* previousRootInlineBox(const InlineBox* box)
+{
+    Node* node = box->renderer()->node();
+    Node* enclosingBlockNode = enclosingNodeWithNonInlineRenderer(node);
+    Node* previousNode = node->previousLeafNode();
+    while (previousNode && enclosingBlockNode == enclosingNodeWithNonInlineRenderer(previousNode))
+        previousNode = previousNode->previousLeafNode();
+  
+    while (previousNode) {
+        Position pos = createLegacyEditingPosition(previousNode, caretMaxOffset(previousNode));
+        
+        if (pos.isCandidate()) {
+            RenderedPosition renderedPos(pos, DOWNSTREAM);
+            RootInlineBox* root = renderedPos.rootBox();
+            if (root)
+                return root;
+        }
+
+        previousNode = previousNode->previousLeafNode();
+    }
+    return 0;
+}
+
+static const RootInlineBox* nextRootInlineBox(const InlineBox* box)
+{
+    Node* node = box->renderer()->node();
+    Node* enclosingBlockNode = enclosingNodeWithNonInlineRenderer(node);
+    Node* nextNode = node->nextLeafNode();
+    while (nextNode && enclosingBlockNode == enclosingNodeWithNonInlineRenderer(nextNode))
+        nextNode = nextNode->nextLeafNode();
+  
+    while (nextNode) {
+        Position pos;
+        pos = createLegacyEditingPosition(nextNode, caretMinOffset(nextNode));
+        
+        if (pos.isCandidate()) {
+            RenderedPosition renderedPos(pos, DOWNSTREAM);
+            RootInlineBox* root = renderedPos.rootBox();
+            if (root)
+                return root;
+        }
+
+        nextNode = nextNode->nextLeafNode();
+    }
+    return 0;
+}
+
 static const InlineBox* leftInlineBox(const InlineBox* box, TextDirection blockDirection)
 {
     if (box->prevLeafChild())
@@ -1437,7 +1484,9 @@
     if (leftLineBox)
         return leftLineBox->lastLeafChild();
 
-    return 0;
+    const RootInlineBox* leftRootInlineBox = isBlockLTR ? previousRootInlineBox(box) :
+        nextRootInlineBox(box); 
+    return leftRootInlineBox ? leftRootInlineBox->lastLeafChild() : 0; 
 }
 
 static const InlineBox* rightInlineBox(const InlineBox* box, TextDirection blockDirection)
@@ -1451,7 +1500,9 @@
     if (rightLineBox)
         return rightLineBox->firstLeafChild();
 
-    return 0;
+    const RootInlineBox* rightRootInlineBox = isBlockLTR ? nextRootInlineBox(box) :
+        previousRootInlineBox(box); 
+    return rightRootInlineBox ? rightRootInlineBox->firstLeafChild() : 0; 
 }
 
 static VisiblePosition leftWordBoundary(const InlineBox* box, int offset, TextDirection blockDirection)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to