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

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

Issue 208653013: DevTools: Re-land r169860 with UI fixed (empty boxes and missing Styles toolbar buttons) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | Source/devtools/front_end/Settings.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 var crumbsContainer = stackElement.createChild("div"); 81 var crumbsContainer = stackElement.createChild("div");
82 crumbsContainer.id = "elements-crumbs"; 82 crumbsContainer.id = "elements-crumbs";
83 this.crumbsElement = crumbsContainer.createChild("div", "crumbs"); 83 this.crumbsElement = crumbsContainer.createChild("div", "crumbs");
84 this.crumbsElement.addEventListener("mousemove", this._mouseMovedInCrumbs.bi nd(this), false); 84 this.crumbsElement.addEventListener("mousemove", this._mouseMovedInCrumbs.bi nd(this), false);
85 this.crumbsElement.addEventListener("mouseout", this._mouseMovedOutOfCrumbs. bind(this), false); 85 this.crumbsElement.addEventListener("mouseout", this._mouseMovedOutOfCrumbs. bind(this), false);
86 86
87 this.sidebarPanes = {}; 87 this.sidebarPanes = {};
88 this.sidebarPanes.platformFonts = new WebInspector.PlatformFontsSidebarPane( ); 88 this.sidebarPanes.platformFonts = new WebInspector.PlatformFontsSidebarPane( );
89 this.sidebarPanes.computedStyle = new WebInspector.ComputedStyleSidebarPane( ); 89 this.sidebarPanes.computedStyle = new WebInspector.ComputedStyleSidebarPane( );
90 this.sidebarPanes.styles = new WebInspector.StylesSidebarPane(this.sidebarPa nes.computedStyle, this._setPseudoClassForNodeId.bind(this)); 90 this.sidebarPanes.styles = new WebInspector.StylesSidebarPane(this.sidebarPa nes.computedStyle, this._setPseudoClassForNodeId.bind(this));
91
92 this._matchedStylesFilterBoxContainer = document.createElement("div");
93 this._matchedStylesFilterBoxContainer.className = "filter-box-container insp ector-footer status-bar";
94 this._computedStylesFilterBoxContainer = document.createElement("div");
95 this._computedStylesFilterBoxContainer.className = "filter-box-container ins pector-footer status-bar";
96 this.sidebarPanes.styles.setFilterBoxContainers(this._matchedStylesFilterBox Container, this._computedStylesFilterBoxContainer);
97
91 this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane(); 98 this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane();
92 this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane(); 99 this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane();
93 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this); 100 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this);
94 this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPan e(); 101 this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPan e();
95 102
96 this.sidebarPanes.styles.addEventListener(WebInspector.SidebarPane.EventType s.wasShown, this.updateStyles.bind(this, false)); 103 this.sidebarPanes.styles.addEventListener(WebInspector.SidebarPane.EventType s.wasShown, this.updateStyles.bind(this, false));
97 this.sidebarPanes.metrics.addEventListener(WebInspector.SidebarPane.EventTyp es.wasShown, this.updateMetrics.bind(this)); 104 this.sidebarPanes.metrics.addEventListener(WebInspector.SidebarPane.EventTyp es.wasShown, this.updateMetrics.bind(this));
98 this.sidebarPanes.platformFonts.addEventListener(WebInspector.SidebarPane.Ev entTypes.wasShown, this.updatePlatformFonts.bind(this)); 105 this.sidebarPanes.platformFonts.addEventListener(WebInspector.SidebarPane.Ev entTypes.wasShown, this.updatePlatformFonts.bind(this));
99 this.sidebarPanes.properties.addEventListener(WebInspector.SidebarPane.Event Types.wasShown, this.updateProperties.bind(this)); 106 this.sidebarPanes.properties.addEventListener(WebInspector.SidebarPane.Event Types.wasShown, this.updateProperties.bind(this));
100 this.sidebarPanes.eventListeners.addEventListener(WebInspector.SidebarPane.E ventTypes.wasShown, this.updateEventListeners.bind(this)); 107 this.sidebarPanes.eventListeners.addEventListener(WebInspector.SidebarPane.E ventTypes.wasShown, this.updateEventListeners.bind(this));
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 return null; 426 return null;
420 427
421 var resource = WebInspector.resourceTreeModel.resourceForURL(anchor. href); 428 var resource = WebInspector.resourceTreeModel.resourceForURL(anchor. href);
422 if (!resource || resource.type !== WebInspector.resourceTypes.Image) 429 if (!resource || resource.type !== WebInspector.resourceTypes.Image)
423 return null; 430 return null;
424 431
425 anchor.removeAttribute("title"); 432 anchor.removeAttribute("title");
426 } 433 }
427 return anchor; 434 return anchor;
428 }, 435 },
429 436
430 _loadDimensionsForNode: function(treeElement, callback) 437 _loadDimensionsForNode: function(treeElement, callback)
431 { 438 {
432 // We get here for CSS properties, too, so bail out early for non-DOM tr eeElements. 439 // We get here for CSS properties, too, so bail out early for non-DOM tr eeElements.
433 if (treeElement.treeOutline !== this.treeOutline) { 440 if (treeElement.treeOutline !== this.treeOutline) {
434 callback(); 441 callback();
435 return; 442 return;
436 } 443 }
437 444
438 var node = /** @type {!WebInspector.DOMNode} */ (treeElement.represented Object); 445 var node = /** @type {!WebInspector.DOMNode} */ (treeElement.represented Object);
439 446
440 if (!node.nodeName() || node.nodeName().toLowerCase() !== "img") { 447 if (!node.nodeName() || node.nodeName().toLowerCase() !== "img") {
441 callback(); 448 callback();
442 return; 449 return;
443 } 450 }
444 451
445 WebInspector.RemoteObject.resolveNode(node, "", resolvedNode); 452 WebInspector.RemoteObject.resolveNode(node, "", resolvedNode);
446 453
447 function resolvedNode(object) 454 function resolvedNode(object)
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 this._splitView.uninstallResizer(this.sidebarPaneView.headerElement( )); 1203 this._splitView.uninstallResizer(this.sidebarPaneView.headerElement( ));
1197 } 1204 }
1198 1205
1199 this._splitView.setVertical(!vertically); 1206 this._splitView.setVertical(!vertically);
1200 1207
1201 var computedPane = new WebInspector.SidebarPane(WebInspector.UIString("C omputed")); 1208 var computedPane = new WebInspector.SidebarPane(WebInspector.UIString("C omputed"));
1202 computedPane.element.classList.add("composite"); 1209 computedPane.element.classList.add("composite");
1203 computedPane.element.classList.add("fill"); 1210 computedPane.element.classList.add("fill");
1204 var expandComputed = computedPane.expand.bind(computedPane); 1211 var expandComputed = computedPane.expand.bind(computedPane);
1205 1212
1206 computedPane.bodyElement.appendChild(this.sidebarPanes.computedStyle.tit leElement);
1207 computedPane.bodyElement.classList.add("metrics-and-computed"); 1213 computedPane.bodyElement.classList.add("metrics-and-computed");
1208 this.sidebarPanes.computedStyle.show(computedPane.bodyElement);
1209 this.sidebarPanes.computedStyle.setExpandCallback(expandComputed); 1214 this.sidebarPanes.computedStyle.setExpandCallback(expandComputed);
1210 1215
1211 this.sidebarPanes.platformFonts.show(computedPane.bodyElement); 1216 var matchedStylePanesWrapper = document.createElement("div");
1217 matchedStylePanesWrapper.className = "style-panes-wrapper";
1218 var computedStylePanesWrapper = document.createElement("div");
1219 computedStylePanesWrapper.className = "style-panes-wrapper";
1212 1220
1213 /** 1221 /**
1214 * @param {!WebInspector.SidebarPane} pane 1222 * @param {boolean} inComputedStyle
1215 * @param {!Element=} beforeElement
1216 * @this {WebInspector.ElementsPanel} 1223 * @this {WebInspector.ElementsPanel}
1217 */ 1224 */
1218 function showMetrics(pane, beforeElement) 1225 function showMetrics(inComputedStyle)
1219 { 1226 {
1220 this.sidebarPanes.metrics.show(pane.bodyElement, beforeElement); 1227 if (inComputedStyle)
1228 this.sidebarPanes.metrics.show(computedStylePanesWrapper, this.s idebarPanes.computedStyle.element);
1229 else
1230 this.sidebarPanes.metrics.show(matchedStylePanesWrapper);
1221 } 1231 }
1222 1232
1223 /** 1233 /**
1224 * @param {!WebInspector.Event} event 1234 * @param {!WebInspector.Event} event
1225 * @this {WebInspector.ElementsPanel} 1235 * @this {WebInspector.ElementsPanel}
1226 */ 1236 */
1227 function tabSelected(event) 1237 function tabSelected(event)
1228 { 1238 {
1229 var tabId = /** @type {string} */ (event.data.tabId); 1239 var tabId = /** @type {string} */ (event.data.tabId);
1230 if (tabId === computedPane.title()) 1240 if (tabId === computedPane.title())
1231 showMetrics.call(this, computedPane, this.sidebarPanes.computedS tyle.element); 1241 showMetrics.call(this, true);
1232 if (tabId === stylesPane.title()) 1242 else if (tabId === stylesPane.title())
1233 showMetrics.call(this, stylesPane); 1243 showMetrics.call(this, false);
1234 } 1244 }
1235 1245
1236 this.sidebarPaneView = new WebInspector.SidebarTabbedPane(); 1246 this.sidebarPaneView = new WebInspector.SidebarTabbedPane();
1237 1247
1238 if (vertically) { 1248 if (vertically) {
1239 this._splitView.installResizer(this.sidebarPaneView.headerElement()) ; 1249 this._splitView.installResizer(this.sidebarPaneView.headerElement()) ;
1240 this.sidebarPanes.metrics.show(computedPane.bodyElement, this.sideba rPanes.computedStyle.element);
1241 this.sidebarPanes.metrics.setExpandCallback(expandComputed); 1250 this.sidebarPanes.metrics.setExpandCallback(expandComputed);
1242 1251
1243 var compositePane = new WebInspector.SidebarPane(this.sidebarPanes.s tyles.title()); 1252 var compositePane = new WebInspector.SidebarPane(this.sidebarPanes.s tyles.title());
1244 compositePane.element.classList.add("composite"); 1253 compositePane.element.classList.add("composite");
1245 compositePane.element.classList.add("fill"); 1254 compositePane.element.classList.add("fill");
1246 var expandComposite = compositePane.expand.bind(compositePane); 1255 var expandComposite = compositePane.expand.bind(compositePane);
1247 1256
1248 var splitView = new WebInspector.SplitView(true, true, "stylesPaneSp litViewState", 0.5); 1257 var splitView = new WebInspector.SplitView(true, true, "stylesPaneSp litViewState", 0.5);
1249 splitView.show(compositePane.bodyElement); 1258 splitView.show(compositePane.bodyElement);
1250 1259
1251 this.sidebarPanes.styles.show(splitView.mainElement()); 1260 splitView.mainElement().appendChild(matchedStylePanesWrapper);
1252 splitView.mainElement().appendChild(this.sidebarPanes.styles.titleEl ement); 1261 splitView.sidebarElement().appendChild(computedStylePanesWrapper);
1262
1253 this.sidebarPanes.styles.setExpandCallback(expandComposite); 1263 this.sidebarPanes.styles.setExpandCallback(expandComposite);
1254 1264
1255 computedPane.show(splitView.sidebarElement()); 1265 computedPane.show(computedStylePanesWrapper);
1256 computedPane.setExpandCallback(expandComposite); 1266 computedPane.setExpandCallback(expandComposite);
1257 1267
1268 if (WebInspector.experimentsSettings.cssStyleSearch.isEnabled()) {
1269 splitView.mainElement().appendChild(this._matchedStylesFilterBox Container);
1270 splitView.sidebarElement().appendChild(this._computedStylesFilte rBoxContainer);
1271 }
1272
1258 this.sidebarPaneView.addPane(compositePane); 1273 this.sidebarPaneView.addPane(compositePane);
1259 } else { 1274 } else {
1260 var stylesPane = new WebInspector.SidebarPane(this.sidebarPanes.styl es.title()); 1275 var stylesPane = new WebInspector.SidebarPane(this.sidebarPanes.styl es.title());
1261 stylesPane.element.classList.add("composite"); 1276 stylesPane.element.classList.add("composite");
1262 stylesPane.element.classList.add("fill"); 1277 stylesPane.element.classList.add("fill");
1263 var expandStyles = stylesPane.expand.bind(stylesPane); 1278 var expandStyles = stylesPane.expand.bind(stylesPane);
1264 stylesPane.bodyElement.classList.add("metrics-and-styles"); 1279 stylesPane.bodyElement.classList.add("metrics-and-styles");
1265 this.sidebarPanes.styles.show(stylesPane.bodyElement); 1280
1281 stylesPane.bodyElement.appendChild(matchedStylePanesWrapper);
1282 computedPane.bodyElement.appendChild(computedStylePanesWrapper);
1283
1266 this.sidebarPanes.styles.setExpandCallback(expandStyles); 1284 this.sidebarPanes.styles.setExpandCallback(expandStyles);
1267 this.sidebarPanes.metrics.setExpandCallback(expandStyles); 1285 this.sidebarPanes.metrics.setExpandCallback(expandStyles);
1268 stylesPane.bodyElement.appendChild(this.sidebarPanes.styles.titleEle ment);
1269 1286
1270 this.sidebarPaneView.addEventListener(WebInspector.TabbedPane.EventT ypes.TabSelected, tabSelected, this); 1287 this.sidebarPaneView.addEventListener(WebInspector.TabbedPane.EventT ypes.TabSelected, tabSelected, this);
1271 1288
1272 showMetrics.call(this, stylesPane); 1289 if (WebInspector.experimentsSettings.cssStyleSearch.isEnabled()) {
1290 stylesPane.bodyElement.appendChild(this._matchedStylesFilterBoxC ontainer);
1291 computedPane.bodyElement.appendChild(this._computedStylesFilterB oxContainer);
1292 }
1293
1273 this.sidebarPaneView.addPane(stylesPane); 1294 this.sidebarPaneView.addPane(stylesPane);
1274 this.sidebarPaneView.addPane(computedPane); 1295 this.sidebarPaneView.addPane(computedPane);
1275 } 1296 }
1276 1297
1298 this.sidebarPanes.styles.show(matchedStylePanesWrapper);
1299 this.sidebarPanes.computedStyle.show(computedStylePanesWrapper);
1300 matchedStylePanesWrapper.appendChild(this.sidebarPanes.styles.titleEleme nt);
1301 showMetrics.call(this, vertically);
1302 this.sidebarPanes.platformFonts.show(computedStylePanesWrapper);
1303
1277 this.sidebarPaneView.addPane(this.sidebarPanes.eventListeners); 1304 this.sidebarPaneView.addPane(this.sidebarPanes.eventListeners);
1278 this.sidebarPaneView.addPane(this.sidebarPanes.domBreakpoints); 1305 this.sidebarPaneView.addPane(this.sidebarPanes.domBreakpoints);
1279 this.sidebarPaneView.addPane(this.sidebarPanes.properties); 1306 this.sidebarPaneView.addPane(this.sidebarPanes.properties);
1280 this._extensionSidebarPanesContainer = this.sidebarPaneView; 1307 this._extensionSidebarPanesContainer = this.sidebarPaneView;
1281 1308
1282 for (var i = 0; i < this._extensionSidebarPanes.length; ++i) 1309 for (var i = 0; i < this._extensionSidebarPanes.length; ++i)
1283 this._extensionSidebarPanesContainer.addPane(this._extensionSidebarP anes[i]); 1310 this._extensionSidebarPanesContainer.addPane(this._extensionSidebarP anes[i]);
1284 1311
1285 this.sidebarPaneView.show(this._splitView.sidebarElement()); 1312 this.sidebarPaneView.show(this._splitView.sidebarElement());
1286 this.sidebarPanes.styles.expand(); 1313 this.sidebarPanes.styles.expand();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 return; 1364 return;
1338 1365
1339 if (WebInspector.inspectElementModeController && WebInspector.inspectEle mentModeController.enabled()) { 1366 if (WebInspector.inspectElementModeController && WebInspector.inspectEle mentModeController.enabled()) {
1340 InspectorFrontendHost.bringToFront(); 1367 InspectorFrontendHost.bringToFront();
1341 WebInspector.inspectElementModeController.disable(); 1368 WebInspector.inspectElementModeController.disable();
1342 } 1369 }
1343 1370
1344 /** @type {!WebInspector.ElementsPanel} */ (WebInspector.inspectorView.p anel("elements")).revealAndSelectNode(node.id); 1371 /** @type {!WebInspector.ElementsPanel} */ (WebInspector.inspectorView.p anel("elements")).revealAndSelectNode(node.id);
1345 } 1372 }
1346 } 1373 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/Settings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698