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..1fd4d141605b3ae0a2a3ba90a78295bbabdaa5c1 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 element = this._providerElement(i).element(); |
+ var lineContent = element.childTextNodes().map(Components.Linkifier.untruncatedNodeText).join(''); |
+ textLines.push(lineContent); |
+ } |
var endSelectionElement = this._providerElement(endSelection.item).element(); |
if (endSelection.node && endSelection.node.isSelfOrDescendant(endSelectionElement)) { |
@@ -456,10 +459,15 @@ Console.ConsoleViewport = class { |
offset = container.textContent.length; |
} |
} |
+ |
var chars = 0; |
var node = itemElement; |
while ((node = node.traverseNextTextNode(itemElement)) && !node.isSelfOrDescendant(container)) |
- chars += node.textContent.length; |
+ chars += Components.Linkifier.untruncatedNodeText(node).length; |
+ // If the selection offset is at the end of a link's ellipsis, use the untruncated length as offset. |
+ var untruncatedContainerLength = Components.Linkifier.untruncatedNodeText(container).length; |
+ if (offset === 1 && untruncatedContainerLength > offset) |
+ offset = untruncatedContainerLength; |
return chars + offset; |
} |