Backed out changeset 9b832d90d637 (bug 462188) due to 7 test failures on Linux and 1 on Windows (0 on Mac).

This commit is contained in:
L. David Baron 2009-01-16 15:00:40 -08:00
parent 4169a80855
commit e11583f7ec
2 changed files with 3 additions and 50 deletions

View File

@ -1948,24 +1948,10 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
if (NS_FAILED(res)) return res;
if (*aCancel) return NS_OK;
res = mHTMLEditor->ExtendSelectionForDelete(aSelection, &aAction);
NS_ENSURE_SUCCESS(res, res);
// We should delete nothing.
if (aAction == nsIEditor::eNone)
return NS_OK;
// ExtendSelectionForDelete() may have changed the selection, update it
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(startNode), &startOffset);
if (NS_FAILED(res)) return res;
if (!startNode) return NS_ERROR_FAILURE;
res = aSelection->GetIsCollapsed(&bCollapsed);
if (NS_FAILED(res)) return res;
}
if (bCollapsed)
{
// what's in the direction we are deleting?
nsWSRunObject wsObj(mHTMLEditor, startNode, startOffset);
nsCOMPtr<nsIDOMNode> visNode;
@ -2010,6 +1996,9 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
}
else
{
res = mHTMLEditor->ExtendSelectionForDelete(aSelection, &aAction);
NS_ENSURE_SUCCESS(res, res);
nsCOMPtr<nsIDOMRange> range;
res = aSelection->GetRangeAt(0, getter_AddRefs(range));
NS_ENSURE_SUCCESS(res, res);
@ -2026,8 +2015,6 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
NS_ASSERTION(container == visNode, "selection end not in visNode");
#endif
res = range->GetStartOffset(&so);
NS_ENSURE_SUCCESS(res, res);
res = range->GetEndOffset(&eo);
NS_ENSURE_SUCCESS(res, res);
}

View File

@ -50,8 +50,6 @@ function test() {
var wordSelModifiers =
(navigator.platform.indexOf("Mac") >= 0) ?
{shiftKey:true, altKey:true} : {shiftKey:true, ctrlKey:true};
var wordModifiers =
(navigator.platform.indexOf("Mac") >= 0) ? {altKey:true} : {ctrlKey:true};
var sel = window.getSelection();
var editor = document.getElementById("editor");
@ -88,18 +86,6 @@ function test() {
is(editor.textContent, text, "Backspace broken in \"" + editor.innerHTML + "\"");
}
function testDeletePrevWord(node, offset, text) {
synthesizeKey("VK_BACK_SPACE", wordModifiers);
is(sel.anchorNode, node, "Delete previous word broken in \"" + editor.innerHTML + "\"");
is(sel.anchorOffset, offset, "Delete previous word broken in \"" + editor.innerHTML + "\"");
}
function testDeleteNextWord(node, offset, text) {
synthesizeKey("VK_DELETE", wordModifiers);
is(sel.anchorNode, node, "Delete next word broken in \"" + editor.innerHTML + "\"");
is(sel.anchorOffset, offset, "Delete next word broken in \"" + editor.innerHTML + "\"");
}
// Test cell-wise deletion of Delete
editor.innerHTML = "สวัสดีพ่อแม่พี่น้อง";
sel.collapse(editor.firstChild, 0);
@ -183,26 +169,6 @@ function test() {
testRight(editor.firstChild, 5);
testDelete(editor.firstChild, 5, "helloשלום");
// Tests for Bug 462188
editor.innerHTML = "You should not see this text.";
sel.collapse(editor.firstChild, 29);
testDeletePrevWord(editor.firstChild, 24, "You should not see this ");
testDeletePrevWord(editor.firstChild, 19, "You should not see ");
testDeletePrevWord(editor.firstChild, 15, "You should not ");
testDeletePrevWord(editor.firstChild, 11, "You should ");
testDeletePrevWord(editor.firstChild, 4, "You ");
testDeletePrevWord(editor, 0, "");
editor.innerHTML = "You should not see this text.";
sel.collapse(editor.firstChild, 0);
testDeleteNextWord(editor.firstChild, 0, " should not see this text.");
testDeleteNextWord(editor.firstChild, 0, " not see this text.");
testDeleteNextWord(editor.firstChild, 0, " see this text.");
testDeleteNextWord(editor.firstChild, 0, " this text.");
testDeleteNextWord(editor.firstChild, 0, " text.");
testDeleteNextWord(editor, 0, "");
SimpleTest.finish();
}