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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | |
98 this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane(); | 91 this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane(); |
99 this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane(); | 92 this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane(); |
100 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr
eateProxy(this); | 93 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr
eateProxy(this); |
101 this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPan
e(); | 94 this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPan
e(); |
102 | 95 |
103 this.sidebarPanes.styles.addEventListener(WebInspector.SidebarPane.EventType
s.wasShown, this.updateStyles.bind(this, false)); | 96 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)); | 97 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)); | 98 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)); | 99 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)); | 100 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 Loading... |
426 return null; | 419 return null; |
427 | 420 |
428 var resource = WebInspector.resourceTreeModel.resourceForURL(anchor.
href); | 421 var resource = WebInspector.resourceTreeModel.resourceForURL(anchor.
href); |
429 if (!resource || resource.type !== WebInspector.resourceTypes.Image) | 422 if (!resource || resource.type !== WebInspector.resourceTypes.Image) |
430 return null; | 423 return null; |
431 | 424 |
432 anchor.removeAttribute("title"); | 425 anchor.removeAttribute("title"); |
433 } | 426 } |
434 return anchor; | 427 return anchor; |
435 }, | 428 }, |
436 | 429 |
437 _loadDimensionsForNode: function(treeElement, callback) | 430 _loadDimensionsForNode: function(treeElement, callback) |
438 { | 431 { |
439 // We get here for CSS properties, too, so bail out early for non-DOM tr
eeElements. | 432 // We get here for CSS properties, too, so bail out early for non-DOM tr
eeElements. |
440 if (treeElement.treeOutline !== this.treeOutline) { | 433 if (treeElement.treeOutline !== this.treeOutline) { |
441 callback(); | 434 callback(); |
442 return; | 435 return; |
443 } | 436 } |
444 | 437 |
445 var node = /** @type {!WebInspector.DOMNode} */ (treeElement.represented
Object); | 438 var node = /** @type {!WebInspector.DOMNode} */ (treeElement.represented
Object); |
446 | 439 |
447 if (!node.nodeName() || node.nodeName().toLowerCase() !== "img") { | 440 if (!node.nodeName() || node.nodeName().toLowerCase() !== "img") { |
448 callback(); | 441 callback(); |
449 return; | 442 return; |
450 } | 443 } |
451 | 444 |
452 WebInspector.RemoteObject.resolveNode(node, "", resolvedNode); | 445 WebInspector.RemoteObject.resolveNode(node, "", resolvedNode); |
453 | 446 |
454 function resolvedNode(object) | 447 function resolvedNode(object) |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 this._splitView.uninstallResizer(this.sidebarPaneView.headerElement(
)); | 1196 this._splitView.uninstallResizer(this.sidebarPaneView.headerElement(
)); |
1204 } | 1197 } |
1205 | 1198 |
1206 this._splitView.setVertical(!vertically); | 1199 this._splitView.setVertical(!vertically); |
1207 | 1200 |
1208 var computedPane = new WebInspector.SidebarPane(WebInspector.UIString("C
omputed")); | 1201 var computedPane = new WebInspector.SidebarPane(WebInspector.UIString("C
omputed")); |
1209 computedPane.element.classList.add("composite"); | 1202 computedPane.element.classList.add("composite"); |
1210 computedPane.element.classList.add("fill"); | 1203 computedPane.element.classList.add("fill"); |
1211 var expandComputed = computedPane.expand.bind(computedPane); | 1204 var expandComputed = computedPane.expand.bind(computedPane); |
1212 | 1205 |
| 1206 computedPane.bodyElement.appendChild(this.sidebarPanes.computedStyle.tit
leElement); |
1213 computedPane.bodyElement.classList.add("metrics-and-computed"); | 1207 computedPane.bodyElement.classList.add("metrics-and-computed"); |
| 1208 this.sidebarPanes.computedStyle.show(computedPane.bodyElement); |
1214 this.sidebarPanes.computedStyle.setExpandCallback(expandComputed); | 1209 this.sidebarPanes.computedStyle.setExpandCallback(expandComputed); |
1215 | 1210 |
1216 var matchedStylePanesWrapper = document.createElement("div"); | 1211 this.sidebarPanes.platformFonts.show(computedPane.bodyElement); |
1217 matchedStylePanesWrapper.className = "style-panes-wrapper"; | |
1218 var computedStylePanesWrapper = document.createElement("div"); | |
1219 computedStylePanesWrapper.className = "style-panes-wrapper"; | |
1220 | 1212 |
1221 /** | 1213 /** |
1222 * @param {boolean} inComputedStyle | 1214 * @param {!WebInspector.SidebarPane} pane |
| 1215 * @param {!Element=} beforeElement |
1223 * @this {WebInspector.ElementsPanel} | 1216 * @this {WebInspector.ElementsPanel} |
1224 */ | 1217 */ |
1225 function showMetrics(inComputedStyle) | 1218 function showMetrics(pane, beforeElement) |
1226 { | 1219 { |
1227 if (inComputedStyle) | 1220 this.sidebarPanes.metrics.show(pane.bodyElement, beforeElement); |
1228 this.sidebarPanes.metrics.show(computedStylePanesWrapper, this.s
idebarPanes.computedStyle.element); | |
1229 else | |
1230 this.sidebarPanes.metrics.show(matchedStylePanesWrapper); | |
1231 } | 1221 } |
1232 | 1222 |
1233 /** | 1223 /** |
1234 * @param {!WebInspector.Event} event | 1224 * @param {!WebInspector.Event} event |
1235 * @this {WebInspector.ElementsPanel} | 1225 * @this {WebInspector.ElementsPanel} |
1236 */ | 1226 */ |
1237 function tabSelected(event) | 1227 function tabSelected(event) |
1238 { | 1228 { |
1239 var tabId = /** @type {string} */ (event.data.tabId); | 1229 var tabId = /** @type {string} */ (event.data.tabId); |
1240 if (tabId === computedPane.title()) | 1230 if (tabId === computedPane.title()) |
1241 showMetrics.call(this, true); | 1231 showMetrics.call(this, computedPane, this.sidebarPanes.computedS
tyle.element); |
1242 else if (tabId === stylesPane.title()) | 1232 if (tabId === stylesPane.title()) |
1243 showMetrics.call(this, false); | 1233 showMetrics.call(this, stylesPane); |
1244 } | 1234 } |
1245 | 1235 |
1246 this.sidebarPaneView = new WebInspector.SidebarTabbedPane(); | 1236 this.sidebarPaneView = new WebInspector.SidebarTabbedPane(); |
1247 | 1237 |
1248 if (vertically) { | 1238 if (vertically) { |
1249 this._splitView.installResizer(this.sidebarPaneView.headerElement())
; | 1239 this._splitView.installResizer(this.sidebarPaneView.headerElement())
; |
| 1240 this.sidebarPanes.metrics.show(computedPane.bodyElement, this.sideba
rPanes.computedStyle.element); |
1250 this.sidebarPanes.metrics.setExpandCallback(expandComputed); | 1241 this.sidebarPanes.metrics.setExpandCallback(expandComputed); |
1251 | 1242 |
1252 var compositePane = new WebInspector.SidebarPane(this.sidebarPanes.s
tyles.title()); | 1243 var compositePane = new WebInspector.SidebarPane(this.sidebarPanes.s
tyles.title()); |
1253 compositePane.element.classList.add("composite"); | 1244 compositePane.element.classList.add("composite"); |
1254 compositePane.element.classList.add("fill"); | 1245 compositePane.element.classList.add("fill"); |
1255 var expandComposite = compositePane.expand.bind(compositePane); | 1246 var expandComposite = compositePane.expand.bind(compositePane); |
1256 | 1247 |
1257 var splitView = new WebInspector.SplitView(true, true, "stylesPaneSp
litViewState", 0.5); | 1248 var splitView = new WebInspector.SplitView(true, true, "stylesPaneSp
litViewState", 0.5); |
1258 splitView.show(compositePane.bodyElement); | 1249 splitView.show(compositePane.bodyElement); |
1259 | 1250 |
1260 matchedStylePanesWrapper.appendChild(this.sidebarPanes.styles.titleE
lement); | 1251 this.sidebarPanes.styles.show(splitView.mainElement()); |
1261 splitView.mainElement().appendChild(matchedStylePanesWrapper); | 1252 splitView.mainElement().appendChild(this.sidebarPanes.styles.titleEl
ement); |
1262 splitView.sidebarElement().appendChild(computedStylePanesWrapper); | |
1263 | |
1264 this.sidebarPanes.styles.setExpandCallback(expandComposite); | 1253 this.sidebarPanes.styles.setExpandCallback(expandComposite); |
1265 | 1254 |
1266 computedPane.show(splitView.sidebarElement()); | 1255 computedPane.show(splitView.sidebarElement()); |
1267 computedPane.setExpandCallback(expandComposite); | 1256 computedPane.setExpandCallback(expandComposite); |
1268 | 1257 |
1269 splitView.mainElement().appendChild(this._matchedStylesFilterBoxCont
ainer); | |
1270 splitView.sidebarElement().appendChild(this._computedStylesFilterBox
Container); | |
1271 | |
1272 this.sidebarPaneView.addPane(compositePane); | 1258 this.sidebarPaneView.addPane(compositePane); |
1273 } else { | 1259 } else { |
1274 var stylesPane = new WebInspector.SidebarPane(this.sidebarPanes.styl
es.title()); | 1260 var stylesPane = new WebInspector.SidebarPane(this.sidebarPanes.styl
es.title()); |
1275 stylesPane.element.classList.add("composite"); | 1261 stylesPane.element.classList.add("composite"); |
1276 stylesPane.element.classList.add("fill"); | 1262 stylesPane.element.classList.add("fill"); |
1277 var expandStyles = stylesPane.expand.bind(stylesPane); | 1263 var expandStyles = stylesPane.expand.bind(stylesPane); |
1278 stylesPane.bodyElement.classList.add("metrics-and-styles"); | 1264 stylesPane.bodyElement.classList.add("metrics-and-styles"); |
1279 | 1265 this.sidebarPanes.styles.show(stylesPane.bodyElement); |
1280 stylesPane.bodyElement.appendChild(matchedStylePanesWrapper); | |
1281 computedPane.bodyElement.appendChild(computedStylePanesWrapper); | |
1282 | |
1283 this.sidebarPanes.styles.setExpandCallback(expandStyles); | 1266 this.sidebarPanes.styles.setExpandCallback(expandStyles); |
1284 this.sidebarPanes.metrics.setExpandCallback(expandStyles); | 1267 this.sidebarPanes.metrics.setExpandCallback(expandStyles); |
1285 this.sidebarPanes.styles.element.appendChild(this.sidebarPanes.style
s.titleElement); | 1268 stylesPane.bodyElement.appendChild(this.sidebarPanes.styles.titleEle
ment); |
1286 | 1269 |
1287 this.sidebarPaneView.addEventListener(WebInspector.TabbedPane.EventT
ypes.TabSelected, tabSelected, this); | 1270 this.sidebarPaneView.addEventListener(WebInspector.TabbedPane.EventT
ypes.TabSelected, tabSelected, this); |
1288 | 1271 |
1289 stylesPane.bodyElement.appendChild(this._matchedStylesFilterBoxConta
iner); | 1272 showMetrics.call(this, stylesPane); |
1290 computedPane.bodyElement.appendChild(this._computedStylesFilterBoxCo
ntainer); | |
1291 this.sidebarPaneView.addPane(stylesPane); | 1273 this.sidebarPaneView.addPane(stylesPane); |
1292 this.sidebarPaneView.addPane(computedPane); | 1274 this.sidebarPaneView.addPane(computedPane); |
1293 } | 1275 } |
1294 | 1276 |
1295 this.sidebarPanes.styles.show(matchedStylePanesWrapper); | |
1296 this.sidebarPanes.computedStyle.show(computedStylePanesWrapper); | |
1297 showMetrics.call(this, vertically); | |
1298 this.sidebarPanes.platformFonts.show(computedStylePanesWrapper); | |
1299 | |
1300 this.sidebarPaneView.addPane(this.sidebarPanes.eventListeners); | 1277 this.sidebarPaneView.addPane(this.sidebarPanes.eventListeners); |
1301 this.sidebarPaneView.addPane(this.sidebarPanes.domBreakpoints); | 1278 this.sidebarPaneView.addPane(this.sidebarPanes.domBreakpoints); |
1302 this.sidebarPaneView.addPane(this.sidebarPanes.properties); | 1279 this.sidebarPaneView.addPane(this.sidebarPanes.properties); |
1303 this._extensionSidebarPanesContainer = this.sidebarPaneView; | 1280 this._extensionSidebarPanesContainer = this.sidebarPaneView; |
1304 | 1281 |
1305 for (var i = 0; i < this._extensionSidebarPanes.length; ++i) | 1282 for (var i = 0; i < this._extensionSidebarPanes.length; ++i) |
1306 this._extensionSidebarPanesContainer.addPane(this._extensionSidebarP
anes[i]); | 1283 this._extensionSidebarPanesContainer.addPane(this._extensionSidebarP
anes[i]); |
1307 | 1284 |
1308 this.sidebarPaneView.show(this._splitView.sidebarElement()); | 1285 this.sidebarPaneView.show(this._splitView.sidebarElement()); |
1309 this.sidebarPanes.styles.expand(); | 1286 this.sidebarPanes.styles.expand(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 return; | 1337 return; |
1361 | 1338 |
1362 if (WebInspector.inspectElementModeController && WebInspector.inspectEle
mentModeController.enabled()) { | 1339 if (WebInspector.inspectElementModeController && WebInspector.inspectEle
mentModeController.enabled()) { |
1363 InspectorFrontendHost.bringToFront(); | 1340 InspectorFrontendHost.bringToFront(); |
1364 WebInspector.inspectElementModeController.disable(); | 1341 WebInspector.inspectElementModeController.disable(); |
1365 } | 1342 } |
1366 | 1343 |
1367 /** @type {!WebInspector.ElementsPanel} */ (WebInspector.inspectorView.p
anel("elements")).revealAndSelectNode(node.id); | 1344 /** @type {!WebInspector.ElementsPanel} */ (WebInspector.inspectorView.p
anel("elements")).revealAndSelectNode(node.id); |
1368 } | 1345 } |
1369 } | 1346 } |
OLD | NEW |