Title: [101430] trunk
Revision
101430
Author
x...@chromium.org
Date
2011-11-29 16:23:23 -0800 (Tue, 29 Nov 2011)

Log Message

--webkit-visual-word should be able to reach end of text, instead of end of line
https://bugs.webkit.org/show_bug.cgi?id=72048

Reviewed by Ryosuke Niwa.

Source/WebCore: 

Revert r92223 -- webkit-visual-word should reach boundary of line.
When there is no more left or right words in the same editing boundary and
current position is an editable position, return start or end position in this
editable content.

Test: editing/selection/move-by-word-visually-textarea.html

* editing/visible_units.cpp:
(WebCore::collectWordBreaksInBoxInsideBlockWithSameDirectionality):
(WebCore::collectWordBreaksInBoxInsideBlockWithDifferntDirectionality):
(WebCore::leftWordPosition):
(WebCore::rightWordPosition):

LayoutTests: 

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (101429 => 101430)


--- trunk/LayoutTests/ChangeLog	2011-11-30 00:19:58 UTC (rev 101429)
+++ trunk/LayoutTests/ChangeLog	2011-11-30 00:23:23 UTC (rev 101430)
@@ -1,3 +1,18 @@
+2011-11-10  Xiaomei Ji  <x...@chromium.org>
+
+        --webkit-visual-word should be able to reach end of text, instead of end of line
+        https://bugs.webkit.org/show_bug.cgi?id=72048
+
+        Reviewed by Ryosuke Niwa.
+
+        * editing/selection/move-by-word-visually-inline-block-positioned-element-expected.txt:
+        * editing/selection/move-by-word-visually-inline-block-positioned-element.html:
+        * editing/selection/move-by-word-visually-multi-line-expected.txt:
+        * editing/selection/move-by-word-visually-multi-line.html:
+        * editing/selection/move-by-word-visually-single-space-inline-element-expected.txt:
+        * editing/selection/move-by-word-visually-textarea-expected.txt: Added.
+        * editing/selection/move-by-word-visually-textarea.html: Added.
+
 2011-11-29  Alan Stearns  <stea...@adobe.com>
 
         Clean up fast/regions/no-split-line-box.html test

Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element-expected.txt (101429 => 101430)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element-expected.txt	2011-11-30 00:19:58 UTC (rev 101429)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element-expected.txt	2011-11-30 00:23:23 UTC (rev 101430)
@@ -2,32 +2,32 @@
 ======== 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]
+"begin start"[0, 6], "abc def"[0, 4], "end ing"[0, 4], "this is float"[0, 5, 8], "this is fixed"[5, 8], "this is relative"[0, 5, 8], "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]
+"abc def"[0, 4], "end ing"[0, 4], "this is float"[0, 5, 8], "this is fixed"[5, 8], "this is relative"[0, 5, 8], "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]
+"end ing"[0, 4], "this is float"[0, 5, 8], "this is fixed"[5, 8], "this is relative"[0, 5, 8], "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]
+"this is float"[0, 5, 8], "this is fixed"[5, 8], "this is relative"[0, 5, 8], "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]
+"this is fixed"[0, 5, 8], "this is relative"[0, 5, 8], "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]
+"this is relative"[0, 5, 8], "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:

Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element.html (101429 => 101430)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element.html	2011-11-30 00:19:58 UTC (rev 101429)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element.html	2011-11-30 00:23:23 UTC (rev 101430)
@@ -15,32 +15,32 @@
 
 <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]|
+title="[d_1, 0][d_1, 6][d_2, 0][d_2, 4][d_3, 0][d_3, 4][d_4, 0][d_4, 5][d_4, 8][d_5, 5][d_5, 8][d_6, 0][d_6, 5][d_6, 8][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]|
+title="[d_2, 0][d_2, 4][d_3, 0][d_3, 4][d_4, 0][d_4, 5][d_4, 8][d_5, 5][d_5, 8][d_6, 0][d_6, 5][d_6, 8][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]|
+title="[d_3, 0][d_3, 4][d_4, 0][d_4, 5][d_4, 8][d_5, 5][d_5, 8][d_6, 0][d_6, 5][d_6, 8][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]|
+title="[d_4, 0][d_4, 5][d_4, 8][d_5, 5][d_5, 8][d_6, 0][d_6, 5][d_6, 8][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]|
+title="[d_5, 0][d_5, 5][d_5, 8][d_6, 0][d_6, 5][d_6, 8][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]|
+title="[d_6, 0][d_6, 5][d_6, 8][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>
 

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


--- trunk/LayoutTests/editing/selection/move-by-word-visually-multi-line-expected.txt	2011-11-30 00:19:58 UTC (rev 101429)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-multi-line-expected.txt	2011-11-30 00:23:23 UTC (rev 101430)
@@ -2,62 +2,67 @@
 ======== Move By Word ====
 Test 1, LTR:
 Move right by one word
-"abc def ghi jkl mn "[0, 4, 8, 12, 16, 19], "opq rst uvw xyz"[0, 4, 8, 12, 15]
+"abc def ghi jkl mn "[0, 4, 8, 12, 16], "opq rst uvw xyz"[0, 4, 8, 12, 15]
 Move left by one word
 "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], "opq rst uvw xyz"[0, 4, 8, 12, 15]
+"abc def ghi jkl mn "[0, 4, 8, 12, 16], "opq rst uvw xyz"[0, 4, 8, 12, 15]
 Move left by one word
 "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]
+"AAA AAA AAA AAA "[0, 3, 8, 11], "AAA AAA AAA AAA"[0, 3, 8, 11, 15]
 Move left by one word
 "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], "AAA AAA AAA AAA"[0, 3, 8, 11, 15]
+"AAA AAA AAA AAA "[0, 3, 8, 11], "AAA AAA AAA AAA"[0, 3, 8, 11, 15]
 Move left by one word
 "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]
+" abc def AAA AAA hij AAA AAA uvw xyz "[1, 5, 9, 12, 17, 21, 25, 29, 33], "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], " 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], "AAA kj AAA mn opq AAA AAA"[0, 4, 7, 11, 14, 18, 22, 25]
+" abc def AAA AAA hij AAA AAA uvw xyz "[1, 5, 9, 12, 17, 21, 25, 29, 33], "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], " 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]
+"abc def ghi jkl mn "[0, 3, 8, 11, 16], "opq rst uvw xyz"[0, 3, 8, 11, 15]
 Move right by one word
 "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], "opq rst uvw xyz"[0, 3, 8, 11, 15]
+"abc def ghi jkl mn "[0, 3, 8, 11, 16, 18], "opq rst uvw xyz"[0, 3, 8, 11, 15]    FAIL expected: ["abc def ghi jkl mn "[ 0,  3,  8,  11,  16, ]"opq rst uvw xyz"[ 0,  3,  8,  11,  15]
+"abc def ghi jkl mn "[16, 18]   FAIL expected "opq rst uvw xyz"[ 0]
+"abc def ghi jkl mn "[17, 18]   FAIL expected "opq rst uvw xyz"[ 0]
 Move right by one word
 "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]
+"AAA AAA AAA AAA "[0, 4, 8, 12], "AAA AAA AAA AAA"[0, 4, 8, 12, 15]
 Move right by one word
 "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], "AAA AAA AAA AAA"[0, 4, 8, 12, 15]
+"AAA AAA AAA AAA "[0, 4, 8, 12], "AAA AAA AAA AAA"[0, 4, 8, 12, 15]
 Move right by one word
 "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]
+" abc def AAA AAA hij AAA AAA uvw xyz "[1, 4, 9, 13, 17, 21, 25, 29, 33], "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], " 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], "AAA kj AAA mn opq AAA AAA"[0, 4, 7, 11, 14, 18, 22, 25]
+" 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]    FAIL expected: [" abc def AAA AAA hij AAA AAA uvw xyz "[ 1,  4,  9,  13,  17,  21,  25,  29,  33, ]"AAA kj AAA mn opq AAA AAA"[ 0,  4,  7,  11,  14,  18,  22,  25]
+" abc def AAA AAA hij AAA AAA uvw xyz "[33, 36]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
+" abc def AAA AAA hij AAA AAA uvw xyz "[35, 36]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
+" abc def AAA AAA hij AAA AAA uvw xyz "[34, 36]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 0]
 Move right by one word
 "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:

Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-multi-line.html (101429 => 101430)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-multi-line.html	2011-11-30 00:19:58 UTC (rev 101429)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-multi-line.html	2011-11-30 00:23:23 UTC (rev 101430)
@@ -37,33 +37,33 @@
 
 <!-- test multi-line -->
 <div><span class="fix_width" id="span_size">אאא אאא</span></div>
-<div contenteditable dir=ltr id="ml_1" class="test_move_by_word fix_width" title="[ml_1, 0][ml_1, 4][ml_1, 8][ml_1, 12][ml_1, 16][ml_1, 19][ml_1, 0, 5][ml_1, 4, 5][ml_1, 8, 5][ml_1, 12, 5][ml_1, 15, 5]|[ml_1, 15, 5][ml_1, 12, 5][ml_1, 8, 5][ml_1, 4, 5][ml_1, 0, 5][ml_1, 16][ml_1, 12][ml_1, 8][ml_1, 4][ml_1, 0]">abc def ghi jkl mn <br/><br/><br/>opq rst uvw xyz</div>
+<div contenteditable dir=ltr id="ml_1" class="test_move_by_word fix_width" title="[ml_1, 0][ml_1, 4][ml_1, 8][ml_1, 12][ml_1, 16][ml_1, 0, 5][ml_1, 4, 5][ml_1, 8, 5][ml_1, 12, 5][ml_1, 15, 5]|[ml_1, 15, 5][ml_1, 12, 5][ml_1, 8, 5][ml_1, 4, 5][ml_1, 0, 5][ml_1, 16][ml_1, 12][ml_1, 8][ml_1, 4][ml_1, 0]">abc def ghi jkl mn <br/><br/><br/>opq rst uvw xyz</div>
 
-<div contenteditable dir=ltr id="ml_2" class="test_move_by_word fix_width" title="[ml_2, 0][ml_2, 4][ml_2, 8][ml_2, 12][ml_2, 16][ml_2, 18][ml_2, 0, 5][ml_2, 4, 5][ml_2, 8, 5][ml_2, 12, 5][ml_2, 15, 5]|[ml_2, 15, 5][ml_2, 12, 5][ml_2, 8, 5][ml_2, 4, 5][ml_2, 0, 5][ml_2, 16][ml_2, 12][ml_2, 8][ml_2, 4][ml_2, 0]">abc def ghi jkl mn <div><br/></div><div><br/></div><div><br/></div>opq rst uvw xyz</div>
+<div contenteditable dir=ltr id="ml_2" class="test_move_by_word fix_width" title="[ml_2, 0][ml_2, 4][ml_2, 8][ml_2, 12][ml_2, 16][ml_2, 0, 5][ml_2, 4, 5][ml_2, 8, 5][ml_2, 12, 5][ml_2, 15, 5]|[ml_2, 15, 5][ml_2, 12, 5][ml_2, 8, 5][ml_2, 4, 5][ml_2, 0, 5][ml_2, 16][ml_2, 12][ml_2, 8][ml_2, 4][ml_2, 0]">abc def ghi jkl mn <div><br/></div><div><br/></div><div><br/></div>opq rst uvw xyz</div>
 
-<div contenteditable dir=ltr id="ml_3" class="test_move_by_word fix_width" title="[ml_3, 0][ml_3, 3][ml_3, 8][ml_3, 11]][ml_3, 16][ml_3, 0, 5][ml_3, 3, 5][ml_3, 8, 5][ml_3, 11, 5][ml_3, 15, 5]|[ml_3, 15, 5][ml_3, 11, 5][ml_3, 8, 5][ml_3, 3, 5][ml_3, 0, 5][ml_3, 11][ml_3, 8][ml_3, 3][ml_3, 0]">אאא אאא אאא אאא <br/><br/><br/>אאא אאא אאא אאא</div>
+<div contenteditable dir=ltr id="ml_3" class="test_move_by_word fix_width" title="[ml_3, 0][ml_3, 3][ml_3, 8][ml_3, 11]][ml_3, 0, 5][ml_3, 3, 5][ml_3, 8, 5][ml_3, 11, 5][ml_3, 15, 5]|[ml_3, 15, 5][ml_3, 11, 5][ml_3, 8, 5][ml_3, 3, 5][ml_3, 0, 5][ml_3, 11][ml_3, 8][ml_3, 3][ml_3, 0]">אאא אאא אאא אאא <br/><br/><br/>אאא אאא אאא אאא</div>
 
-<div contenteditable dir=ltr id="ml_4" class="test_move_by_word fix_width" title="[ml_4, 0][ml_4, 3][ml_4, 8][ml_4, 11][ml_4, 16][ml_4, 0, 5][ml_4, 3, 5][ml_4, 8, 5][ml_4, 11, 5][ml_4, 15, 5]|[ml_4, 15, 5][ml_4, 11, 5][ml_4, 8, 5][ml_4, 3, 5][ml_4, 0, 5][ml_4, 11][ml_4, 8][ml_4, 3][ml_4, 0]">אאא אאא אאא אאא <div><br/></div><div><br/></div><div><br/></div>אאא אאא אאא אאא</div>
+<div contenteditable dir=ltr id="ml_4" class="test_move_by_word fix_width" title="[ml_4, 0][ml_4, 3][ml_4, 8][ml_4, 11][ml_4, 0, 5][ml_4, 3, 5][ml_4, 8, 5][ml_4, 11, 5][ml_4, 15, 5]|[ml_4, 15, 5][ml_4, 11, 5][ml_4, 8, 5][ml_4, 3, 5][ml_4, 0, 5][ml_4, 11][ml_4, 8][ml_4, 3][ml_4, 0]">אאא אאא אאא אאא <div><br/></div><div><br/></div><div><br/></div>אאא אאא אאא אאא</div>
 
-<div contenteditable dir=ltr id="ml_5" class="test_move_by_word fix_width" title="[ml_5, 1][ml_5, 5][ml_5, 9][ml_5, 12][ml_5, 17][ml_5, 21][ml_5, 25][ml_5, 29][ml_5, 33][ml_5, 37][ml_5, 0, 5][ml_5, 4, 5][ml_5, 7, 5][ml_5, 11, 5][ml_5, 14, 5][ml_5, 18, 5][ml_5, 22, 5][ml_5, 25, 5]|[ml_5, 25, 5][ml_5, 22, 5][ml_5, 18, 5][ml_5, 14, 5][ml_5, 11, 5][ml_5, 7, 5][ml_5, 4, 5][ml_5, 0, 5][ml_5, 33][ml_5, 29][ml_5, 25][ml_5, 21][ml_5, 17][ml_5, 12][ml_5, 9][ml_5, 5][ml_5, 1]"> abc def אאא אאא hij אאא אאא uvw xyz <br/><br/><br/>אאא kj אאא mn opq אאא אאא</div>
+<div contenteditable dir=ltr id="ml_5" class="test_move_by_word fix_width" title="[ml_5, 1][ml_5, 5][ml_5, 9][ml_5, 12][ml_5, 17][ml_5, 21][ml_5, 25][ml_5, 29][ml_5, 33][ml_5, 0, 5][ml_5, 4, 5][ml_5, 7, 5][ml_5, 11, 5][ml_5, 14, 5][ml_5, 18, 5][ml_5, 22, 5][ml_5, 25, 5]|[ml_5, 25, 5][ml_5, 22, 5][ml_5, 18, 5][ml_5, 14, 5][ml_5, 11, 5][ml_5, 7, 5][ml_5, 4, 5][ml_5, 0, 5][ml_5, 33][ml_5, 29][ml_5, 25][ml_5, 21][ml_5, 17][ml_5, 12][ml_5, 9][ml_5, 5][ml_5, 1]"> abc def אאא אאא hij אאא אאא uvw xyz <br/><br/><br/>אאא kj אאא mn opq אאא אאא</div>
 
-<div contenteditable dir=ltr id="ml_6" class="test_move_by_word fix_width" title="[ml_6, 1][ml_6, 5][ml_6, 9][ml_6, 12][ml_6, 17][ml_6, 21][ml_6, 25][ml_6, 29][ml_6, 33][ml_6, 36][ml_6, 0, 5][ml_6, 4, 5][ml_6, 7, 5][ml_6, 11, 5][ml_6, 14, 5][ml_6, 18, 5][ml_6, 22, 5][ml_6, 25, 5]|[ml_6, 25, 5][ml_6, 22, 5][ml_6, 18, 5][ml_6, 14, 5][ml_6, 11, 5][ml_6, 7, 5][ml_6, 4, 5][ml_6, 0, 5][ml_6, 33][ml_6, 29][ml_6, 25][ml_6, 21][ml_6, 17][ml_6, 12][ml_6, 9][ml_6, 5][ml_6, 1]"> abc def אאא אאא hij אאא אאא uvw xyz <div><br/></div><div><br/></div><div><br/></div>אאא kj אאא mn opq אאא אאא</div>
+<div contenteditable dir=ltr id="ml_6" class="test_move_by_word fix_width" title="[ml_6, 1][ml_6, 5][ml_6, 9][ml_6, 12][ml_6, 17][ml_6, 21][ml_6, 25][ml_6, 29][ml_6, 33][ml_6, 0, 5][ml_6, 4, 5][ml_6, 7, 5][ml_6, 11, 5][ml_6, 14, 5][ml_6, 18, 5][ml_6, 22, 5][ml_6, 25, 5]|[ml_6, 25, 5][ml_6, 22, 5][ml_6, 18, 5][ml_6, 14, 5][ml_6, 11, 5][ml_6, 7, 5][ml_6, 4, 5][ml_6, 0, 5][ml_6, 33][ml_6, 29][ml_6, 25][ml_6, 21][ml_6, 17][ml_6, 12][ml_6, 9][ml_6, 5][ml_6, 1]"> abc def אאא אאא hij אאא אאא uvw xyz <div><br/></div><div><br/></div><div><br/></div>אאא kj אאא mn opq אאא אאא</div>
 
 
-<div contenteditable dir=rtl id="ml_7" class="test_move_by_word fix_width" title="[ml_7, 15, 5][ml_7, 11, 5][ml_7, 8, 5][ml_7, 3, 5][ml_7, 0, 5][ml_7, 16][ml_7, 11][ml_7, 8][ml_7, 3][ml_7, 0]|[ml_7, 0][ml_7, 3][ml_7, 8][ml_7, 11][ml_7, 16][ml_7, 19][ml_7, 0, 5][ml_7, 3, 5][ml_7, 8, 5][ml_7, 11, 5][ml_7, 15, 5]">abc def ghi jkl mn <br/><br/><br/>opq rst uvw xyz</div>
+<div contenteditable dir=rtl id="ml_7" class="test_move_by_word fix_width" title="[ml_7, 15, 5][ml_7, 11, 5][ml_7, 8, 5][ml_7, 3, 5][ml_7, 0, 5][ml_7, 16][ml_7, 11][ml_7, 8][ml_7, 3][ml_7, 0]|[ml_7, 0][ml_7, 3][ml_7, 8][ml_7, 11][ml_7, 16][ml_7, 0, 5][ml_7, 3, 5][ml_7, 8, 5][ml_7, 11, 5][ml_7, 15, 5]">abc def ghi jkl mn <br/><br/><br/>opq rst uvw xyz</div>
 
-<div contenteditable dir=rtl id="ml_8" class="test_move_by_word fix_width" title="[ml_8, 15, 5][ml_8, 11, 5][ml_8, 8, 5][ml_8, 3, 5][ml_8, 0, 5][ml_8, 18][ml_8, 16][ml_8, 11][ml_8, 8][ml_8, 3][ml_8, 0]|[ml_8, 0][ml_8, 3][ml_8, 8][ml_8, 11][ml_8, 16][ml_8, 18][ml_8, 0, 5][ml_8, 3, 5][ml_8, 8, 5][ml_8, 11, 5][ml_8, 15, 5]">abc def ghi jkl mn <div><br/></div><div><br/></div><div><br/></div>opq rst uvw xyz</div>
+<div contenteditable dir=rtl id="ml_8" class="test_move_by_word fix_width" title="[ml_8, 15, 5][ml_8, 11, 5][ml_8, 8, 5][ml_8, 3, 5][ml_8, 0, 5][ml_8, 18][ml_8, 16][ml_8, 11][ml_8, 8][ml_8, 3][ml_8, 0]|[ml_8, 0][ml_8, 3][ml_8, 8][ml_8, 11][ml_8, 16][ml_8, 0, 5][ml_8, 3, 5][ml_8, 8, 5][ml_8, 11, 5][ml_8, 15, 5]">abc def ghi jkl mn <div><br/></div><div><br/></div><div><br/></div>opq rst uvw xyz</div>
 
-<div contenteditable dir=rtl id="ml_9" class="test_move_by_word fix_width" title="[ml_9, 15, 5][ml_9, 12, 5][ml_9, 8, 5][ml_9, 4, 5][ml_9, 0, 5][ml_9, 12][ml_9, 8][ml_9, 4][ml_9, 0]|[ml_9, 0][ml_9, 4][ml_9, 8][ml_9, 12][ml_9, 16][ml_9, 0, 5][ml_9, 4, 5][ml_9, 8, 5][ml_9, 12, 5][ml_9, 15, 5]">אאא אאא אאא אאא <br/><br/><br/>אאא אאא אאא אאא</div>
+<div contenteditable dir=rtl id="ml_9" class="test_move_by_word fix_width" title="[ml_9, 15, 5][ml_9, 12, 5][ml_9, 8, 5][ml_9, 4, 5][ml_9, 0, 5][ml_9, 12][ml_9, 8][ml_9, 4][ml_9, 0]|[ml_9, 0][ml_9, 4][ml_9, 8][ml_9, 12][ml_9, 0, 5][ml_9, 4, 5][ml_9, 8, 5][ml_9, 12, 5][ml_9, 15, 5]">אאא אאא אאא אאא <br/><br/><br/>אאא אאא אאא אאא</div>
 
-<div contenteditable dir=rtl id="ml_10" class="test_move_by_word fix_width" title="[ml_10, 15, 5][ml_10, 12, 5][ml_10, 8, 5][ml_10, 4, 5][ml_10, 0, 5][ml_10, 12][ml_10, 8][ml_10, 4][ml_10, 0]|[ml_10, 0][ml_10, 4][ml_10, 8][ml_10, 12][ml_10, 16][ml_10, 0, 5][ml_10, 4, 5][ml_10, 8, 5][ml_10, 12, 5][ml_10, 15, 5]">אאא אאא אאא אאא <div><br/></div><div><br/></div><div><br/></div>אאא אאא אאא אאא</div>
+<div contenteditable dir=rtl id="ml_10" class="test_move_by_word fix_width" title="[ml_10, 15, 5][ml_10, 12, 5][ml_10, 8, 5][ml_10, 4, 5][ml_10, 0, 5][ml_10, 12][ml_10, 8][ml_10, 4][ml_10, 0]|[ml_10, 0][ml_10, 4][ml_10, 8][ml_10, 12][ml_10, 0, 5][ml_10, 4, 5][ml_10, 8, 5][ml_10, 12, 5][ml_10, 15, 5]">אאא אאא אאא אאא <div><br/></div><div><br/></div><div><br/></div>אאא אאא אאא אאא</div>
 
 <div contenteditable dir=rtl id="ml_11" class="test_move_by_word fix_width" title="
-[ml_11, 25, 5][ml_11, 22, 5][ml_11, 18, 5][ml_11, 14, 5][ml_11, 11, 5][ml_11, 7, 5][ml_11, 4, 5][ml_11, 0, 5][ml_11, 33][ml_11, 29][ml_11, 25][ml_11, 21][ml_11, 17][ml_11, 13][ml_11, 9][ml_11, 4][ml_11, 1]|[ml_11, 1][ml_11, 4][ml_11, 9][ml_11, 13][ml_11, 17][ml_11, 21][ml_11, 25][ml_11, 29][ml_11, 33][ml_11, 37][ml_11, 0, 5][ml_11, 4, 5][ml_11, 7, 5][ml_11, 11, 5][ml_11, 14, 5][ml_11, 18, 5][ml_11, 22, 5][ml_11, 25, 5]
+[ml_11, 25, 5][ml_11, 22, 5][ml_11, 18, 5][ml_11, 14, 5][ml_11, 11, 5][ml_11, 7, 5][ml_11, 4, 5][ml_11, 0, 5][ml_11, 33][ml_11, 29][ml_11, 25][ml_11, 21][ml_11, 17][ml_11, 13][ml_11, 9][ml_11, 4][ml_11, 1]|[ml_11, 1][ml_11, 4][ml_11, 9][ml_11, 13][ml_11, 17][ml_11, 21][ml_11, 25][ml_11, 29][ml_11, 33][ml_11, 0, 5][ml_11, 4, 5][ml_11, 7, 5][ml_11, 11, 5][ml_11, 14, 5][ml_11, 18, 5][ml_11, 22, 5][ml_11, 25, 5]
 "> abc def אאא אאא hij אאא אאא uvw xyz <br/><br/><br/>אאא kj אאא mn opq אאא אאא</div>
 
 <div contenteditable dir=rtl id="ml_12" class="test_move_by_word fix_width" title="
-[ml_12, 25, 5][ml_12, 22, 5][ml_12, 18, 5][ml_12, 14, 5][ml_12, 11, 5][ml_12, 7, 5][ml_12, 4, 5][ml_12, 0, 5][ml_12, 36][ml_12, 33][ml_12, 29][ml_12, 25][ml_12, 21][ml_12, 17][ml_12, 13][ml_12, 9][ml_12, 4][ml_12, 1]|[ml_12, 1][ml_12, 4][ml_12, 9][ml_12, 13][ml_12, 17][ml_12, 21][ml_12, 25][ml_12, 29][ml_12, 33][ml_12, 36][ml_12, 0, 5][ml_12, 4, 5][ml_12, 7, 5][ml_12, 11, 5][ml_12, 14, 5][ml_12, 18, 5][ml_12, 22, 5][ml_12, 25, 5]
+[ml_12, 25, 5][ml_12, 22, 5][ml_12, 18, 5][ml_12, 14, 5][ml_12, 11, 5][ml_12, 7, 5][ml_12, 4, 5][ml_12, 0, 5][ml_12, 36][ml_12, 33][ml_12, 29][ml_12, 25][ml_12, 21][ml_12, 17][ml_12, 13][ml_12, 9][ml_12, 4][ml_12, 1]|[ml_12, 1][ml_12, 4][ml_12, 9][ml_12, 13][ml_12, 17][ml_12, 21][ml_12, 25][ml_12, 29][ml_12, 33][ml_12, 0, 5][ml_12, 4, 5][ml_12, 7, 5][ml_12, 11, 5][ml_12, 14, 5][ml_12, 18, 5][ml_12, 22, 5][ml_12, 25, 5]
 "> abc def אאא אאא hij אאא אאא uvw xyz <div><br/></div><div><br/></div><div><br/></div>אאא kj אאא mn opq אאא אאא</div>
 
 <!-- mixed editability -->

Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-inline-element-expected.txt (101429 => 101430)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-inline-element-expected.txt	2011-11-30 00:19:58 UTC (rev 101429)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-inline-element-expected.txt	2011-11-30 00:23:23 UTC (rev 101430)
@@ -75,11 +75,7 @@
 Move right by one word
 "ABD DSU "[0], "FFZ LIG"[3], "ABD DSU "[8], "abc def"[4], "ABD DSU "[7, 3], "FFZ LIG"[7]
 Move left by one word
-"FFZ LIG"[7], "ABD DSU "[3, 7], "abc def"[4], "ABD DSU "[8], "FFZ LIG"[3]    FAIL expected: ["FFZ LIG"[ 7, ]"ABD DSU "[ 3,  7, ]"abc def"[ 4, ]"ABD DSU "[ 8, ]"FFZ LIG"[ 3, ]"ABD DSU "[ 0]
-"FFZ LIG"[3, 3]   FAIL expected "ABD DSU "[ 0]
-"FFZ LIG"[4, 4]   FAIL expected "ABD DSU "[ 0]
-"FFZ LIG"[5, 5]   FAIL expected "ABD DSU "[ 0]
-"FFZ LIG"[6, 6]   FAIL expected "ABD DSU "[ 0]
+"FFZ LIG"[7], "ABD DSU "[3, 7], "abc def"[4], "ABD DSU "[8], "FFZ LIG"[3], "ABD DSU "[0]
 Test 13, RTL:
 Move left by one word
 "ABD DSU "[0, 4, 8], "abc def"[3], "FFZ LIG"[4, 7]

Added: trunk/LayoutTests/editing/selection/move-by-word-visually-textarea-expected.txt (0 => 101430)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-textarea-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-textarea-expected.txt	2011-11-30 00:23:23 UTC (rev 101430)
@@ -0,0 +1,2 @@
+PASS Pass
+

Added: trunk/LayoutTests/editing/selection/move-by-word-visually-textarea.html (0 => 101430)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-textarea.html	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-textarea.html	2011-11-30 00:23:23 UTC (rev 101430)
@@ -0,0 +1,40 @@
+<script src=""
+<script>
+
+_onload_ = function() {
+    var sel = window.getSelection();
+    sel.empty();
+    
+    var test = document.getElementById("test_move_by_word");
+    test.focus();
+    test.value = "word word word\n\n\nword\n\n\n   ";
+    test.selectionDirection = 'none';
+    test.selectionStart = 0;
+    test.selectionEnd = 0;
+
+    var wordBreaks = test.title.split(" ");
+    var fail = false;
+    var i;
+    for (i = 0; i < 5; ++i) {
+        var start = test.selectionStart;
+        sel.modify("move", "right", "-webkit-visual-word");
+        var wordBreak;
+        if (i >= wordBreaks.length)
+            wordBreak = wordBreaks[wordBreaks.length - 1];
+        else
+            wordBreak = wordBreaks[i];
+        if (test.selectionStart != wordBreak) {
+            testFailed("Expected: " + start + " -> " + wordBreak + "; Actual : " + start + " -> " + test.selectionStart);
+            fail = true;
+        }
+    }
+
+    if (fail == false)
+        testPassed("Pass");
+}
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+
+<textarea title = "5 10 17 27" dir=ltr id="test_move_by_word"></textarea>

Modified: trunk/Source/WebCore/ChangeLog (101429 => 101430)


--- trunk/Source/WebCore/ChangeLog	2011-11-30 00:19:58 UTC (rev 101429)
+++ trunk/Source/WebCore/ChangeLog	2011-11-30 00:23:23 UTC (rev 101430)
@@ -1,3 +1,23 @@
+2011-11-10  Xiaomei Ji  <x...@chromium.org>
+
+        --webkit-visual-word should be able to reach end of text, instead of end of line
+        https://bugs.webkit.org/show_bug.cgi?id=72048
+
+        Reviewed by Ryosuke Niwa.
+
+        Revert r92223 -- webkit-visual-word should reach boundary of line.
+        When there is no more left or right words in the same editing boundary and
+        current position is an editable position, return start or end position in this
+        editable content.
+
+        Test: editing/selection/move-by-word-visually-textarea.html
+
+        * editing/visible_units.cpp:
+        (WebCore::collectWordBreaksInBoxInsideBlockWithSameDirectionality):
+        (WebCore::collectWordBreaksInBoxInsideBlockWithDifferntDirectionality):
+        (WebCore::leftWordPosition):
+        (WebCore::rightWordPosition):
+
 2011-11-29  Oliver Hunt  <oli...@apple.com>
 
         Allow WebCore to describe typed arrays to JSC

Modified: trunk/Source/WebCore/editing/visible_units.cpp (101429 => 101430)


--- trunk/Source/WebCore/editing/visible_units.cpp	2011-11-30 00:19:58 UTC (rev 101429)
+++ trunk/Source/WebCore/editing/visible_units.cpp	2011-11-30 00:23:23 UTC (rev 101430)
@@ -1100,12 +1100,6 @@
 static const int invalidOffset = -1;
 static const int offsetNotFound = -1;
 
-static bool isBoxVisuallyLastInLine(const InlineBox* box, TextDirection blockDirection)
-{
-    return blockDirection == LTR ? !box->nextLeafChild() || box->nextLeafChild()->renderer()->isBR()
-        : !box->prevLeafChild() || box->prevLeafChild()->renderer()->isBR();
-}
-
 static bool positionIsInBox(const VisiblePosition& wordBreak, const InlineBox* box, int& offsetOfWordBreak)
 {
     if (wordBreak.isNull())
@@ -1292,22 +1286,10 @@
     
 typedef Vector<WordBoundaryEntry, 50> WordBoundaryVector;
     
-static void appendPositionAtLogicalEndOfLine(const InlineBox* box, WordBoundaryVector& orderedWordBoundaries)
-{
-    VisiblePosition endOfBlock = logicalEndOfLine(createLegacyEditingPosition(box->renderer()->node(), box->caretMaxOffset()));
-
-    int offsetOfEndOfBlock;
-    if (positionIsInBox(endOfBlock, box, offsetOfEndOfBlock))
-        orderedWordBoundaries.append(WordBoundaryEntry(endOfBlock, offsetOfEndOfBlock));
-}
-    
 static void collectWordBreaksInBoxInsideBlockWithSameDirectionality(const InlineBox* box, WordBoundaryVector& orderedWordBoundaries)
 {
     orderedWordBoundaries.clear();
 
-    if (!box->renderer()->isBR() && isBoxVisuallyLastInLine(box, box->direction()))
-        appendPositionAtLogicalEndOfLine(box, orderedWordBoundaries);
-    
     VisiblePosition wordBreak;
     int offsetOfWordBreak = invalidOffset;
     while (1) {
@@ -1323,9 +1305,6 @@
 {
     orderedWordBoundaries.clear();
     
-    if (!box->renderer()->isBR() && isBoxVisuallyLastInLine(box, box->direction() == LTR ? RTL : LTR))
-        appendPositionAtLogicalEndOfLine(box, orderedWordBoundaries);
-    
     VisiblePosition wordBreak;
     int offsetOfWordBreak = invalidOffset;
     bool isLastWordBreakInBox = false;
@@ -1631,7 +1610,14 @@
         return VisiblePosition();
 
     VisiblePosition leftWordBreak = leftWordPositionIgnoringEditingBoundary(visiblePosition);
-    return visiblePosition.honorEditingBoundaryAtOrBefore(leftWordBreak);
+    leftWordBreak = visiblePosition.honorEditingBoundaryAtOrBefore(leftWordBreak);
+    
+    // FIXME: How should we handle a non-editable position?
+    if (leftWordBreak.isNull() && isEditablePosition(visiblePosition.deepEquivalent())) {
+        TextDirection blockDirection = directionOfEnclosingBlock(visiblePosition.deepEquivalent());
+        leftWordBreak = blockDirection == LTR ? startOfEditableContent(visiblePosition) : endOfEditableContent(visiblePosition);
+    }
+    return leftWordBreak;
 }
 
 VisiblePosition rightWordPosition(const VisiblePosition& visiblePosition)
@@ -1640,7 +1626,14 @@
         return VisiblePosition();
 
     VisiblePosition rightWordBreak = rightWordPositionIgnoringEditingBoundary(visiblePosition);
-    return visiblePosition.honorEditingBoundaryAtOrBefore(rightWordBreak);
+    rightWordBreak = visiblePosition.honorEditingBoundaryAtOrBefore(rightWordBreak);
+
+    // FIXME: How should we handle a non-editable position?
+    if (rightWordBreak.isNull() && isEditablePosition(visiblePosition.deepEquivalent())) {
+        TextDirection blockDirection = directionOfEnclosingBlock(visiblePosition.deepEquivalent());
+        rightWordBreak = blockDirection == LTR ? endOfEditableContent(visiblePosition) : startOfEditableContent(visiblePosition);
+    }
+    return rightWordBreak;
 }
 
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to