OLD | NEW |
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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 */ | 574 */ |
575 _getPopoverAnchor(element, event) { | 575 _getPopoverAnchor(element, event) { |
576 var link = element; | 576 var link = element; |
577 while (link && !link[Elements.ElementsTreeElement.HrefSymbol]) | 577 while (link && !link[Elements.ElementsTreeElement.HrefSymbol]) |
578 link = link.parentElementOrShadowHost(); | 578 link = link.parentElementOrShadowHost(); |
579 return link ? link : undefined; | 579 return link ? link : undefined; |
580 } | 580 } |
581 | 581 |
582 /** | 582 /** |
583 * @param {!Element} link | 583 * @param {!Element} link |
584 * @param {!UI.Popover} popover | 584 * @param {!UI.GlassPane} popover |
| 585 * @return {!Promise<boolean>} |
585 */ | 586 */ |
586 _showPopover(link, popover) { | 587 _showPopover(link, popover) { |
587 var node = this.selectedDOMNode(); | 588 var node = this.selectedDOMNode(); |
588 if (node) { | 589 if (!node) |
589 Components.DOMPresentationUtils.buildImagePreviewContents( | 590 return Promise.resolve(false); |
590 node.target(), link[Elements.ElementsTreeElement.HrefSymbol], true, sh
owPopover); | 591 |
591 } | 592 var fulfill; |
| 593 var promise = new Promise(x => fulfill = x); |
| 594 Components.DOMPresentationUtils.buildImagePreviewContents( |
| 595 node.target(), link[Elements.ElementsTreeElement.HrefSymbol], true, show
Popover); |
| 596 return promise; |
592 | 597 |
593 /** | 598 /** |
594 * @param {!Element=} contents | 599 * @param {!Element=} contents |
595 */ | 600 */ |
596 function showPopover(contents) { | 601 function showPopover(contents) { |
597 if (!contents) | 602 if (contents) |
598 return; | 603 popover.contentElement.appendChild(contents); |
599 popover.showForAnchor(contents, link); | 604 fulfill(!!contents); |
600 } | 605 } |
601 } | 606 } |
602 | 607 |
603 _jumpToSearchResult(index) { | 608 _jumpToSearchResult(index) { |
604 this._currentSearchResultIndex = (index + this._searchResults.length) % this
._searchResults.length; | 609 this._currentSearchResultIndex = (index + this._searchResults.length) % this
._searchResults.length; |
605 this._highlightCurrentSearchResult(); | 610 this._highlightCurrentSearchResult(); |
606 } | 611 } |
607 | 612 |
608 /** | 613 /** |
609 * @override | 614 * @override |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 showMetrics.call(this, true); | 901 showMetrics.call(this, true); |
897 else if (tabId === Common.UIString('Styles')) | 902 else if (tabId === Common.UIString('Styles')) |
898 showMetrics.call(this, false); | 903 showMetrics.call(this, false); |
899 } | 904 } |
900 | 905 |
901 this.sidebarPaneView = UI.viewManager.createTabbedLocation(() => UI.viewMana
ger.showView('elements')); | 906 this.sidebarPaneView = UI.viewManager.createTabbedLocation(() => UI.viewMana
ger.showView('elements')); |
902 var tabbedPane = this.sidebarPaneView.tabbedPane(); | 907 var tabbedPane = this.sidebarPaneView.tabbedPane(); |
903 if (this._popoverHelper) | 908 if (this._popoverHelper) |
904 this._popoverHelper.hidePopover(); | 909 this._popoverHelper.hidePopover(); |
905 this._popoverHelper = new UI.PopoverHelper(tabbedPane.element); | 910 this._popoverHelper = new UI.PopoverHelper(tabbedPane.element); |
| 911 this._popoverHelper.setHasPadding(true); |
906 this._popoverHelper.initializeCallbacks(this._getPopoverAnchor.bind(this), t
his._showPopover.bind(this)); | 912 this._popoverHelper.initializeCallbacks(this._getPopoverAnchor.bind(this), t
his._showPopover.bind(this)); |
907 this._popoverHelper.setTimeout(0); | 913 this._popoverHelper.setTimeout(0); |
908 | 914 |
909 if (horizontally) { | 915 if (horizontally) { |
910 // Styles and computed are merged into a single tab. | 916 // Styles and computed are merged into a single tab. |
911 this._splitWidget.installResizer(tabbedPane.headerElement()); | 917 this._splitWidget.installResizer(tabbedPane.headerElement()); |
912 | 918 |
913 var stylesView = new UI.SimpleView(Common.UIString('Styles')); | 919 var stylesView = new UI.SimpleView(Common.UIString('Styles')); |
914 stylesView.element.classList.add('flex-auto'); | 920 stylesView.element.classList.add('flex-auto'); |
915 | 921 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 * @param {!SDK.DOMNode} node | 1112 * @param {!SDK.DOMNode} node |
1107 * @return {?{title: string, color: string}} | 1113 * @return {?{title: string, color: string}} |
1108 */ | 1114 */ |
1109 decorate(node) { | 1115 decorate(node) { |
1110 return { | 1116 return { |
1111 color: 'orange', | 1117 color: 'orange', |
1112 title: Common.UIString('Element state: %s', ':' + SDK.CSSModel.fromNode(no
de).pseudoState(node).join(', :')) | 1118 title: Common.UIString('Element state: %s', ':' + SDK.CSSModel.fromNode(no
de).pseudoState(node).join(', :')) |
1113 }; | 1119 }; |
1114 } | 1120 } |
1115 }; | 1121 }; |
OLD | NEW |