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

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

Issue 2144923002: DevTools: remove the ComputedStyles -> Styles pane dependency. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined Created 4 years, 5 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 crumbsContainer.id = "elements-crumbs"; 64 crumbsContainer.id = "elements-crumbs";
65 this._breadcrumbs = new WebInspector.ElementsBreadcrumbs(); 65 this._breadcrumbs = new WebInspector.ElementsBreadcrumbs();
66 this._breadcrumbs.show(crumbsContainer); 66 this._breadcrumbs.show(crumbsContainer);
67 this._breadcrumbs.addEventListener(WebInspector.ElementsBreadcrumbs.Events.N odeSelected, this._crumbNodeSelected, this); 67 this._breadcrumbs.addEventListener(WebInspector.ElementsBreadcrumbs.Events.N odeSelected, this._crumbNodeSelected, this);
68 68
69 this.sidebarPanes = {}; 69 this.sidebarPanes = {};
70 /** @type !Array<!WebInspector.ElementsSidebarViewWrapperPane> */ 70 /** @type !Array<!WebInspector.ElementsSidebarViewWrapperPane> */
71 this._elementsSidebarViewWrappers = []; 71 this._elementsSidebarViewWrappers = [];
72 this._currentToolbarPane = null; 72 this._currentToolbarPane = null;
73 73
74 var sharedSidebarModel = new WebInspector.SharedSidebarModel();
75 this.sidebarPanes.platformFonts = WebInspector.PlatformFontsWidget.createSid ebarWrapper(sharedSidebarModel);
76 this.sidebarPanes.styles = new WebInspector.StylesSidebarPane(); 74 this.sidebarPanes.styles = new WebInspector.StylesSidebarPane();
77 this.sidebarPanes.computedStyle = WebInspector.ComputedStyleWidget.createSid ebarWrapper(this.sidebarPanes.styles, sharedSidebarModel, this._revealProperty.b ind(this)); 75 this.sidebarPanes.computedStyle = WebInspector.ComputedStyleWidget.createSid ebarWrapper();
78
79 this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane(); 76 this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane();
80 this.sidebarPanes.properties = WebInspector.PropertiesWidget.createSidebarWr apper(); 77 this.sidebarPanes.properties = WebInspector.PropertiesWidget.createSidebarWr apper();
81 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this); 78 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this);
82 this.sidebarPanes.eventListeners = WebInspector.EventListenersWidget.createS idebarWrapper(); 79 this.sidebarPanes.eventListeners = WebInspector.EventListenersWidget.createS idebarWrapper();
83 80
84 this._stylesSidebarToolbar = this._createStylesSidebarToolbar(this.sidebarPa nes.styles); 81 this._stylesSidebarToolbar = this._createStylesSidebarToolbar(this.sidebarPa nes.styles);
85 82
86 WebInspector.moduleSetting("sidebarPosition").addChangeListener(this._update SidebarPosition.bind(this)); 83 WebInspector.moduleSetting("sidebarPosition").addChangeListener(this._update SidebarPosition.bind(this));
87 this._updateSidebarPosition(); 84 this._updateSidebarPosition();
88 this._loadSidebarViews(); 85 this._loadSidebarViews();
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 computedStylePanesWrapper.show(computedPane.element); 938 computedStylePanesWrapper.show(computedPane.element);
942 939
943 this.sidebarPaneView.addEventListener(WebInspector.TabbedPane.EventT ypes.TabSelected, tabSelected, this); 940 this.sidebarPaneView.addEventListener(WebInspector.TabbedPane.EventT ypes.TabSelected, tabSelected, this);
944 this.sidebarPaneView.addPane(stylesPane); 941 this.sidebarPaneView.addPane(stylesPane);
945 this.sidebarPaneView.addPane(computedPane); 942 this.sidebarPaneView.addPane(computedPane);
946 } 943 }
947 944
948 this.sidebarPanes.styles.show(matchedStylePanesWrapper.element); 945 this.sidebarPanes.styles.show(matchedStylePanesWrapper.element);
949 this.sidebarPanes.computedStyle.show(computedStylePanesWrapper.element); 946 this.sidebarPanes.computedStyle.show(computedStylePanesWrapper.element);
950 showMetrics.call(this, horizontally); 947 showMetrics.call(this, horizontally);
951 this.sidebarPanes.platformFonts.show(computedStylePanesWrapper.element);
952 948
953 this.sidebarPaneView.addPane(this.sidebarPanes.eventListeners); 949 this.sidebarPaneView.addPane(this.sidebarPanes.eventListeners);
954 this.sidebarPaneView.addPane(this.sidebarPanes.domBreakpoints); 950 this.sidebarPaneView.addPane(this.sidebarPanes.domBreakpoints);
955 this.sidebarPaneView.addPane(this.sidebarPanes.properties); 951 this.sidebarPaneView.addPane(this.sidebarPanes.properties);
956 952
957 for (var sidebarViewWrapper of this._elementsSidebarViewWrappers) 953 for (var sidebarViewWrapper of this._elementsSidebarViewWrappers)
958 this.sidebarPaneView.addPane(sidebarViewWrapper); 954 this.sidebarPaneView.addPane(sidebarViewWrapper);
959 955
960 this._extensionSidebarPanesContainer = this.sidebarPaneView; 956 this._extensionSidebarPanesContainer = this.sidebarPaneView;
961 957
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 return; 1020 return;
1025 var commandCallback = WebInspector.Revealer.reveal.bind(WebInspector.Rev ealer, object); 1021 var commandCallback = WebInspector.Revealer.reveal.bind(WebInspector.Rev ealer, object);
1026 contextMenu.appendItem(WebInspector.UIString.capitalize("Reveal in Eleme nts ^panel"), commandCallback); 1022 contextMenu.appendItem(WebInspector.UIString.capitalize("Reveal in Eleme nts ^panel"), commandCallback);
1027 } 1023 }
1028 } 1024 }
1029 1025
1030 /** 1026 /**
1031 * @constructor 1027 * @constructor
1032 * @implements {WebInspector.Revealer} 1028 * @implements {WebInspector.Revealer}
1033 */ 1029 */
1034 WebInspector.ElementsPanel.DOMNodeRevealer = function() 1030 WebInspector.ElementsPanel.DOMNodeRevealer = function() { }
1035 {
1036 }
1037 1031
1038 WebInspector.ElementsPanel.DOMNodeRevealer.prototype = { 1032 WebInspector.ElementsPanel.DOMNodeRevealer.prototype = {
1039 /** 1033 /**
1040 * @override 1034 * @override
1041 * @param {!Object} node 1035 * @param {!Object} node
1042 * @return {!Promise} 1036 * @return {!Promise}
1043 */ 1037 */
1044 reveal: function(node) 1038 reveal: function(node)
1045 { 1039 {
1046 var panel = WebInspector.ElementsPanel.instance(); 1040 var panel = WebInspector.ElementsPanel.instance();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 panel.revealAndSelectNode(resolvedNode); 1074 panel.revealAndSelectNode(resolvedNode);
1081 resolve(undefined); 1075 resolve(undefined);
1082 return; 1076 return;
1083 } 1077 }
1084 reject(new Error("Could not resolve node to reveal.")); 1078 reject(new Error("Could not resolve node to reveal."));
1085 } 1079 }
1086 } 1080 }
1087 } 1081 }
1088 } 1082 }
1089 1083
1084 /**
1085 * @constructor
1086 * @implements {WebInspector.Revealer}
1087 */
1088 WebInspector.ElementsPanel.CSSPropertyRevealer = function() { }
1089
1090 WebInspector.ElementsPanel.CSSPropertyRevealer.prototype = {
1091 /**
1092 * @override
1093 * @param {!Object} property
1094 * @return {!Promise}
1095 */
1096 reveal: function(property)
1097 {
1098 var panel = WebInspector.ElementsPanel.instance();
1099 return panel._revealProperty(/** @type {!WebInspector.CSSProperty} */ (p roperty));
1100 }
1101 }
1102
1090 WebInspector.ElementsPanel.show = function() 1103 WebInspector.ElementsPanel.show = function()
1091 { 1104 {
1092 WebInspector.inspectorView.setCurrentPanel(WebInspector.ElementsPanel.instan ce()); 1105 WebInspector.inspectorView.setCurrentPanel(WebInspector.ElementsPanel.instan ce());
1093 } 1106 }
1094 1107
1095 /** 1108 /**
1096 * @return {!WebInspector.ElementsPanel} 1109 * @return {!WebInspector.ElementsPanel}
1097 */ 1110 */
1098 WebInspector.ElementsPanel.instance = function() 1111 WebInspector.ElementsPanel.instance = function()
1099 { 1112 {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 /** 1180 /**
1168 * @override 1181 * @override
1169 * @param {!WebInspector.DOMNode} node 1182 * @param {!WebInspector.DOMNode} node
1170 * @return {?{title: string, color: string}} 1183 * @return {?{title: string, color: string}}
1171 */ 1184 */
1172 decorate: function(node) 1185 decorate: function(node)
1173 { 1186 {
1174 return { color: "orange", title: WebInspector.UIString("Element state: % s", ":" + WebInspector.CSSModel.fromNode(node).pseudoState(node).join(", :")) }; 1187 return { color: "orange", title: WebInspector.UIString("Element state: % s", ":" + WebInspector.CSSModel.fromNode(node).pseudoState(node).join(", :")) };
1175 } 1188 }
1176 } 1189 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698