[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

rniwa at webkit.org rniwa at webkit.org
Wed Dec 22 17:45:48 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 7d2dfb608babb20222803a1a9563e3014b74962b
Author: rniwa at webkit.org <rniwa at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 30 02:54:54 2010 +0000

    2010-11-19  Ryosuke Niwa  <rniwa at webkit.org>
    
            Reviewed by David Hyatt.
    
            up arrow doesn't work with RTL text with word wrapping
            https://bugs.webkit.org/show_bug.cgi?id=41987
    
            The bug was caused by positionForPoint's not returning the correct affinity when the x coordiate
            is to the left of the first line, and startOfLine's incorrectly moving position to the previous candidate.
    
            Fixed the bug by returning upstream VisiblePosition in positionForPoint if the first inline text box's offset
            is greater than 0.  Also removed the code added by http://trac.webkit.org/changeset/23608 since this changeset
            does not add any test, and the problem described in the changelog reproduces regardless of the code's presence.
    
            Tests: editing/selection/click-left-of-rtl-wrapping-text.html
                   editing/selection/modify-up-on-rtl-wrapping-text.html
    
            * editing/visible_units.cpp:
            (WebCore::startOfLine):
            * rendering/RenderText.cpp:
            (WebCore::RenderText::positionForPoint):
    2010-11-29  Ryosuke Niwa  <rniwa at webkit.org>
    
            Reviewed by David Hyatt.
    
            up arrow doesn't work with RTL text with word wrapping
            https://bugs.webkit.org/show_bug.cgi?id=41987
    
            Added tests to ensure WebKit places caret at the right position in soft-wrapping RTL text when clicking
            to the left of RTL text or when moving upwards at the end of line.
    
            * editing/selection/click-left-of-rtl-wrapping-text-expected.txt: Added.
            * editing/selection/click-left-of-rtl-wrapping-text.html: Added.
            * editing/selection/home-end-expected.txt: RTL's expected result now matches LTR's.
            * editing/selection/modify-up-on-rtl-wrapping-text-expected.txt: Added.
            * editing/selection/modify-up-on-rtl-wrapping-text.html: Added.
            * platform/chromium-win/editing/selection/extend-selection-home-end-expected.txt: RTL's expected result now matches LTR's.
            * platform/gtk/editing/selection/extend-selection-home-end-expected.txt: Ditto.
            * platform/mac/editing/selection/extend-selection-home-end-expected.txt: Ditto.
            * platform/win/editing/selection/extend-selection-home-end-expected.txt: Ditto.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72861 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index e03d99b..f1f655f 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,23 @@
+2010-11-29  Ryosuke Niwa  <rniwa at webkit.org>
+
+        Reviewed by David Hyatt.
+
+        up arrow doesn't work with RTL text with word wrapping
+        https://bugs.webkit.org/show_bug.cgi?id=41987
+
+        Added tests to ensure WebKit places caret at the right position in soft-wrapping RTL text when clicking
+        to the left of RTL text or when moving upwards at the end of line.
+
+        * editing/selection/click-left-of-rtl-wrapping-text-expected.txt: Added.
+        * editing/selection/click-left-of-rtl-wrapping-text.html: Added.
+        * editing/selection/home-end-expected.txt: RTL's expected result now matches LTR's.
+        * editing/selection/modify-up-on-rtl-wrapping-text-expected.txt: Added.
+        * editing/selection/modify-up-on-rtl-wrapping-text.html: Added.
+        * platform/chromium-win/editing/selection/extend-selection-home-end-expected.txt: RTL's expected result now matches LTR's.
+        * platform/gtk/editing/selection/extend-selection-home-end-expected.txt: Ditto.
+        * platform/mac/editing/selection/extend-selection-home-end-expected.txt: Ditto.
+        * platform/win/editing/selection/extend-selection-home-end-expected.txt: Ditto.
+
 2010-11-29  Xiaomei Ji  <xji at chromium.org>
 
         Reviewed by NOBODY.
diff --git a/LayoutTests/editing/selection/click-left-of-rtl-wrapping-text-expected.txt b/LayoutTests/editing/selection/click-left-of-rtl-wrapping-text-expected.txt
new file mode 100644
index 0000000..eec8470
--- /dev/null
+++ b/LayoutTests/editing/selection/click-left-of-rtl-wrapping-text-expected.txt
@@ -0,0 +1,13 @@
+This tests clicking on the left of RTL text puts the caret at the end of the line.
+
+PASS: clicking on the left of the 1st line of ך לכ put the caret at 2
+PASS: clicking on the left of the 2nd line of ך לכ put the caret at 4
+PASS: clicking on the left of the 1st line of גכ יגכע ג put the caret at 3
+PASS: clicking on the left of the 2nd line of גכ יגכע ג put the caret at 8
+FAIL: clicking on the left of the 3rd line of גכ יגכע ג put the caret at 9 but expected at 10
+PASS: clicking on the left of the 1st line of גכ יגכ יגכ יגכ יגכ put the caret at 3
+PASS: clicking on the left of the 2nd line of גכ יגכ יגכ יגכ יגכ put the caret at 7
+PASS: clicking on the left of the 3rd line of גכ יגכ יגכ יגכ יגכ put the caret at 11
+PASS: clicking on the left of the 4th line of גכ יגכ יגכ יגכ יגכ put the caret at 15
+PASS: clicking on the left of the 5th line of גכ יגכ יגכ יגכ יגכ put the caret at 18
+
diff --git a/LayoutTests/editing/selection/click-left-of-rtl-wrapping-text.html b/LayoutTests/editing/selection/click-left-of-rtl-wrapping-text.html
new file mode 100644
index 0000000..a01c584
--- /dev/null
+++ b/LayoutTests/editing/selection/click-left-of-rtl-wrapping-text.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html charset="utf-8">
+<body>
+<p>This tests clicking on the left of RTL text puts the caret at the end of the line.</p>
+<pre id="console"></pre>
+<script>
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+var tests = [
+    {content: "&#1498; &#1500;&#1499;", width: "2.5ex", expected: [2, 4]},
+    {content: "&#1490;&#1499; &#1497;&#1490;&#1499;&#1506; &#1490;", width: "5ex", expected: [3, 8, 10]},
+    {content: "&#1490;&#1499; &#1497;&#1490;&#1499; &#1497;&#1490;&#1499; &#1497;&#1490;&#1499; &#1497;&#1490;&#1499;", width: "5ex",
+        expected: [3, 7, 11, 15, 18]},
+];
+
+function failed(message) {
+    console.innerHTML += 'FAIL: ' + message + '\n';
+}
+
+function passed(message) {
+    console.innerHTML += 'PASS: ' + message + '\n';
+}
+
+function runTest(container, test) {
+    container.innerHTML = test.content;
+    container.style.width = test.width;
+
+    var x = 2;
+    var y = 2;
+    var yIncrement = container.offsetHeight / test.expected.length;
+    var lines = ['st', 'nd', 'rd', 'th'];
+
+    for (var i = 0; i < test.expected.length; i++) {
+        eventSender.mouseMoveTo(container.offsetLeft + x, container.offsetTop + y);
+        eventSender.mouseDown();
+        eventSender.leapForward(500);
+        eventSender.mouseUp();
+        var line = (i + 1) + lines[Math.min(i, lines.length - 1)];
+        var action = 'clicking on the left of the ' + line + ' line of ' + test.content;
+
+        if (!window.getSelection().isCollapsed)
+            return failed(action + ' put selection instead of caret');
+
+        var range = window.getSelection().getRangeAt(0);
+        if (range.startContainer != container.firstChild)
+            return failed(action + ' put the caret at a wrong container');
+
+        action += ' put the caret at ' + range.startOffset;
+        if (range.startOffset != test.expected[i])
+            return failed(action + ' but expected at ' + test.expected[i]);
+        y += yIncrement;
+        passed(action);
+    }
+
+}
+
+var console = document.getElementById('console');
+
+var container = document.createElement('div');
+container.contentEditable = true;
+container.setAttribute('dir', 'rtl');
+document.body.appendChild(container);
+
+if (!window.eventSender)
+    failed('Clicking tests require eventSender');
+else {
+    for (var i = 0; i < tests.length; i++)
+        runTest(container, tests[i]);
+    container.innerHTML = '';
+}
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/editing/selection/home-end-expected.txt b/LayoutTests/editing/selection/home-end-expected.txt
index 897c86d..4be56bf 100644
--- a/LayoutTests/editing/selection/home-end-expected.txt
+++ b/LayoutTests/editing/selection/home-end-expected.txt
@@ -116,12 +116,12 @@ Test 20, LTR:
   Moving forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[0, 8]
   Moving backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[8, 0]
 Test 20, RTL:
-  Moving forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[0, 7]
-  Moving backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[7, 0]
+  Moving forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[0, 8]
+  Moving backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[8, 0]
 Test 21, LTR:
   Moving forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[0, 8]
   Moving backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[8, 0]
 Test 21, RTL:
-  Moving forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[0, 7]
-  Moving backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[7, 0]
+  Moving forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[0, 8]
+  Moving backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[8, 0]
 
diff --git a/LayoutTests/editing/selection/modify-up-on-rtl-wrapping-text-expected.txt b/LayoutTests/editing/selection/modify-up-on-rtl-wrapping-text-expected.txt
new file mode 100644
index 0000000..781add8
--- /dev/null
+++ b/LayoutTests/editing/selection/modify-up-on-rtl-wrapping-text-expected.txt
@@ -0,0 +1,13 @@
+This tests clicking on the left of RTL text puts the caret at the end of the line.
+
+PASS: on ך לכ, caret is at 4 initially
+PASS: on ך לכ, caret is at 2 after moving upwards once
+PASS: on ג גכ כעי, caret is at 8 initially
+PASS: on ג גכ כעי, caret is at 5 after moving upwards once
+PASS: on ג גכ כעי, caret is at 2 after moving upwards twice
+PASS: on גכ יגכ יגכ יגכ יגכ, caret is at 18 initially
+PASS: on גכ יגכ יגכ יגכ יגכ, caret is at 14 after moving upwards once
+PASS: on גכ יגכ יגכ יגכ יגכ, caret is at 10 after moving upwards twice
+PASS: on גכ יגכ יגכ יגכ יגכ, caret is at 6 after moving upwards 3 times
+PASS: on גכ יגכ יגכ יגכ יגכ, caret is at 3 after moving upwards 4 times
+גכ יגכ יגכ יגכ יגכ
diff --git a/LayoutTests/editing/selection/modify-up-on-rtl-wrapping-text.html b/LayoutTests/editing/selection/modify-up-on-rtl-wrapping-text.html
new file mode 100644
index 0000000..ef26f67
--- /dev/null
+++ b/LayoutTests/editing/selection/modify-up-on-rtl-wrapping-text.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html charset="utf-8">
+<body>
+<p>This tests clicking on the left of RTL text puts the caret at the end of the line.</p>
+<pre id="console"></pre>
+<script>
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+var tests = [
+    {content: "&#1498; &#1500;&#1499;", width: "2.5ex", expected: [2, 4]},
+    {content: "&#1490; &#1490;&#1499; &#1499;&#1506;&#1497;", width: "3.5ex", expected: [2, 5, 8]},
+    {content: "&#1490;&#1499; &#1497;&#1490;&#1499; &#1497;&#1490;&#1499; &#1497;&#1490;&#1499; &#1497;&#1490;&#1499;", width: "5ex",
+        expected: [3, 6, 10, 14, 18]},
+];
+
+function failed(message) {
+    console.innerHTML += 'FAIL: ' + message + '\n';
+}
+
+function passed(message) {
+    console.innerHTML += 'PASS: ' + message + '\n';
+}
+
+function runTest(container, test) {
+    container.innerHTML = test.content;
+    container.style.width = test.width;
+
+    var lines = ['st', 'nd', 'rd', 'th'];
+    window.getSelection().setPosition(container.firstChild, test.content.length);
+
+    for (var i = 0; i < test.expected.length; i++) {
+        if (!window.getSelection().isCollapsed)
+            return failed('the selection was not collapsed');
+
+        var range = window.getSelection().getRangeAt(0);
+        if (range.startContainer != container.firstChild)
+            return failed('caret was at a wrong container');
+
+        var action = 'on ' + test.content + ', caret is at ' + range.startOffset;
+        if (i == 0) action += ' initially';
+        else if (i == 1) action += ' after moving upwards once';
+        else if (i == 2) action += ' after moving upwards twice';
+        else action += ' after moving upwards ' + i + ' times';
+        if (range.startOffset != test.expected[test.expected.length - i - 1])
+            return failed(action + ' but expected at ' + test.expected[i]);
+        passed(action);
+        window.getSelection().modify('move', 'backward', 'line')
+    }
+}
+
+var console = document.getElementById('console');
+
+var container = document.createElement('div');
+container.contentEditable = true;
+container.setAttribute('dir', 'rtl');
+document.body.appendChild(container);
+
+for (var i = 0; i < tests.length; i++)
+    runTest(container, tests[i]);
+//container.innerHTML = '';
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium-win/editing/selection/extend-selection-home-end-expected.txt b/LayoutTests/platform/chromium-win/editing/selection/extend-selection-home-end-expected.txt
index 23d8a3c..f74c7ab 100644
--- a/LayoutTests/platform/chromium-win/editing/selection/extend-selection-home-end-expected.txt
+++ b/LayoutTests/platform/chromium-win/editing/selection/extend-selection-home-end-expected.txt
@@ -123,11 +123,11 @@ Test 21, LTR:
   Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,16)]
   Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,16)]
 Test 21, RTL:
-  Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,15)]
-  Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,15), (0,0)]
+  Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,16)]
+  Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,16), (0,0)]
 Test 22, LTR:
   Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,16)]
   Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,16)]
 Test 22, RTL:
-  Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,15)]
-  Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,15), (0,0)]
+  Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,16)]
+  Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,16), (0,0)]
diff --git a/LayoutTests/platform/gtk/editing/selection/extend-selection-home-end-expected.txt b/LayoutTests/platform/gtk/editing/selection/extend-selection-home-end-expected.txt
index 6606c9b..688584c 100644
--- a/LayoutTests/platform/gtk/editing/selection/extend-selection-home-end-expected.txt
+++ b/LayoutTests/platform/gtk/editing/selection/extend-selection-home-end-expected.txt
@@ -126,12 +126,12 @@ Test 21, LTR:
   Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,8)]
   Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,8)]
 Test 21, RTL:
-  Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,7)]
-  Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,7)]
+  Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,8)]
+  Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,8)]
 Test 22, LTR:
   Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,8)]
   Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,8)]
 Test 22, RTL:
-  Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,7)]
-  Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,7)]
+  Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,8)]
+  Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,8)]
 
diff --git a/LayoutTests/platform/mac/editing/selection/extend-selection-home-end-expected.txt b/LayoutTests/platform/mac/editing/selection/extend-selection-home-end-expected.txt
index 6606c9b..688584c 100644
--- a/LayoutTests/platform/mac/editing/selection/extend-selection-home-end-expected.txt
+++ b/LayoutTests/platform/mac/editing/selection/extend-selection-home-end-expected.txt
@@ -126,12 +126,12 @@ Test 21, LTR:
   Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,8)]
   Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,8)]
 Test 21, RTL:
-  Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,7)]
-  Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,7)]
+  Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,8)]
+  Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,8)]
 Test 22, LTR:
   Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,8)]
   Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,8)]
 Test 22, RTL:
-  Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,7)]
-  Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,7)]
+  Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,8)]
+  Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,8)]
 
diff --git a/LayoutTests/platform/win/editing/selection/extend-selection-home-end-expected.txt b/LayoutTests/platform/win/editing/selection/extend-selection-home-end-expected.txt
index fb01397..79f5588 100644
--- a/LayoutTests/platform/win/editing/selection/extend-selection-home-end-expected.txt
+++ b/LayoutTests/platform/win/editing/selection/extend-selection-home-end-expected.txt
@@ -126,12 +126,12 @@ Test 21, LTR:
   Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,8)]
   Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,8)]
 Test 21, RTL:
-  Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,7)]
-  Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,7), (0,0)]
+  Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,8)]
+  Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,8), (0,0)]
 Test 22, LTR:
   Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,8)]
   Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,8)]
 Test 22, RTL:
-  Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,7)]
-  Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,7), (0,0)]
+  Extending forward: "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,0), (0,8)]
+  Extending backward:  "abcdefg abcdefg abcdefg a abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg "[(0,8), (0,0)]
 
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6d539e0..04181bc 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2010-11-19  Ryosuke Niwa  <rniwa at webkit.org>
+
+        Reviewed by David Hyatt.
+
+        up arrow doesn't work with RTL text with word wrapping
+        https://bugs.webkit.org/show_bug.cgi?id=41987
+
+        The bug was caused by positionForPoint's not returning the correct affinity when the x coordiate
+        is to the left of the first line, and startOfLine's incorrectly moving position to the previous candidate.
+
+        Fixed the bug by returning upstream VisiblePosition in positionForPoint if the first inline text box's offset
+        is greater than 0.  Also removed the code added by http://trac.webkit.org/changeset/23608 since this changeset
+        does not add any test, and the problem described in the changelog reproduces regardless of the code's presence.
+
+        Tests: editing/selection/click-left-of-rtl-wrapping-text.html
+               editing/selection/modify-up-on-rtl-wrapping-text.html
+
+        * editing/visible_units.cpp:
+        (WebCore::startOfLine):
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::positionForPoint):
+
 2010-11-29  Ilya Sherman  <isherman at chromium.org>
 
         Reviewed by Kent Tamura.
diff --git a/WebCore/editing/visible_units.cpp b/WebCore/editing/visible_units.cpp
index 91de663..2c7b87c 100644
--- a/WebCore/editing/visible_units.cpp
+++ b/WebCore/editing/visible_units.cpp
@@ -418,21 +418,6 @@ static VisiblePosition startPositionForLine(const VisiblePosition& c)
 VisiblePosition startOfLine(const VisiblePosition& c)
 {
     VisiblePosition visPos = startPositionForLine(c);
-    
-    if (visPos.isNotNull()) {
-        // Make sure the start of line is not greater than the given input position.  Else use the previous position to 
-        // obtain start of line.  This condition happens when the input position is before the space character at the end 
-        // of a soft-wrapped non-editable line. In this scenario, startPositionForLine would incorrectly hand back a position
-        // greater than the input position.  This fix is to account for the discrepancy between lines with webkit-line-break:after-white-space 
-        // style versus lines without that style, which would break before a space by default. 
-        Position p = visPos.deepEquivalent();
-        if (p.deprecatedEditingOffset() > c.deepEquivalent().deprecatedEditingOffset() && p.node()->isSameNode(c.deepEquivalent().node())) {
-            visPos = c.previous();
-            if (visPos.isNull())
-                return VisiblePosition();
-            visPos = startPositionForLine(visPos);
-        }
-    }
 
     return c.honorEditableBoundaryAtOrAfter(visPos);
 }
diff --git a/WebCore/rendering/RenderText.cpp b/WebCore/rendering/RenderText.cpp
index 7635d07..0d1bd91 100644
--- a/WebCore/rendering/RenderText.cpp
+++ b/WebCore/rendering/RenderText.cpp
@@ -429,7 +429,7 @@ VisiblePosition RenderText::positionForPoint(const IntPoint& point)
         // at the y coordinate of the first line or above
         // and the x coordinate is to the left of the first text box left edge
         offset = firstTextBox()->offsetForPosition(pointLineDirection);
-        return createVisiblePosition(offset + firstTextBox()->start(), DOWNSTREAM);
+        return createVisiblePosition(offset + firstTextBox()->start(), offset > 0 ? VP_UPSTREAM_IF_POSSIBLE : DOWNSTREAM);
     }
     if (lastTextBox() && pointBlockDirection >= lastTextBox()->root()->selectionTop() && pointLineDirection >= lastTextBox()->logicalRight()) {
         // at the y coordinate of the last line or below

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list