| 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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 // FIXME: crbug.com/425984 | 500 // FIXME: crbug.com/425984 |
| 501 this._contentElement.classList.toggle("elements-wrap", event.data); | 501 this._contentElement.classList.toggle("elements-wrap", event.data); |
| 502 for (var i = 0; i < this._treeOutlines.length; ++i) | 502 for (var i = 0; i < this._treeOutlines.length; ++i) |
| 503 this._treeOutlines[i].setWordWrap(/** @type {boolean} */ (event.data
)); | 503 this._treeOutlines[i].setWordWrap(/** @type {boolean} */ (event.data
)); |
| 504 }, | 504 }, |
| 505 | 505 |
| 506 switchToAndFocus: function(node) | 506 switchToAndFocus: function(node) |
| 507 { | 507 { |
| 508 // Reset search restore. | 508 // Reset search restore. |
| 509 this._searchableView.cancelSearch(); | 509 this._searchableView.cancelSearch(); |
| 510 WebInspector.inspectorView.setCurrentPanel(this); | 510 WebInspector.viewManager.showView("elements").then(() => this.selectDOMN
ode(node, true)); |
| 511 this.selectDOMNode(node, true); | |
| 512 }, | 511 }, |
| 513 | 512 |
| 514 /** | 513 /** |
| 515 * @param {!Element} element | 514 * @param {!Element} element |
| 516 * @param {!Event} event | 515 * @param {!Event} event |
| 517 * @return {!Element|!AnchorBox|undefined} | 516 * @return {!Element|!AnchorBox|undefined} |
| 518 */ | 517 */ |
| 519 _getPopoverAnchor: function(element, event) | 518 _getPopoverAnchor: function(element, event) |
| 520 { | 519 { |
| 521 var anchor = element.enclosingNodeOrSelfWithClass("webkit-html-resource-
link"); | 520 var anchor = element.enclosingNodeOrSelfWithClass("webkit-html-resource-
link"); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 _leaveUserAgentShadowDOM: function(node) | 768 _leaveUserAgentShadowDOM: function(node) |
| 770 { | 769 { |
| 771 var userAgentShadowRoot; | 770 var userAgentShadowRoot; |
| 772 while ((userAgentShadowRoot = node.ancestorUserAgentShadowRoot()) && use
rAgentShadowRoot.parentNode) | 771 while ((userAgentShadowRoot = node.ancestorUserAgentShadowRoot()) && use
rAgentShadowRoot.parentNode) |
| 773 node = userAgentShadowRoot.parentNode; | 772 node = userAgentShadowRoot.parentNode; |
| 774 return node; | 773 return node; |
| 775 }, | 774 }, |
| 776 | 775 |
| 777 /** | 776 /** |
| 778 * @param {!WebInspector.DOMNode} node | 777 * @param {!WebInspector.DOMNode} node |
| 778 * @return {!Promise} |
| 779 */ | 779 */ |
| 780 revealAndSelectNode: function(node) | 780 revealAndSelectNode: function(node) |
| 781 { | 781 { |
| 782 if (WebInspector.inspectElementModeController && WebInspector.inspectEle
mentModeController.isInInspectElementMode()) | 782 if (WebInspector.inspectElementModeController && WebInspector.inspectEle
mentModeController.isInInspectElementMode()) |
| 783 WebInspector.inspectElementModeController.stopInspection(); | 783 WebInspector.inspectElementModeController.stopInspection(); |
| 784 | 784 |
| 785 this._omitDefaultSelection = true; | 785 this._omitDefaultSelection = true; |
| 786 | 786 |
| 787 var showLayoutEditor = !!WebInspector.inspectElementModeController && We
bInspector.inspectElementModeController.isInLayoutEditorMode(); | |
| 788 WebInspector.inspectorView.setCurrentPanel(this, showLayoutEditor); | |
| 789 node = WebInspector.moduleSetting("showUAShadowDOM").get() ? node : this
._leaveUserAgentShadowDOM(node); | 787 node = WebInspector.moduleSetting("showUAShadowDOM").get() ? node : this
._leaveUserAgentShadowDOM(node); |
| 790 if (!showLayoutEditor) | 788 node.highlightForTwoSeconds(); |
| 791 node.highlightForTwoSeconds(); | |
| 792 | 789 |
| 793 this.selectDOMNode(node, true); | 790 return WebInspector.viewManager.showView("elements").then(() => { |
| 794 delete this._omitDefaultSelection; | 791 this.selectDOMNode(node, true); |
| 792 delete this._omitDefaultSelection; |
| 795 | 793 |
| 796 if (!this._notFirstInspectElement) | 794 if (!this._notFirstInspectElement) |
| 797 InspectorFrontendHost.inspectElementCompleted(); | 795 InspectorFrontendHost.inspectElementCompleted(); |
| 798 this._notFirstInspectElement = true; | 796 this._notFirstInspectElement = true; |
| 797 }); |
| 799 }, | 798 }, |
| 800 | 799 |
| 801 _sidebarContextMenuEventFired: function(event) | 800 _sidebarContextMenuEventFired: function(event) |
| 802 { | 801 { |
| 803 var contextMenu = new WebInspector.ContextMenu(event); | 802 var contextMenu = new WebInspector.ContextMenu(event); |
| 804 contextMenu.appendApplicableItems(/** @type {!Object} */ (event.deepElem
entFromPoint())); | 803 contextMenu.appendApplicableItems(/** @type {!Object} */ (event.deepElem
entFromPoint())); |
| 805 contextMenu.show(); | 804 contextMenu.show(); |
| 806 }, | 805 }, |
| 807 | 806 |
| 808 _showUAShadowDOMChanged: function() | 807 _showUAShadowDOMChanged: function() |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 */ | 865 */ |
| 867 function tabSelected(event) | 866 function tabSelected(event) |
| 868 { | 867 { |
| 869 var tabId = /** @type {string} */ (event.data.tabId); | 868 var tabId = /** @type {string} */ (event.data.tabId); |
| 870 if (tabId === WebInspector.UIString("Computed")) | 869 if (tabId === WebInspector.UIString("Computed")) |
| 871 showMetrics.call(this, true); | 870 showMetrics.call(this, true); |
| 872 else if (tabId === WebInspector.UIString("Styles")) | 871 else if (tabId === WebInspector.UIString("Styles")) |
| 873 showMetrics.call(this, false); | 872 showMetrics.call(this, false); |
| 874 } | 873 } |
| 875 | 874 |
| 876 this.sidebarPaneView = WebInspector.viewManager.createTabbedLocation(()
=> WebInspector.inspectorView.setCurrentPanel(this)); | 875 this.sidebarPaneView = WebInspector.viewManager.createTabbedLocation(()
=> WebInspector.viewManager.showView("elements")); |
| 877 var tabbedPane = this.sidebarPaneView.tabbedPane(); | 876 var tabbedPane = this.sidebarPaneView.tabbedPane(); |
| 878 tabbedPane.element.addEventListener("contextmenu", this._sidebarContextM
enuEventFired.bind(this), false); | 877 tabbedPane.element.addEventListener("contextmenu", this._sidebarContextM
enuEventFired.bind(this), false); |
| 879 if (this._popoverHelper) | 878 if (this._popoverHelper) |
| 880 this._popoverHelper.hidePopover(); | 879 this._popoverHelper.hidePopover(); |
| 881 this._popoverHelper = new WebInspector.PopoverHelper(tabbedPane.element,
this._getPopoverAnchor.bind(this), this._showPopover.bind(this)); | 880 this._popoverHelper = new WebInspector.PopoverHelper(tabbedPane.element,
this._getPopoverAnchor.bind(this), this._showPopover.bind(this)); |
| 882 this._popoverHelper.setTimeout(0); | 881 this._popoverHelper.setTimeout(0); |
| 883 | 882 |
| 884 if (horizontally) { | 883 if (horizontally) { |
| 885 // Styles and computed are merged into a single tab. | 884 // Styles and computed are merged into a single tab. |
| 886 this._splitWidget.installResizer(tabbedPane.headerElement()); | 885 this._splitWidget.installResizer(tabbedPane.headerElement()); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 } | 1019 } |
| 1021 | 1020 |
| 1022 /** | 1021 /** |
| 1023 * @param {?WebInspector.DOMNode} resolvedNode | 1022 * @param {?WebInspector.DOMNode} resolvedNode |
| 1024 */ | 1023 */ |
| 1025 function onNodeResolved(resolvedNode) | 1024 function onNodeResolved(resolvedNode) |
| 1026 { | 1025 { |
| 1027 panel._pendingNodeReveal = false; | 1026 panel._pendingNodeReveal = false; |
| 1028 | 1027 |
| 1029 if (resolvedNode) { | 1028 if (resolvedNode) { |
| 1030 panel.revealAndSelectNode(resolvedNode); | 1029 panel.revealAndSelectNode(resolvedNode).then(resolve); |
| 1031 resolve(undefined); | |
| 1032 return; | 1030 return; |
| 1033 } | 1031 } |
| 1034 reject(new Error("Could not resolve node to reveal.")); | 1032 reject(new Error("Could not resolve node to reveal.")); |
| 1035 } | 1033 } |
| 1036 } | 1034 } |
| 1037 } | 1035 } |
| 1038 } | 1036 } |
| 1039 | 1037 |
| 1040 /** | 1038 /** |
| 1041 * @constructor | 1039 * @constructor |
| 1042 * @implements {WebInspector.Revealer} | 1040 * @implements {WebInspector.Revealer} |
| 1043 */ | 1041 */ |
| 1044 WebInspector.ElementsPanel.CSSPropertyRevealer = function() { } | 1042 WebInspector.ElementsPanel.CSSPropertyRevealer = function() { } |
| 1045 | 1043 |
| 1046 WebInspector.ElementsPanel.CSSPropertyRevealer.prototype = { | 1044 WebInspector.ElementsPanel.CSSPropertyRevealer.prototype = { |
| 1047 /** | 1045 /** |
| 1048 * @override | 1046 * @override |
| 1049 * @param {!Object} property | 1047 * @param {!Object} property |
| 1050 * @return {!Promise} | 1048 * @return {!Promise} |
| 1051 */ | 1049 */ |
| 1052 reveal: function(property) | 1050 reveal: function(property) |
| 1053 { | 1051 { |
| 1054 var panel = WebInspector.ElementsPanel.instance(); | 1052 var panel = WebInspector.ElementsPanel.instance(); |
| 1055 return panel._revealProperty(/** @type {!WebInspector.CSSProperty} */ (p
roperty)); | 1053 return panel._revealProperty(/** @type {!WebInspector.CSSProperty} */ (p
roperty)); |
| 1056 } | 1054 } |
| 1057 } | 1055 } |
| 1058 | 1056 |
| 1059 WebInspector.ElementsPanel.show = function() | |
| 1060 { | |
| 1061 WebInspector.inspectorView.setCurrentPanel(WebInspector.ElementsPanel.instan
ce()); | |
| 1062 } | |
| 1063 | |
| 1064 /** | 1057 /** |
| 1065 * @return {!WebInspector.ElementsPanel} | 1058 * @return {!WebInspector.ElementsPanel} |
| 1066 */ | 1059 */ |
| 1067 WebInspector.ElementsPanel.instance = function() | 1060 WebInspector.ElementsPanel.instance = function() |
| 1068 { | 1061 { |
| 1069 return /** @type {!WebInspector.ElementsPanel} */ (self.runtime.sharedInstan
ce(WebInspector.ElementsPanel)); | 1062 return /** @type {!WebInspector.ElementsPanel} */ (self.runtime.sharedInstan
ce(WebInspector.ElementsPanel)); |
| 1070 } | 1063 } |
| 1071 | 1064 |
| 1072 /** | 1065 /** |
| 1073 * @constructor | 1066 * @constructor |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 /** | 1108 /** |
| 1116 * @override | 1109 * @override |
| 1117 * @param {!WebInspector.DOMNode} node | 1110 * @param {!WebInspector.DOMNode} node |
| 1118 * @return {?{title: string, color: string}} | 1111 * @return {?{title: string, color: string}} |
| 1119 */ | 1112 */ |
| 1120 decorate: function(node) | 1113 decorate: function(node) |
| 1121 { | 1114 { |
| 1122 return { color: "orange", title: WebInspector.UIString("Element state: %
s", ":" + WebInspector.CSSModel.fromNode(node).pseudoState(node).join(", :")) }; | 1115 return { color: "orange", title: WebInspector.UIString("Element state: %
s", ":" + WebInspector.CSSModel.fromNode(node).pseudoState(node).join(", :")) }; |
| 1123 } | 1116 } |
| 1124 } | 1117 } |
| OLD | NEW |