Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 24 matching lines...) Expand all Loading... | |
| 35 WebInspector.Linkifier = class { | 35 WebInspector.Linkifier = class { |
| 36 /** | 36 /** |
| 37 * @param {number=} maxLengthForDisplayedURLs | 37 * @param {number=} maxLengthForDisplayedURLs |
| 38 */ | 38 */ |
| 39 constructor(maxLengthForDisplayedURLs) { | 39 constructor(maxLengthForDisplayedURLs) { |
| 40 this._maxLength = maxLengthForDisplayedURLs || WebInspector.Linkifier.MaxLen gthForDisplayedURLs; | 40 this._maxLength = maxLengthForDisplayedURLs || WebInspector.Linkifier.MaxLen gthForDisplayedURLs; |
| 41 /** @type {!Map<!WebInspector.Target, !Array<!Element>>} */ | 41 /** @type {!Map<!WebInspector.Target, !Array<!Element>>} */ |
| 42 this._anchorsByTarget = new Map(); | 42 this._anchorsByTarget = new Map(); |
| 43 /** @type {!Map<!WebInspector.Target, !WebInspector.LiveLocationPool>} */ | 43 /** @type {!Map<!WebInspector.Target, !WebInspector.LiveLocationPool>} */ |
| 44 this._locationPoolByTarget = new Map(); | 44 this._locationPoolByTarget = new Map(); |
| 45 WebInspector.Linkifier._instances.add(this); | |
| 45 WebInspector.targetManager.observeTargets(this); | 46 WebInspector.targetManager.observeTargets(this); |
| 46 } | 47 } |
| 47 | 48 |
| 48 /** | 49 /** |
| 50 * @param {!WebInspector.LinkifierIconProvider} iconProvider | |
| 51 */ | |
| 52 static registerIconProvider(iconProvider) { | |
|
dgozman
2016/11/09 18:58:48
If you only support a single one, call it setDecor
lushnikov
2016/11/09 21:46:51
Done.
| |
| 53 console.assert(!WebInspector.Linkifier._iconProvider, 'Cannot re-register ic on provider.'); | |
| 54 WebInspector.Linkifier._iconProvider = iconProvider; | |
| 55 iconProvider.addEventListener(WebInspector.LinkifierIconProvider.Events.Icon Changed, onIconChanged); | |
| 56 for (var linkifier of WebInspector.Linkifier._instances) | |
| 57 linkifier._updateAllAnchorIcons(); | |
| 58 | |
| 59 /** | |
| 60 * @param {!WebInspector.Event} event | |
| 61 */ | |
| 62 function onIconChanged(event) { | |
| 63 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */(event.data); | |
| 64 var anchors = uiSourceCode[WebInspector.Linkifier._sourceCodeAnchors] || [ ]; | |
| 65 for (var anchor of anchors) | |
| 66 WebInspector.Linkifier._updateAnchorIcon(anchor); | |
| 67 } | |
| 68 } | |
| 69 | |
| 70 _updateAllAnchorIcons() { | |
| 71 for (var target of this._anchorsByTarget.keysArray()) { | |
| 72 var anchors = this._anchorsByTarget.get(target); | |
| 73 for (var anchor of anchors) | |
| 74 WebInspector.Linkifier._updateAnchorIcon(anchor); | |
| 75 } | |
| 76 } | |
| 77 | |
| 78 /** | |
| 49 * @param {?WebInspector.Linkifier.LinkHandler} handler | 79 * @param {?WebInspector.Linkifier.LinkHandler} handler |
| 50 */ | 80 */ |
| 51 static setLinkHandler(handler) { | 81 static setLinkHandler(handler) { |
| 52 WebInspector.Linkifier._linkHandler = handler; | 82 WebInspector.Linkifier._linkHandler = handler; |
| 53 } | 83 } |
| 54 | 84 |
| 55 /** | 85 /** |
| 56 * @param {string} url | 86 * @param {string} url |
| 57 * @param {number=} lineNumber | 87 * @param {number=} lineNumber |
| 58 * @return {boolean} | 88 * @return {boolean} |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 74 */ | 104 */ |
| 75 static linkifyUsingRevealer(revealable, text, fallbackHref, fallbackLineNumber , title, classes) { | 105 static linkifyUsingRevealer(revealable, text, fallbackHref, fallbackLineNumber , title, classes) { |
| 76 var a = createElement('a'); | 106 var a = createElement('a'); |
| 77 a.className = (classes || '') + ' webkit-html-resource-link'; | 107 a.className = (classes || '') + ' webkit-html-resource-link'; |
| 78 a.textContent = text.trimMiddle(WebInspector.Linkifier.MaxLengthForDisplayed URLs); | 108 a.textContent = text.trimMiddle(WebInspector.Linkifier.MaxLengthForDisplayed URLs); |
| 79 a.title = title || text; | 109 a.title = title || text; |
| 80 if (fallbackHref) { | 110 if (fallbackHref) { |
| 81 a.href = fallbackHref; | 111 a.href = fallbackHref; |
| 82 a.lineNumber = fallbackLineNumber; | 112 a.lineNumber = fallbackLineNumber; |
| 83 } | 113 } |
| 114 | |
| 84 /** | 115 /** |
| 85 * @param {!Event} event | 116 * @param {!Event} event |
| 86 * @this {Object} | 117 * @this {Object} |
| 87 */ | 118 */ |
| 88 function clickHandler(event) { | 119 function clickHandler(event) { |
| 89 event.stopImmediatePropagation(); | 120 event.stopImmediatePropagation(); |
| 90 event.preventDefault(); | 121 event.preventDefault(); |
| 91 if (fallbackHref && WebInspector.Linkifier.handleLink(fallbackHref, fallba ckLineNumber)) | 122 if (fallbackHref && WebInspector.Linkifier.handleLink(fallbackHref, fallba ckLineNumber)) |
| 92 return; | 123 return; |
| 93 | 124 |
| 94 WebInspector.Revealer.reveal(this); | 125 WebInspector.Revealer.reveal(this); |
| 95 } | 126 } |
| 96 a.addEventListener('click', clickHandler.bind(revealable), false); | 127 a.addEventListener('click', clickHandler.bind(revealable), false); |
| 97 return a; | 128 return a; |
| 98 } | 129 } |
| 99 | 130 |
| 100 /** | 131 /** |
| 101 * @param {!Element} anchor | 132 * @param {!Element} anchor |
| 102 * @return {?WebInspector.UILocation} uiLocation | 133 * @return {?WebInspector.UILocation} uiLocation |
| 103 */ | 134 */ |
| 104 static uiLocationByAnchor(anchor) { | 135 static uiLocationByAnchor(anchor) { |
| 105 return anchor[WebInspector.Linkifier._uiLocationSymbol]; | 136 return anchor[WebInspector.Linkifier._uiLocationSymbol]; |
| 106 } | 137 } |
| 107 | 138 |
| 108 /** | 139 /** |
| 140 * @param {!Element} anchor | |
| 141 * @param {?WebInspector.UILocation} uiLocation | |
| 142 */ | |
| 143 static _bindAnchorToUILocation(anchor, uiLocation) { | |
| 144 anchor[WebInspector.Linkifier._uiLocationSymbol] = uiLocation; | |
| 145 if (!uiLocation) | |
| 146 return; | |
| 147 var uiSourceCode = uiLocation.uiSourceCode; | |
| 148 var sourceCodeAnchors = uiSourceCode[WebInspector.Linkifier._sourceCodeAncho rs]; | |
| 149 if (!sourceCodeAnchors) { | |
| 150 sourceCodeAnchors = new Set(); | |
| 151 uiSourceCode[WebInspector.Linkifier._sourceCodeAnchors] = sourceCodeAnchor s; | |
| 152 } | |
| 153 sourceCodeAnchors.add(anchor); | |
| 154 } | |
| 155 | |
| 156 /** | |
| 157 * @param {!Element} anchor | |
| 158 */ | |
| 159 static _unbindAnchorFromUILocation(anchor) { | |
| 160 if (!anchor[WebInspector.Linkifier._uiLocationSymbol]) | |
| 161 return; | |
| 162 | |
| 163 var uiSourceCode = anchor[WebInspector.Linkifier._uiLocationSymbol].uiSource Code; | |
| 164 var sourceCodeAnchors = uiSourceCode[WebInspector.Linkifier._sourceCodeAncho rs]; | |
| 165 if (sourceCodeAnchors) | |
| 166 sourceCodeAnchors.delete(anchor); | |
| 167 } | |
| 168 | |
| 169 /** | |
| 109 * @param {!WebInspector.Target} target | 170 * @param {!WebInspector.Target} target |
| 110 * @param {string} scriptId | 171 * @param {string} scriptId |
| 111 * @param {number} lineNumber | 172 * @param {number} lineNumber |
| 112 * @param {number=} columnNumber | 173 * @param {number=} columnNumber |
| 113 * @return {string} | 174 * @return {string} |
| 114 */ | 175 */ |
| 115 static liveLocationText(target, scriptId, lineNumber, columnNumber) { | 176 static liveLocationText(target, scriptId, lineNumber, columnNumber) { |
| 116 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); | 177 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); |
| 117 if (!debuggerModel) | 178 if (!debuggerModel) |
| 118 return ''; | 179 return ''; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 138 /** | 199 /** |
| 139 * @override | 200 * @override |
| 140 * @param {!WebInspector.Target} target | 201 * @param {!WebInspector.Target} target |
| 141 */ | 202 */ |
| 142 targetRemoved(target) { | 203 targetRemoved(target) { |
| 143 var locationPool = /** @type {!WebInspector.LiveLocationPool} */ (this._loca tionPoolByTarget.remove(target)); | 204 var locationPool = /** @type {!WebInspector.LiveLocationPool} */ (this._loca tionPoolByTarget.remove(target)); |
| 144 locationPool.disposeAll(); | 205 locationPool.disposeAll(); |
| 145 var anchors = this._anchorsByTarget.remove(target); | 206 var anchors = this._anchorsByTarget.remove(target); |
| 146 for (var anchor of anchors) { | 207 for (var anchor of anchors) { |
| 147 delete anchor[WebInspector.Linkifier._liveLocationSymbol]; | 208 delete anchor[WebInspector.Linkifier._liveLocationSymbol]; |
| 209 WebInspector.Linkifier._unbindAnchorFromUILocation(anchor); | |
| 148 var fallbackAnchor = anchor[WebInspector.Linkifier._fallbackAnchorSymbol]; | 210 var fallbackAnchor = anchor[WebInspector.Linkifier._fallbackAnchorSymbol]; |
| 149 if (fallbackAnchor) { | 211 if (fallbackAnchor) { |
| 150 anchor.href = fallbackAnchor.href; | 212 anchor.href = fallbackAnchor.href; |
| 151 anchor.lineNumber = fallbackAnchor.lineNumber; | 213 anchor.lineNumber = fallbackAnchor.lineNumber; |
| 152 anchor.title = fallbackAnchor.title; | 214 anchor.title = fallbackAnchor.title; |
| 153 anchor.className = fallbackAnchor.className; | 215 anchor.className = fallbackAnchor.className; |
| 154 anchor.textContent = fallbackAnchor.textContent; | 216 anchor.textContent = fallbackAnchor.textContent; |
| 155 delete anchor[WebInspector.Linkifier._fallbackAnchorSymbol]; | 217 delete anchor[WebInspector.Linkifier._fallbackAnchorSymbol]; |
| 156 } | 218 } |
| 157 } | 219 } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 anchor[WebInspector.Linkifier._fallbackAnchorSymbol] = fallbackAnchor; | 321 anchor[WebInspector.Linkifier._fallbackAnchorSymbol] = fallbackAnchor; |
| 260 return anchor; | 322 return anchor; |
| 261 } | 323 } |
| 262 | 324 |
| 263 /** | 325 /** |
| 264 * @param {!WebInspector.CSSLocation} rawLocation | 326 * @param {!WebInspector.CSSLocation} rawLocation |
| 265 * @param {string=} classes | 327 * @param {string=} classes |
| 266 * @return {!Element} | 328 * @return {!Element} |
| 267 */ | 329 */ |
| 268 linkifyCSSLocation(rawLocation, classes) { | 330 linkifyCSSLocation(rawLocation, classes) { |
| 269 var anchor = this._createAnchor(classes); | 331 var anchor = this._createAnchor(classes, true); |
|
dgozman
2016/11/09 18:58:48
This should be a parameter of linkifier.
lushnikov
2016/11/09 21:46:51
Done.
| |
| 270 var liveLocation = WebInspector.cssWorkspaceBinding.createLiveLocation( | 332 var liveLocation = WebInspector.cssWorkspaceBinding.createLiveLocation( |
| 271 rawLocation, this._updateAnchor.bind(this, anchor), | 333 rawLocation, this._updateAnchor.bind(this, anchor), |
| 272 /** @type {!WebInspector.LiveLocationPool} */ (this._locationPoolByTarge t.get(rawLocation.target()))); | 334 /** @type {!WebInspector.LiveLocationPool} */ (this._locationPoolByTarge t.get(rawLocation.target()))); |
| 273 var anchors = /** @type {!Array<!Element>} */ (this._anchorsByTarget.get(raw Location.target())); | 335 var anchors = /** @type {!Array<!Element>} */ (this._anchorsByTarget.get(raw Location.target())); |
| 274 anchors.push(anchor); | 336 anchors.push(anchor); |
| 275 anchor[WebInspector.Linkifier._liveLocationSymbol] = liveLocation; | 337 anchor[WebInspector.Linkifier._liveLocationSymbol] = liveLocation; |
| 276 return anchor; | 338 return anchor; |
| 277 } | 339 } |
| 278 | 340 |
| 279 /** | 341 /** |
| 280 * @param {!WebInspector.Target} target | 342 * @param {!WebInspector.Target} target |
| 281 * @param {!Element} anchor | 343 * @param {!Element} anchor |
| 282 */ | 344 */ |
| 283 disposeAnchor(target, anchor) { | 345 disposeAnchor(target, anchor) { |
| 284 delete anchor[WebInspector.Linkifier._uiLocationSymbol]; | 346 WebInspector.Linkifier._unbindAnchorFromUILocation(anchor); |
| 285 delete anchor[WebInspector.Linkifier._fallbackAnchorSymbol]; | 347 delete anchor[WebInspector.Linkifier._fallbackAnchorSymbol]; |
| 286 var liveLocation = anchor[WebInspector.Linkifier._liveLocationSymbol]; | 348 var liveLocation = anchor[WebInspector.Linkifier._liveLocationSymbol]; |
| 287 if (liveLocation) | 349 if (liveLocation) |
| 288 liveLocation.dispose(); | 350 liveLocation.dispose(); |
| 289 delete anchor[WebInspector.Linkifier._liveLocationSymbol]; | 351 delete anchor[WebInspector.Linkifier._liveLocationSymbol]; |
| 290 } | 352 } |
| 291 | 353 |
| 292 /** | 354 /** |
| 293 * @param {string=} classes | 355 * @param {string=} classes |
| 356 * @param {boolean=} enableIconDecorations | |
| 294 * @return {!Element} | 357 * @return {!Element} |
| 295 */ | 358 */ |
| 296 _createAnchor(classes) { | 359 _createAnchor(classes, enableIconDecorations) { |
| 297 var anchor = createElement('a'); | 360 var anchor = createElement('a'); |
| 361 if (enableIconDecorations) | |
| 362 anchor[WebInspector.Linkifier._enableIconsSymbol] = true; | |
| 298 anchor.className = (classes || '') + ' webkit-html-resource-link'; | 363 anchor.className = (classes || '') + ' webkit-html-resource-link'; |
| 299 | 364 |
| 300 /** | 365 /** |
| 301 * @param {!Event} event | 366 * @param {!Event} event |
| 302 */ | 367 */ |
| 303 function clickHandler(event) { | 368 function clickHandler(event) { |
| 304 var uiLocation = anchor[WebInspector.Linkifier._uiLocationSymbol]; | 369 var uiLocation = anchor[WebInspector.Linkifier._uiLocationSymbol]; |
| 305 if (!uiLocation) | 370 if (!uiLocation) |
| 306 return; | 371 return; |
| 307 | 372 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 318 for (var target of this._anchorsByTarget.keysArray()) { | 383 for (var target of this._anchorsByTarget.keysArray()) { |
| 319 this.targetRemoved(target); | 384 this.targetRemoved(target); |
| 320 this.targetAdded(target); | 385 this.targetAdded(target); |
| 321 } | 386 } |
| 322 } | 387 } |
| 323 | 388 |
| 324 dispose() { | 389 dispose() { |
| 325 for (var target of this._anchorsByTarget.keysArray()) | 390 for (var target of this._anchorsByTarget.keysArray()) |
| 326 this.targetRemoved(target); | 391 this.targetRemoved(target); |
| 327 WebInspector.targetManager.unobserveTargets(this); | 392 WebInspector.targetManager.unobserveTargets(this); |
| 393 WebInspector.Linkifier._instances.delete(this); | |
| 328 } | 394 } |
| 329 | 395 |
| 330 /** | 396 /** |
| 331 * @param {!Element} anchor | 397 * @param {!Element} anchor |
| 332 * @param {!WebInspector.LiveLocation} liveLocation | 398 * @param {!WebInspector.LiveLocation} liveLocation |
| 333 */ | 399 */ |
| 334 _updateAnchor(anchor, liveLocation) { | 400 _updateAnchor(anchor, liveLocation) { |
| 401 WebInspector.Linkifier._unbindAnchorFromUILocation(anchor); | |
| 335 var uiLocation = liveLocation.uiLocation(); | 402 var uiLocation = liveLocation.uiLocation(); |
| 403 WebInspector.Linkifier._bindAnchorToUILocation(anchor, uiLocation); | |
| 336 if (!uiLocation) | 404 if (!uiLocation) |
| 337 return; | 405 return; |
| 338 anchor[WebInspector.Linkifier._uiLocationSymbol] = uiLocation; | |
| 339 this._formatLiveAnchor(anchor, uiLocation, liveLocation.isBlackboxed()); | |
| 340 } | |
| 341 | 406 |
| 342 /** | |
| 343 * @param {!Element} anchor | |
| 344 * @param {!WebInspector.UILocation} uiLocation | |
| 345 * @param {boolean} isBlackboxed | |
| 346 */ | |
| 347 _formatLiveAnchor(anchor, uiLocation, isBlackboxed) { | |
| 348 var text = uiLocation.linkText(); | 407 var text = uiLocation.linkText(); |
| 349 text = text.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g, '$1\u2026'); | 408 text = text.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g, '$1\u2026'); |
| 350 if (this._maxLength) | 409 if (this._maxLength) |
| 351 text = text.trimMiddle(this._maxLength); | 410 text = text.trimMiddle(this._maxLength); |
| 352 anchor.textContent = text; | 411 anchor.textContent = text; |
| 353 | 412 |
| 354 var titleText = uiLocation.uiSourceCode.url(); | 413 var titleText = uiLocation.uiSourceCode.url(); |
| 355 if (typeof uiLocation.lineNumber === 'number') | 414 if (typeof uiLocation.lineNumber === 'number') |
| 356 titleText += ':' + (uiLocation.lineNumber + 1); | 415 titleText += ':' + (uiLocation.lineNumber + 1); |
| 357 anchor.title = titleText; | 416 anchor.title = titleText; |
| 417 anchor.classList.toggle('webkit-html-blackbox-link', liveLocation.isBlackbox ed()); | |
| 418 WebInspector.Linkifier._updateAnchorIcon(anchor); | |
| 419 } | |
| 358 | 420 |
| 359 anchor.classList.toggle('webkit-html-blackbox-link', isBlackboxed); | 421 /** |
| 422 * @param {!Element} anchor | |
| 423 */ | |
| 424 static _updateAnchorIcon(anchor) { | |
| 425 if (!anchor[WebInspector.Linkifier._enableIconsSymbol]) | |
| 426 return; | |
| 427 var uiLocation = anchor[WebInspector.Linkifier._uiLocationSymbol]; | |
| 428 if (!WebInspector.Linkifier._iconProvider || !uiLocation) | |
| 429 return; | |
| 430 var iconType = WebInspector.Linkifier._iconProvider.iconType(uiLocation.uiSo urceCode); | |
| 431 var icon = anchor.querySelector('span[is=ui-icon]'); | |
| 432 if (!iconType) { | |
| 433 if (icon) | |
| 434 icon.setIconType(''); | |
| 435 return; | |
| 436 } | |
| 437 | |
| 438 if (!icon) { | |
| 439 icon = WebInspector.Icon.create(iconType); | |
| 440 icon.style.setProperty('margin-right', '2px'); | |
| 441 anchor.insertBefore(icon, anchor.firstChild); | |
| 442 } else { | |
| 443 icon.setIconType(iconType); | |
| 444 } | |
| 360 } | 445 } |
| 361 }; | 446 }; |
| 362 | 447 |
| 448 /** @type {!Set<!WebInspector.Linkifier>} */ | |
| 449 WebInspector.Linkifier._instances = new Set(); | |
| 450 /** @type {?WebInspector.LinkifierIconProvider} */ | |
| 451 WebInspector.Linkifier._iconProvider = null; | |
| 452 | |
| 453 WebInspector.Linkifier._enableIconsSymbol = Symbol('Linkifier.enableIconsSymbol' ); | |
| 454 WebInspector.Linkifier._sourceCodeAnchors = Symbol('Linkifier.anchors'); | |
| 363 WebInspector.Linkifier._uiLocationSymbol = Symbol('uiLocation'); | 455 WebInspector.Linkifier._uiLocationSymbol = Symbol('uiLocation'); |
| 364 WebInspector.Linkifier._fallbackAnchorSymbol = Symbol('fallbackAnchor'); | 456 WebInspector.Linkifier._fallbackAnchorSymbol = Symbol('fallbackAnchor'); |
| 365 WebInspector.Linkifier._liveLocationSymbol = Symbol('liveLocation'); | 457 WebInspector.Linkifier._liveLocationSymbol = Symbol('liveLocation'); |
| 366 | 458 |
| 367 /** | 459 /** |
| 368 * The maximum number of characters to display in a URL. | 460 * The maximum number of characters to display in a URL. |
| 369 * @const | 461 * @const |
| 370 * @type {number} | 462 * @type {number} |
| 371 */ | 463 */ |
| 372 WebInspector.Linkifier.MaxLengthForDisplayedURLs = 150; | 464 WebInspector.Linkifier.MaxLengthForDisplayedURLs = 150; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 385 | 477 |
| 386 WebInspector.Linkifier.LinkHandler.prototype = { | 478 WebInspector.Linkifier.LinkHandler.prototype = { |
| 387 /** | 479 /** |
| 388 * @param {string} url | 480 * @param {string} url |
| 389 * @param {number=} lineNumber | 481 * @param {number=} lineNumber |
| 390 * @return {boolean} | 482 * @return {boolean} |
| 391 */ | 483 */ |
| 392 handleLink: function(url, lineNumber) {} | 484 handleLink: function(url, lineNumber) {} |
| 393 }; | 485 }; |
| 394 | 486 |
| 487 /** | |
| 488 * @extends {WebInspector.EventTarget} | |
| 489 * @interface | |
| 490 */ | |
| 491 WebInspector.LinkifierIconProvider = function() {}; | |
|
dgozman
2016/11/09 18:58:48
LinkDecorator
lushnikov
2016/11/09 21:46:51
Done.
| |
| 492 | |
| 493 WebInspector.LinkifierIconProvider.prototype = { | |
| 494 /** | |
| 495 * @param {!WebInspector.UISourceCode} uiSourceCode | |
| 496 * @return {string} | |
|
lushnikov
2016/11/09 18:23:28
it feels daunting to return a string here, but if
dgozman
2016/11/09 18:58:48
Let's go with WI.Icon.
lushnikov
2016/11/09 21:46:51
Done.
| |
| 497 */ | |
| 498 iconType: function(uiSourceCode) {} | |
|
dgozman
2016/11/09 18:58:48
linkIcon
lushnikov
2016/11/09 21:46:51
Done.
| |
| 499 }; | |
| 500 | |
| 501 WebInspector.LinkifierIconProvider.Events = { | |
| 502 IconChanged: Symbol('IconChanged') | |
|
dgozman
2016/11/09 18:58:48
LinkIconChanged
lushnikov
2016/11/09 21:46:51
Done.
| |
| 503 }; | |
| 395 | 504 |
| 396 /** | 505 /** |
| 397 * @param {string} string | 506 * @param {string} string |
| 398 * @param {function(string,string,number=,number=):!Node} linkifier | 507 * @param {function(string,string,number=,number=):!Node} linkifier |
| 399 * @return {!DocumentFragment} | 508 * @return {!DocumentFragment} |
| 400 */ | 509 */ |
| 401 WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linki fier) { | 510 WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linki fier) { |
| 402 var container = createDocumentFragment(); | 511 var container = createDocumentFragment(); |
| 403 var linkStringRegEx = | 512 var linkStringRegEx = |
| 404 /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|data:|www\.)[\w$\-_+*'=\|\/\\(){}[\]^% @&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({^%@&#~]/; | 513 /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|data:|www\.)[\w$\-_+*'=\|\/\\(){}[\]^% @&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({^%@&#~]/; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 487 | 596 |
| 488 /** | 597 /** |
| 489 * @param {!WebInspector.NetworkRequest} request | 598 * @param {!WebInspector.NetworkRequest} request |
| 490 * @return {!Element} | 599 * @return {!Element} |
| 491 */ | 600 */ |
| 492 WebInspector.linkifyRequestAsNode = function(request) { | 601 WebInspector.linkifyRequestAsNode = function(request) { |
| 493 var anchor = WebInspector.linkifyURLAsNode(request.url); | 602 var anchor = WebInspector.linkifyURLAsNode(request.url); |
| 494 anchor.requestId = request.requestId; | 603 anchor.requestId = request.requestId; |
| 495 return anchor; | 604 return anchor; |
| 496 }; | 605 }; |
| OLD | NEW |