Title: [93935] trunk
Revision
93935
Author
[email protected]
Date
2011-08-26 21:42:59 -0700 (Fri, 26 Aug 2011)

Log Message

Regression(91788): Bad cast in WebCore::blockWithNextLineBox
https://bugs.webkit.org/show_bug.cgi?id=66090

Reviewed by Ryosuke Niwa.

Source/WebCore:

This is more like (but not exactly) a revert of r91788.
It does not search for previous or next root inline box in different
render object, which completely eliminates the cause of this issue.
And it removes createPositionAvoidingIgnoredNode(), changed its caller
to use createLegacyEditingPosition(). createPositionAvoidingIgnoredNode
is not correct when node is a replaced element whose caretMaxOffset
could be greater than 1.

Tests: editing/selection/move-by-word-visually-crash-test-1.html
       editing/selection/move-by-word-visually-crash-test-2.html
       editing/selection/move-by-word-visually-crash-test-3.html
       editing/selection/move-by-word-visually-crash-test-4.html

* editing/htmlediting.cpp:
* editing/htmlediting.h:
* editing/visible_units.cpp:
(WebCore::previousWordBreakInBoxInsideBlockWithSameDirectionality):
(WebCore::leftmostPositionInRTLBoxInLTRBlock):
(WebCore::rightmostPositionInLTRBoxInRTLBlock):
(WebCore::nextWordBreakInBoxInsideBlockWithDifferentDirectionality):
(WebCore::appendPositionAtLogicalEndOfLine):
(WebCore::leftInlineBox):
(WebCore::rightInlineBox):

LayoutTests:

* editing/selection/move-by-word-visually-crash-test-1-expected.txt: Added.
* editing/selection/move-by-word-visually-crash-test-1.html: Added.
* editing/selection/move-by-word-visually-crash-test-2-expected.txt: Added.
* editing/selection/move-by-word-visually-crash-test-2.html: Added.
* editing/selection/move-by-word-visually-crash-test-3-expected.txt: Added.
* editing/selection/move-by-word-visually-crash-test-3.html: Added.
* editing/selection/move-by-word-visually-crash-test-4-expected.txt: Added.
* editing/selection/move-by-word-visually-crash-test-4.html: Added.
* editing/selection/move-by-word-visually-multi-line-expected.txt:
* editing/selection/resources/move-by-word-visually.js:
(runMoveLeftRight):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (93934 => 93935)


--- trunk/LayoutTests/ChangeLog	2011-08-27 04:19:22 UTC (rev 93934)
+++ trunk/LayoutTests/ChangeLog	2011-08-27 04:42:59 UTC (rev 93935)
@@ -1,3 +1,22 @@
+2011-08-26  Xiaomei Ji  <[email protected]>
+
+        Regression(91788): Bad cast in WebCore::blockWithNextLineBox
+        https://bugs.webkit.org/show_bug.cgi?id=66090
+
+        Reviewed by Ryosuke Niwa.
+
+        * editing/selection/move-by-word-visually-crash-test-1-expected.txt: Added.
+        * editing/selection/move-by-word-visually-crash-test-1.html: Added.
+        * editing/selection/move-by-word-visually-crash-test-2-expected.txt: Added.
+        * editing/selection/move-by-word-visually-crash-test-2.html: Added.
+        * editing/selection/move-by-word-visually-crash-test-3-expected.txt: Added.
+        * editing/selection/move-by-word-visually-crash-test-3.html: Added.
+        * editing/selection/move-by-word-visually-crash-test-4-expected.txt: Added.
+        * editing/selection/move-by-word-visually-crash-test-4.html: Added.
+        * editing/selection/move-by-word-visually-multi-line-expected.txt:
+        * editing/selection/resources/move-by-word-visually.js:
+        (runMoveLeftRight):
+
 2011-08-26  Gavin Barraclough  <[email protected]>
 
         DFG JIT - ArithMod may clobber operands.

Added: trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-1-expected.txt (0 => 93935)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-1-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-1-expected.txt	2011-08-27 04:42:59 UTC (rev 93935)
@@ -0,0 +1 @@
+Crash test passed

Added: trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-1.html (0 => 93935)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-1.html	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-1.html	2011-08-27 04:42:59 UTC (rev 93935)
@@ -0,0 +1,17 @@
+<script src=""
+<script>
+
+_onload_ = function() {
+    try {
+        runTest();
+        document.body.innerHTML = "Crash test passed";
+    } finally {
+    }
+};
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<textarea></textarea>
+<base><div title="0|0" class="test_move_by_word">
+

Added: trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-2-expected.txt (0 => 93935)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-2-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-2-expected.txt	2011-08-27 04:42:59 UTC (rev 93935)
@@ -0,0 +1 @@
+Crash test passed

Added: trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-2.html (0 => 93935)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-2.html	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-2.html	2011-08-27 04:42:59 UTC (rev 93935)
@@ -0,0 +1,16 @@
+<script src=""
+<script>
+
+_onload_ = function() {
+    try {
+        runTest();
+        document.body.innerHTML = "Crash test passed";
+    } finally {
+    }
+};
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<vkern></vkern><marquee><div title="0|0" class="test_move_by_word">abc def
+

Added: trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-3-expected.txt (0 => 93935)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-3-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-3-expected.txt	2011-08-27 04:42:59 UTC (rev 93935)
@@ -0,0 +1 @@
+Crash test passed

Added: trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-3.html (0 => 93935)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-3.html	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-3.html	2011-08-27 04:42:59 UTC (rev 93935)
@@ -0,0 +1,16 @@
+<script src=""
+<script>
+
+_onload_ = function() {
+    try {
+        runTest();
+        document.body.innerHTML = "Crash test passed";
+    } finally {
+    }
+};
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<video></video><meter><image class="test_move_by_word" title="0|0">
+

Added: trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-4-expected.txt (0 => 93935)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-4-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-4-expected.txt	2011-08-27 04:42:59 UTC (rev 93935)
@@ -0,0 +1 @@
+Crash test passed

Added: trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-4.html (0 => 93935)


--- trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-4.html	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-4.html	2011-08-27 04:42:59 UTC (rev 93935)
@@ -0,0 +1,15 @@
+<script src=""
+<script>
+
+_onload_ = function() {
+    try {
+        runTest();
+        document.body.innerHTML = "Crash test passed";
+    } finally {
+    }
+};
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+><div title="0|0" class="test_move_by_word" dir=ltr><keygen><base>

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


--- trunk/LayoutTests/editing/selection/move-by-word-visually-multi-line-expected.txt	2011-08-27 04:19:22 UTC (rev 93934)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-multi-line-expected.txt	2011-08-27 04:42:59 UTC (rev 93935)
@@ -7,9 +7,17 @@
 "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, 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]
 Move left by one word
-"opq rst uvw xyz"[15, 12, 8, 4, 0], "abc def ghi jkl mn "[16, 12, 8, 4, 0]
+"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]
 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]
@@ -17,9 +25,17 @@
 "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, 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]
 Move left by one word
-"AAA AAA AAA AAA"[15, 11, 8, 3, 0], "AAA AAA AAA AAA "[11, 8, 3, 0]
+"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]
 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]
@@ -27,9 +43,17 @@
 "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, 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]
 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]
+"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]
 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]
@@ -37,9 +61,17 @@
 "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]    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]
 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]
+"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]
 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]
@@ -47,9 +79,17 @@
 "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, 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]
 Move right by one word
-"AAA AAA AAA AAA"[15, 12, 8, 4, 0], "AAA AAA AAA AAA "[12, 8, 4, 0]
+"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]
 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]
@@ -57,9 +97,17 @@
 "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]    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]
 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]
+"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]
 Test 13, LTR:
 Move right by one word
 "abc def "[0, 4]

Modified: trunk/LayoutTests/editing/selection/resources/move-by-word-visually.js (93934 => 93935)


--- trunk/LayoutTests/editing/selection/resources/move-by-word-visually.js	2011-08-27 04:19:22 UTC (rev 93934)
+++ trunk/LayoutTests/editing/selection/resources/move-by-word-visually.js	2011-08-27 04:42:59 UTC (rev 93935)
@@ -266,8 +266,8 @@
             moveByWordForEveryPosition(sel, tests[i], "rtl");
         }
     }
-
-    document.getElementById("testMoveByWord").style.display = "none";
+    if (document.getElementById("testMoveByWord"))
+        document.getElementById("testMoveByWord").style.display = "none";
 }
 
 function runTest() {

Modified: trunk/Source/WebCore/ChangeLog (93934 => 93935)


--- trunk/Source/WebCore/ChangeLog	2011-08-27 04:19:22 UTC (rev 93934)
+++ trunk/Source/WebCore/ChangeLog	2011-08-27 04:42:59 UTC (rev 93935)
@@ -1,3 +1,34 @@
+2011-08-26  Xiaomei Ji  <[email protected]>
+
+        Regression(91788): Bad cast in WebCore::blockWithNextLineBox
+        https://bugs.webkit.org/show_bug.cgi?id=66090
+
+        Reviewed by Ryosuke Niwa.
+
+        This is more like (but not exactly) a revert of r91788.
+        It does not search for previous or next root inline box in different
+        render object, which completely eliminates the cause of this issue.
+        And it removes createPositionAvoidingIgnoredNode(), changed its caller
+        to use createLegacyEditingPosition(). createPositionAvoidingIgnoredNode
+        is not correct when node is a replaced element whose caretMaxOffset
+        could be greater than 1.
+
+        Tests: editing/selection/move-by-word-visually-crash-test-1.html
+               editing/selection/move-by-word-visually-crash-test-2.html
+               editing/selection/move-by-word-visually-crash-test-3.html
+               editing/selection/move-by-word-visually-crash-test-4.html
+
+        * editing/htmlediting.cpp:
+        * editing/htmlediting.h:
+        * editing/visible_units.cpp:
+        (WebCore::previousWordBreakInBoxInsideBlockWithSameDirectionality):
+        (WebCore::leftmostPositionInRTLBoxInLTRBlock):
+        (WebCore::rightmostPositionInLTRBoxInRTLBlock):
+        (WebCore::nextWordBreakInBoxInsideBlockWithDifferentDirectionality):
+        (WebCore::appendPositionAtLogicalEndOfLine):
+        (WebCore::leftInlineBox):
+        (WebCore::rightInlineBox):
+
 2011-08-26  James Robinson  <[email protected]>
 
         [Chromium] Possible leak of LayerRendererChromium

Modified: trunk/Source/WebCore/editing/htmlediting.cpp (93934 => 93935)


--- trunk/Source/WebCore/editing/htmlediting.cpp	2011-08-27 04:19:22 UTC (rev 93934)
+++ trunk/Source/WebCore/editing/htmlediting.cpp	2011-08-27 04:42:59 UTC (rev 93935)
@@ -1137,21 +1137,4 @@
     return updatedSelection;
 }
 
-Position createPositionAvoidingIgnoredNode(Node* node, int offset)
-{
-    if (!node)
-        return Position();
-    if (!node->isTextNode()) {
-        // FIXME: the pass-in offset is the caretMinOffset() or caretMaxOffset() of box.
-        // caretMaxOffset could be 1 for replacedElement, br, and hr. 
-        // We should get rid of this offset checking code after we get rid of legacy editing
-        // position in rendering code.
-        if (!offset)
-            return positionBeforeNode(node);
-        ASSERT(offset == 1);
-        return positionAfterNode(node);
-    }
-    return Position(static_cast<Text*>(node), offset);
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/editing/htmlediting.h (93934 => 93935)


--- trunk/Source/WebCore/editing/htmlediting.h	2011-08-27 04:19:22 UTC (rev 93934)
+++ trunk/Source/WebCore/editing/htmlediting.h	2011-08-27 04:42:59 UTC (rev 93935)
@@ -142,8 +142,6 @@
     return editingIgnoresContent(node) ? positionAfterNode(node) : lastPositionInNode(node);
 }
 
-Position createPositionAvoidingIgnoredNode(Node*, int offset);
-
 // comparision functions on Position
     
 int comparePositions(const Position&, const Position&);

Modified: trunk/Source/WebCore/editing/visible_units.cpp (93934 => 93935)


--- trunk/Source/WebCore/editing/visible_units.cpp	2011-08-27 04:19:22 UTC (rev 93934)
+++ trunk/Source/WebCore/editing/visible_units.cpp	2011-08-27 04:42:59 UTC (rev 93935)
@@ -1177,7 +1177,7 @@
     if (hasSeenWordBreakInThisBox)
         wordBreak = previousWordBreak;
     else {
-        wordBreak = createPositionAvoidingIgnoredNode(box->renderer()->node(), box->caretMaxOffset());
+        wordBreak = createLegacyEditingPosition(box->renderer()->node(), box->caretMaxOffset());
 
         // Return the rightmost word boundary of LTR box or leftmost word boundary of RTL box if
         // it is not in the previously visited boxes. For example, given a logical text 
@@ -1216,21 +1216,21 @@
     InlineBox* nextLeaf = box->nextLeafChild();   
     
     if (previousLeaf && !previousLeaf->isLeftToRightDirection())
-        return createPositionAvoidingIgnoredNode(node, box->caretMaxOffset());
+        return createLegacyEditingPosition(node, box->caretMaxOffset());
 
     if (nextLeaf && !nextLeaf->isLeftToRightDirection()) {
         if (previousLeaf)
-            return createPositionAvoidingIgnoredNode(previousLeaf->renderer()->node(), previousLeaf->caretMaxOffset());
+            return createLegacyEditingPosition(previousLeaf->renderer()->node(), previousLeaf->caretMaxOffset());
 
         InlineBox* lastRTLLeaf;
         do {
             lastRTLLeaf = nextLeaf;
             nextLeaf = nextLeaf->nextLeafChild();
         } while (nextLeaf && !nextLeaf->isLeftToRightDirection());
-        return createPositionAvoidingIgnoredNode(lastRTLLeaf->renderer()->node(), lastRTLLeaf->caretMinOffset());
+        return createLegacyEditingPosition(lastRTLLeaf->renderer()->node(), lastRTLLeaf->caretMinOffset());
     }
 
-    return createPositionAvoidingIgnoredNode(node, box->caretMinOffset());
+    return createLegacyEditingPosition(node, box->caretMinOffset());
 }
 
 static VisiblePosition rightmostPositionInLTRBoxInRTLBlock(const InlineBox* box)
@@ -1241,21 +1241,21 @@
     InlineBox* nextLeaf = box->nextLeafChild();   
     
     if (nextLeaf && nextLeaf->isLeftToRightDirection())    
-        return createPositionAvoidingIgnoredNode(node, box->caretMaxOffset());
+        return createLegacyEditingPosition(node, box->caretMaxOffset());
 
     if (previousLeaf && previousLeaf->isLeftToRightDirection()) {
         if (nextLeaf)
-            return createPositionAvoidingIgnoredNode(nextLeaf->renderer()->node(), nextLeaf->caretMaxOffset());
+            return createLegacyEditingPosition(nextLeaf->renderer()->node(), nextLeaf->caretMaxOffset());
 
         InlineBox* firstLTRLeaf;
         do {
             firstLTRLeaf = previousLeaf;
             previousLeaf = previousLeaf->prevLeafChild();
         } while (previousLeaf && previousLeaf->isLeftToRightDirection());
-        return createPositionAvoidingIgnoredNode(firstLTRLeaf->renderer()->node(), firstLTRLeaf->caretMinOffset());
+        return createLegacyEditingPosition(firstLTRLeaf->renderer()->node(), firstLTRLeaf->caretMinOffset());
     }
 
-    return createPositionAvoidingIgnoredNode(node, box->caretMinOffset());
+    return createLegacyEditingPosition(node, box->caretMinOffset());
 }
     
 static VisiblePosition lastWordBreakInBox(const InlineBox* box, int& offsetOfWordBreak)
@@ -1301,7 +1301,7 @@
     
     bool hasSeenWordBreakInThisBox = previousWordBreak.isNotNull();
     VisiblePosition wordBreak = hasSeenWordBreakInThisBox ? previousWordBreak : 
-        createPositionAvoidingIgnoredNode(box->renderer()->node(), box->caretMinOffset());
+        createLegacyEditingPosition(box->renderer()->node(), box->caretMinOffset());
 
     wordBreak = nextBoundary(wordBreak, nextWordPositionBoundary);
   
@@ -1340,7 +1340,7 @@
     
 static void appendPositionAtLogicalEndOfLine(const InlineBox* box, WordBoundaryVector& orderedWordBoundaries)
 {
-    VisiblePosition endOfBlock = logicalEndOfLine(createPositionAvoidingIgnoredNode(box->renderer()->node(), box->caretMaxOffset()));
+    VisiblePosition endOfBlock = logicalEndOfLine(createLegacyEditingPosition(box->renderer()->node(), box->caretMaxOffset()));
 
     int offsetOfEndOfBlock;
     if (positionIsInBox(endOfBlock, box, offsetOfEndOfBlock))
@@ -1472,58 +1472,6 @@
     return offsetNotFound;
 }
 
-static const RenderBlock* blockWithPreviousLineBox(const RenderBlock* startingBlock)
-{
-    for (const RenderBlock* block = startingBlock; block; block = toRenderBlock(block->previousSibling())) {
-        if (block->childrenInline()) {
-            if (block->firstRootBox())
-                return block;
-        } else if (const RenderBlock* renderBlock = blockWithPreviousLineBox(toRenderBlock(block->lastChild())))
-            return renderBlock;
-    }
-    return 0;
-}
-
-static const RootInlineBox* previousRootInlineBox(const InlineBox* box)
-{
-    Node* node = box->renderer()->node();
-
-    for (RenderObject* renderer = node->renderer(); renderer; renderer = renderer->parent()) {
-        if (renderer->isRenderBlock()) {
-            if (const RenderBlock* blockWithLineBoxes = blockWithPreviousLineBox(toRenderBlock(renderer->previousSibling())))
-                return blockWithLineBoxes->lastRootBox();
-        }
-    }
-
-    return 0;
-}
-
-static const RenderBlock* blockWithNextLineBox(const RenderBlock* startingBlock)
-{
-    for (const RenderBlock* block = startingBlock; block; block = toRenderBlock(block->nextSibling())) {
-        if (block->childrenInline()) {
-            if (block->firstRootBox())
-                return block;
-        } else if (const RenderBlock* renderBlock = blockWithNextLineBox(toRenderBlock(block->firstChild())))
-            return renderBlock;
-    }
-    return 0;
-}
-
-static const RootInlineBox* nextRootInlineBox(const InlineBox* box)
-{
-    Node* node = box->renderer()->node();
-
-    for (RenderObject* renderer = node->renderer(); renderer; renderer = renderer->parent()) {
-        if (renderer->isRenderBlock()) {
-            if (const RenderBlock* blockWithLineBoxes = blockWithNextLineBox(toRenderBlock(renderer->nextSibling())))
-                return blockWithLineBoxes->firstRootBox();
-        }
-    }
-
-    return 0;
-}
-
 static const InlineBox* leftInlineBox(const InlineBox* box, TextDirection blockDirection)
 {
     if (box->prevLeafChild())
@@ -1535,8 +1483,7 @@
     if (leftLineBox)
         return leftLineBox->lastLeafChild();
 
-    const RootInlineBox* leftRootInlineBox = isBlockLTR ? previousRootInlineBox(box) : nextRootInlineBox(box);
-    return leftRootInlineBox ? leftRootInlineBox->lastLeafChild() : 0;
+    return 0;
 }
 
 static const InlineBox* rightInlineBox(const InlineBox* box, TextDirection blockDirection)
@@ -1550,8 +1497,7 @@
     if (rightLineBox)
         return rightLineBox->firstLeafChild();
 
-    const RootInlineBox* rightRootInlineBox = isBlockLTR ? nextRootInlineBox(box) : previousRootInlineBox(box);
-    return rightRootInlineBox ? rightRootInlineBox->firstLeafChild() : 0;
+    return 0;
 }
 
 static VisiblePosition leftWordBoundary(const InlineBox* box, int offset, TextDirection blockDirection)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to