Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Unified Diff: third_party/WebKit/Source/devtools/front_end/console/ConsoleViewport.js

Issue 2644753002: DevTools: untruncate links on copy (Closed)
Patch Set: ac Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698