Bug 333064 - Fix space insertion in copy of CJK text. r=enndeakin

This commit is contained in:
Jorg K 2016-05-09 08:43:00 -04:00
Родитель be53769e71
Коммит 9e2a1c4966
3 изменённых файлов: 64 добавлений и 1 удалений

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

@ -171,8 +171,11 @@ SelectionCopyHelper(nsISelection *aSel, nsIDocument *aDoc,
nsAutoString htmlInfoBuf;
if (encodedTextHTML) {
// Redo the encoding, but this time use the passed-in flags.
// Don't allow wrapping of CJK strings.
mimeType.AssignLiteral(kHTMLMime);
rv = docEncoder->Init(domDoc, mimeType, aFlags);
rv = docEncoder->Init(domDoc, mimeType,
aFlags |
nsIDocumentEncoder::OutputDisallowLineBreaking);
NS_ENSURE_SUCCESS(rv, rv);
rv = docEncoder->SetSelection(aSel);

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

@ -333,6 +333,7 @@ skip-if = buildapp == 'b2g' || toolkit == 'android' # b2g(clipboard undefined) b
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
[test_bug330925.xhtml]
[test_bug331959.html]
[test_bug333064.html]
[test_bug333198.html]
[test_bug333673.html]
[test_bug337631.html]

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

@ -0,0 +1,59 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=333064
-->
<head>
<title>Test for Bug 333064</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=333064">Mozilla Bug 333064</a>
<p id="display"></p>
<div id="display">
</div>
<div id="korean-text">안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안</div>
<pre id="test">
</pre>
<script class="testbody" type="application/javascript">
/** Test for Bug 333064 **/
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
var div = document.getElementById("korean-text");
var sel = window.getSelection();
// Select text node in div.
var r = document.createRange();
r.setStart(div, 0);
r.setEnd(div, 1);
sel.addRange(r);
SimpleTest.waitForClipboard(
function compare(value) {
// Make sure we got the HTML flavour we asked for and that our
// string is included without additional spaces.
return value.includes("korean-text") && value.includes("안".repeat(160));
},
function setup() {
synthesizeKey("C", {accelKey: true});
},
function onSuccess() {
SimpleTest.finish();
},
function onFailure() {
SimpleTest.finish();
},
"text/html"
);
});
</script>
</body>
</html>