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

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

Issue 1688283002: [DevTools] Blackboxing in LiveLocations is supported in Linkifier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-source-map-support-v3
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 * @param {?WebInspector.Target} target 195 * @param {?WebInspector.Target} target
196 * @param {!RuntimeAgent.CallFrame} callFrame 196 * @param {!RuntimeAgent.CallFrame} callFrame
197 * @param {string=} classes 197 * @param {string=} classes
198 * @return {!Element} 198 * @return {!Element}
199 */ 199 */
200 linkifyConsoleCallFrame: function(target, callFrame, classes) 200 linkifyConsoleCallFrame: function(target, callFrame, classes)
201 { 201 {
202 // FIXME(62725): console stack trace line/column numbers are one-based. 202 // FIXME(62725): console stack trace line/column numbers are one-based.
203 var lineNumber = callFrame.lineNumber ? callFrame.lineNumber - 1 : 0; 203 var lineNumber = callFrame.lineNumber ? callFrame.lineNumber - 1 : 0;
204 var columnNumber = callFrame.columnNumber ? callFrame.columnNumber - 1 : 0; 204 var columnNumber = callFrame.columnNumber ? callFrame.columnNumber - 1 : 0;
205 var anchor = this.linkifyScriptLocation(target, callFrame.scriptId, call Frame.url, lineNumber, columnNumber, classes); 205 return this.linkifyScriptLocation(target, callFrame.scriptId, callFrame. url, lineNumber, columnNumber, classes);
206 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target);
207 var location = debuggerModel && debuggerModel.createRawLocationByScriptI d(callFrame.scriptId, callFrame.lineNumber, callFrame.columnNumber);
208 var blackboxed = location ?
209 WebInspector.blackboxManager.isBlackboxedRawLocation(location) :
210 WebInspector.blackboxManager.isBlackboxedURL(callFrame.url);
211 if (blackboxed)
212 anchor.classList.add("webkit-html-blackbox-link");
213
214 return anchor;
215 }, 206 },
216 207
217 /** 208 /**
218 * @param {!WebInspector.CSSLocation} rawLocation 209 * @param {!WebInspector.CSSLocation} rawLocation
219 * @param {string=} classes 210 * @param {string=} classes
220 * @return {!Element} 211 * @return {!Element}
221 */ 212 */
222 linkifyCSSLocation: function(rawLocation, classes) 213 linkifyCSSLocation: function(rawLocation, classes)
223 { 214 {
224 var anchor = this._createAnchor(classes); 215 var anchor = this._createAnchor(classes);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 274
284 dispose: function() 275 dispose: function()
285 { 276 {
286 this.reset(); 277 this.reset();
287 WebInspector.targetManager.unobserveTargets(this); 278 WebInspector.targetManager.unobserveTargets(this);
288 this._liveLocationsByTarget.clear(); 279 this._liveLocationsByTarget.clear();
289 }, 280 },
290 281
291 /** 282 /**
292 * @param {!Element} anchor 283 * @param {!Element} anchor
293 * @param {!WebInspector.UILocation} uiLocation 284 * @param {!WebInspector.LiveLocation} liveLocation
294 */ 285 */
295 _updateAnchor: function(anchor, uiLocation) 286 _updateAnchor: function(anchor, liveLocation)
296 { 287 {
288 var uiLocation = liveLocation.uiLocation();
289 if (!uiLocation)
290 return;
297 anchor[WebInspector.Linkifier._uiLocationSymbol] = uiLocation; 291 anchor[WebInspector.Linkifier._uiLocationSymbol] = uiLocation;
298 this._formatter.formatLiveAnchor(anchor, uiLocation); 292 this._formatter.formatLiveAnchor(anchor, uiLocation);
299 } 293 }
300 } 294 }
301 295
302 /** 296 /**
303 * @param {!Element} anchor 297 * @param {!Element} anchor
304 * @return {?WebInspector.UILocation} uiLocation 298 * @return {?WebInspector.UILocation} uiLocation
305 */ 299 */
306 WebInspector.Linkifier.uiLocationByAnchor = function(anchor) 300 WebInspector.Linkifier.uiLocationByAnchor = function(anchor)
(...skipping 22 matching lines...) Expand all
329 var text = uiLocation.linkText(); 323 var text = uiLocation.linkText();
330 text = text.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g, "$1\u2026"); 324 text = text.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g, "$1\u2026");
331 if (this._maxLength) 325 if (this._maxLength)
332 text = text.trimMiddle(this._maxLength); 326 text = text.trimMiddle(this._maxLength);
333 anchor.textContent = text; 327 anchor.textContent = text;
334 328
335 var titleText = uiLocation.uiSourceCode.url(); 329 var titleText = uiLocation.uiSourceCode.url();
336 if (typeof uiLocation.lineNumber === "number") 330 if (typeof uiLocation.lineNumber === "number")
337 titleText += ":" + (uiLocation.lineNumber + 1); 331 titleText += ":" + (uiLocation.lineNumber + 1);
338 anchor.title = titleText; 332 anchor.title = titleText;
333
334 if (uiLocation.isBlackboxed)
335 anchor.classList.add("webkit-html-blackbox-link");
336 else
337 anchor.classList.remove("webkit-html-blackbox-link");
339 } 338 }
340 } 339 }
341 340
342 /** 341 /**
343 * @constructor 342 * @constructor
344 * @extends {WebInspector.Linkifier.DefaultFormatter} 343 * @extends {WebInspector.Linkifier.DefaultFormatter}
345 */ 344 */
346 WebInspector.Linkifier.DefaultCSSFormatter = function() 345 WebInspector.Linkifier.DefaultCSSFormatter = function()
347 { 346 {
348 WebInspector.Linkifier.DefaultFormatter.call(this, WebInspector.Linkifier.De faultCSSFormatter.MaxLengthForDisplayedURLs); 347 WebInspector.Linkifier.DefaultFormatter.call(this, WebInspector.Linkifier.De faultCSSFormatter.MaxLengthForDisplayedURLs);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 /** 540 /**
542 * @param {!WebInspector.NetworkRequest} request 541 * @param {!WebInspector.NetworkRequest} request
543 * @return {!Element} 542 * @return {!Element}
544 */ 543 */
545 WebInspector.linkifyRequestAsNode = function(request) 544 WebInspector.linkifyRequestAsNode = function(request)
546 { 545 {
547 var anchor = WebInspector.linkifyURLAsNode(request.url); 546 var anchor = WebInspector.linkifyURLAsNode(request.url);
548 anchor.requestId = request.requestId; 547 anchor.requestId = request.requestId;
549 return anchor; 548 return anchor;
550 } 549 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698