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

Unified Diff: third_party/WebKit/Source/devtools/front_end/components/Linkifier.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/components/Linkifier.js
diff --git a/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js b/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
index 066190ef070a4b59907a30bfad694e6db80e3f6d..265d7fc578a952c253108f052d550428fe538086 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
@@ -303,13 +303,12 @@ Components.Linkifier = class {
return;
Components.Linkifier._bindUILocation(anchor, uiLocation);
- var text = uiLocation.linkText();
- var info = Components.Linkifier._linkInfo(anchor);
- info.originalLinkText = text;
- text = text.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g, '$1\u2026');
+ var originalLinkText = uiLocation.linkText(true /* skipTrim */);
+ var text = originalLinkText.replace(/([a-f0-9]{7})[a-f0-9]{13,}/g, '$1\u2026');
if (this._maxLength)
text = text.trimMiddle(this._maxLength);
- anchor.textContent = text;
+ anchor.removeChildren();
+ anchor.appendChild(Components.DOMPresentationUtils.createTruncatedTextNode(text, originalLinkText));
var titleText = uiLocation.uiSourceCode.url();
if (typeof uiLocation.lineNumber === 'number')
@@ -396,9 +395,10 @@ Components.Linkifier = class {
link.title = title;
if (href)
link.href = href;
- link.textContent = text;
if (maxLength)
- link.textContent = link.textContent.trimMiddle(maxLength);
+ link.appendChild(Components.DOMPresentationUtils.createTruncatedTextNode(text.trimMiddle(maxLength), text));
+ else
+ link.textContent = text;
link[Components.Linkifier._infoSymbol] = {
icon: null,
enableDecorator: false,
@@ -408,8 +408,7 @@ Components.Linkifier = class {
lineNumber: null,
columnNumber: null,
revealable: null,
- fallback: null,
- originalLinkText: text
+ fallback: null
};
if (!preventClick)
link.addEventListener('click', Components.Linkifier._handleClick, false);
@@ -420,15 +419,6 @@ Components.Linkifier = class {
/**
* @param {?Element} link
- * @return {?string}
- */
- static originalLinkText(link) {
- var info = this._linkInfo(link);
- return info ? info.originalLinkText : null;
- }
-
- /**
- * @param {?Element} link
* @return {?Components._LinkInfo}
*/
static _linkInfo(link) {
@@ -560,8 +550,7 @@ Components.Linkifier._infoSymbol = Symbol('Linkifier.info');
* lineNumber: ?number,
* columnNumber: ?number,
* revealable: ?Object,
- * fallback: ?Element,
- * originalLinkText: string
+ * fallback: ?Element
* }}
*/
Components._LinkInfo;

Powered by Google App Engine
This is Rietveld 408576698