Backed out changeset a50d707b3bbc (bug 1769534) for causing debugger frame failures. CLOSED TREE

This commit is contained in:
Marian-Vasile Laza 2022-09-14 17:05:11 +03:00
Родитель 308d06e28b
Коммит e8b90ffd2f
8 изменённых файлов: 40 добавлений и 104 удалений

Просмотреть файл

@ -6,6 +6,8 @@ import React from "react";
export default function FrameIndent() {
return (
<span className="frame-indent clipboard-only">&#32;&#32;&#32;&#32;</span>
<span className="frame-indent clipboard-only">
&nbsp;&nbsp;&nbsp;&nbsp;
</span>
);
}

Просмотреть файл

@ -150,10 +150,6 @@
left: -9999px;
}
.frames .frame-indent {
white-space: pre;
}
.call-stack-pane [role="listitem"] .location-async-cause {
height: 20px;
line-height: 20px;

Просмотреть файл

@ -20,11 +20,11 @@ add_task(async function() {
expectedPattern =
"text-align: left;[\\r\\n]+" +
"element[\\r\\n]+" +
"Best Match this.style[\\r\\n]+" +
"Best Match this.style[\\r\\n]+" +
"left[\\r\\n]+" +
"width: 25px;[\\r\\n]+" +
"element[\\r\\n]+" +
"Best Match this.style[\\r\\n]+" +
"Best Match this.style[\\r\\n]+" +
"25px[\\r\\n]*";
info("Expanding computed view properties");

Просмотреть файл

@ -30,10 +30,6 @@
white-space: normal;
}
.frames .frame-indent {
white-space: pre;
}
.frames .title {
text-overflow: ellipsis;
white-space: nowrap;

Просмотреть файл

@ -23,8 +23,8 @@ is(s.convertToPlainText("foo", c.OutputLFLineBreak, 0), "foo", "Wrong conversion
is(s.convertToPlainText("foo foo foo", c.OutputWrap | c.OutputLFLineBreak, 7), "foo foo\nfoo", "Wrong conversion result 2");
is(s.convertToPlainText("<body><noscript>b<span>a</span>r</noscript>foo", c.OutputLFLineBreak, 0), "foo", "Wrong conversion result 3");
is(s.convertToPlainText("<body><noscript>b<span>a</span>r</noscript>foo", c.OutputNoScriptContent, 0), "barfoo", "Wrong conversion result 4");
is(s.convertToPlainText("foo\u00A0 bar", c.OutputPersistNBSP | c.OutputLFLineBreak, 0), "foo\u00A0 bar", "Wrong conversion result 5");
is(s.convertToPlainText("foo\u00A0 bar", c.OutputLFLineBreak, 0), "foo bar", "Wrong conversion result 6");
is(s.convertToPlainText("foo\u00A0bar", c.OutputPersistNBSP | c.OutputLFLineBreak, 0), "foo\u00A0bar", "Wrong conversion result 5");
is(s.convertToPlainText("foo\u00A0bar", c.OutputLFLineBreak, 0), "foo bar", "Wrong conversion result 6");
is(s.convertToPlainText("<body><noframes>bar</noframes>foo", c.OutputLFLineBreak, 0), "foo", "Wrong conversion result 7");
// OutputNoFramesContent doesn't actually work, because the flag gets overridden in all cases.
is(s.convertToPlainText("<body><noframes>bar</noframes>foo", c.OutputNoFramesContent | c.OutputLFLineBreak, 0), "foo", "Wrong conversion result 8");

Просмотреть файл

@ -2,7 +2,6 @@
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=359303
https://bugzilla.mozilla.org/show_bug.cgi?id=1769534
-->
<head>
<meta charset="utf-8" />
@ -13,51 +12,43 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1769534
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=359303">Mozilla Bug 359303</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1769534">Mozilla Bug 1769534</a>
<p id="display"></p>
<div id="content">
<!-- In a plain-text editable control (such as a textarea or textinput), copying to clipboard should
preserve all non-breaking spaces. -->
preserve non-breaking spaces. -->
<input
id="input-with-non-breaking-spaces"
value="Input content: This town is 100&nbsp;km away / «&nbsp;Est-ce Paris&nbsp;?&nbsp;» / Consecutive non-breaking spaces: '&nbsp;&nbsp;' / &nbsp; &nbsp; &nbsp;Text padded using editor-generated pattern.
">
value="Input content: This town is 100&nbsp;km away / «&nbsp;Est-ce Paris&nbsp;?&nbsp;» / Consecutive non-breaking spaces: '&nbsp;&nbsp;'">
<textarea id="textarea-with-non-breaking-spaces">
Textarea content:
- This town is 100&nbsp;km away.
- «&nbsp;Est-ce Paris&nbsp;?&nbsp;»
- Consecutive non-breaking spaces: '&nbsp;&nbsp;'
&nbsp; &nbsp; &nbsp;Text padded using editor-generated pattern.
- Consecutive non-breaking spaces: "&nbsp;&nbsp;"
</textarea>
<!-- In a content-editable div, copying to clipboard should preserve non-breaking spaces.
However, HTML editors programmatically insert a alternating pattern of space / NBSP when padding text with spaces
(otherwises spaces would be collapsed).
These programmatically-generated NBSPs should be replaced by plain spaces when copying to plain-text.
See https://bugzilla.mozilla.org/show_bug.cgi?id=1769534
However, for compatibility with what other browsers currently do, the behavior of replacing non-breaking spaces by spaces is preserved for now.
See https://bugzilla.mozilla.org/show_bug.cgi?id=359303#c145
-->
<div contenteditable="true" id="content-editable-with-non-breaking-spaces">
Content-editable content:
- This town is 100&nbsp;km away.
- «&nbsp;Est-ce Paris&nbsp;?&nbsp;»
- Consecutive non-breaking spaces: '&nbsp;&nbsp;'
&nbsp; &nbsp; &nbsp;Text padded using editor-generated pattern.
- Consecutive non-breaking spaces: "&nbsp;&nbsp;"
</div>
<!-- In non-editable HTML nodes, like this paragraph, copying to clipboard should preserve non-breaking spaces.
However, HTML editors programmatically insert a alternating pattern of space / NBSP when padding text with spaces
(otherwises spaces would be collapsed).
These programmatically-generated NBSPs should be replaced by plain spaces when copying to plain-text.
See https://bugzilla.mozilla.org/show_bug.cgi?id=1769534
<!-- In non-editable HTML nodes, like this paragraph, copying to clipboard should preserve non-breaking
spaces.
However, for compatibility with what other browsers currently do, the behavior of replacing non-breaking spaces by spaces is preserved for now.
See https://bugzilla.mozilla.org/show_bug.cgi?id=359303#c145
-->
<p id="paragraph-with-non-breaking-spaces">
Paragraph content:
- This town is 100&nbsp;km away.
- «&nbsp;Est-ce Paris&nbsp;?&nbsp;»
- Consecutive non-breaking spaces: '&nbsp;&nbsp;'
&nbsp; &nbsp; &nbsp;Text padded using editor-generated pattern.
- Consecutive non-breaking spaces: "&nbsp;&nbsp;"
</p>
</div>
@ -93,40 +84,28 @@ async function clipboardTextForElementId(aDomId, aExpectedString) {
return copiedText;
}
function assertUserNbspPreserved(aCopiedText) {
ok(aCopiedText.includes("100 km"), "NBSP between two characters should be preserved");
ok(aCopiedText.includes("« "), "A single NBSP near a punctuation mark should be preserved");
ok(aCopiedText.includes(" »"), "A single NBSP near a punctuation mark should be preserved");
ok(aCopiedText.includes(" ? "), "NBSPs before *and* after a character should be preserved");
ok(aCopiedText.includes("'  '"), "Consecutive NBSPs should be preserved");
}
function assertEditorGeneratedNbspPreserved(aCopiedText) {
ok(aCopiedText.includes("      Text padded"), "When copying from a plain-text control, editor-generated NBSP (if any) should be preserved");
}
function assertEditorGeneratedNbspReplaced(aCopiedText) {
ok(aCopiedText.includes(" Text padded"), "When copying plain-text from a non plain-text control, editor-generated NBSP should be replaced by standard spaces");
}
/** Test for Bug 359303 **/
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(async function() {
let textCopiedFromInput = await clipboardTextForElementId("input-with-non-breaking-spaces", "Input");
assertUserNbspPreserved(textCopiedFromInput);
assertEditorGeneratedNbspPreserved(textCopiedFromInput);
let iValue = await clipboardTextForElementId("input-with-non-breaking-spaces", "Input");
ok(iValue.includes("100 km"), "NBSP between two characters should be preserved");
ok(iValue.includes("« "), "A single NBSP near a punctuation mark should be preserved");
ok(iValue.includes(" »"), "A single NBSP near a punctuation mark should be preserved");
ok(iValue.includes(" ? "), "NBSPs before *and* after a character should be preserved");
ok(iValue.includes("  "), "Consecutive NBSPs should be preserved");
let textCopiedFromTextarea = await clipboardTextForElementId("textarea-with-non-breaking-spaces", "Textarea");
assertUserNbspPreserved(textCopiedFromTextarea);
assertEditorGeneratedNbspPreserved(textCopiedFromTextarea);
let tValue = await clipboardTextForElementId("textarea-with-non-breaking-spaces", "Textarea");
ok(tValue.includes("100 km"), "NBSP between two characters should be preserved");
ok(tValue.includes("« "), "A single NBSP near a punctuation mark should be preserved");
ok(tValue.includes(" »"), "A single NBSP near a punctuation mark should be preserved");
ok(tValue.includes(" ? "), "NBSPs before *and* after a character should be preserved");
ok(tValue.includes("  "), "Consecutive NBSPs should be preserved");
let textCopiedFromContentEditable = await clipboardTextForElementId("content-editable-with-non-breaking-spaces", "Content-editable");
assertUserNbspPreserved(textCopiedFromContentEditable);
assertEditorGeneratedNbspReplaced(textCopiedFromContentEditable);
let cValue = await clipboardTextForElementId("content-editable-with-non-breaking-spaces", "Content-editable");
ok(cValue.includes("100 km"), "NBSP should be replaced by spaces, until brower compatibility issues are sorted out");
let textCopiedFromNonEditableHtmlContent = await clipboardTextForElementId("paragraph-with-non-breaking-spaces", "Paragraph");
assertUserNbspPreserved(textCopiedFromNonEditableHtmlContent);
assertEditorGeneratedNbspReplaced(textCopiedFromNonEditableHtmlContent);
let pValue = await clipboardTextForElementId("paragraph-with-non-breaking-spaces", "Paragraph");
ok(pValue.includes("100 km"), "NBSP should be replaced by spaces, until brower compatibility issues are sorted out");
SimpleTest.finish();
});

Просмотреть файл

@ -152,12 +152,9 @@ interface nsIDocumentEncoder : nsISupports
const unsigned long OutputEncodeBasicEntities = (1 << 14);
/**
* Normally, for non-text-control elements (that is, neither <textarea>
* nor <input>), &nbsp; characters adjacent to regular spaces are replaced
* by regular spaces.
* This flag suppresses that behavior, and causes all &nbsp; characters
* to be preserved.
*
* Normally &nbsp; is replaced with a space character when
* encoding data as plain text, set this flag if that's
* not desired.
* Plaintext output only.
*/
const unsigned long OutputPersistNBSP = (1 << 17);

Просмотреть файл

@ -107,44 +107,10 @@ static void DetermineLineBreak(const int32_t aFlags, nsAString& aLineBreak) {
void nsPlainTextSerializer::CurrentLine::MaybeReplaceNbspsInContent(
const int32_t aFlags) {
// HTML editors may enforce consecutive spaces in HTML output by replacing
// them with non-breaking spaces.
// Here we revert this hack when converting HTML text to plain text.
if (!(aFlags & nsIDocumentEncoder::OutputPersistNBSP)) {
//
// Replace NBSP characters with spaces if they are adjacent to a space.
//
const uint32_t length = mContent.Length();
bool containsSpace = false;
bool containsNBSP = false;
// 1. Inspect the string forwards, and replace NBSPs that are **after**
// regular spaces.
//
// After that loop, all sequences of "spaceNBSP*" have been replaced by
// equally long "space*" sequences.
for (uint32_t i = 0; i < length; i++) {
if (mContent[i] == kSPACE) {
containsSpace = true;
} else if (mContent[i] == kNBSP) {
if (i > 0 && mContent[i - 1] == kSPACE) {
mContent.SetCharAt(kSPACE, i);
} else {
containsNBSP = true;
}
}
}
// 2. If we found spaces and didn't replace all relevant NBSPs, inpect the
// string backwards, and replace NBSPs that are **before** regular spaces.
//
// After that loop, all sequences of "NBSP*space" have been replaced by
// equally long "space*" sequences.
if (containsSpace && containsNBSP && length >= 1) {
for (uint32_t i = length - 1; i > 0; i--) {
if (mContent[i - 1] == kNBSP && mContent[i] == kSPACE) {
mContent.SetCharAt(kSPACE, i - 1);
}
}
}
// First, replace all nbsp characters with spaces,
// which the unicode encoder won't do for us.
mContent.ReplaceChar(kNBSP, kSPACE);
}
}