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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 var crumbsContainer = stackElement.createChild("div"); | 86 var crumbsContainer = stackElement.createChild("div"); |
87 crumbsContainer.id = "elements-crumbs"; | 87 crumbsContainer.id = "elements-crumbs"; |
88 this.crumbsElement = crumbsContainer.createChild("div", "crumbs"); | 88 this.crumbsElement = crumbsContainer.createChild("div", "crumbs"); |
89 this.crumbsElement.addEventListener("mousemove", this._mouseMovedInCrumbs.bi nd(this), false); | 89 this.crumbsElement.addEventListener("mousemove", this._mouseMovedInCrumbs.bi nd(this), false); |
90 this.crumbsElement.addEventListener("mouseout", this._mouseMovedOutOfCrumbs. bind(this), false); | 90 this.crumbsElement.addEventListener("mouseout", this._mouseMovedOutOfCrumbs. bind(this), false); |
91 | 91 |
92 this.sidebarPanes = {}; | 92 this.sidebarPanes = {}; |
93 this.sidebarPanes.platformFonts = new WebInspector.PlatformFontsSidebarPane( ); | 93 this.sidebarPanes.platformFonts = new WebInspector.PlatformFontsSidebarPane( ); |
94 this.sidebarPanes.computedStyle = new WebInspector.ComputedStyleSidebarPane( ); | 94 this.sidebarPanes.computedStyle = new WebInspector.ComputedStyleSidebarPane( ); |
95 this.sidebarPanes.styles = new WebInspector.StylesSidebarPane(this.sidebarPa nes.computedStyle, this._setPseudoClassForNodeId.bind(this)); | 95 this.sidebarPanes.styles = new WebInspector.StylesSidebarPane(this.sidebarPa nes.computedStyle, this._setPseudoClassForNodeId.bind(this)); |
96 if (WebInspector.experimentsSettings.cssStyleSearch.isEnabled()) { | |
97 this._matchedStylesFilterBoxContainer = document.createElement("div"); | |
pfeldman
2014/03/24 15:18:54
Lets create them regardless.
| |
98 this._matchedStylesFilterBoxContainer.className = "filter-box-container inspector-footer status-bar"; | |
99 this._computedStylesFilterBoxContainer = document.createElement("div"); | |
100 this._computedStylesFilterBoxContainer.className = "filter-box-container inspector-footer status-bar"; | |
101 this.sidebarPanes.styles.setFilterBoxContainers(this._matchedStylesFilte rBoxContainer, this._computedStylesFilterBoxContainer); | |
102 } | |
96 this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane(); | 103 this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane(); |
97 this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane(); | 104 this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane(); |
98 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this); | 105 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this); |
99 this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPan e(); | 106 this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPan e(); |
100 | 107 |
101 this.sidebarPanes.styles.addEventListener(WebInspector.SidebarPane.EventType s.wasShown, this.updateStyles.bind(this, false)); | 108 this.sidebarPanes.styles.addEventListener(WebInspector.SidebarPane.EventType s.wasShown, this.updateStyles.bind(this, false)); |
102 this.sidebarPanes.metrics.addEventListener(WebInspector.SidebarPane.EventTyp es.wasShown, this.updateMetrics.bind(this)); | 109 this.sidebarPanes.metrics.addEventListener(WebInspector.SidebarPane.EventTyp es.wasShown, this.updateMetrics.bind(this)); |
103 this.sidebarPanes.platformFonts.addEventListener(WebInspector.SidebarPane.Ev entTypes.wasShown, this.updatePlatformFonts.bind(this)); | 110 this.sidebarPanes.platformFonts.addEventListener(WebInspector.SidebarPane.Ev entTypes.wasShown, this.updatePlatformFonts.bind(this)); |
104 this.sidebarPanes.properties.addEventListener(WebInspector.SidebarPane.Event Types.wasShown, this.updateProperties.bind(this)); | 111 this.sidebarPanes.properties.addEventListener(WebInspector.SidebarPane.Event Types.wasShown, this.updateProperties.bind(this)); |
105 this.sidebarPanes.eventListeners.addEventListener(WebInspector.SidebarPane.E ventTypes.wasShown, this.updateEventListeners.bind(this)); | 112 this.sidebarPanes.eventListeners.addEventListener(WebInspector.SidebarPane.E ventTypes.wasShown, this.updateEventListeners.bind(this)); |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 return null; | 440 return null; |
434 | 441 |
435 var resource = WebInspector.resourceTreeModel.resourceForURL(anchor. href); | 442 var resource = WebInspector.resourceTreeModel.resourceForURL(anchor. href); |
436 if (!resource || resource.type !== WebInspector.resourceTypes.Image) | 443 if (!resource || resource.type !== WebInspector.resourceTypes.Image) |
437 return null; | 444 return null; |
438 | 445 |
439 anchor.removeAttribute("title"); | 446 anchor.removeAttribute("title"); |
440 } | 447 } |
441 return anchor; | 448 return anchor; |
442 }, | 449 }, |
443 | 450 |
444 _loadDimensionsForNode: function(treeElement, callback) | 451 _loadDimensionsForNode: function(treeElement, callback) |
445 { | 452 { |
446 // We get here for CSS properties, too, so bail out early for non-DOM tr eeElements. | 453 // We get here for CSS properties, too, so bail out early for non-DOM tr eeElements. |
447 if (treeElement.treeOutline !== this.treeOutline) { | 454 if (treeElement.treeOutline !== this.treeOutline) { |
448 callback(); | 455 callback(); |
449 return; | 456 return; |
450 } | 457 } |
451 | 458 |
452 var node = /** @type {!WebInspector.DOMNode} */ (treeElement.represented Object); | 459 var node = /** @type {!WebInspector.DOMNode} */ (treeElement.represented Object); |
453 | 460 |
454 if (!node.nodeName() || node.nodeName().toLowerCase() !== "img") { | 461 if (!node.nodeName() || node.nodeName().toLowerCase() !== "img") { |
455 callback(); | 462 callback(); |
456 return; | 463 return; |
457 } | 464 } |
458 | 465 |
459 WebInspector.RemoteObject.resolveNode(node, "", resolvedNode); | 466 WebInspector.RemoteObject.resolveNode(node, "", resolvedNode); |
460 | 467 |
461 function resolvedNode(object) | 468 function resolvedNode(object) |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1209 this._splitView.uninstallResizer(this.sidebarPaneView.headerElement( )); | 1216 this._splitView.uninstallResizer(this.sidebarPaneView.headerElement( )); |
1210 } | 1217 } |
1211 | 1218 |
1212 this._splitView.setVertical(!vertically); | 1219 this._splitView.setVertical(!vertically); |
1213 | 1220 |
1214 var computedPane = new WebInspector.SidebarPane(WebInspector.UIString("C omputed")); | 1221 var computedPane = new WebInspector.SidebarPane(WebInspector.UIString("C omputed")); |
1215 computedPane.element.classList.add("composite"); | 1222 computedPane.element.classList.add("composite"); |
1216 computedPane.element.classList.add("fill"); | 1223 computedPane.element.classList.add("fill"); |
1217 var expandComputed = computedPane.expand.bind(computedPane); | 1224 var expandComputed = computedPane.expand.bind(computedPane); |
1218 | 1225 |
1219 computedPane.bodyElement.appendChild(this.sidebarPanes.computedStyle.tit leElement); | |
1220 computedPane.bodyElement.classList.add("metrics-and-computed"); | 1226 computedPane.bodyElement.classList.add("metrics-and-computed"); |
1221 this.sidebarPanes.computedStyle.show(computedPane.bodyElement); | |
1222 this.sidebarPanes.computedStyle.setExpandCallback(expandComputed); | 1227 this.sidebarPanes.computedStyle.setExpandCallback(expandComputed); |
1223 | 1228 |
1224 this.sidebarPanes.platformFonts.show(computedPane.bodyElement); | 1229 var matchedStylePanesWrapper = document.createElement("div"); |
1230 matchedStylePanesWrapper.className = "style-panes-wrapper"; | |
1231 var computedStylePanesWrapper = document.createElement("div"); | |
1232 computedStylePanesWrapper.className = "style-panes-wrapper"; | |
1225 | 1233 |
1226 /** | 1234 /** |
1227 * @param {!WebInspector.SidebarPane} pane | 1235 * @param {boolean} inComputedStyle |
1228 * @param {!Element=} beforeElement | |
1229 * @this {WebInspector.ElementsPanel} | 1236 * @this {WebInspector.ElementsPanel} |
1230 */ | 1237 */ |
1231 function showMetrics(pane, beforeElement) | 1238 function showMetrics(inComputedStyle) |
1232 { | 1239 { |
1233 this.sidebarPanes.metrics.show(pane.bodyElement, beforeElement); | 1240 if (inComputedStyle) |
1241 this.sidebarPanes.metrics.show(computedStylePanesWrapper, this.s idebarPanes.computedStyle.element); | |
1242 else | |
1243 this.sidebarPanes.metrics.show(matchedStylePanesWrapper); | |
1234 } | 1244 } |
1235 | 1245 |
1236 /** | 1246 /** |
1237 * @param {!WebInspector.Event} event | 1247 * @param {!WebInspector.Event} event |
1238 * @this {WebInspector.ElementsPanel} | 1248 * @this {WebInspector.ElementsPanel} |
1239 */ | 1249 */ |
1240 function tabSelected(event) | 1250 function tabSelected(event) |
1241 { | 1251 { |
1242 var tabId = /** @type {string} */ (event.data.tabId); | 1252 var tabId = /** @type {string} */ (event.data.tabId); |
1243 if (tabId === computedPane.title()) | 1253 if (tabId === computedPane.title()) |
1244 showMetrics.call(this, computedPane, this.sidebarPanes.computedS tyle.element); | 1254 showMetrics.call(this, true); |
1245 if (tabId === stylesPane.title()) | 1255 else if (tabId === stylesPane.title()) |
1246 showMetrics.call(this, stylesPane); | 1256 showMetrics.call(this, false); |
1247 } | 1257 } |
1248 | 1258 |
1249 this.sidebarPaneView = new WebInspector.SidebarTabbedPane(); | 1259 this.sidebarPaneView = new WebInspector.SidebarTabbedPane(); |
1250 | 1260 |
1251 if (vertically) { | 1261 if (vertically) { |
1252 this._splitView.installResizer(this.sidebarPaneView.headerElement()) ; | 1262 this._splitView.installResizer(this.sidebarPaneView.headerElement()) ; |
1253 this.sidebarPanes.metrics.show(computedPane.bodyElement, this.sideba rPanes.computedStyle.element); | |
1254 this.sidebarPanes.metrics.setExpandCallback(expandComputed); | 1263 this.sidebarPanes.metrics.setExpandCallback(expandComputed); |
1255 | 1264 |
1256 var compositePane = new WebInspector.SidebarPane(this.sidebarPanes.s tyles.title()); | 1265 var compositePane = new WebInspector.SidebarPane(this.sidebarPanes.s tyles.title()); |
1257 compositePane.element.classList.add("composite"); | 1266 compositePane.element.classList.add("composite"); |
1258 compositePane.element.classList.add("fill"); | 1267 compositePane.element.classList.add("fill"); |
1259 var expandComposite = compositePane.expand.bind(compositePane); | 1268 var expandComposite = compositePane.expand.bind(compositePane); |
1260 | 1269 |
1261 var splitView = new WebInspector.SplitView(true, true, "stylesPaneSp litViewState", 0.5); | 1270 var splitView = new WebInspector.SplitView(true, true, "stylesPaneSp litViewState", 0.5); |
1262 splitView.show(compositePane.bodyElement); | 1271 splitView.show(compositePane.bodyElement); |
1263 | 1272 |
1264 this.sidebarPanes.styles.show(splitView.mainElement()); | 1273 matchedStylePanesWrapper.appendChild(this.sidebarPanes.styles.titleE lement); |
1265 splitView.mainElement().appendChild(this.sidebarPanes.styles.titleEl ement); | 1274 splitView.mainElement().appendChild(matchedStylePanesWrapper); |
1275 splitView.sidebarElement().appendChild(computedStylePanesWrapper); | |
1276 | |
1266 this.sidebarPanes.styles.setExpandCallback(expandComposite); | 1277 this.sidebarPanes.styles.setExpandCallback(expandComposite); |
1267 | 1278 |
1268 computedPane.show(splitView.sidebarElement()); | 1279 computedPane.show(splitView.sidebarElement()); |
1269 computedPane.setExpandCallback(expandComposite); | 1280 computedPane.setExpandCallback(expandComposite); |
1270 | 1281 |
1282 if (WebInspector.experimentsSettings.cssStyleSearch.isEnabled()) { | |
1283 splitView.mainElement().appendChild(this._matchedStylesFilterBox Container); | |
1284 splitView.sidebarElement().appendChild(this._computedStylesFilte rBoxContainer); | |
1285 } | |
1286 | |
1271 this.sidebarPaneView.addPane(compositePane); | 1287 this.sidebarPaneView.addPane(compositePane); |
1272 } else { | 1288 } else { |
1273 var stylesPane = new WebInspector.SidebarPane(this.sidebarPanes.styl es.title()); | 1289 var stylesPane = new WebInspector.SidebarPane(this.sidebarPanes.styl es.title()); |
1274 stylesPane.element.classList.add("composite"); | 1290 stylesPane.element.classList.add("composite"); |
1275 stylesPane.element.classList.add("fill"); | 1291 stylesPane.element.classList.add("fill"); |
1276 var expandStyles = stylesPane.expand.bind(stylesPane); | 1292 var expandStyles = stylesPane.expand.bind(stylesPane); |
1277 stylesPane.bodyElement.classList.add("metrics-and-styles"); | 1293 stylesPane.bodyElement.classList.add("metrics-and-styles"); |
1278 this.sidebarPanes.styles.show(stylesPane.bodyElement); | 1294 |
1295 stylesPane.bodyElement.appendChild(matchedStylePanesWrapper); | |
1296 computedPane.bodyElement.appendChild(computedStylePanesWrapper); | |
1297 | |
1279 this.sidebarPanes.styles.setExpandCallback(expandStyles); | 1298 this.sidebarPanes.styles.setExpandCallback(expandStyles); |
1280 this.sidebarPanes.metrics.setExpandCallback(expandStyles); | 1299 this.sidebarPanes.metrics.setExpandCallback(expandStyles); |
1281 stylesPane.bodyElement.appendChild(this.sidebarPanes.styles.titleEle ment); | 1300 this.sidebarPanes.styles.element.appendChild(this.sidebarPanes.style s.titleElement); |
1282 | 1301 |
1283 this.sidebarPaneView.addEventListener(WebInspector.TabbedPane.EventT ypes.TabSelected, tabSelected, this); | 1302 this.sidebarPaneView.addEventListener(WebInspector.TabbedPane.EventT ypes.TabSelected, tabSelected, this); |
1284 | 1303 |
1285 showMetrics.call(this, stylesPane); | 1304 if (WebInspector.experimentsSettings.cssStyleSearch.isEnabled()) { |
1305 stylesPane.bodyElement.appendChild(this._matchedStylesFilterBoxC ontainer); | |
1306 computedPane.bodyElement.appendChild(this._computedStylesFilterB oxContainer); | |
1307 } | |
1286 this.sidebarPaneView.addPane(stylesPane); | 1308 this.sidebarPaneView.addPane(stylesPane); |
1287 this.sidebarPaneView.addPane(computedPane); | 1309 this.sidebarPaneView.addPane(computedPane); |
1288 } | 1310 } |
1289 | 1311 |
1312 this.sidebarPanes.styles.show(matchedStylePanesWrapper); | |
1313 this.sidebarPanes.computedStyle.show(computedStylePanesWrapper); | |
1314 showMetrics.call(this, vertically); | |
1315 this.sidebarPanes.platformFonts.show(computedStylePanesWrapper); | |
1316 | |
1290 this.sidebarPaneView.addPane(this.sidebarPanes.eventListeners); | 1317 this.sidebarPaneView.addPane(this.sidebarPanes.eventListeners); |
1291 this.sidebarPaneView.addPane(this.sidebarPanes.domBreakpoints); | 1318 this.sidebarPaneView.addPane(this.sidebarPanes.domBreakpoints); |
1292 this.sidebarPaneView.addPane(this.sidebarPanes.properties); | 1319 this.sidebarPaneView.addPane(this.sidebarPanes.properties); |
1293 this._extensionSidebarPanesContainer = this.sidebarPaneView; | 1320 this._extensionSidebarPanesContainer = this.sidebarPaneView; |
1294 | 1321 |
1295 for (var i = 0; i < this._extensionSidebarPanes.length; ++i) | 1322 for (var i = 0; i < this._extensionSidebarPanes.length; ++i) |
1296 this._extensionSidebarPanesContainer.addPane(this._extensionSidebarP anes[i]); | 1323 this._extensionSidebarPanesContainer.addPane(this._extensionSidebarP anes[i]); |
1297 | 1324 |
1298 this.sidebarPaneView.show(this._splitView.sidebarElement()); | 1325 this.sidebarPaneView.show(this._splitView.sidebarElement()); |
1299 this.sidebarPanes.styles.expand(); | 1326 this.sidebarPanes.styles.expand(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1378 return; | 1405 return; |
1379 | 1406 |
1380 if (WebInspector.inspectElementModeController && WebInspector.inspectEle mentModeController.enabled()) { | 1407 if (WebInspector.inspectElementModeController && WebInspector.inspectEle mentModeController.enabled()) { |
1381 InspectorFrontendHost.bringToFront(); | 1408 InspectorFrontendHost.bringToFront(); |
1382 WebInspector.inspectElementModeController.disable(); | 1409 WebInspector.inspectElementModeController.disable(); |
1383 } | 1410 } |
1384 | 1411 |
1385 /** @type {!WebInspector.ElementsPanel} */ (WebInspector.inspectorView.p anel("elements")).revealAndSelectNode(node.id); | 1412 /** @type {!WebInspector.ElementsPanel} */ (WebInspector.inspectorView.p anel("elements")).revealAndSelectNode(node.id); |
1386 } | 1413 } |
1387 } | 1414 } |
OLD | NEW |