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 }, | 99 }, |
100 | 100 |
101 /** | 101 /** |
102 * @return {boolean} | 102 * @return {boolean} |
103 */ | 103 */ |
104 isShowing: function() | 104 isShowing: function() |
105 { | 105 { |
106 return this._isShowing; | 106 return this._isShowing; |
107 }, | 107 }, |
108 | 108 |
| 109 /** |
| 110 * @return {boolean} |
| 111 */ |
| 112 _shouldHideOnDetach: function() |
| 113 { |
| 114 if (this._hideOnDetach) |
| 115 return true; |
| 116 for (var child of this._children) { |
| 117 if (child._shouldHideOnDetach()) |
| 118 return true; |
| 119 } |
| 120 return false; |
| 121 }, |
| 122 |
109 setHideOnDetach: function() | 123 setHideOnDetach: function() |
110 { | 124 { |
111 this._hideOnDetach = true; | 125 this._hideOnDetach = true; |
112 }, | 126 }, |
113 | 127 |
114 /** | 128 /** |
115 * @return {boolean} | 129 * @return {boolean} |
116 */ | 130 */ |
117 _inNotification: function() | 131 _inNotification: function() |
118 { | 132 { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 */ | 279 */ |
266 detach: function(overrideHideOnDetach) | 280 detach: function(overrideHideOnDetach) |
267 { | 281 { |
268 var parentElement = this.element.parentElement; | 282 var parentElement = this.element.parentElement; |
269 if (!parentElement) | 283 if (!parentElement) |
270 return; | 284 return; |
271 | 285 |
272 if (this._parentIsShowing()) | 286 if (this._parentIsShowing()) |
273 this._processWillHide(); | 287 this._processWillHide(); |
274 | 288 |
275 if (this._hideOnDetach && !overrideHideOnDetach) { | 289 if (!overrideHideOnDetach && this._shouldHideOnDetach()) { |
276 this.element.classList.remove("visible"); | 290 this.element.classList.remove("visible"); |
277 this._visible = false; | 291 this._visible = false; |
278 if (this._parentIsShowing()) | 292 if (this._parentIsShowing()) |
279 this._processWasHidden(); | 293 this._processWasHidden(); |
280 if (this._parentView && this._hasNonZeroConstraints()) | 294 if (this._parentView && this._hasNonZeroConstraints()) |
281 this._parentView.invalidateConstraints(); | 295 this._parentView.invalidateConstraints(); |
282 return; | 296 return; |
283 } | 297 } |
284 | 298 |
285 // Force legal removal | 299 // Force legal removal |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 { | 670 { |
657 WebInspector.View.__assert(!child.__viewCounter && !child.__view, "Attempt t
o remove element containing view via regular DOM operation"); | 671 WebInspector.View.__assert(!child.__viewCounter && !child.__view, "Attempt t
o remove element containing view via regular DOM operation"); |
658 return WebInspector.View._originalRemoveChild.call(this, child); | 672 return WebInspector.View._originalRemoveChild.call(this, child); |
659 } | 673 } |
660 | 674 |
661 Element.prototype.removeChildren = function() | 675 Element.prototype.removeChildren = function() |
662 { | 676 { |
663 WebInspector.View.__assert(!this.__viewCounter, "Attempt to remove element c
ontaining view via regular DOM operation"); | 677 WebInspector.View.__assert(!this.__viewCounter, "Attempt to remove element c
ontaining view via regular DOM operation"); |
664 WebInspector.View._originalRemoveChildren.call(this); | 678 WebInspector.View._originalRemoveChildren.call(this); |
665 } | 679 } |
OLD | NEW |