| 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 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 this._splitView = new WebInspector.SplitView(true, true, "elementsPanelSplit
ViewState", 325, 325); | 42 this._splitView = new WebInspector.SplitView(true, true, "elementsPanelSplit
ViewState", 325, 325); |
| 43 this._splitView.addEventListener(WebInspector.SplitView.Events.SidebarSizeCh
anged, this._updateTreeOutlineVisibleWidth.bind(this)); | 43 this._splitView.addEventListener(WebInspector.SplitView.Events.SidebarSizeCh
anged, this._updateTreeOutlineVisibleWidth.bind(this)); |
| 44 this._splitView.show(this.element); | 44 this._splitView.show(this.element); |
| 45 | 45 |
| 46 this._searchableView = new WebInspector.SearchableView(this); | 46 this._searchableView = new WebInspector.SearchableView(this); |
| 47 this._searchableView.setMinimumSize(25, 19); | 47 this._searchableView.setMinimumSize(25, 19); |
| 48 this._searchableView.show(this._splitView.mainElement()); | 48 this._searchableView.show(this._splitView.mainElement()); |
| 49 var stackElement = this._searchableView.element; | 49 var stackElement = this._searchableView.element; |
| 50 | 50 |
| 51 this.contentElement = stackElement.createChild("div"); | 51 this._contentElement = stackElement.createChild("div"); |
| 52 this.contentElement.id = "elements-content"; | 52 this._contentElement.id = "elements-content"; |
| 53 // FIXME: crbug.com/425984 | 53 // FIXME: crbug.com/425984 |
| 54 if (WebInspector.settings.domWordWrap.get()) | 54 if (WebInspector.settings.domWordWrap.get()) |
| 55 this.contentElement.classList.add("elements-wrap"); | 55 this.contentElement.classList.add("elements-wrap"); |
| 56 WebInspector.settings.domWordWrap.addChangeListener(this._domWordWrapSetting
Changed.bind(this)); | 56 WebInspector.settings.domWordWrap.addChangeListener(this._domWordWrapSetting
Changed.bind(this)); |
| 57 | 57 |
| 58 this._splitView.sidebarElement().addEventListener("contextmenu", this._sideb
arContextMenuEventFired.bind(this), false); | 58 this._splitView.sidebarElement().addEventListener("contextmenu", this._sideb
arContextMenuEventFired.bind(this), false); |
| 59 | 59 |
| 60 var crumbsContainer = stackElement.createChild("div"); | 60 var crumbsContainer = stackElement.createChild("div"); |
| 61 crumbsContainer.id = "elements-crumbs"; | 61 crumbsContainer.id = "elements-crumbs"; |
| 62 this.crumbsElement = crumbsContainer.createChild("div", "crumbs"); | 62 this.crumbsElement = crumbsContainer.createChild("div", "crumbs"); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 searchableView: function() | 191 searchableView: function() |
| 192 { | 192 { |
| 193 return this._searchableView; | 193 return this._searchableView; |
| 194 }, | 194 }, |
| 195 | 195 |
| 196 wasShown: function() | 196 wasShown: function() |
| 197 { | 197 { |
| 198 for (var i = 0; i < this._treeOutlines.length; ++i) { | 198 for (var i = 0; i < this._treeOutlines.length; ++i) { |
| 199 var treeOutline = this._treeOutlines[i]; | 199 var treeOutline = this._treeOutlines[i]; |
| 200 // Attach heavy component lazily | 200 // Attach heavy component lazily |
| 201 if (treeOutline.element.parentElement !== this.contentElement) | 201 if (treeOutline.element.parentElement !== this._contentElement) |
| 202 this.contentElement.appendChild(treeOutline.element); | 202 this._contentElement.appendChild(treeOutline.element); |
| 203 } | 203 } |
| 204 WebInspector.Panel.prototype.wasShown.call(this); | 204 WebInspector.Panel.prototype.wasShown.call(this); |
| 205 this.updateBreadcrumb(); | 205 this.updateBreadcrumb(); |
| 206 | 206 |
| 207 for (var i = 0; i < this._treeOutlines.length; ++i) { | 207 for (var i = 0; i < this._treeOutlines.length; ++i) { |
| 208 var treeOutline = this._treeOutlines[i]; | 208 var treeOutline = this._treeOutlines[i]; |
| 209 treeOutline.updateSelection(); | 209 treeOutline.updateSelection(); |
| 210 treeOutline.setVisible(true); | 210 treeOutline.setVisible(true); |
| 211 | 211 |
| 212 if (!treeOutline.rootDOMNode) | 212 if (!treeOutline.rootDOMNode) |
| 213 if (treeOutline.domModel().existingDocument()) | 213 if (treeOutline.domModel().existingDocument()) |
| 214 this._documentUpdated(treeOutline.domModel(), treeOutline.do
mModel().existingDocument()); | 214 this._documentUpdated(treeOutline.domModel(), treeOutline.do
mModel().existingDocument()); |
| 215 else | 215 else |
| 216 treeOutline.domModel().requestDocument(); | 216 treeOutline.domModel().requestDocument(); |
| 217 } | 217 } |
| 218 | 218 |
| 219 }, | 219 }, |
| 220 | 220 |
| 221 willHide: function() | 221 willHide: function() |
| 222 { | 222 { |
| 223 for (var i = 0; i < this._treeOutlines.length; ++i) { | 223 for (var i = 0; i < this._treeOutlines.length; ++i) { |
| 224 var treeOutline = this._treeOutlines[i]; | 224 var treeOutline = this._treeOutlines[i]; |
| 225 treeOutline.domModel().hideDOMNodeHighlight(); | 225 treeOutline.domModel().hideDOMNodeHighlight(); |
| 226 treeOutline.setVisible(false); | 226 treeOutline.setVisible(false); |
| 227 // Detach heavy component on hide | 227 // Detach heavy component on hide |
| 228 this.contentElement.removeChild(treeOutline.element); | 228 this._contentElement.removeChild(treeOutline.element); |
| 229 } | 229 } |
| 230 this._popoverHelper.hidePopover(); | 230 this._popoverHelper.hidePopover(); |
| 231 WebInspector.Panel.prototype.willHide.call(this); | 231 WebInspector.Panel.prototype.willHide.call(this); |
| 232 }, | 232 }, |
| 233 | 233 |
| 234 onResize: function() | 234 onResize: function() |
| 235 { | 235 { |
| 236 this._updateTreeOutlineVisibleWidth(); | 236 this._updateTreeOutlineVisibleWidth(); |
| 237 }, | 237 }, |
| 238 | 238 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 this._currentSearchResultIndex = -1; | 439 this._currentSearchResultIndex = -1; |
| 440 | 440 |
| 441 if (shouldJump) | 441 if (shouldJump) |
| 442 this._jumpToSearchResult(jumpBackwards ? -1 : 0); | 442 this._jumpToSearchResult(jumpBackwards ? -1 : 0); |
| 443 } | 443 } |
| 444 }, | 444 }, |
| 445 | 445 |
| 446 _domWordWrapSettingChanged: function(event) | 446 _domWordWrapSettingChanged: function(event) |
| 447 { | 447 { |
| 448 // FIXME: crbug.com/425984 | 448 // FIXME: crbug.com/425984 |
| 449 this.contentElement.classList.toggle("elements-wrap", event.data); | 449 this._contentElement.classList.toggle("elements-wrap", event.data); |
| 450 for (var i = 0; i < this._treeOutlines.length; ++i) | 450 for (var i = 0; i < this._treeOutlines.length; ++i) |
| 451 this._treeOutlines[i].setWordWrap(/** @type {boolean} */ (event.data
)); | 451 this._treeOutlines[i].setWordWrap(/** @type {boolean} */ (event.data
)); |
| 452 | 452 |
| 453 var selectedNode = this.selectedDOMNode(); | 453 var selectedNode = this.selectedDOMNode(); |
| 454 if (!selectedNode) | 454 if (!selectedNode) |
| 455 return; | 455 return; |
| 456 | 456 |
| 457 var treeElement = this._treeElementForNode(selectedNode); | 457 var treeElement = this._treeElementForNode(selectedNode); |
| 458 if (treeElement) | 458 if (treeElement) |
| 459 treeElement.updateSelection(); // Recalculate selection highlight di
mensions. | 459 treeElement.updateSelection(); // Recalculate selection highlight di
mensions. |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 } | 863 } |
| 864 | 864 |
| 865 // Find the focused crumb index. | 865 // Find the focused crumb index. |
| 866 if (crumb === focusedCrumb) | 866 if (crumb === focusedCrumb) |
| 867 focusedIndex = i; | 867 focusedIndex = i; |
| 868 | 868 |
| 869 crumb.classList.remove("compact", "collapsed", "hidden"); | 869 crumb.classList.remove("compact", "collapsed", "hidden"); |
| 870 } | 870 } |
| 871 | 871 |
| 872 // Layout 1: Measure total and normal crumb sizes | 872 // Layout 1: Measure total and normal crumb sizes |
| 873 var contentElementWidth = this.contentElement.offsetWidth; | 873 var contentElementWidth = this._contentElement.offsetWidth; |
| 874 var normalSizes = []; | 874 var normalSizes = []; |
| 875 for (var i = 0; i < crumbs.childNodes.length; ++i) { | 875 for (var i = 0; i < crumbs.childNodes.length; ++i) { |
| 876 var crumb = crumbs.childNodes[i]; | 876 var crumb = crumbs.childNodes[i]; |
| 877 normalSizes[i] = crumb.offsetWidth; | 877 normalSizes[i] = crumb.offsetWidth; |
| 878 } | 878 } |
| 879 | 879 |
| 880 // Layout 2: Measure collapsed crumb sizes | 880 // Layout 2: Measure collapsed crumb sizes |
| 881 var compactSizes = []; | 881 var compactSizes = []; |
| 882 for (var i = 0; i < crumbs.childNodes.length; ++i) { | 882 for (var i = 0; i < crumbs.childNodes.length; ++i) { |
| 883 var crumb = crumbs.childNodes[i]; | 883 var crumb = crumbs.childNodes[i]; |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1570 | 1570 |
| 1571 WebInspector.ElementsPanelFactory.prototype = { | 1571 WebInspector.ElementsPanelFactory.prototype = { |
| 1572 /** | 1572 /** |
| 1573 * @return {!WebInspector.Panel} | 1573 * @return {!WebInspector.Panel} |
| 1574 */ | 1574 */ |
| 1575 createPanel: function() | 1575 createPanel: function() |
| 1576 { | 1576 { |
| 1577 return WebInspector.ElementsPanel.instance(); | 1577 return WebInspector.ElementsPanel.instance(); |
| 1578 } | 1578 } |
| 1579 } | 1579 } |
| OLD | NEW |