Bug 1119503 - Part 5: Make children of message-body class be preformatted to fix copied text of line number showing up on new line; r=past

This commit is contained in:
Brian Grinstead 2015-01-27 13:26:11 -05:00 committed by Ehsan Akhgari
parent 3c11e6e16d
commit 2e72906fa9
4 changed files with 15 additions and 6 deletions

View File

@ -896,13 +896,16 @@ Messages.Simple.prototype = Heritage.extend(Messages.BaseMessage.prototype,
let body = this.document.createElementNS(XHTML_NS, "span");
body.className = "message-body-wrapper message-body devtools-monospace";
let anchor, container = body;
let bodyInner = this.document.createElementNS(XHTML_NS, "span");
body.appendChild(bodyInner);
let anchor, container = bodyInner;
if (this._link || this._linkCallback) {
container = anchor = this.document.createElementNS(XHTML_NS, "a");
anchor.href = this._link || "#";
anchor.draggable = false;
this._addLinkCallback(anchor, this._linkCallback);
body.appendChild(anchor);
bodyInner.appendChild(anchor);
}
if (typeof this._message == "function") {

View File

@ -57,7 +57,9 @@ function consoleOpened(aHud) {
controller = top.document.commandDispatcher.getControllerForCommand("cmd_copy");
is(controller.isCommandEnabled("cmd_copy"), true, "cmd_copy is enabled");
let selection = HUD.iframeWindow.getSelection() + "";
// Remove new lines since getSelection() includes one between message and line
// number, but the clipboard doesn't (see bug 1119503)
let selection = (HUD.iframeWindow.getSelection() + "").replace(/\r?\n|\r/g, " ");
isnot(selection.indexOf("bug587617"), -1,
"selection text includes 'bug587617'");
@ -80,7 +82,9 @@ function testContextMenuCopy() {
let copyItem = contextMenu.querySelector("*[command='cmd_copy']");
ok(copyItem, "the context menu on the output node has a \"Copy\" item");
let selection = HUD.iframeWindow.getSelection() + "";
// Remove new lines since getSelection() includes one between message and line
// number, but the clipboard doesn't (see bug 1119503)
let selection = (HUD.iframeWindow.getSelection() + "").replace(/\r?\n|\r/g, " ");
copyItem.doCommand();

View File

@ -69,7 +69,9 @@ function performTest(HUD, [result]) {
getControllerForCommand("cmd_copy");
is(controller.isCommandEnabled("cmd_copy"), true, "cmd_copy is enabled");
let selectionText = HUD.iframeWindow.getSelection() + "";
// Remove new lines since getSelection() includes one between message and line
// number, but the clipboard doesn't (see bug 1119503)
let selectionText = (HUD.iframeWindow.getSelection() + "").replace(/\r?\n|\r/g, " ");
isnot(selectionText.indexOf("foobarBazBug613280"), -1,
"selection text includes 'foobarBazBug613280'");

View File

@ -117,7 +117,7 @@ a {
display: flex;
}
.message-body {
.message-body > * {
white-space: pre-wrap;
word-wrap: break-word;
}