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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 _processWasShown: function() | 147 _processWasShown: function() |
148 { | 148 { |
149 if (this._inNotification()) | 149 if (this._inNotification()) |
150 return; | 150 return; |
151 this.restoreScrollPositions(); | 151 this.restoreScrollPositions(); |
152 this._notify(this.wasShown); | 152 this._notify(this.wasShown); |
153 this._callOnVisibleChildren(this._processWasShown); | 153 this._callOnVisibleChildren(this._processWasShown); |
154 }, | 154 }, |
155 | 155 |
| 156 _processWasDetachedFromHierarchy: function() |
| 157 { |
| 158 this._notify(this.wasDetachedFromHierarchy); |
| 159 var copy = this._children.slice(); |
| 160 for (var widget of copy) |
| 161 widget._processWasDetachedFromHierarchy(); |
| 162 }, |
| 163 |
156 _processWillHide: function() | 164 _processWillHide: function() |
157 { | 165 { |
158 if (this._inNotification()) | 166 if (this._inNotification()) |
159 return; | 167 return; |
160 this.storeScrollPositions(); | 168 this.storeScrollPositions(); |
161 | 169 |
162 this._callOnVisibleChildren(this._processWillHide); | 170 this._callOnVisibleChildren(this._processWillHide); |
163 this._notify(this.willHide); | 171 this._notify(this.willHide); |
164 this._isShowing = false; | 172 this._isShowing = false; |
165 }, | 173 }, |
(...skipping 27 matching lines...) Expand all Loading... |
193 }, | 201 }, |
194 | 202 |
195 wasShown: function() | 203 wasShown: function() |
196 { | 204 { |
197 }, | 205 }, |
198 | 206 |
199 willHide: function() | 207 willHide: function() |
200 { | 208 { |
201 }, | 209 }, |
202 | 210 |
| 211 wasDetachedFromHierarchy: function() |
| 212 { |
| 213 }, |
| 214 |
203 onResize: function() | 215 onResize: function() |
204 { | 216 { |
205 }, | 217 }, |
206 | 218 |
207 onLayout: function() | 219 onLayout: function() |
208 { | 220 { |
209 }, | 221 }, |
210 | 222 |
211 /** | 223 /** |
212 * @param {!Element} parentElement | 224 * @param {!Element} parentElement |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 // Update widget hierarchy. | 343 // Update widget hierarchy. |
332 if (this._parentWidget) { | 344 if (this._parentWidget) { |
333 var childIndex = this._parentWidget._children.indexOf(this); | 345 var childIndex = this._parentWidget._children.indexOf(this); |
334 WebInspector.Widget.__assert(childIndex >= 0, "Attempt to remove non
-child widget"); | 346 WebInspector.Widget.__assert(childIndex >= 0, "Attempt to remove non
-child widget"); |
335 this._parentWidget._children.splice(childIndex, 1); | 347 this._parentWidget._children.splice(childIndex, 1); |
336 if (this._parentWidget._defaultFocusedChild === this) | 348 if (this._parentWidget._defaultFocusedChild === this) |
337 this._parentWidget._defaultFocusedChild = null; | 349 this._parentWidget._defaultFocusedChild = null; |
338 this._parentWidget.childWasDetached(this); | 350 this._parentWidget.childWasDetached(this); |
339 var parent = this._parentWidget; | 351 var parent = this._parentWidget; |
340 this._parentWidget = null; | 352 this._parentWidget = null; |
| 353 this._processWasDetachedFromHierarchy(); |
341 } else { | 354 } else { |
342 WebInspector.Widget.__assert(this._isRoot, "Removing non-root widget
from DOM"); | 355 WebInspector.Widget.__assert(this._isRoot, "Removing non-root widget
from DOM"); |
343 } | 356 } |
344 }, | 357 }, |
345 | 358 |
346 detachChildWidgets: function() | 359 detachChildWidgets: function() |
347 { | 360 { |
348 var children = this._children.slice(); | 361 var children = this._children.slice(); |
349 for (var i = 0; i < children.length; ++i) | 362 for (var i = 0; i < children.length; ++i) |
350 children[i].detach(); | 363 children[i].detach(); |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 { | 780 { |
768 WebInspector.Widget.__assert(!child.__widgetCounter && !child.__widget, "Att
empt to remove element containing widget via regular DOM operation"); | 781 WebInspector.Widget.__assert(!child.__widgetCounter && !child.__widget, "Att
empt to remove element containing widget via regular DOM operation"); |
769 return WebInspector.Widget._originalRemoveChild.call(this, child); | 782 return WebInspector.Widget._originalRemoveChild.call(this, child); |
770 } | 783 } |
771 | 784 |
772 Element.prototype.removeChildren = function() | 785 Element.prototype.removeChildren = function() |
773 { | 786 { |
774 WebInspector.Widget.__assert(!this.__widgetCounter, "Attempt to remove eleme
nt containing widget via regular DOM operation"); | 787 WebInspector.Widget.__assert(!this.__widgetCounter, "Attempt to remove eleme
nt containing widget via regular DOM operation"); |
775 WebInspector.Widget._originalRemoveChildren.call(this); | 788 WebInspector.Widget._originalRemoveChildren.call(this); |
776 } | 789 } |
OLD | NEW |