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

Unified Diff: third_party/WebKit/Source/devtools/front_end/components/Linkifier.js

Issue 2571713005: DevTools: untruncate links on console export (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4926fac9712de8b707479812097b27abdee2146e..ae2f88ffdb1d9e9e29c66552352a135d7aa670cf 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
@@ -304,6 +304,8 @@ Components.Linkifier = class {
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');
if (this._maxLength)
text = text.trimMiddle(this._maxLength);
@@ -356,7 +358,7 @@ Components.Linkifier = class {
if (typeof lineNumber === 'number' && !text)
linkText += ':' + (lineNumber + 1);
var title = linkText !== url ? url : '';
- var link = Components.Linkifier._createLink(linkText.trimMiddle(150), className || '', title, url, preventClick);
+ var link = Components.Linkifier._createLink(linkText, className || '', title, url, preventClick);
var info = Components.Linkifier._linkInfo(link);
if (typeof lineNumber === 'number')
info.lineNumber = lineNumber;
@@ -372,8 +374,7 @@ Components.Linkifier = class {
* @return {!Element}
*/
static linkifyRevealable(revealable, text, fallbackHref) {
- var link = Components.Linkifier._createLink(
- text.trimMiddle(Components.Linkifier.MaxLengthForDisplayedURLs), '', undefined, fallbackHref);
+ var link = Components.Linkifier._createLink(text, '', undefined, fallbackHref);
Components.Linkifier._linkInfo(link).revealable = revealable;
return link;
}
@@ -393,7 +394,7 @@ Components.Linkifier = class {
link.title = title;
if (href)
link.href = href;
- link.textContent = text;
+ link.textContent = text.trimMiddle(Components.Linkifier.MaxLengthForDisplayedURLs);
dgozman 2016/12/14 17:25:07 Why do we trim to the same length? Previously we d
luoe 2016/12/17 01:18:19 Right, I did not intend to change this. Let me ha
link[Components.Linkifier._infoSymbol] = {
icon: null,
enableDecorator: false,
@@ -403,7 +404,8 @@ Components.Linkifier = class {
lineNumber: null,
columnNumber: null,
revealable: null,
- fallback: null
+ fallback: null,
+ originalLinkText: text
};
if (!preventClick)
link.addEventListener('click', Components.Linkifier._handleClick, false);
@@ -414,6 +416,15 @@ 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) {
@@ -545,7 +556,8 @@ Components.Linkifier._infoSymbol = Symbol('Linkifier.info');
* lineNumber: ?number,
* columnNumber: ?number,
* revealable: ?Object,
- * fallback: ?Element
+ * fallback: ?Element,
+ * originalLinkText: string
* }}
*/
Components._LinkInfo;
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698