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