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

Side by Side Diff: Source/devtools/front_end/ElementsPanel.js

Issue 129793013: DevTools: Implement Styles search and Computed style filter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move Computed style filter to the bottom Created 6 years, 10 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 | Annotate | Revision Log
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 var crumbsContainer = stackElement.createChild("div"); 88 var crumbsContainer = stackElement.createChild("div");
89 crumbsContainer.id = "elements-crumbs"; 89 crumbsContainer.id = "elements-crumbs";
90 this.crumbsElement = crumbsContainer.createChild("div", "crumbs"); 90 this.crumbsElement = crumbsContainer.createChild("div", "crumbs");
91 this.crumbsElement.addEventListener("mousemove", this._mouseMovedInCrumbs.bi nd(this), false); 91 this.crumbsElement.addEventListener("mousemove", this._mouseMovedInCrumbs.bi nd(this), false);
92 this.crumbsElement.addEventListener("mouseout", this._mouseMovedOutOfCrumbs. bind(this), false); 92 this.crumbsElement.addEventListener("mouseout", this._mouseMovedOutOfCrumbs. bind(this), false);
93 93
94 this.sidebarPanes = {}; 94 this.sidebarPanes = {};
95 this.sidebarPanes.platformFonts = new WebInspector.PlatformFontsSidebarPane( ); 95 this.sidebarPanes.platformFonts = new WebInspector.PlatformFontsSidebarPane( );
96 this.sidebarPanes.computedStyle = new WebInspector.ComputedStyleSidebarPane( ); 96 this.sidebarPanes.computedStyle = new WebInspector.ComputedStyleSidebarPane( );
97 this.sidebarPanes.styles = new WebInspector.StylesSidebarPane(this.sidebarPa nes.computedStyle, this._setPseudoClassForNodeId.bind(this)); 97 this.sidebarPanes.styles = new WebInspector.StylesSidebarPane(this.sidebarPa nes.computedStyle, this._setPseudoClassForNodeId.bind(this));
98 if (WebInspector.experimentsSettings.cssStyleSearch.isEnabled()) {
99 this._matchedStylesFilterBoxContainer = document.createElement("div");
100 this._matchedStylesFilterBoxContainer.className = "filter-box-container inspector-footer status-bar";
101 this._computedStylesFilterBoxContainer = document.createElement("div");
102 this._computedStylesFilterBoxContainer.className = "filter-box-container inspector-footer status-bar";
103 this.sidebarPanes.styles.setFilterBoxContainers(this._matchedStylesFilte rBoxContainer, this._computedStylesFilterBoxContainer);
104 }
98 this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane(); 105 this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane();
99 this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane(); 106 this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane();
100 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this); 107 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this);
101 this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPan e(); 108 this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPan e();
102 109
103 this.sidebarPanes.styles.addEventListener(WebInspector.SidebarPane.EventType s.wasShown, this.updateStyles.bind(this, false)); 110 this.sidebarPanes.styles.addEventListener(WebInspector.SidebarPane.EventType s.wasShown, this.updateStyles.bind(this, false));
104 this.sidebarPanes.metrics.addEventListener(WebInspector.SidebarPane.EventTyp es.wasShown, this.updateMetrics.bind(this)); 111 this.sidebarPanes.metrics.addEventListener(WebInspector.SidebarPane.EventTyp es.wasShown, this.updateMetrics.bind(this));
105 this.sidebarPanes.platformFonts.addEventListener(WebInspector.SidebarPane.Ev entTypes.wasShown, this.updatePlatformFonts.bind(this)); 112 this.sidebarPanes.platformFonts.addEventListener(WebInspector.SidebarPane.Ev entTypes.wasShown, this.updatePlatformFonts.bind(this));
106 this.sidebarPanes.properties.addEventListener(WebInspector.SidebarPane.Event Types.wasShown, this.updateProperties.bind(this)); 113 this.sidebarPanes.properties.addEventListener(WebInspector.SidebarPane.Event Types.wasShown, this.updateProperties.bind(this));
107 this.sidebarPanes.eventListeners.addEventListener(WebInspector.SidebarPane.E ventTypes.wasShown, this.updateEventListeners.bind(this)); 114 this.sidebarPanes.eventListeners.addEventListener(WebInspector.SidebarPane.E ventTypes.wasShown, this.updateEventListeners.bind(this));
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 return null; 441 return null;
435 442
436 var resource = WebInspector.resourceTreeModel.resourceForURL(anchor. href); 443 var resource = WebInspector.resourceTreeModel.resourceForURL(anchor. href);
437 if (!resource || resource.type !== WebInspector.resourceTypes.Image) 444 if (!resource || resource.type !== WebInspector.resourceTypes.Image)
438 return null; 445 return null;
439 446
440 anchor.removeAttribute("title"); 447 anchor.removeAttribute("title");
441 } 448 }
442 return anchor; 449 return anchor;
443 }, 450 },
444 451
445 _loadDimensionsForNode: function(treeElement, callback) 452 _loadDimensionsForNode: function(treeElement, callback)
446 { 453 {
447 // We get here for CSS properties, too, so bail out early for non-DOM tr eeElements. 454 // We get here for CSS properties, too, so bail out early for non-DOM tr eeElements.
448 if (treeElement.treeOutline !== this.treeOutline) { 455 if (treeElement.treeOutline !== this.treeOutline) {
449 callback(); 456 callback();
450 return; 457 return;
451 } 458 }
452 459
453 var node = /** @type {!WebInspector.DOMNode} */ (treeElement.represented Object); 460 var node = /** @type {!WebInspector.DOMNode} */ (treeElement.represented Object);
454 461
455 if (!node.nodeName() || node.nodeName().toLowerCase() !== "img") { 462 if (!node.nodeName() || node.nodeName().toLowerCase() !== "img") {
456 callback(); 463 callback();
457 return; 464 return;
458 } 465 }
459 466
460 WebInspector.RemoteObject.resolveNode(node, "", resolvedNode); 467 WebInspector.RemoteObject.resolveNode(node, "", resolvedNode);
461 468
462 function resolvedNode(object) 469 function resolvedNode(object)
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 this._splitView.uninstallResizer(this.sidebarPaneView.headerElement( )); 1206 this._splitView.uninstallResizer(this.sidebarPaneView.headerElement( ));
1200 } 1207 }
1201 1208
1202 this._splitView.setVertical(!vertically); 1209 this._splitView.setVertical(!vertically);
1203 1210
1204 var computedPane = new WebInspector.SidebarPane(WebInspector.UIString("C omputed")); 1211 var computedPane = new WebInspector.SidebarPane(WebInspector.UIString("C omputed"));
1205 computedPane.element.classList.add("composite"); 1212 computedPane.element.classList.add("composite");
1206 computedPane.element.classList.add("fill"); 1213 computedPane.element.classList.add("fill");
1207 var expandComputed = computedPane.expand.bind(computedPane); 1214 var expandComputed = computedPane.expand.bind(computedPane);
1208 1215
1209 computedPane.bodyElement.appendChild(this.sidebarPanes.computedStyle.tit leElement);
1210 computedPane.bodyElement.classList.add("metrics-and-computed"); 1216 computedPane.bodyElement.classList.add("metrics-and-computed");
1211 this.sidebarPanes.computedStyle.show(computedPane.bodyElement);
1212 this.sidebarPanes.computedStyle.setExpandCallback(expandComputed); 1217 this.sidebarPanes.computedStyle.setExpandCallback(expandComputed);
1213 1218
1214 this.sidebarPanes.platformFonts.show(computedPane.bodyElement); 1219 var matchedStylePanesWrapper = document.createElement("div");
1220 matchedStylePanesWrapper.className = "style-panes-wrapper";
1221 var computedStylePanesWrapper = document.createElement("div");
1222 computedStylePanesWrapper.className = "style-panes-wrapper";
1215 1223
1216 /** 1224 /**
1217 * @param {!WebInspector.SidebarPane} pane 1225 * @param {!Element} parentElement
1218 * @param {!Element=} beforeElement 1226 * @param {!Element=} beforeElement
1219 * @this {WebInspector.ElementsPanel} 1227 * @this {WebInspector.ElementsPanel}
1220 */ 1228 */
1221 function showMetrics(pane, beforeElement) 1229 function showMetrics(parentElement, beforeElement)
1222 { 1230 {
1223 this.sidebarPanes.metrics.show(pane.bodyElement, beforeElement); 1231 this.sidebarPanes.metrics.show(parentElement, beforeElement);
1224 } 1232 }
1225 1233
1226 /** 1234 /**
1227 * @param {!WebInspector.Event} event 1235 * @param {!WebInspector.Event} event
1228 * @this {WebInspector.ElementsPanel} 1236 * @this {WebInspector.ElementsPanel}
1229 */ 1237 */
1230 function tabSelected(event) 1238 function tabSelected(event)
1231 { 1239 {
1232 var tabId = /** @type {string} */ (event.data.tabId); 1240 var tabId = /** @type {string} */ (event.data.tabId);
1233 if (tabId === computedPane.title()) 1241 if (tabId === computedPane.title())
1234 showMetrics.call(this, computedPane, this.sidebarPanes.computedS tyle.element); 1242 showMetrics.call(this, computedStylePanesWrapper, this.sidebarPa nes.computedStyle.element);
1235 if (tabId === stylesPane.title()) 1243 else if (tabId === stylesPane.title())
1236 showMetrics.call(this, stylesPane); 1244 showMetrics.call(this, matchedStylePanesWrapper);
1237 } 1245 }
1238 1246
1239 this.sidebarPaneView = new WebInspector.SidebarTabbedPane(); 1247 this.sidebarPaneView = new WebInspector.SidebarTabbedPane();
1240 1248
1241 if (vertically) { 1249 if (vertically) {
1242 this._splitView.installResizer(this.sidebarPaneView.headerElement()) ; 1250 this._splitView.installResizer(this.sidebarPaneView.headerElement()) ;
1243 this.sidebarPanes.metrics.show(computedPane.bodyElement, this.sideba rPanes.computedStyle.element); 1251 var splitView = new WebInspector.SplitView(true, true, "StylesPaneSp litRatio", 0.5);
1244 this.sidebarPanes.metrics.setExpandCallback(expandComputed);
1245
1246 var compositePane = new WebInspector.SidebarPane(this.sidebarPanes.s tyles.title()); 1252 var compositePane = new WebInspector.SidebarPane(this.sidebarPanes.s tyles.title());
1247 compositePane.element.classList.add("composite"); 1253 compositePane.element.classList.add("composite");
1248 compositePane.element.classList.add("fill"); 1254 compositePane.element.classList.add("fill");
1249 var expandComposite = compositePane.expand.bind(compositePane); 1255 var expandComposite = compositePane.expand.bind(compositePane);
1250
1251 var splitView = new WebInspector.SplitView(true, true, "StylesPaneSp litRatio", 0.5);
1252 splitView.show(compositePane.bodyElement); 1256 splitView.show(compositePane.bodyElement);
1253 1257
1254 this.sidebarPanes.styles.show(splitView.mainElement()); 1258 splitView.mainElement().appendChild(matchedStylePanesWrapper);
pfeldman 2014/03/13 05:33:53 Could you work on minimizing the diff - it seems l
apavlov 2014/03/13 16:28:15 The issue is that I'm adding wrappers for contents
1255 splitView.mainElement().appendChild(this.sidebarPanes.styles.titleEl ement); 1259 splitView.sidebarElement().appendChild(computedStylePanesWrapper);
1260
1261 this.sidebarPanes.metrics.setExpandCallback(expandComputed);
1262
1263 matchedStylePanesWrapper.appendChild(this.sidebarPanes.styles.titleE lement);
1256 this.sidebarPanes.styles.setExpandCallback(expandComposite); 1264 this.sidebarPanes.styles.setExpandCallback(expandComposite);
1257 1265
1258 computedPane.show(splitView.sidebarElement()); 1266 computedPane.show(splitView.sidebarElement());
1259 computedPane.setExpandCallback(expandComposite); 1267 computedPane.setExpandCallback(expandComposite);
1260 1268
1269 if (WebInspector.experimentsSettings.cssStyleSearch.isEnabled()) {
1270 splitView.mainElement().appendChild(this._matchedStylesFilterBox Container);
1271 splitView.sidebarElement().appendChild(this._computedStylesFilte rBoxContainer);
1272 }
1273
1261 this.sidebarPaneView.addPane(compositePane); 1274 this.sidebarPaneView.addPane(compositePane);
1262 } else { 1275 } else {
1263 var stylesPane = new WebInspector.SidebarPane(this.sidebarPanes.styl es.title()); 1276 var stylesPane = new WebInspector.SidebarPane(this.sidebarPanes.styl es.title());
1264 stylesPane.element.classList.add("composite"); 1277 stylesPane.element.classList.add("composite");
1265 stylesPane.element.classList.add("fill"); 1278 stylesPane.element.classList.add("fill");
1266 var expandStyles = stylesPane.expand.bind(stylesPane); 1279 var expandStyles = stylesPane.expand.bind(stylesPane);
1267 stylesPane.bodyElement.classList.add("metrics-and-styles"); 1280 stylesPane.bodyElement.classList.add("metrics-and-styles");
1268 this.sidebarPanes.styles.show(stylesPane.bodyElement); 1281
1282 stylesPane.bodyElement.appendChild(matchedStylePanesWrapper);
1283 computedPane.bodyElement.appendChild(computedStylePanesWrapper);
1284
1269 this.sidebarPanes.styles.setExpandCallback(expandStyles); 1285 this.sidebarPanes.styles.setExpandCallback(expandStyles);
1270 this.sidebarPanes.metrics.setExpandCallback(expandStyles); 1286 this.sidebarPanes.metrics.setExpandCallback(expandStyles);
1271 stylesPane.bodyElement.appendChild(this.sidebarPanes.styles.titleEle ment); 1287 this.sidebarPanes.styles.element.appendChild(this.sidebarPanes.style s.titleElement);
1272 1288
1273 this.sidebarPaneView.addEventListener(WebInspector.TabbedPane.EventT ypes.TabSelected, tabSelected, this); 1289 this.sidebarPaneView.addEventListener(WebInspector.TabbedPane.EventT ypes.TabSelected, tabSelected, this);
1274 1290
1275 showMetrics.call(this, stylesPane); 1291 if (WebInspector.experimentsSettings.cssStyleSearch.isEnabled()) {
1292 stylesPane.bodyElement.appendChild(this._matchedStylesFilterBoxC ontainer);
1293 computedPane.bodyElement.appendChild(this._computedStylesFilterB oxContainer);
1294 }
1276 this.sidebarPaneView.addPane(stylesPane); 1295 this.sidebarPaneView.addPane(stylesPane);
1277 this.sidebarPaneView.addPane(computedPane); 1296 this.sidebarPaneView.addPane(computedPane);
1278 } 1297 }
1279 1298
1299 this.sidebarPanes.styles.show(matchedStylePanesWrapper);
1300 this.sidebarPanes.computedStyle.show(computedStylePanesWrapper);
1301 if (vertically)
1302 this.sidebarPanes.metrics.show(computedStylePanesWrapper, this.sideb arPanes.computedStyle.element);
1303 else
1304 this.sidebarPanes.metrics.show(matchedStylePanesWrapper);
1305 this.sidebarPanes.platformFonts.show(computedStylePanesWrapper);
1306
1280 this.sidebarPaneView.addPane(this.sidebarPanes.eventListeners); 1307 this.sidebarPaneView.addPane(this.sidebarPanes.eventListeners);
1281 this.sidebarPaneView.addPane(this.sidebarPanes.domBreakpoints); 1308 this.sidebarPaneView.addPane(this.sidebarPanes.domBreakpoints);
1282 this.sidebarPaneView.addPane(this.sidebarPanes.properties); 1309 this.sidebarPaneView.addPane(this.sidebarPanes.properties);
1283 this._extensionSidebarPanesContainer = this.sidebarPaneView; 1310 this._extensionSidebarPanesContainer = this.sidebarPaneView;
1284 1311
1285 for (var i = 0; i < this._extensionSidebarPanes.length; ++i) 1312 for (var i = 0; i < this._extensionSidebarPanes.length; ++i)
1286 this._extensionSidebarPanesContainer.addPane(this._extensionSidebarP anes[i]); 1313 this._extensionSidebarPanesContainer.addPane(this._extensionSidebarP anes[i]);
1287 1314
1288 this.sidebarPaneView.show(this._splitView.sidebarElement()); 1315 this.sidebarPaneView.show(this._splitView.sidebarElement());
1289 this.sidebarPanes.styles.expand(); 1316 this.sidebarPanes.styles.expand();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 WebInspector.ElementsPanel.DOMNodeRevealer.prototype = { 1388 WebInspector.ElementsPanel.DOMNodeRevealer.prototype = {
1362 /** 1389 /**
1363 * @param {!Object} node 1390 * @param {!Object} node
1364 */ 1391 */
1365 reveal: function(node) 1392 reveal: function(node)
1366 { 1393 {
1367 if (node instanceof WebInspector.DOMNode) 1394 if (node instanceof WebInspector.DOMNode)
1368 /** @type {!WebInspector.ElementsPanel} */ (WebInspector.showPanel(" elements")).revealAndSelectNode(node.id); 1395 /** @type {!WebInspector.ElementsPanel} */ (WebInspector.showPanel(" elements")).revealAndSelectNode(node.id);
1369 } 1396 }
1370 } 1397 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/Settings.js » ('j') | Source/devtools/front_end/StylesSidebarPane.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698