Commit 4c6e10d7 authored by mrowe@apple.com's avatar mrowe@apple.com

2008-06-22 Jonathon Jongsma <jonathon.jongsma@collabora.co.uk>

        Reviewed by Darin Adler.

        Fix https://bugs.webkit.org/show_bug.cgi?id=19465
        Bug 19465: Cursor sometimes gets 'stuck' in textareas when trying to navigate with arrow keys

        Test: editing/input/textarea-arrow-navigation.html

        * rendering/RenderText.cpp:
        (WebCore::RenderText::positionForCoordinates): In the case when the next position is to the right
        of the last text box but the text offset is 0, set the affinity to DOWNSTREAM instead of UPSTREAM so
        that the cursor doesn't remain on the previous line.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34735 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 92522713
2008-06-22 Jonathon Jongsma <jonathon.jongsma@collabora.co.uk>
Reviewed by Darin Adler.
Test for https://bugs.webkit.org/show_bug.cgi?id=19465
Bug 19465: Cursor sometimes gets 'stuck' in textareas when trying to navigate with arrow keys
* editing/input/textarea-arrow-navigation.html:
* editing/input/textarea-arrow-navigation-expected.html: Added.
2008-06-22 Robert Blaut <webkit@blaut.biz>
Reviewed by Darin Adler.
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
This tests that the cursor doesn't get 'stuck' when advancing through a text area with the down arrow key. See bug #19465 for more information
If the test is successful and the cursor is at the end of the textarea, you should see the word 'Success' printed below
Success
<html>
<head>
<link rel=stylesheet href="../editingStyle.css" type="text/css">
<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
<script>
function log(str) {
var li = document.createElement("li");
li.appendChild(document.createTextNode(str));
var console = document.getElementById("console");
console.appendChild(li);
}
function editingTest() {
if (window.layoutTestController)
window.layoutTestController.dumpAsText();
var textarea = document.getElementById("test");
// set the cursor several characters into the first line of the text area so
// that when you go down by a line, the cursor will be at the end of the
// numbered lines:
textarea.setSelectionRange(5, 5);
for (var i = 0; i < 10; i++) {
// press the 'down arrow' a bunch of times to try to get to the end of
// the text area
moveSelectionForwardByLineCommand();
}
if (textarea.selectionStart != textarea.value.length)
log ("Fail. Expected: selectionStart == " + textarea.value.length + ", Found: " + textarea.selectionStart);
else
log("Success");
}
</script>
</head>
<body>
<p>
This tests that the cursor doesn't get 'stuck' when advancing through a
text area with the down arrow key. See bug #19465 for more information
</p>
<p>
If the test is successful and the cursor is at the end of the textarea, you should see the word 'Success' printed below
</p>
<textarea id="test" rows="10" cols="80">What steps will reproduce the problem?
1.
2.
3.
What is the expected output? What do you see instead?</textarea>
<ul id="console"></ul>
<script>
runEditingTest();
</script>
</body>
</html>
2008-06-22 Jonathon Jongsma <jonathon.jongsma@collabora.co.uk>
Reviewed by Darin Adler.
Fix https://bugs.webkit.org/show_bug.cgi?id=19465
Bug 19465: Cursor sometimes gets 'stuck' in textareas when trying to navigate with arrow keys
Test: editing/input/textarea-arrow-navigation.html
* rendering/RenderText.cpp:
(WebCore::RenderText::positionForCoordinates): In the case when the next position is to the right
of the last text box but the text offset is 0, set the affinity to DOWNSTREAM instead of UPSTREAM so
that the cursor doesn't remain on the previous line.
2008-06-22 Robert Blaut <webkit@blaut.biz>
Reviewed by Darin Adler.
......@@ -315,7 +315,7 @@ VisiblePosition RenderText::positionForCoordinates(int x, int y)
// box is last on line
// and the x coordinate is to the right of the last text box right edge
// generate VisiblePosition, use UPSTREAM affinity if possible
return VisiblePosition(element(), offset + box->m_start, VP_UPSTREAM_IF_POSSIBLE);
return VisiblePosition(element(), offset + box->m_start, offset > 0 ? VP_UPSTREAM_IF_POSSIBLE : DOWNSTREAM);
}
lastBoxAbove = box;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment