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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 505 * @param {string=} linkText | 505 * @param {string=} linkText |
| 506 * @param {string=} classes | 506 * @param {string=} classes |
| 507 * @param {boolean=} isExternal | 507 * @param {boolean=} isExternal |
| 508 * @param {string=} tooltipText | 508 * @param {string=} tooltipText |
| 509 * @return {!Element} | 509 * @return {!Element} |
| 510 */ | 510 */ |
| 511 WebInspector.linkifyURLAsNode = function(url, linkText, classes, isExternal, too ltipText) | 511 WebInspector.linkifyURLAsNode = function(url, linkText, classes, isExternal, too ltipText) |
| 512 { | 512 { |
| 513 if (!linkText) | 513 if (!linkText) |
| 514 linkText = url; | 514 linkText = url; |
| 515 classes = (classes ? classes + " " : ""); | 515 classes = (classes ? classes + " " : ""); |
|
caseq
2016/03/17 00:28:39
please move this down to conditional where we modi
dgozman
2016/03/18 19:06:47
Done.
| |
| 516 classes += isExternal ? "webkit-html-external-link" : "webkit-html-resource- link"; | |
| 517 | 516 |
| 518 var a = createElement("a"); | 517 var a = createElement("a"); |
| 519 var href = sanitizeHref(url); | 518 var href = url; |
| 520 if (href !== null) | 519 if (url.trim().toLowerCase().startsWith("javascript:")) |
| 520 href = null; | |
| 521 if (isExternal && WebInspector.ParsedURL.isRelativeURL(url)) | |
| 522 href = null; | |
| 523 if (href !== null) { | |
| 521 a.href = href; | 524 a.href = href; |
| 525 classes += isExternal ? "webkit-html-external-link" : "webkit-html-resou rce-link"; | |
| 526 } | |
| 522 a.className = classes; | 527 a.className = classes; |
| 523 if (!tooltipText && linkText !== url) | 528 if (!tooltipText && linkText !== url) |
| 524 a.title = url; | 529 a.title = url; |
| 525 else if (tooltipText) | 530 else if (tooltipText) |
| 526 a.title = tooltipText; | 531 a.title = tooltipText; |
| 527 a.textContent = linkText.trimMiddle(WebInspector.Linkifier.MaxLengthForDispl ayedURLs); | 532 a.textContent = linkText.trimMiddle(WebInspector.Linkifier.MaxLengthForDispl ayedURLs); |
| 528 if (isExternal) | 533 if (isExternal) |
| 529 a.setAttribute("target", "_blank"); | 534 a.setAttribute("target", "_blank"); |
| 530 | 535 |
| 531 return a; | 536 return a; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 564 /** | 569 /** |
| 565 * @param {!WebInspector.NetworkRequest} request | 570 * @param {!WebInspector.NetworkRequest} request |
| 566 * @return {!Element} | 571 * @return {!Element} |
| 567 */ | 572 */ |
| 568 WebInspector.linkifyRequestAsNode = function(request) | 573 WebInspector.linkifyRequestAsNode = function(request) |
| 569 { | 574 { |
| 570 var anchor = WebInspector.linkifyURLAsNode(request.url); | 575 var anchor = WebInspector.linkifyURLAsNode(request.url); |
| 571 anchor.requestId = request.requestId; | 576 anchor.requestId = request.requestId; |
| 572 return anchor; | 577 return anchor; |
| 573 } | 578 } |
| OLD | NEW |