| Index: third_party/WebKit/Source/devtools/front_end/console/ConsoleViewport.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewport.js b/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewport.js
|
| index 89ae0cb8d8aa72efdc67e9af54f02d97030c76eb..b3048346a0b7256f72d301846b8ae56bc8c2ba49 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewport.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewport.js
|
| @@ -423,8 +423,11 @@ Console.ConsoleViewport = class {
|
| }
|
|
|
| var textLines = [];
|
| - for (var i = startSelection.item; i <= endSelection.item; ++i)
|
| - textLines.push(this._providerElement(i).element().deepTextContent());
|
| + for (var i = startSelection.item; i <= endSelection.item; ++i) {
|
| + var currElement = this._providerElement(i).element();
|
| + var lineContent = currElement.childTextNodes().map(Components.DOMPresentationUtils.originalNodeText).join('');
|
| + textLines.push(lineContent);
|
| + }
|
|
|
| var endSelectionElement = this._providerElement(endSelection.item).element();
|
| if (endSelection.node && endSelection.node.isSelfOrDescendant(endSelectionElement)) {
|
| @@ -456,10 +459,17 @@ Console.ConsoleViewport = class {
|
| offset = container.textContent.length;
|
| }
|
| }
|
| + // To calculate the correct offset, this assumes that links truncate from the middle.
|
| + var originalLinkText = Components.DOMPresentationUtils.originalNodeText(container);
|
| + if (originalLinkText !== null) {
|
| + var truncatedLength = originalLinkText.length - container.textContent.length;
|
| + if (offset > container.textContent.length >> 1)
|
| + offset += truncatedLength;
|
| + }
|
| var chars = 0;
|
| var node = itemElement;
|
| while ((node = node.traverseNextTextNode(itemElement)) && !node.isSelfOrDescendant(container))
|
| - chars += node.textContent.length;
|
| + chars += Components.DOMPresentationUtils.originalNodeText(node).length;
|
| return chars + offset;
|
| }
|
|
|
|
|