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 коммит произвёл Ehsan Akhgari
Родитель 3f37e1a74e
Коммит f27da06422
4 изменённых файлов: 15 добавлений и 6 удалений

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

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

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

@ -57,7 +57,9 @@ function consoleOpened(aHud) {
controller = top.document.commandDispatcher.getControllerForCommand("cmd_copy"); controller = top.document.commandDispatcher.getControllerForCommand("cmd_copy");
is(controller.isCommandEnabled("cmd_copy"), true, "cmd_copy is enabled"); 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, isnot(selection.indexOf("bug587617"), -1,
"selection text includes 'bug587617'"); "selection text includes 'bug587617'");
@ -80,7 +82,9 @@ function testContextMenuCopy() {
let copyItem = contextMenu.querySelector("*[command='cmd_copy']"); let copyItem = contextMenu.querySelector("*[command='cmd_copy']");
ok(copyItem, "the context menu on the output node has a \"Copy\" item"); 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(); copyItem.doCommand();

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

@ -69,7 +69,9 @@ function performTest(HUD, [result]) {
getControllerForCommand("cmd_copy"); getControllerForCommand("cmd_copy");
is(controller.isCommandEnabled("cmd_copy"), true, "cmd_copy is enabled"); 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, isnot(selectionText.indexOf("foobarBazBug613280"), -1,
"selection text includes 'foobarBazBug613280'"); "selection text includes 'foobarBazBug613280'");

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

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