diff --git a/editor/libeditor/HTMLEditSubActionHandler.cpp b/editor/libeditor/HTMLEditSubActionHandler.cpp
index a5f00e592d66..bcb02bb4ad52 100644
--- a/editor/libeditor/HTMLEditSubActionHandler.cpp
+++ b/editor/libeditor/HTMLEditSubActionHandler.cpp
@@ -1700,38 +1700,6 @@ EditActionResult HTMLEditor::HandleInsertText(
"Failed to unset interline position");
if (currentPoint.IsSet()) {
- if (currentPoint.IsInTextNode() &&
- IsVisibleTextNode(*currentPoint.ContainerAsText())) {
- // If the text is visible, we should remove padding element if
- // there is. Currently, we should remove it when it's immediately
- // after the text node. I.e., not scanning next element outside
- // the parent element even if there is one in same block because
- // element should be in same element if it's created for empty line.
- RefPtr nextSibling =
- currentPoint.GetContainer()->GetNextSibling();
- if (nextSibling && nextSibling->IsHTMLElement(nsGkAtoms::br) &&
- !IsVisibleBRElement(nextSibling)) {
- {
- AutoTrackDOMPoint tracker(RangeUpdaterRef(), ¤tPoint);
- nsresult rv = DeleteNodeWithTransaction(*nextSibling);
- if (NS_WARN_IF(Destroyed())) {
- return EditActionHandled(NS_ERROR_EDITOR_DESTROYED);
- }
- if (NS_FAILED(rv)) {
- NS_WARNING(
- "HTMLEditor::DeleteNodeWithTransaction() failed to remove "
- "unnecessary padding element");
- return EditActionHandled(rv);
- }
- }
- if (!currentPoint.IsSetAndValid()) {
- NS_WARNING(
- "Mutation event listener changed the DOM tree unexpected while "
- "removing invisible element");
- return EditActionHandled(NS_ERROR_EDITOR_UNEXPECTED_DOM_TREE);
- }
- }
- }
nsresult rv = CollapseSelectionTo(currentPoint);
if (NS_WARN_IF(rv == NS_ERROR_EDITOR_DESTROYED)) {
return EditActionHandled(NS_ERROR_EDITOR_DESTROYED);
diff --git a/editor/libeditor/tests/test_bug1250010.html b/editor/libeditor/tests/test_bug1250010.html
index 7acc176e15bc..7113fa91770f 100644
--- a/editor/libeditor/tests/test_bug1250010.html
+++ b/editor/libeditor/tests/test_bug1250010.html
@@ -45,8 +45,8 @@ SimpleTest.waitForFocus(function() {
sendString("a");
is(div.innerHTML, "
1234567890
" +
- "
a
" +
- "
b
",
+ "
a
" +
+ "
b
",
"unexpected HTML");
// Second test: Since we modified the code path that splits non-text nodes,
diff --git a/editor/libeditor/tests/test_bug1330796.html b/editor/libeditor/tests/test_bug1330796.html
index 7f4ba07ac79b..1fe1430b7869 100644
--- a/editor/libeditor/tests/test_bug1330796.html
+++ b/editor/libeditor/tests/test_bug1330796.html
@@ -41,10 +41,10 @@ var tests = [
[ "> mailcite ", 5,
"> mai x lcite "],
[ "> mailcite ", 10,
- "> mailcite x" ],
+ "> mailcite x " ],
// No at the end to simulate prior deletion to the end of the quote.
[ "> mailcite", 10,
- "> mailcite x" ],
+ "> mailcite x " ],
// Without style="display: block;".
[ "> mailcite ", 0,
@@ -52,10 +52,10 @@ var tests = [
[ "> mailcite ", 5,
"> mai x lcite " ],
[ "> mailcite ", 10,
- "> mailcite x" ],
+ "> mailcite x " ],
// No at the end to simulate prior deletion to the end of the quote.
[ "> mailcite", 10,
- "> mailcite x" ],
+ "> mailcite x " ],
];
/** Test for Bug 1330796 **/
diff --git a/editor/libeditor/tests/test_bug1385905.html b/editor/libeditor/tests/test_bug1385905.html
index 6dc1f14ea43c..fda99ae7410f 100644
--- a/editor/libeditor/tests/test_bug1385905.html
+++ b/editor/libeditor/tests/test_bug1385905.html
@@ -33,8 +33,9 @@ SimpleTest.waitForFocus(() => {
"Typing Enter at start of the
element");
diff --git a/editor/libeditor/tests/test_bug1397412.xhtml b/editor/libeditor/tests/test_bug1397412.xhtml
index 0e47b1f2facc..a97596769627 100644
--- a/editor/libeditor/tests/test_bug1397412.xhtml
+++ b/editor/libeditor/tests/test_bug1397412.xhtml
@@ -28,7 +28,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1397412
";
- var expectedHTML1 = "xx t";
+ var expectedHTML1 = "xx t ";
var initialHTML2 = "xx
yy ";
var expectedHTML2 = "xx t yy ";
window.docShell
@@ -47,8 +47,7 @@ function runTest() {
selection.collapse(body, 2);
sendString("t");
var actualHTML = body.innerHTML;
- is(actualHTML, expectedHTML1,
- "'t' should be inserted immediately after the first and the other one should be removed");
+ is(actualHTML, expectedHTML1, "'t' should be inserted between s");
// Test 2.
body.innerHTML = initialHTML2;
diff --git a/editor/libeditor/tests/test_bug551704.html b/editor/libeditor/tests/test_bug551704.html
index c8f2314721c8..ad63904f6698 100644
--- a/editor/libeditor/tests/test_bug551704.html
+++ b/editor/libeditor/tests/test_bug551704.html
@@ -112,7 +112,7 @@ function continueTest() {
} else {
type = typeABCDEF;
}
- var expectedHTML = "
", "No tag should be generated");
SimpleTest.finish();
});
diff --git a/editor/libeditor/tests/test_bug832025.html b/editor/libeditor/tests/test_bug832025.html
index d6a89b272b42..92c8b68b08f1 100644
--- a/editor/libeditor/tests/test_bug832025.html
+++ b/editor/libeditor/tests/test_bug832025.html
@@ -35,7 +35,7 @@ sendKey("return");
// insert some text
document.execCommand("insertText", false, "abc");
-is(test.innerHTML, "
header1
abc
",
+is(test.innerHTML, "
header1
abc
",
"A paragraph automatically created after a CR at the end of an H1 should not be bold");
diff --git a/editor/libeditor/tests/test_dom_input_event_on_htmleditor.html b/editor/libeditor/tests/test_dom_input_event_on_htmleditor.html
index beeee39e1e81..2dcc3bede4a2 100644
--- a/editor/libeditor/tests/test_dom_input_event_on_htmleditor.html
+++ b/editor/libeditor/tests/test_dom_input_event_on_htmleditor.html
@@ -225,7 +225,12 @@ async function runTests() {
cancelBeforeInput = false;
action = 'typing "B"';
synthesizeKey("B", {shiftKey: true}, aWindow);
- is(editTarget.innerHTML, "B", `${aDescription}"B" should've been inserted by ${action}`);
+ // XXX This inconsistency must be a bug.
+ if (!isEditTargetIsDescendantOfEditingHost) {
+ is(editTarget.innerHTML, "B ", `${aDescription}"B" should've been inserted by ${action}`);
+ } else {
+ is(editTarget.innerHTML, "B", `${aDescription}"B" should've been inserted by ${action}`);
+ }
is(beforeInputEvent.cancelable, true, `${aDescription}"beforeinput" event for ${action} should be cancelable`);
is(beforeInputEvent.inputType, "insertText", `${aDescription}inputType of "beforeinput" event for ${action} should be "insertText"`);
is(beforeInputEvent.data, "B", `${aDescription}data of "beforeinput" event for ${action} should be "B"`);
@@ -241,7 +246,12 @@ async function runTests() {
cancelBeforeInput = true;
action = 'typing "Enter"';
synthesizeKey("KEY_Enter", {}, aWindow);
- is(editTarget.innerHTML, "B", `${aDescription}shouldn't modify the editor by ${action} since "beforeinput" was canceled`);
+ // XXX This inconsistency must be a bug.
+ if (!isEditTargetIsDescendantOfEditingHost) {
+ is(editTarget.innerHTML, "B ", `${aDescription}shouldn't modify the editor by ${action} since "beforeinput" was canceled`);
+ } else {
+ is(editTarget.innerHTML, "B", `${aDescription}shouldn't modify the editor by ${action} since "beforeinput" was canceled`);
+ }
ok(beforeInputEvent, `${aDescription}"beforeinput" event should've been fired at ${action}`);
ok(!inputEvent, `${aDescription}"input" event shouldn't been fired at ${action} since "beforeinput" was canceled`);
@@ -273,9 +283,9 @@ async function runTests() {
action = 'typing "C" in new paragraph';
synthesizeKey("C", {shiftKey: true}, aWindow);
if (!isEditTargetIsDescendantOfEditingHost) {
- is(editTarget.innerHTML, "
B
C
", `${aDescription}should insert "C" into the new paragraph by ${action}`);
+ is(editTarget.innerHTML, "
B
C
", `${aDescription}should insert "C" into the new paragraph by ${action}`);
} else {
- is(editTarget.innerHTML, "B C", `${aDescription}should insert "C" into the new paragraph by ${action}`);
+ is(editTarget.innerHTML, "B C ", `${aDescription}should insert "C" into the new paragraph by ${action}`);
}
is(beforeInputEvent.cancelable, true, `${aDescription}"beforeinput" event for ${action} should be cancelable`);
is(beforeInputEvent.inputType, "insertText", `${aDescription}inputType of "beforeinput" event for ${action} should be "insertText"`);
diff --git a/editor/libeditor/tests/test_dragdrop.html b/editor/libeditor/tests/test_dragdrop.html
index b79c113b3ad5..df5cb487db66 100644
--- a/editor/libeditor/tests/test_dragdrop.html
+++ b/editor/libeditor/tests/test_dragdrop.html
@@ -1613,7 +1613,7 @@ async function doTest() {
});
is(input.value, "Somt",
`${description}: dragged range should be removed from `);
- is(contenteditable.innerHTML, "e Tex",
+ is(contenteditable.innerHTML, "e Tex ",
`${description}: dragged content should be inserted into contenteditable`);
is(beforeinputEvents.length, 2,
`${description}: 2 "beforeinput" events should be fired on and contenteditable`);
@@ -1659,7 +1659,7 @@ async function doTest() {
});
is(input.value, "Some Text",
`${description}: dragged range shouldn't be removed from `);
- is(contenteditable.innerHTML, "e Tex",
+ is(contenteditable.innerHTML, "e Tex ",
`${description}: dragged content should be inserted into contenteditable`);
is(beforeinputEvents.length, 2,
`${description}: 2 "beforeinput" events should be fired on and contenteditable`);
@@ -1748,7 +1748,7 @@ async function doTest() {
});
is(input.value, "Some Text",
`${description}: dragged range shouldn't be removed from `);
- is(contenteditable.innerHTML, "e Tex",
+ is(contenteditable.innerHTML, "e Tex ",
`${description}: dragged content should be inserted into contenteditable`);
is(beforeinputEvents.length, 1,
`${description}: only one "beforeinput" events should be fired on contenteditable`);
@@ -1793,7 +1793,7 @@ async function doTest() {
`${description}: dragged range should be removed from