зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1724650 - part 8: Update WPT result and add new tests to insert mulitple white-spaces r=m_kato
This does NOT add tests to `inserttext` command which includes linefeed characters with other characters. It seems that Blink handles 2 or more length string is handled as multiple calls for every character. So each linefeed character is handled as `insertparagraph`, but Gecko treats the linefeed characters as-is. We should add the tests later with changing Gecko's behavior, but for now, we should keep current behavior because this difference must not be trobule in the wild, but we need to improve preformatted string handler of Gecko better against reported web-compat issues. Differential Revision: https://phabricator.services.mozilla.com/D124562
This commit is contained in:
Родитель
d09a8cbb39
Коммит
b8c286c107
|
@ -989,7 +989,6 @@ nsresult WhiteSpaceVisibilityKeeper::ReplaceText(
|
|||
// replace them with NBSP for making sure the collapsible characters visible.
|
||||
// FYI: There is no case only linefeeds are collapsible. So, we need to
|
||||
// do the things only when white-spaces are collapsible.
|
||||
// TODO: Add WPT for inserting multiple white-spaces.
|
||||
MOZ_DIAGNOSTIC_ASSERT(!theString.IsEmpty());
|
||||
if (NS_WARN_IF(!pointToInsert.IsInContentNode()) ||
|
||||
!EditorUtils::IsWhiteSpacePreformatted(
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -709,7 +709,6 @@
|
|||
expected: FAIL
|
||||
|
||||
|
||||
|
||||
[delete.html?7001-last]
|
||||
[[["delete",""\]\] "<div style=white-space:pre>foo\\nb[\]</div>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
@ -717,9 +716,6 @@
|
|||
[[["delete",""\]\] "<div style=white-space:pre-wrap>foo\\nb[\]</div>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["delete",""\]\] "<div style=white-space:pre-line>foo\\n\\n[\]bar</div>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["delete",""\]\] "<div style=white-space:pre-line>foo\\nb[\]</div>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -623,18 +623,11 @@
|
|||
[[["forwarddelete",""\]\] "<div><div contenteditable=false><span contenteditable>{}<br></span></div></div>": execCommand("forwarddelete", false, "") return value]
|
||||
expected: FAIL
|
||||
|
||||
[[["forwarddelete",""\]\] "<div style=white-space:pre-line>foo[\]\\n bar</div>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["forwarddelete",""\]\] "<div style=white-space:pre-line>foo[\]\\n\\nbar</div>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["forwarddelete",""\]\] "<div style=white-space:pre-line>[\]f\\nbar</div>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["forwarddelete",""\]\] "<div style=white-space:nowrap>foo[\] \\nbar</div>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["forwarddelete",""\]\] "<div style=white-space:nowrap>[\]f\\nbar</div>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -50,9 +50,3 @@
|
|||
|
||||
[Backspace at "<div>abc <ul><li>[\] def </li></ul> ghi</div>" - comparing innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[Backspace at "<p style="white-space:pre-line">abc \\n \\n [\]def</p>"]
|
||||
expected: FAIL
|
||||
|
||||
[Backspace at "<p style="white-space:pre-line">abc \\n \\n [\]def</p>" - comparing innerHTML]
|
||||
expected: FAIL
|
||||
|
|
|
@ -101,23 +101,8 @@
|
|||
[Delete at "<div>abc <ul><li> def[\] </li></ul> ghi</div>"]
|
||||
expected: FAIL
|
||||
|
||||
[Delete at "<p style="white-space:pre-line">abc[\]\\n def</p>"]
|
||||
expected: FAIL
|
||||
|
||||
[Delete at "<p style="white-space:pre-line">abc[\] \\ndef</p>"]
|
||||
expected: FAIL
|
||||
|
||||
[Delete at "<p style="white-space:pre-line">abc[\] \\n def</p>"]
|
||||
expected: FAIL
|
||||
|
||||
[Delete at "<p style="white-space:pre-line">abc[\] \\n \\n def</p>"]
|
||||
expected: FAIL
|
||||
|
||||
[Delete at "<p style="white-space:pre-line">abc[\]\\n def</p>" - comparing innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[Delete at "<p style="white-space:pre-line">abc[\] \\n def</p>" - comparing innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[Delete at "<p style="white-space:pre-line">abc[\] \\n \\n def</p>" - comparing innerHTML]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1279,4 +1279,68 @@ var browserTests = [
|
|||
"<div contenteditable=\"false\"><span contenteditable=\"\">abcd<br></span></div>"],
|
||||
[true],
|
||||
{"inserttext":[false,false,"",false,false,""]}],
|
||||
["<div style=white-space:pre>foo[]bar</div>",
|
||||
[["inserttext"," "]],
|
||||
"<div style=\"white-space:pre\">foo bar</div>",
|
||||
[true],
|
||||
{"inserttext":[false,false,"",false,false,""]}],
|
||||
["<div style=white-space:pre>foo[]</div>",
|
||||
[["inserttext"," "]],
|
||||
"<div style=\"white-space:pre\">foo </div>",
|
||||
[true],
|
||||
{"inserttext":[false,false,"",false,false,""]}],
|
||||
["<div style=white-space:pre-wrap>foo[]bar</div>",
|
||||
[["inserttext"," "]],
|
||||
"<div style=\"white-space:pre-wrap\">foo bar</div>",
|
||||
[true],
|
||||
{"inserttext":[false,false,"",false,false,""]}],
|
||||
["<div style=white-space:pre-wrap>foo[]</div>",
|
||||
[["inserttext"," "]],
|
||||
"<div style=\"white-space:pre-wrap\">foo </div>",
|
||||
[true],
|
||||
{"inserttext":[false,false,"",false,false,""]}],
|
||||
// FYI: The white-space sequence different does not matter here. It's tested
|
||||
// in white-spaces-after-execCommand-inserttext.tentative.html.
|
||||
["<div style=white-space:pre-line>foo[]bar</div>",
|
||||
[["inserttext"," "]],
|
||||
[
|
||||
"<div style=\"white-space:pre-line\">foo bar</div>",
|
||||
"<div style=\"white-space:pre-line\">foo bar</div>",
|
||||
"<div style=\"white-space:pre-line\">foo bar</div>",
|
||||
],
|
||||
[true],
|
||||
{"inserttext":[false,false,"",false,false,""]}],
|
||||
["<div style=white-space:pre-line>foo[]</div>",
|
||||
[["inserttext"," "]],
|
||||
[
|
||||
"<div style=\"white-space:pre-line\">foo </div>",
|
||||
"<div style=\"white-space:pre-line\">foo </div>",
|
||||
"<div style=\"white-space:pre-line\">foo \n</div>",
|
||||
"<div style=\"white-space:pre-line\">foo \n</div>",
|
||||
"<div style=\"white-space:pre-line\">foo <br></div>",
|
||||
"<div style=\"white-space:pre-line\">foo <br></div>",
|
||||
],
|
||||
[true],
|
||||
{"inserttext":[false,false,"",false,false,""]}],
|
||||
["<div style=white-space:nowrap>foo[]bar</div>",
|
||||
[["inserttext"," "]],
|
||||
[
|
||||
"<div style=\"white-space:nowrap\">foo bar</div>",
|
||||
"<div style=\"white-space:nowrap\">foo bar</div>",
|
||||
"<div style=\"white-space:nowrap\">foo bar</div>",
|
||||
],
|
||||
[true],
|
||||
{"inserttext":[false,false,"",false,false,""]}],
|
||||
["<div style=white-space:nowrap>foo[]</div>",
|
||||
[["inserttext"," "]],
|
||||
[
|
||||
"<div style=\"white-space:nowrap\">foo </div>",
|
||||
"<div style=\"white-space:nowrap\">foo </div>",
|
||||
"<div style=\"white-space:nowrap\">foo \n</div>",
|
||||
"<div style=\"white-space:nowrap\">foo \n</div>",
|
||||
"<div style=\"white-space:nowrap\">foo <br></div>",
|
||||
"<div style=\"white-space:nowrap\">foo <br></div>",
|
||||
],
|
||||
[true],
|
||||
{"inserttext":[false,false,"",false,false,""]}],
|
||||
]
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<meta name="timeout" content="long">
|
||||
<meta name="variant" content="?pre">
|
||||
<meta name="variant" content="?pre-wrap">
|
||||
<meta name="variant" content="?pre-line">
|
||||
<meta name="variant" content="?nowrap">
|
||||
<meta name="variant" content="?white-space=pre&command=insertParagraph">
|
||||
<meta name="variant" content="?white-space=pre-wrap&command=insertParagraph">
|
||||
<meta name="variant" content="?white-space=pre-line&command=insertParagraph">
|
||||
<meta name="variant" content="?white-space=nowrap&command=insertParagraph">
|
||||
<meta name="variant" content="?white-space=pre&command=insertText">
|
||||
<meta name="variant" content="?white-space=pre-wrap&command=insertText">
|
||||
<meta name="variant" content="?white-space=pre-line&command=insertText">
|
||||
<meta name="variant" content="?white-space=nowrap&command=insertText">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../include/editor-test-utils.js"></script>
|
||||
|
@ -15,9 +19,19 @@
|
|||
/**
|
||||
* The expected behavior is based on Chrome 91.
|
||||
*/
|
||||
const style = location.search.substr(1);
|
||||
const params = new URLSearchParams(location.search);
|
||||
const style = params.get("white-space");
|
||||
const isNewLineSignificant = style == "pre" || style == "pre-wrap" || style == "pre-line";
|
||||
const command = params.get("command");
|
||||
const editingHost = document.querySelector("div[contenteditable]");
|
||||
function doIt() {
|
||||
if (command == "insertParagraph") {
|
||||
document.execCommand(command);
|
||||
} else {
|
||||
// Inserting a linefeed by insertText command should be equivalent of insertParagraph
|
||||
document.execCommand(command, false, "\n");
|
||||
}
|
||||
}
|
||||
for (const defaultParagraphSeparator of ["div", "p"]) {
|
||||
document.execCommand("defaultparagraphseparator", false, defaultParagraphSeparator);
|
||||
for (const display of ["block", "inline", "inline-block"]) {
|
||||
|
@ -30,7 +44,7 @@ for (const defaultParagraphSeparator of ["div", "p"]) {
|
|||
const utils = new EditorTestUtils(editingHost);
|
||||
utils.setupEditingHost(`abc[]`);
|
||||
editingHost.getBoundingClientRect();
|
||||
document.execCommand("insertparagraph");
|
||||
doIt();
|
||||
if (display == "block") {
|
||||
assert_in_array(
|
||||
editingHost.innerHTML,
|
||||
|
@ -64,7 +78,7 @@ for (const defaultParagraphSeparator of ["div", "p"]) {
|
|||
const utils = new EditorTestUtils(editingHost);
|
||||
utils.setupEditingHost(`[]abc`);
|
||||
editingHost.getBoundingClientRect();
|
||||
document.execCommand("insertparagraph");
|
||||
doIt();
|
||||
if (display == "block") {
|
||||
assert_in_array(
|
||||
editingHost.innerHTML,
|
||||
|
@ -101,7 +115,7 @@ for (const defaultParagraphSeparator of ["div", "p"]) {
|
|||
const utils = new EditorTestUtils(editingHost);
|
||||
utils.setupEditingHost(`a[]bc`);
|
||||
editingHost.getBoundingClientRect();
|
||||
document.execCommand("insertparagraph");
|
||||
doIt();
|
||||
if (display == "block") {
|
||||
assert_in_array(
|
||||
editingHost.innerHTML,
|
||||
|
@ -140,7 +154,7 @@ for (const defaultParagraphSeparator of ["div", "p"]) {
|
|||
utils.setupEditingHost(`abc[]`);
|
||||
editingHost.getBoundingClientRect();
|
||||
document.execCommand("italic");
|
||||
document.execCommand("insertparagraph");
|
||||
doIt();
|
||||
document.execCommand("inserttext", false, "def");
|
||||
if (display == "block") {
|
||||
assert_in_array(
|
||||
|
@ -184,7 +198,7 @@ for (const defaultParagraphSeparator of ["div", "p"]) {
|
|||
const utils = new EditorTestUtils(editingHost);
|
||||
utils.setupEditingHost(`<b>abc[]</b>`);
|
||||
editingHost.getBoundingClientRect();
|
||||
document.execCommand("insertparagraph");
|
||||
doIt();
|
||||
document.execCommand("inserttext", false, "def");
|
||||
if (display == "block") {
|
||||
assert_in_array(
|
||||
|
@ -232,7 +246,7 @@ for (const defaultParagraphSeparator of ["div", "p"]) {
|
|||
const utils = new EditorTestUtils(editingHost);
|
||||
utils.setupEditingHost(`<${paragraph} style="white-space:${style}">abc[]</${paragraph}>`);
|
||||
editingHost.getBoundingClientRect();
|
||||
document.execCommand("insertparagraph");
|
||||
doIt();
|
||||
assert_equals(
|
||||
editingHost.innerHTML,
|
||||
`<${paragraph} style="white-space:${style}">abc</${paragraph}><${paragraph} style="white-space:${style}"><br></${paragraph}>`,
|
||||
|
@ -246,7 +260,7 @@ for (const defaultParagraphSeparator of ["div", "p"]) {
|
|||
const utils = new EditorTestUtils(editingHost);
|
||||
utils.setupEditingHost(`<${paragraph} style="white-space:${style}">[]abc</${paragraph}>`);
|
||||
editingHost.getBoundingClientRect();
|
||||
document.execCommand("insertparagraph");
|
||||
doIt();
|
||||
assert_in_array(
|
||||
editingHost.innerHTML,
|
||||
[
|
||||
|
@ -263,7 +277,7 @@ for (const defaultParagraphSeparator of ["div", "p"]) {
|
|||
const utils = new EditorTestUtils(editingHost);
|
||||
utils.setupEditingHost(`<${paragraph} style="white-space:${style}">a[]bc</${paragraph}>`);
|
||||
editingHost.getBoundingClientRect();
|
||||
document.execCommand("insertparagraph");
|
||||
doIt();
|
||||
assert_in_array(
|
||||
editingHost.innerHTML,
|
||||
[
|
||||
|
@ -283,7 +297,7 @@ for (const defaultParagraphSeparator of ["div", "p"]) {
|
|||
const utils = new EditorTestUtils(editingHost);
|
||||
utils.setupEditingHost(`<${paragraph}>abc[]</${paragraph}>`);
|
||||
editingHost.getBoundingClientRect();
|
||||
document.execCommand("insertparagraph");
|
||||
doIt();
|
||||
assert_equals(
|
||||
editingHost.innerHTML,
|
||||
`<${paragraph}>abc</${paragraph}><${paragraph}><br></${paragraph}>`,
|
||||
|
@ -297,7 +311,7 @@ for (const defaultParagraphSeparator of ["div", "p"]) {
|
|||
const utils = new EditorTestUtils(editingHost);
|
||||
utils.setupEditingHost(`<${paragraph}>[]abc</${paragraph}>`);
|
||||
editingHost.getBoundingClientRect();
|
||||
document.execCommand("insertparagraph");
|
||||
doIt();
|
||||
assert_in_array(
|
||||
editingHost.innerHTML,
|
||||
[
|
||||
|
@ -314,7 +328,7 @@ for (const defaultParagraphSeparator of ["div", "p"]) {
|
|||
const utils = new EditorTestUtils(editingHost);
|
||||
utils.setupEditingHost(`<${paragraph}>a[]bc</${paragraph}>`);
|
||||
editingHost.getBoundingClientRect();
|
||||
document.execCommand("insertparagraph");
|
||||
doIt();
|
||||
assert_in_array(
|
||||
editingHost.innerHTML,
|
||||
[
|
||||
|
@ -336,7 +350,7 @@ for (const defaultParagraphSeparator of ["div", "p"]) {
|
|||
const styleAttr = `style="display:${display}; white-space:${style}"`;
|
||||
utils.setupEditingHost(`<${paragraph} ${styleAttr}>abc[]</${paragraph}>`);
|
||||
editingHost.getBoundingClientRect();
|
||||
document.execCommand("insertparagraph");
|
||||
doIt();
|
||||
if (display != "block") {
|
||||
assert_equals(
|
||||
editingHost.innerHTML,
|
||||
|
@ -359,7 +373,7 @@ for (const defaultParagraphSeparator of ["div", "p"]) {
|
|||
const styleAttr = `style="display:${display}; white-space:${style}"`;
|
||||
utils.setupEditingHost(`<${paragraph} ${styleAttr}>[]abc</${paragraph}>`);
|
||||
editingHost.getBoundingClientRect();
|
||||
document.execCommand("insertparagraph");
|
||||
doIt();
|
||||
if (display != "block") {
|
||||
assert_in_array(
|
||||
editingHost.innerHTML,
|
||||
|
@ -388,7 +402,7 @@ for (const defaultParagraphSeparator of ["div", "p"]) {
|
|||
const utils = new EditorTestUtils(editingHost);
|
||||
utils.setupEditingHost(`<${paragraph} ${styleAttr}>a[]bc</${paragraph}>`);
|
||||
editingHost.getBoundingClientRect();
|
||||
document.execCommand("insertparagraph");
|
||||
doIt();
|
||||
if (display != "block") {
|
||||
assert_in_array(
|
||||
editingHost.innerHTML,
|
||||
|
|
Загрузка…
Ссылка в новой задаче