Backout bug 157546 (making the delete key delete by clusters) to fix blockers bug 419217 and bug 419406. Instead of removing the added test, mark now-failing tests as todo. a=damons

This commit is contained in:
dbaron@dbaron.org 2008-04-14 18:04:18 -07:00
parent 67349a88bf
commit 4589e85ab3
7 changed files with 14 additions and 42 deletions

View File

@ -51,7 +51,7 @@ interface nsIDOMNode;
interface nsISelection;
interface nsISelectionDisplay;
[scriptable, uuid(513b9460-d56a-4c4e-b6f9-0b8ae4372a3b)]
[scriptable, uuid(5f8f41cb-f182-4010-9e38-7c873e8e8a9f)]
interface nsISelectionController : nsISelectionDisplay
{
const short SELECTION_NONE=0;
@ -164,12 +164,6 @@ interface nsISelectionController : nsISelectionDisplay
*/
void characterMove(in boolean forward, in boolean extend);
/** CharacterExtendForDelete will extend the selection one character cell
* forward in the document.
* this method is used internally for handling del key.
*/
[noscript] void characterExtendForDelete();
/** WordMove will move the selection one word forward/backward in the document.
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
* the "point" of selection that is extended is considered the "focus" point.

View File

@ -679,7 +679,6 @@ NS_IMETHODIMP nsPlaintextEditor::DeleteSelection(nsIEditor::EDirection aAction)
// This needs to happen inside selection batching,
// otherwise the deleted text is autocopied to the clipboard.
if (aAction == eNextWord || aAction == ePreviousWord
|| (aAction == eNext && bCollapsed)
|| aAction == eToBeginningOfLine || aAction == eToEndOfLine)
{
nsCOMPtr<nsISelectionController> selCont (do_QueryReferent(mSelConWeak));
@ -698,10 +697,6 @@ NS_IMETHODIMP nsPlaintextEditor::DeleteSelection(nsIEditor::EDirection aAction)
result = selCont->WordExtendForDelete(PR_FALSE);
aAction = eNone;
break;
case eNext:
result = selCont->CharacterExtendForDelete();
aAction = eNone;
break;
case eToBeginningOfLine:
selCont->IntraLineMove(PR_TRUE, PR_FALSE); // try to move to end
result = selCont->IntraLineMove(PR_FALSE, PR_TRUE); // select to beginning

View File

@ -930,7 +930,6 @@ public:
// nsISelectionController
NS_IMETHOD CharacterMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD CharacterExtendForDelete();
NS_IMETHOD WordMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD WordExtendForDelete(PRBool aForward);
NS_IMETHOD LineMove(PRBool aForward, PRBool aExtend);
@ -2773,12 +2772,6 @@ PresShell::CharacterMove(PRBool aForward, PRBool aExtend)
return mSelection->CharacterMove(aForward, aExtend);
}
NS_IMETHODIMP
PresShell::CharacterExtendForDelete()
{
return mSelection->CharacterExtendForDelete();
}
NS_IMETHODIMP
PresShell::WordMove(PRBool aForward, PRBool aExtend)
{

View File

@ -582,7 +582,6 @@ public:
NS_IMETHOD GetCaretVisible(PRBool *_retval);
NS_IMETHOD SetCaretVisibilityDuringSelection(PRBool aVisibility);
NS_IMETHOD CharacterMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD CharacterExtendForDelete();
NS_IMETHOD WordMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD WordExtendForDelete(PRBool aForward);
NS_IMETHOD LineMove(PRBool aForward, PRBool aExtend);
@ -807,13 +806,6 @@ nsTextInputSelectionImpl::CharacterMove(PRBool aForward, PRBool aExtend)
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP
nsTextInputSelectionImpl::CharacterExtendForDelete()
{
if (mFrameSelection)
return mFrameSelection->CharacterExtendForDelete();
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP
nsTextInputSelectionImpl::WordMove(PRBool aForward, PRBool aExtend)

View File

@ -409,12 +409,6 @@ public:
/*unsafe*/
nsresult CharacterMove(PRBool aForward, PRBool aExtend);
/** CharacterExtendForDelete extends the selection forward (logically) to
* the next character cell, so that the selected cell can be deleted.
*/
/*unsafe*/
nsresult CharacterExtendForDelete();
/** WordMove will generally be called from the nsiselectioncontroller implementations.
* the effect being the selection will move one word left or right.
* @param aForward move forward in document.

View File

@ -2773,12 +2773,6 @@ nsFrameSelection::CharacterMove(PRBool aForward, PRBool aExtend)
return MoveCaret(nsIDOMKeyEvent::DOM_VK_LEFT,aExtend,eSelectCharacter);
}
nsresult
nsFrameSelection::CharacterExtendForDelete()
{
return MoveCaret(nsIDOMKeyEvent::DOM_VK_DELETE, PR_TRUE, eSelectCharacter);
}
nsresult
nsFrameSelection::WordMove(PRBool aForward, PRBool aExtend)
{

View File

@ -53,10 +53,14 @@ function test() {
var sel = window.getSelection();
var editor = document.getElementById("editor");
var todo1 = false;
var todo2 = false;
function testRight(node, offset) {
synthesizeKey("VK_RIGHT", {});
is(sel.anchorNode, node, "Right movement broken in \"" + editor.innerHTML + "\"");
is(sel.anchorOffset, offset, "Right movement broken in \"" + editor.innerHTML + "\"");
var is_func2 = todo2 ? todo_is : is;
is_func2(sel.anchorOffset, offset, "Right movement broken in \"" + editor.innerHTML + "\"");
}
function selErrString(dir) {
@ -75,8 +79,10 @@ function test() {
function testDelete(node, offset, text) {
synthesizeKey("VK_DELETE", {});
is(sel.anchorNode, node, "Delete broken in \"" + editor.innerHTML + "\"");
is(sel.anchorOffset, offset, "Delete broken in \"" + editor.innerHTML + "\"");
is(editor.textContent, text, "Delete broken in \"" + editor.innerHTML + "\"");
var is_func2 = todo2 ? todo_is : is;
is_func2(sel.anchorOffset, offset, "Delete broken in \"" + editor.innerHTML + "\"");
var is_func1 = todo1 ? todo_is : is;
is_func1(editor.textContent, text, "Delete broken in \"" + editor.innerHTML + "\"");
}
function testBackspace(node, offset, text) {
@ -89,6 +95,7 @@ function test() {
// Test cell-wise deletion of Delete
editor.innerHTML = "สวัสดีพ่อแม่พี่น้อง";
sel.collapse(editor.firstChild, 0);
todo1 = true;
testRight(editor.firstChild, 1);
testDelete(editor.firstChild, 1, "สสดีพ่อแม่พี่น้อง");
testRight(editor.firstChild, 2);
@ -97,10 +104,13 @@ function test() {
testDelete(editor.firstChild, 4, "สสพ่แม่พี่น้อง");
testRight(editor.firstChild, 5);
testDelete(editor.firstChild, 5, "สสพ่แพี่น้อง");
todo2 = true;
testRight(editor.firstChild, 8);
testDelete(editor.firstChild, 8, "สสพ่แพี่อง");
testRight(editor.firstChild, 9);
testDelete(editor.firstChild, 9, "สสพ่แพี่อ");
todo1 = false;
todo2 = false;
// Test character-wise deletion of Backspace
editor.innerHTML = "สวัสดีพ่อแม่พี่น้อง";