| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 /** | 27 /** |
| 28 * @constructor | 28 * @constructor |
| 29 * @extends {WebInspector.SidebarPane} | 29 * @extends {WebInspector.SidebarPane} |
| 30 */ | 30 */ |
| 31 WebInspector.ScopeChainSidebarPane = function() | 31 WebInspector.ScopeChainSidebarPane = function() |
| 32 { | 32 { |
| 33 WebInspector.SidebarPane.call(this, WebInspector.UIString("Scope Variables")
); | 33 WebInspector.SidebarPane.call(this, WebInspector.UIString("Scope Variables")
); |
| 34 this._sections = []; | 34 this._sections = []; |
| 35 /** @type {!Set.<?string>} */ | 35 /** @type {!Set.<?string>} */ |
| 36 this._expandedSections = new Set(); | 36 this._expandedSections = new Set(); |
| 37 /** @type {!Set.<string>} */ | 37 /** @type {!WebInspector.ObjectPropertiesMemento} */ |
| 38 this._expandedProperties = new Set(); | 38 this.memento = new WebInspector.ObjectPropertiesMemento(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 WebInspector.ScopeChainSidebarPane.prototype = { | 41 WebInspector.ScopeChainSidebarPane.prototype = { |
| 42 /** | 42 /** |
| 43 * @param {?WebInspector.DebuggerModel.CallFrame} callFrame | 43 * @param {?WebInspector.DebuggerModel.CallFrame} callFrame |
| 44 */ | 44 */ |
| 45 update: function(callFrame) | 45 update: function(callFrame) |
| 46 { | 46 { |
| 47 this.bodyElement.removeChildren(); | 47 this.bodyElement.removeChildren(); |
| 48 | 48 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 var subtitle = declarativeScope ? undefined : scope.object.descripti
on; | 121 var subtitle = declarativeScope ? undefined : scope.object.descripti
on; |
| 122 if (!title || title === subtitle) | 122 if (!title || title === subtitle) |
| 123 subtitle = undefined; | 123 subtitle = undefined; |
| 124 | 124 |
| 125 var runtimeModel = callFrame.target().runtimeModel; | 125 var runtimeModel = callFrame.target().runtimeModel; |
| 126 if (declarativeScope) | 126 if (declarativeScope) |
| 127 var scopeObject = runtimeModel.createScopeRemoteObject(scope.obj
ect, new WebInspector.ScopeRef(i, callFrame.id, undefined)); | 127 var scopeObject = runtimeModel.createScopeRemoteObject(scope.obj
ect, new WebInspector.ScopeRef(i, callFrame.id, undefined)); |
| 128 else | 128 else |
| 129 var scopeObject = runtimeModel.createRemoteObject(scope.object); | 129 var scopeObject = runtimeModel.createRemoteObject(scope.object); |
| 130 | 130 |
| 131 var section = new WebInspector.ObjectPropertiesSection(scopeObject,
title, subtitle, emptyPlaceholder, true, extraProperties, WebInspector.ScopeVari
ableTreeElement); | 131 var section = new WebInspector.ObjectPropertiesSection(scopeObject,
title, subtitle, emptyPlaceholder, true, extraProperties, WebInspector.ScopeVari
ableTreeElement, this.memento); |
| 132 section.editInSelectedCallFrameWhenPaused = true; | 132 section.editInSelectedCallFrameWhenPaused = true; |
| 133 section.pane = this; | |
| 134 | 133 |
| 135 if (scope.type === DebuggerAgent.ScopeType.Global) | 134 if (scope.type === DebuggerAgent.ScopeType.Global) |
| 136 section.collapse(); | 135 section.collapse(); |
| 137 else if (!foundLocalScope || scope.type === DebuggerAgent.ScopeType.
Local || this._expandedSections.has(title)) | 136 else if (!foundLocalScope || scope.type === DebuggerAgent.ScopeType.
Local || this._expandedSections.has(title)) |
| 138 section.expand(); | 137 section.expand(); |
| 139 | 138 |
| 140 this._sections.push(section); | 139 this._sections.push(section); |
| 141 this.bodyElement.appendChild(section.element); | 140 this.bodyElement.appendChild(section.element); |
| 142 } | 141 } |
| 143 }, | 142 }, |
| 144 | 143 |
| 145 __proto__: WebInspector.SidebarPane.prototype | 144 __proto__: WebInspector.SidebarPane.prototype |
| 146 } | 145 } |
| 147 | 146 |
| 147 |
| 148 /** | 148 /** |
| 149 * @constructor | 149 * @constructor |
| 150 * @extends {WebInspector.ObjectPropertyTreeElement} | 150 * @extends {WebInspector.ObjectPropertyTreeElement} |
| 151 * @param {!WebInspector.RemoteObjectProperty} property | 151 * @param {!WebInspector.RemoteObjectProperty} property |
| 152 */ | 152 */ |
| 153 WebInspector.ScopeVariableTreeElement = function(property) | 153 WebInspector.ScopeVariableTreeElement = function(property) |
| 154 { | 154 { |
| 155 WebInspector.ObjectPropertyTreeElement.call(this, property); | 155 WebInspector.ObjectPropertyTreeElement.call(this, property); |
| 156 } | 156 } |
| 157 | 157 |
| 158 WebInspector.ScopeVariableTreeElement.prototype = { | 158 WebInspector.ScopeVariableTreeElement.prototype = { |
| 159 onattach: function() | 159 onattach: function() |
| 160 { | 160 { |
| 161 WebInspector.ObjectPropertyTreeElement.prototype.onattach.call(this); | 161 WebInspector.ObjectPropertyTreeElement.prototype.onattach.call(this); |
| 162 if (this.hasChildren && this.treeOutline.section.pane._expandedPropertie
s.has(this.propertyPath())) | 162 if (this.hasChildren && this.treeOutline.section.memento.isPropertyPathE
xpanded(this.propertyPath())) |
| 163 this.expand(); | 163 this.expand(); |
| 164 }, | 164 }, |
| 165 | 165 |
| 166 onexpand: function() | 166 onexpand: function() |
| 167 { | 167 { |
| 168 this.treeOutline.section.pane._expandedProperties.add(this.propertyPath(
)); | 168 this.treeOutline.section.memento.addExpandedPropertyPath(this.propertyPa
th()); |
| 169 }, | 169 }, |
| 170 | 170 |
| 171 oncollapse: function() | 171 oncollapse: function() |
| 172 { | 172 { |
| 173 this.treeOutline.section.pane._expandedProperties.delete(this.propertyPa
th()); | 173 this.treeOutline.section.memento.deleteExpandedPropertyPath(this.propert
yPath()); |
| 174 }, | 174 }, |
| 175 | 175 |
| 176 /** | 176 /** |
| 177 * @override | 177 * @override |
| 178 * @return {string|undefined} | 178 * @return {string|undefined} |
| 179 */ | 179 */ |
| 180 propertyPath: function() | 180 propertyPath: function() |
| 181 { | 181 { |
| 182 if (!this._propertyIdentifier) { | 182 if (!this._propertyIdentifier) { |
| 183 var section = this.treeOutline.section; | 183 var section = this.treeOutline.section; |
| 184 this._propertyIdentifier = section.title + ":" + (section.subtitle ?
section.subtitle + ":" : "") + WebInspector.ObjectPropertyTreeElement.prototype
.propertyPath.call(this); | 184 this._propertyIdentifier = section.title + ":" + (section.subtitle ?
section.subtitle + ":" : "") + WebInspector.ObjectPropertyTreeElement.prototype
.propertyPath.call(this); |
| 185 } | 185 } |
| 186 return this._propertyIdentifier; | 186 return this._propertyIdentifier; |
| 187 }, | 187 }, |
| 188 | 188 |
| 189 __proto__: WebInspector.ObjectPropertyTreeElement.prototype | 189 __proto__: WebInspector.ObjectPropertyTreeElement.prototype |
| 190 } | 190 } |
| OLD | NEW |