| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve
nts.DockSideChanged, this._dockSideChanged.bind(this)); | 112 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve
nts.DockSideChanged, this._dockSideChanged.bind(this)); |
| 113 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi
s._dockSideChanged.bind(this)); | 113 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi
s._dockSideChanged.bind(this)); |
| 114 this._dockSideChanged(); | 114 this._dockSideChanged(); |
| 115 | 115 |
| 116 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._get
PopoverAnchor.bind(this), this._showPopover.bind(this)); | 116 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._get
PopoverAnchor.bind(this), this._showPopover.bind(this)); |
| 117 this._popoverHelper.setTimeout(0); | 117 this._popoverHelper.setTimeout(0); |
| 118 | 118 |
| 119 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.Document
Updated, this._documentUpdatedEvent, this); | 119 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.Document
Updated, this._documentUpdatedEvent, this); |
| 120 WebInspector.settings.showShadowDOM.addChangeListener(this._showShadowDOMCha
nged.bind(this)); | 120 WebInspector.settings.showShadowDOM.addChangeListener(this._showShadowDOMCha
nged.bind(this)); |
| 121 | 121 |
| 122 if (WebInspector.domAgent.existingDocument()) | |
| 123 this._documentUpdated(WebInspector.domAgent.existingDocument()); | |
| 124 | |
| 125 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Mod
elWasEnabled, this._updateSidebars, this); | 122 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Mod
elWasEnabled, this._updateSidebars, this); |
| 126 } | 123 } |
| 127 | 124 |
| 128 WebInspector.ElementsPanel.prototype = { | 125 WebInspector.ElementsPanel.prototype = { |
| 129 _updateTreeOutlineVisibleWidth: function() | 126 _updateTreeOutlineVisibleWidth: function() |
| 130 { | 127 { |
| 131 if (!this.treeOutline) | 128 if (!this.treeOutline) |
| 132 return; | 129 return; |
| 133 | 130 |
| 134 var width = this._splitView.element.offsetWidth; | 131 var width = this._splitView.element.offsetWidth; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 161 if (this.treeOutline.element.parentElement !== this.contentElement) | 158 if (this.treeOutline.element.parentElement !== this.contentElement) |
| 162 this.contentElement.appendChild(this.treeOutline.element); | 159 this.contentElement.appendChild(this.treeOutline.element); |
| 163 | 160 |
| 164 WebInspector.Panel.prototype.wasShown.call(this); | 161 WebInspector.Panel.prototype.wasShown.call(this); |
| 165 | 162 |
| 166 this.updateBreadcrumb(); | 163 this.updateBreadcrumb(); |
| 167 this.treeOutline.updateSelection(); | 164 this.treeOutline.updateSelection(); |
| 168 this.treeOutline.setVisible(true); | 165 this.treeOutline.setVisible(true); |
| 169 | 166 |
| 170 if (!this.treeOutline.rootDOMNode) | 167 if (!this.treeOutline.rootDOMNode) |
| 171 WebInspector.domAgent.requestDocument(); | 168 if (WebInspector.domAgent.existingDocument()) |
| 169 this._documentUpdated(WebInspector.domAgent.existingDocument()); |
| 170 else |
| 171 WebInspector.domAgent.requestDocument(); |
| 172 }, | 172 }, |
| 173 | 173 |
| 174 willHide: function() | 174 willHide: function() |
| 175 { | 175 { |
| 176 WebInspector.domAgent.hideDOMNodeHighlight(); | 176 WebInspector.domAgent.hideDOMNodeHighlight(); |
| 177 this.treeOutline.setVisible(false); | 177 this.treeOutline.setVisible(false); |
| 178 this._popoverHelper.hidePopover(); | 178 this._popoverHelper.hidePopover(); |
| 179 | 179 |
| 180 // Detach heavy component on hide | 180 // Detach heavy component on hide |
| 181 this.contentElement.removeChild(this.treeOutline.element); | 181 this.contentElement.removeChild(this.treeOutline.element); |
| 182 | 182 |
| 183 WebInspector.Panel.prototype.willHide.call(this); | 183 WebInspector.Panel.prototype.willHide.call(this); |
| 184 }, | 184 }, |
| 185 | 185 |
| 186 onResize: function() | 186 onResize: function() |
| 187 { | 187 { |
| 188 this._updateTreeOutlineVisibleWidth(); | 188 this._updateTreeOutlineVisibleWidth(); |
| 189 }, | 189 }, |
| 190 | 190 |
| 191 omitDefaultSelection: function() |
| 192 { |
| 193 this._omitDefaultSelection = true; |
| 194 }, |
| 195 |
| 196 stopOmittingDefaultSelection: function() |
| 197 { |
| 198 delete this._omitDefaultSelection; |
| 199 }, |
| 200 |
| 191 /** | 201 /** |
| 192 * @param {!DOMAgent.NodeId} nodeId | 202 * @param {!DOMAgent.NodeId} nodeId |
| 193 * @param {string} pseudoClass | 203 * @param {string} pseudoClass |
| 194 * @param {boolean} enable | 204 * @param {boolean} enable |
| 195 */ | 205 */ |
| 196 _setPseudoClassForNodeId: function(nodeId, pseudoClass, enable) | 206 _setPseudoClassForNodeId: function(nodeId, pseudoClass, enable) |
| 197 { | 207 { |
| 198 var node = WebInspector.domAgent.nodeForId(nodeId); | 208 var node = WebInspector.domAgent.nodeForId(nodeId); |
| 199 if (!node) | 209 if (!node) |
| 200 return; | 210 return; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 function selectLastSelectedNode(nodeId) | 315 function selectLastSelectedNode(nodeId) |
| 306 { | 316 { |
| 307 if (this.selectedDOMNode()) { | 317 if (this.selectedDOMNode()) { |
| 308 // Focused node has been explicitly set while reaching out for t
he last selected node. | 318 // Focused node has been explicitly set while reaching out for t
he last selected node. |
| 309 return; | 319 return; |
| 310 } | 320 } |
| 311 var node = nodeId ? WebInspector.domAgent.nodeForId(nodeId) : null; | 321 var node = nodeId ? WebInspector.domAgent.nodeForId(nodeId) : null; |
| 312 selectNode.call(this, node); | 322 selectNode.call(this, node); |
| 313 } | 323 } |
| 314 | 324 |
| 325 if (this._omitDefaultSelection) |
| 326 return; |
| 327 |
| 315 if (this._selectedPathOnReset) | 328 if (this._selectedPathOnReset) |
| 316 WebInspector.domAgent.pushNodeByPathToFrontend(this._selectedPathOnR
eset, selectLastSelectedNode.bind(this)); | 329 WebInspector.domAgent.pushNodeByPathToFrontend(this._selectedPathOnR
eset, selectLastSelectedNode.bind(this)); |
| 317 else | 330 else |
| 318 selectNode.call(this, null); | 331 selectNode.call(this, null); |
| 319 delete this._selectedPathOnReset; | 332 delete this._selectedPathOnReset; |
| 320 }, | 333 }, |
| 321 | 334 |
| 322 searchCanceled: function() | 335 searchCanceled: function() |
| 323 { | 336 { |
| 324 delete this._searchQuery; | 337 delete this._searchQuery; |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1344 { | 1357 { |
| 1345 } | 1358 } |
| 1346 | 1359 |
| 1347 WebInspector.ElementsPanel.DOMNodeRevealer.prototype = { | 1360 WebInspector.ElementsPanel.DOMNodeRevealer.prototype = { |
| 1348 /** | 1361 /** |
| 1349 * @param {!Object} node | 1362 * @param {!Object} node |
| 1350 */ | 1363 */ |
| 1351 reveal: function(node) | 1364 reveal: function(node) |
| 1352 { | 1365 { |
| 1353 if (node instanceof WebInspector.DOMNode) | 1366 if (node instanceof WebInspector.DOMNode) |
| 1354 /** @type {!WebInspector.ElementsPanel} */ (WebInspector.showPanel("
elements")).revealAndSelectNode(node.id); | 1367 /** @type {!WebInspector.ElementsPanel} */ (WebInspector.panel("elem
ents")).revealAndSelectNode(node.id); |
| 1355 } | 1368 } |
| 1356 } | 1369 } |
| OLD | NEW |