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

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

Issue 2527763003: [DevTools] Turn links into spans to prevent default behavior. (Closed)
Patch Set: fixed comments 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 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 380
381 /** 381 /**
382 * @param {string} text 382 * @param {string} text
383 * @param {string} className 383 * @param {string} className
384 * @param {string=} title 384 * @param {string=} title
385 * @param {string=} href 385 * @param {string=} href
386 * @param {boolean=} preventClick 386 * @param {boolean=} preventClick
387 * @returns{!Element} 387 * @returns{!Element}
388 */ 388 */
389 static _createLink(text, className, title, href, preventClick) { 389 static _createLink(text, className, title, href, preventClick) {
390 var link = createElementWithClass('a', className); 390 var link = createElementWithClass('span', className);
391 link.classList.add('webkit-html-resource-link'); 391 link.classList.add('devtools-link');
392 if (title) 392 if (title)
393 link.title = title; 393 link.title = title;
394 if (href) 394 if (href)
395 link.href = href; 395 link.href = href;
396 link.textContent = text; 396 link.textContent = text;
397 link[Components.Linkifier._infoSymbol] = { 397 link[Components.Linkifier._infoSymbol] = {
398 icon: null, 398 icon: null,
399 enableDecorator: false, 399 enableDecorator: false,
400 uiLocation: null, 400 uiLocation: null,
401 liveLocation: null, 401 liveLocation: null,
402 url: href || null, 402 url: href || null,
403 lineNumber: null, 403 lineNumber: null,
404 columnNumber: null, 404 columnNumber: null,
405 revealable: null, 405 revealable: null,
406 fallback: null 406 fallback: null
407 }; 407 };
408 if (preventClick) 408 if (!preventClick)
409 link.addEventListener('click', event => event.consume(true), false); 409 link.addEventListener('click', Components.Linkifier._handleClick, false);
410 else 410 else
411 link.addEventListener('click', Components.Linkifier._handleClick, false); 411 link.classList.add('devtools-link-prevent-click');
412 return link; 412 return link;
413 } 413 }
414 414
415 /** 415 /**
416 * @param {?Element} link 416 * @param {?Element} link
417 * @return {?Components._LinkInfo} 417 * @return {?Components._LinkInfo}
418 */ 418 */
419 static _linkInfo(link) { 419 static _linkInfo(link) {
420 return /** @type {?Components._LinkInfo} */ (link ? link[Components.Linkifie r._infoSymbol] || null : null); 420 return /** @type {?Components._LinkInfo} */ (link ? link[Components.Linkifie r._infoSymbol] || null : null);
421 } 421 }
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 contextMenu.appendItem(Common.UIString('Save'), save.bind(null, false)); 772 contextMenu.appendItem(Common.UIString('Save'), save.bind(null, false));
773 773
774 if (contentProvider instanceof Workspace.UISourceCode) { 774 if (contentProvider instanceof Workspace.UISourceCode) {
775 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (contentProvider ); 775 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (contentProvider );
776 if (uiSourceCode.project().type() !== Workspace.projectTypes.FileSystem && 776 if (uiSourceCode.project().type() !== Workspace.projectTypes.FileSystem &&
777 uiSourceCode.project().type() !== Workspace.projectTypes.Snippets) 777 uiSourceCode.project().type() !== Workspace.projectTypes.Snippets)
778 contextMenu.appendItem(Common.UIString.capitalize('Save ^as...'), save.b ind(null, true)); 778 contextMenu.appendItem(Common.UIString.capitalize('Save ^as...'), save.b ind(null, true));
779 } 779 }
780 } 780 }
781 }; 781 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698