Chromium Code Reviews| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 | 94 |
| 95 WebInspector.ElementsPanel._elementsSidebarViewTitleSymbol = Symbol("title"); | 95 WebInspector.ElementsPanel._elementsSidebarViewTitleSymbol = Symbol("title"); |
| 96 | 96 |
| 97 WebInspector.ElementsPanel.prototype = { | 97 WebInspector.ElementsPanel.prototype = { |
| 98 /** | 98 /** |
| 99 * @param {!WebInspector.CSSProperty} cssProperty | 99 * @param {!WebInspector.CSSProperty} cssProperty |
| 100 */ | 100 */ |
| 101 _revealProperty: function(cssProperty) | 101 _revealProperty: function(cssProperty) |
| 102 { | 102 { |
| 103 var stylesSidebarPane = this.sidebarPanes.styles; | 103 var stylesSidebarPane = this.sidebarPanes.styles; |
| 104 this.sidebarPaneView.selectTab(WebInspector.UIString("Styles")); | 104 this.sidebarPaneView.showView(WebInspector.UIString("Styles")); |
|
dgozman
2016/08/05 01:32:09
Instance!
| |
| 105 stylesSidebarPane.revealProperty(/** @type {!WebInspector.CSSProperty} * /(cssProperty)); | 105 stylesSidebarPane.revealProperty(/** @type {!WebInspector.CSSProperty} * /(cssProperty)); |
| 106 return Promise.resolve(); | 106 return Promise.resolve(); |
| 107 }, | 107 }, |
| 108 | 108 |
| 109 /** | 109 /** |
| 110 * @param {!WebInspector.StylesSidebarPane} ssp | 110 * @param {!WebInspector.StylesSidebarPane} ssp |
| 111 * @return {!Element} | 111 * @return {!Element} |
| 112 */ | 112 */ |
| 113 _createStylesSidebarToolbar: function(ssp) | 113 _createStylesSidebarToolbar: function(ssp) |
| 114 { | 114 { |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 856 if (position === "right") | 856 if (position === "right") |
| 857 horizontally = false; | 857 horizontally = false; |
| 858 else if (position === "bottom") | 858 else if (position === "bottom") |
| 859 horizontally = true; | 859 horizontally = true; |
| 860 else | 860 else |
| 861 horizontally = WebInspector.inspectorView.element.offsetWidth < 680; | 861 horizontally = WebInspector.inspectorView.element.offsetWidth < 680; |
| 862 | 862 |
| 863 if (this.sidebarPaneView && horizontally === !this._splitWidget.isVertic al()) | 863 if (this.sidebarPaneView && horizontally === !this._splitWidget.isVertic al()) |
| 864 return; | 864 return; |
| 865 | 865 |
| 866 if (this.sidebarPaneView && this.sidebarPaneView.shouldHideOnDetach()) | 866 if (this.sidebarPaneView && this.sidebarPaneView.tabbedPane().shouldHide OnDetach()) |
| 867 return; // We can't reparent extension iframes. | 867 return; // We can't reparent extension iframes. |
| 868 | 868 |
| 869 var selectedTabId = this.sidebarPaneView ? this.sidebarPaneView.selected TabId : null; | |
| 870 | |
| 871 var extensionSidebarPanes = WebInspector.extensionServer.sidebarPanes(); | 869 var extensionSidebarPanes = WebInspector.extensionServer.sidebarPanes(); |
| 872 if (this.sidebarPaneView) { | 870 if (this.sidebarPaneView) { |
| 873 this.sidebarPaneView.detach(); | 871 this.sidebarPaneView.tabbedPane().detach(); |
| 874 this._splitWidget.uninstallResizer(this.sidebarPaneView.headerElemen t()); | 872 this._splitWidget.uninstallResizer(this.sidebarPaneView.tabbedPane() .headerElement()); |
| 875 } | 873 } |
| 876 | 874 |
| 877 this._splitWidget.setVertical(!horizontally); | 875 this._splitWidget.setVertical(!horizontally); |
| 878 this.showToolbarPane(null); | 876 this.showToolbarPane(null); |
| 879 | 877 |
| 880 var computedPane = new WebInspector.View(WebInspector.UIString("Computed ")); | 878 var computedPane = new WebInspector.SimpleView(WebInspector.UIString("Co mputed")); |
| 881 computedPane.element.classList.add("composite"); | 879 computedPane.element.classList.add("composite"); |
| 882 computedPane.element.classList.add("fill"); | 880 computedPane.element.classList.add("fill"); |
| 883 computedPane.element.classList.add("metrics-and-computed"); | 881 computedPane.element.classList.add("metrics-and-computed"); |
| 884 | 882 |
| 885 var matchedStylesContainer = new WebInspector.VBox(); | 883 var matchedStylesContainer = new WebInspector.VBox(); |
| 886 matchedStylesContainer.element.appendChild(this._stylesSidebarToolbar); | 884 matchedStylesContainer.element.appendChild(this._stylesSidebarToolbar); |
| 887 var matchedStylePanesWrapper = new WebInspector.VBox(); | 885 var matchedStylePanesWrapper = new WebInspector.VBox(); |
| 888 matchedStylePanesWrapper.element.classList.add("style-panes-wrapper"); | 886 matchedStylePanesWrapper.element.classList.add("style-panes-wrapper"); |
| 889 matchedStylePanesWrapper.show(matchedStylesContainer.element); | 887 matchedStylePanesWrapper.show(matchedStylesContainer.element); |
| 890 var computedStylePanesWrapper = new WebInspector.VBox(); | 888 var computedStylePanesWrapper = new WebInspector.VBox(); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 908 */ | 906 */ |
| 909 function tabSelected(event) | 907 function tabSelected(event) |
| 910 { | 908 { |
| 911 var tabId = /** @type {string} */ (event.data.tabId); | 909 var tabId = /** @type {string} */ (event.data.tabId); |
| 912 if (tabId === WebInspector.UIString("Computed")) | 910 if (tabId === WebInspector.UIString("Computed")) |
| 913 showMetrics.call(this, true); | 911 showMetrics.call(this, true); |
| 914 else if (tabId === WebInspector.UIString("Styles")) | 912 else if (tabId === WebInspector.UIString("Styles")) |
| 915 showMetrics.call(this, false); | 913 showMetrics.call(this, false); |
| 916 } | 914 } |
| 917 | 915 |
| 918 this.sidebarPaneView = new WebInspector.View.TabbedPaneContainer(); | 916 this.sidebarPaneView = WebInspector.viewManager.createTabbedLocation("el ements-sidebar"); |
| 919 this.sidebarPaneView.element.addEventListener("contextmenu", this._sideb arContextMenuEventFired.bind(this), false); | 917 var tabbedPane = this.sidebarPaneView.tabbedPane(); |
| 918 tabbedPane.element.addEventListener("contextmenu", this._sidebarContextM enuEventFired.bind(this), false); | |
| 920 if (this._popoverHelper) | 919 if (this._popoverHelper) |
| 921 this._popoverHelper.hidePopover(); | 920 this._popoverHelper.hidePopover(); |
| 922 this._popoverHelper = new WebInspector.PopoverHelper(this.sidebarPaneVie w.element, this._getPopoverAnchor.bind(this), this._showPopover.bind(this)); | 921 this._popoverHelper = new WebInspector.PopoverHelper(tabbedPane.element, this._getPopoverAnchor.bind(this), this._showPopover.bind(this)); |
| 923 this._popoverHelper.setTimeout(0); | 922 this._popoverHelper.setTimeout(0); |
| 924 | 923 |
| 925 if (horizontally) { | 924 if (horizontally) { |
| 926 this._splitWidget.installResizer(this.sidebarPaneView.headerElement( )); | 925 this._splitWidget.installResizer(tabbedPane.headerElement()); |
| 927 | 926 |
| 928 var compositePane = new WebInspector.View(WebInspector.UIString("Sty les")); | 927 var compositePane = new WebInspector.SimpleView(WebInspector.UIStrin g("Styles")); |
| 929 compositePane.element.classList.add("flex-auto"); | 928 compositePane.element.classList.add("flex-auto"); |
| 930 | 929 |
| 931 var splitWidget = new WebInspector.SplitWidget(true, true, "stylesPa neSplitViewState", 215); | 930 var splitWidget = new WebInspector.SplitWidget(true, true, "stylesPa neSplitViewState", 215); |
| 932 splitWidget.show(compositePane.element); | 931 splitWidget.show(compositePane.element); |
| 933 | 932 |
| 934 splitWidget.setMainWidget(matchedStylesContainer); | 933 splitWidget.setMainWidget(matchedStylesContainer); |
| 935 splitWidget.setSidebarWidget(computedStylePanesWrapper); | 934 splitWidget.setSidebarWidget(computedStylePanesWrapper); |
| 936 | 935 |
| 937 computedPane.show(computedStylePanesWrapper.element); | 936 computedPane.show(computedStylePanesWrapper.element); |
| 938 this.sidebarPaneView.appendView(compositePane); | 937 this.sidebarPaneView.appendView(compositePane); |
| 939 } else { | 938 } else { |
| 940 var stylesPane = new WebInspector.View(WebInspector.UIString("Styles ")); | 939 var stylesPane = new WebInspector.SimpleView(WebInspector.UIString(" Styles")); |
| 941 stylesPane.element.classList.add("flex-auto", "metrics-and-styles"); | 940 stylesPane.element.classList.add("flex-auto", "metrics-and-styles"); |
| 942 | 941 |
| 943 matchedStylesContainer.show(stylesPane.element); | 942 matchedStylesContainer.show(stylesPane.element); |
| 944 computedStylePanesWrapper.show(computedPane.element); | 943 computedStylePanesWrapper.show(computedPane.element); |
| 945 | 944 |
| 946 this.sidebarPaneView.addEventListener(WebInspector.TabbedPane.EventT ypes.TabSelected, tabSelected, this); | 945 tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSe lected, tabSelected, this); |
| 947 this.sidebarPaneView.appendView(stylesPane); | 946 this.sidebarPaneView.appendView(stylesPane); |
| 948 this.sidebarPaneView.appendView(computedPane); | 947 this.sidebarPaneView.appendView(computedPane); |
| 949 } | 948 } |
| 950 | 949 |
| 951 this.sidebarPanes.styles.show(matchedStylePanesWrapper.element); | 950 this.sidebarPanes.styles.show(matchedStylePanesWrapper.element); |
| 952 this.sidebarPanes.computedStyle.show(computedStylePanesWrapper.element); | 951 this.sidebarPanes.computedStyle.show(computedStylePanesWrapper.element); |
| 953 showMetrics.call(this, horizontally); | 952 showMetrics.call(this, horizontally); |
| 954 | 953 |
| 955 this.sidebarPaneView.appendView(this.sidebarPanes.eventListeners); | 954 this.sidebarPaneView.appendView(this.sidebarPanes.eventListeners); |
| 956 this.sidebarPaneView.appendView(this.sidebarPanes.domBreakpoints); | 955 this.sidebarPaneView.appendView(this.sidebarPanes.domBreakpoints); |
| 957 this.sidebarPaneView.appendView(this.sidebarPanes.properties); | 956 this.sidebarPaneView.appendView(this.sidebarPanes.properties); |
| 958 | 957 |
| 959 for (var sidebarViewWrapper of this._elementsSidebarViews) | 958 for (var sidebarViewWrapper of this._elementsSidebarViews) |
| 960 this.sidebarPaneView.appendView(sidebarViewWrapper); | 959 this.sidebarPaneView.appendView(sidebarViewWrapper); |
| 961 | 960 |
| 962 this._extensionSidebarPanesContainer = this.sidebarPaneView; | 961 this._extensionSidebarPanesContainer = this.sidebarPaneView; |
| 963 | 962 |
| 964 for (var i = 0; i < extensionSidebarPanes.length; ++i) | 963 for (var i = 0; i < extensionSidebarPanes.length; ++i) |
| 965 this._addExtensionSidebarPane(extensionSidebarPanes[i]); | 964 this._addExtensionSidebarPane(extensionSidebarPanes[i]); |
| 966 | 965 |
| 967 this._splitWidget.setSidebarWidget(this.sidebarPaneView); | 966 this._splitWidget.setSidebarWidget(this.sidebarPaneView.tabbedPane()); |
| 968 | |
| 969 if (selectedTabId) | |
| 970 this.sidebarPaneView.selectTab(selectedTabId); | |
| 971 }, | 967 }, |
| 972 | 968 |
| 973 /** | 969 /** |
| 974 * @param {!WebInspector.Event} event | 970 * @param {!WebInspector.Event} event |
| 975 */ | 971 */ |
| 976 _extensionSidebarPaneAdded: function(event) | 972 _extensionSidebarPaneAdded: function(event) |
| 977 { | 973 { |
| 978 var pane = /** @type {!WebInspector.ExtensionSidebarPane} */ (event.data ); | 974 var pane = /** @type {!WebInspector.ExtensionSidebarPane} */ (event.data ); |
| 979 this._addExtensionSidebarPane(pane); | 975 this._addExtensionSidebarPane(pane); |
| 980 }, | 976 }, |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1164 /** | 1160 /** |
| 1165 * @override | 1161 * @override |
| 1166 * @param {!WebInspector.DOMNode} node | 1162 * @param {!WebInspector.DOMNode} node |
| 1167 * @return {?{title: string, color: string}} | 1163 * @return {?{title: string, color: string}} |
| 1168 */ | 1164 */ |
| 1169 decorate: function(node) | 1165 decorate: function(node) |
| 1170 { | 1166 { |
| 1171 return { color: "orange", title: WebInspector.UIString("Element state: % s", ":" + WebInspector.CSSModel.fromNode(node).pseudoState(node).join(", :")) }; | 1167 return { color: "orange", title: WebInspector.UIString("Element state: % s", ":" + WebInspector.CSSModel.fromNode(node).pseudoState(node).join(", :")) }; |
| 1172 } | 1168 } |
| 1173 } | 1169 } |
| OLD | NEW |