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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/ElementsPanel.js

Issue 2527763003: [DevTools] Turn links into spans to prevent default behavior. (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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 this._searchableView.cancelSearch(); 516 this._searchableView.cancelSearch();
517 UI.viewManager.showView('elements').then(() => this.selectDOMNode(node, true )); 517 UI.viewManager.showView('elements').then(() => this.selectDOMNode(node, true ));
518 } 518 }
519 519
520 /** 520 /**
521 * @param {!Element} element 521 * @param {!Element} element
522 * @param {!Event} event 522 * @param {!Event} event
523 * @return {!Element|!AnchorBox|undefined} 523 * @return {!Element|!AnchorBox|undefined}
524 */ 524 */
525 _getPopoverAnchor(element, event) { 525 _getPopoverAnchor(element, event) {
526 var anchor = element.enclosingNodeOrSelfWithClass('webkit-html-resource-link '); 526 var link = element;
lushnikov 2016/11/24 00:14:39 this is actually different. Does it work with imag
dgozman 2016/11/24 00:58:29 It works.
527 if (!anchor || !anchor.href) 527 while (link && !link[Elements.ElementsTreeElement.HrefSymbol])
528 return; 528 link = link.parentElementOrShadowHost();
529 529 return link ? link : undefined;
530 return anchor;
531 } 530 }
532 531
533 /** 532 /**
534 * @param {!Element} anchor 533 * @param {!Element} link
535 * @param {!UI.Popover} popover 534 * @param {!UI.Popover} popover
536 */ 535 */
537 _showPopover(anchor, popover) { 536 _showPopover(link, popover) {
538 var node = this.selectedDOMNode(); 537 var node = this.selectedDOMNode();
539 if (node) 538 if (node) {
540 Components.DOMPresentationUtils.buildImagePreviewContents(node.target(), a nchor.href, true, showPopover); 539 Components.DOMPresentationUtils.buildImagePreviewContents(
540 node.target(), link[Elements.ElementsTreeElement.HrefSymbol], true, sh owPopover);
541 }
541 542
542 /** 543 /**
543 * @param {!Element=} contents 544 * @param {!Element=} contents
544 */ 545 */
545 function showPopover(contents) { 546 function showPopover(contents) {
546 if (!contents) 547 if (!contents)
547 return; 548 return;
548 popover.setCanShrink(false); 549 popover.setCanShrink(false);
549 popover.showForAnchor(contents, anchor); 550 popover.showForAnchor(contents, link);
550 } 551 }
551 } 552 }
552 553
553 _jumpToSearchResult(index) { 554 _jumpToSearchResult(index) {
554 this._hideSearchHighlights(); 555 this._hideSearchHighlights();
555 this._currentSearchResultIndex = (index + this._searchResults.length) % this ._searchResults.length; 556 this._currentSearchResultIndex = (index + this._searchResults.length) % this ._searchResults.length;
556 this._highlightCurrentSearchResult(); 557 this._highlightCurrentSearchResult();
557 } 558 }
558 559
559 /** 560 /**
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 * @param {!SDK.DOMNode} node 1058 * @param {!SDK.DOMNode} node
1058 * @return {?{title: string, color: string}} 1059 * @return {?{title: string, color: string}}
1059 */ 1060 */
1060 decorate(node) { 1061 decorate(node) {
1061 return { 1062 return {
1062 color: 'orange', 1063 color: 'orange',
1063 title: Common.UIString('Element state: %s', ':' + SDK.CSSModel.fromNode(no de).pseudoState(node).join(', :')) 1064 title: Common.UIString('Element state: %s', ':' + SDK.CSSModel.fromNode(no de).pseudoState(node).join(', :'))
1064 }; 1065 };
1065 } 1066 }
1066 }; 1067 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698