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

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

Issue 2174863003: DevTools: traverse widget hierarchy to reveal views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lcean Created 4 years, 4 months 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 * @param {string} title 214 * @param {string} title
215 * @param {!Object} object 215 * @param {!Object} object
216 * @this {WebInspector.ElementsPanel} 216 * @this {WebInspector.ElementsPanel}
217 */ 217 */
218 function addSidebarView(title, object) 218 function addSidebarView(title, object)
219 { 219 {
220 var view = /** @type {!WebInspector.View} */ (object); 220 var view = /** @type {!WebInspector.View} */ (object);
221 this._elementsSidebarViews.push(view); 221 this._elementsSidebarViews.push(view);
222 222
223 if (this.sidebarPaneView) 223 if (this.sidebarPaneView)
224 this.sidebarPaneView.addPane(view); 224 this.sidebarPaneView.appendView(view);
225 } 225 }
226 }, 226 },
227 227
228 /** 228 /**
229 * @override 229 * @override
230 * @param {!WebInspector.Target} target 230 * @param {!WebInspector.Target} target
231 */ 231 */
232 targetAdded: function(target) 232 targetAdded: function(target)
233 { 233 {
234 var domModel = WebInspector.DOMModel.fromTarget(target); 234 var domModel = WebInspector.DOMModel.fromTarget(target);
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 */ 900 */
901 function tabSelected(event) 901 function tabSelected(event)
902 { 902 {
903 var tabId = /** @type {string} */ (event.data.tabId); 903 var tabId = /** @type {string} */ (event.data.tabId);
904 if (tabId === WebInspector.UIString("Computed")) 904 if (tabId === WebInspector.UIString("Computed"))
905 showMetrics.call(this, true); 905 showMetrics.call(this, true);
906 else if (tabId === WebInspector.UIString("Styles")) 906 else if (tabId === WebInspector.UIString("Styles"))
907 showMetrics.call(this, false); 907 showMetrics.call(this, false);
908 } 908 }
909 909
910 this.sidebarPaneView = new WebInspector.SidebarTabbedPane(); 910 this.sidebarPaneView = new WebInspector.View.TabbedPaneContainer();
911 this.sidebarPaneView.element.addEventListener("contextmenu", this._sideb arContextMenuEventFired.bind(this), false); 911 this.sidebarPaneView.element.addEventListener("contextmenu", this._sideb arContextMenuEventFired.bind(this), false);
912 if (this._popoverHelper) 912 if (this._popoverHelper)
913 this._popoverHelper.hidePopover(); 913 this._popoverHelper.hidePopover();
914 this._popoverHelper = new WebInspector.PopoverHelper(this.sidebarPaneVie w.element, this._getPopoverAnchor.bind(this), this._showPopover.bind(this)); 914 this._popoverHelper = new WebInspector.PopoverHelper(this.sidebarPaneVie w.element, this._getPopoverAnchor.bind(this), this._showPopover.bind(this));
915 this._popoverHelper.setTimeout(0); 915 this._popoverHelper.setTimeout(0);
916 916
917 if (horizontally) { 917 if (horizontally) {
918 this._splitWidget.installResizer(this.sidebarPaneView.headerElement( )); 918 this._splitWidget.installResizer(this.sidebarPaneView.headerElement( ));
919 919
920 var compositePane = new WebInspector.View(WebInspector.UIString("Sty les")); 920 var compositePane = new WebInspector.View(WebInspector.UIString("Sty les"));
921 compositePane.element.classList.add("composite"); 921 compositePane.element.classList.add("flex-auto");
922 compositePane.element.classList.add("fill");
923 922
924 var splitWidget = new WebInspector.SplitWidget(true, true, "stylesPa neSplitViewState", 215); 923 var splitWidget = new WebInspector.SplitWidget(true, true, "stylesPa neSplitViewState", 215);
925 splitWidget.show(compositePane.element); 924 splitWidget.show(compositePane.element);
926 925
927 splitWidget.setMainWidget(matchedStylesContainer); 926 splitWidget.setMainWidget(matchedStylesContainer);
928 splitWidget.setSidebarWidget(computedStylePanesWrapper); 927 splitWidget.setSidebarWidget(computedStylePanesWrapper);
929 928
930 computedPane.show(computedStylePanesWrapper.element); 929 computedPane.show(computedStylePanesWrapper.element);
931 this.sidebarPaneView.addPane(compositePane); 930 this.sidebarPaneView.appendView(compositePane);
932 } else { 931 } else {
933 var stylesPane = new WebInspector.View(WebInspector.UIString("Styles ")); 932 var stylesPane = new WebInspector.View(WebInspector.UIString("Styles "));
934 stylesPane.element.classList.add("composite", "fill", "metrics-and-s tyles"); 933 stylesPane.element.classList.add("flex-auto", "metrics-and-styles");
935 934
936 matchedStylesContainer.show(stylesPane.element); 935 matchedStylesContainer.show(stylesPane.element);
937 computedStylePanesWrapper.show(computedPane.element); 936 computedStylePanesWrapper.show(computedPane.element);
938 937
939 this.sidebarPaneView.addEventListener(WebInspector.TabbedPane.EventT ypes.TabSelected, tabSelected, this); 938 this.sidebarPaneView.addEventListener(WebInspector.TabbedPane.EventT ypes.TabSelected, tabSelected, this);
940 this.sidebarPaneView.addPane(stylesPane); 939 this.sidebarPaneView.appendView(stylesPane);
941 this.sidebarPaneView.addPane(computedPane); 940 this.sidebarPaneView.appendView(computedPane);
942 } 941 }
943 942
944 this.sidebarPanes.styles.show(matchedStylePanesWrapper.element); 943 this.sidebarPanes.styles.show(matchedStylePanesWrapper.element);
945 this.sidebarPanes.computedStyle.show(computedStylePanesWrapper.element); 944 this.sidebarPanes.computedStyle.show(computedStylePanesWrapper.element);
946 showMetrics.call(this, horizontally); 945 showMetrics.call(this, horizontally);
947 946
948 this.sidebarPaneView.addPane(this.sidebarPanes.eventListeners); 947 this.sidebarPaneView.appendView(this.sidebarPanes.eventListeners);
949 this.sidebarPaneView.addPane(this.sidebarPanes.domBreakpoints); 948 this.sidebarPaneView.appendView(this.sidebarPanes.domBreakpoints);
950 this.sidebarPaneView.addPane(this.sidebarPanes.properties); 949 this.sidebarPaneView.appendView(this.sidebarPanes.properties);
951 950
952 for (var sidebarViewWrapper of this._elementsSidebarViews) 951 for (var sidebarViewWrapper of this._elementsSidebarViews)
953 this.sidebarPaneView.addPane(sidebarViewWrapper); 952 this.sidebarPaneView.appendView(sidebarViewWrapper);
954 953
955 this._extensionSidebarPanesContainer = this.sidebarPaneView; 954 this._extensionSidebarPanesContainer = this.sidebarPaneView;
956 955
957 for (var i = 0; i < extensionSidebarPanes.length; ++i) 956 for (var i = 0; i < extensionSidebarPanes.length; ++i)
958 this._addExtensionSidebarPane(extensionSidebarPanes[i]); 957 this._addExtensionSidebarPane(extensionSidebarPanes[i]);
959 958
960 this._splitWidget.setSidebarWidget(this.sidebarPaneView); 959 this._splitWidget.setSidebarWidget(this.sidebarPaneView);
961 960
962 if (selectedTabId) 961 if (selectedTabId)
963 this.sidebarPaneView.selectTab(selectedTabId); 962 this.sidebarPaneView.selectTab(selectedTabId);
964 }, 963 },
965 964
966 /** 965 /**
967 * @param {!WebInspector.Event} event 966 * @param {!WebInspector.Event} event
968 */ 967 */
969 _extensionSidebarPaneAdded: function(event) 968 _extensionSidebarPaneAdded: function(event)
970 { 969 {
971 var pane = /** @type {!WebInspector.ExtensionSidebarPane} */ (event.data ); 970 var pane = /** @type {!WebInspector.ExtensionSidebarPane} */ (event.data );
972 this._addExtensionSidebarPane(pane); 971 this._addExtensionSidebarPane(pane);
973 }, 972 },
974 973
975 /** 974 /**
976 * @param {!WebInspector.ExtensionSidebarPane} pane 975 * @param {!WebInspector.ExtensionSidebarPane} pane
977 */ 976 */
978 _addExtensionSidebarPane: function(pane) 977 _addExtensionSidebarPane: function(pane)
979 { 978 {
980 if (pane.panelName() === this.name) 979 if (pane.panelName() === this.name)
981 this._extensionSidebarPanesContainer.addPane(pane); 980 this._extensionSidebarPanesContainer.appendView(pane);
982 }, 981 },
983 982
984 __proto__: WebInspector.Panel.prototype 983 __proto__: WebInspector.Panel.prototype
985 } 984 }
986 985
987 /** 986 /**
988 * @constructor 987 * @constructor
989 * @implements {WebInspector.ContextMenu.Provider} 988 * @implements {WebInspector.ContextMenu.Provider}
990 */ 989 */
991 WebInspector.ElementsPanel.ContextMenuProvider = function() 990 WebInspector.ElementsPanel.ContextMenuProvider = function()
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 /** 1177 /**
1179 * @override 1178 * @override
1180 * @param {!WebInspector.DOMNode} node 1179 * @param {!WebInspector.DOMNode} node
1181 * @return {?{title: string, color: string}} 1180 * @return {?{title: string, color: string}}
1182 */ 1181 */
1183 decorate: function(node) 1182 decorate: function(node)
1184 { 1183 {
1185 return { color: "orange", title: WebInspector.UIString("Element state: % s", ":" + WebInspector.CSSModel.fromNode(node).pseudoState(node).join(", :")) }; 1184 return { color: "orange", title: WebInspector.UIString("Element state: % s", ":" + WebInspector.CSSModel.fromNode(node).pseudoState(node).join(", :")) };
1186 } 1185 }
1187 } 1186 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698