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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 * @return {boolean} | 99 * @return {boolean} |
100 */ | 100 */ |
101 isShowing: function() | 101 isShowing: function() |
102 { | 102 { |
103 return this._isShowing; | 103 return this._isShowing; |
104 }, | 104 }, |
105 | 105 |
106 /** | 106 /** |
107 * @return {boolean} | 107 * @return {boolean} |
108 */ | 108 */ |
109 _shouldHideOnDetach: function() | 109 shouldHideOnDetach: function() |
110 { | 110 { |
111 if (this._hideOnDetach) | 111 if (this._hideOnDetach) |
112 return true; | 112 return true; |
113 for (var child of this._children) { | 113 for (var child of this._children) { |
114 if (child._shouldHideOnDetach()) | 114 if (child.shouldHideOnDetach()) |
115 return true; | 115 return true; |
116 } | 116 } |
117 return false; | 117 return false; |
118 }, | 118 }, |
119 | 119 |
120 setHideOnDetach: function() | 120 setHideOnDetach: function() |
121 { | 121 { |
122 this._hideOnDetach = true; | 122 this._hideOnDetach = true; |
123 }, | 123 }, |
124 | 124 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 */ | 276 */ |
277 detach: function(overrideHideOnDetach) | 277 detach: function(overrideHideOnDetach) |
278 { | 278 { |
279 var parentElement = this.element.parentElement; | 279 var parentElement = this.element.parentElement; |
280 if (!parentElement) | 280 if (!parentElement) |
281 return; | 281 return; |
282 | 282 |
283 if (this._parentIsShowing()) | 283 if (this._parentIsShowing()) |
284 this._processWillHide(); | 284 this._processWillHide(); |
285 | 285 |
286 if (!overrideHideOnDetach && this._shouldHideOnDetach()) { | 286 if (!overrideHideOnDetach && this.shouldHideOnDetach()) { |
287 this.element.classList.add("hidden"); | 287 this.element.classList.add("hidden"); |
288 this._visible = false; | 288 this._visible = false; |
289 if (this._parentIsShowing()) | 289 if (this._parentIsShowing()) |
290 this._processWasHidden(); | 290 this._processWasHidden(); |
291 if (this._parentWidget && this._hasNonZeroConstraints()) | 291 if (this._parentWidget && this._hasNonZeroConstraints()) |
292 this._parentWidget.invalidateConstraints(); | 292 this._parentWidget.invalidateConstraints(); |
293 return; | 293 return; |
294 } | 294 } |
295 | 295 |
296 // Force legal removal | 296 // Force legal removal |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 { | 676 { |
677 WebInspector.Widget.__assert(!child.__widgetCounter && !child.__widget, "Att
empt to remove element containing widget via regular DOM operation"); | 677 WebInspector.Widget.__assert(!child.__widgetCounter && !child.__widget, "Att
empt to remove element containing widget via regular DOM operation"); |
678 return WebInspector.Widget._originalRemoveChild.call(this, child); | 678 return WebInspector.Widget._originalRemoveChild.call(this, child); |
679 } | 679 } |
680 | 680 |
681 Element.prototype.removeChildren = function() | 681 Element.prototype.removeChildren = function() |
682 { | 682 { |
683 WebInspector.Widget.__assert(!this.__widgetCounter, "Attempt to remove eleme
nt containing widget via regular DOM operation"); | 683 WebInspector.Widget.__assert(!this.__widgetCounter, "Attempt to remove eleme
nt containing widget via regular DOM operation"); |
684 WebInspector.Widget._originalRemoveChildren.call(this); | 684 WebInspector.Widget._originalRemoveChildren.call(this); |
685 } | 685 } |
OLD | NEW |