| 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 { | 249 { |
| 250 var currentParent = parentElement; | 250 var currentParent = parentElement; |
| 251 while (currentParent && !currentParent.__widget) | 251 while (currentParent && !currentParent.__widget) |
| 252 currentParent = currentParent.parentElementOrShadowHost(); | 252 currentParent = currentParent.parentElementOrShadowHost(); |
| 253 | 253 |
| 254 if (this._isRoot) | 254 if (this._isRoot) |
| 255 WebInspector.Widget.__assert(!currentParent, "Attempt to show root w
idget under another widget"); | 255 WebInspector.Widget.__assert(!currentParent, "Attempt to show root w
idget under another widget"); |
| 256 else | 256 else |
| 257 WebInspector.Widget.__assert(currentParent && currentParent.__widget
=== this._parentWidget, "Attempt to show under node belonging to alien widget")
; | 257 WebInspector.Widget.__assert(currentParent && currentParent.__widget
=== this._parentWidget, "Attempt to show under node belonging to alien widget")
; |
| 258 | 258 |
| 259 if (this._visible) | 259 var wasVisible = this._visible; |
| 260 if (wasVisible && this.element.parentElement === parentElement) |
| 260 return; | 261 return; |
| 262 |
| 261 this._visible = true; | 263 this._visible = true; |
| 262 | 264 |
| 263 if (this._parentIsShowing()) | 265 if (!wasVisible && this._parentIsShowing()) |
| 264 this._processWillShow(); | 266 this._processWillShow(); |
| 265 | 267 |
| 266 this.element.classList.remove("hidden"); | 268 this.element.classList.remove("hidden"); |
| 267 | 269 |
| 268 // Reparent | 270 // Reparent |
| 269 if (this.element.parentElement !== parentElement) { | 271 if (this.element.parentElement !== parentElement) { |
| 270 WebInspector.Widget._incrementWidgetCounter(parentElement, this.elem
ent); | 272 WebInspector.Widget._incrementWidgetCounter(parentElement, this.elem
ent); |
| 271 if (insertBefore) | 273 if (insertBefore) |
| 272 WebInspector.Widget._originalInsertBefore.call(parentElement, th
is.element, insertBefore); | 274 WebInspector.Widget._originalInsertBefore.call(parentElement, th
is.element, insertBefore); |
| 273 else | 275 else |
| 274 WebInspector.Widget._originalAppendChild.call(parentElement, thi
s.element); | 276 WebInspector.Widget._originalAppendChild.call(parentElement, thi
s.element); |
| 275 } | 277 } |
| 276 | 278 |
| 277 if (this._parentIsShowing()) | 279 if (!wasVisible && this._parentIsShowing()) |
| 278 this._processWasShown(); | 280 this._processWasShown(); |
| 279 | 281 |
| 280 if (this._parentWidget && this._hasNonZeroConstraints()) | 282 if (this._parentWidget && this._hasNonZeroConstraints()) |
| 281 this._parentWidget.invalidateConstraints(); | 283 this._parentWidget.invalidateConstraints(); |
| 282 else | 284 else |
| 283 this._processOnResize(); | 285 this._processOnResize(); |
| 284 }, | 286 }, |
| 285 | 287 |
| 286 hideWidget: function() | 288 hideWidget: function() |
| 287 { | 289 { |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 { | 785 { |
| 784 WebInspector.Widget.__assert(!child.__widgetCounter && !child.__widget, "Att
empt to remove element containing widget via regular DOM operation"); | 786 WebInspector.Widget.__assert(!child.__widgetCounter && !child.__widget, "Att
empt to remove element containing widget via regular DOM operation"); |
| 785 return WebInspector.Widget._originalRemoveChild.call(this, child); | 787 return WebInspector.Widget._originalRemoveChild.call(this, child); |
| 786 } | 788 } |
| 787 | 789 |
| 788 Element.prototype.removeChildren = function() | 790 Element.prototype.removeChildren = function() |
| 789 { | 791 { |
| 790 WebInspector.Widget.__assert(!this.__widgetCounter, "Attempt to remove eleme
nt containing widget via regular DOM operation"); | 792 WebInspector.Widget.__assert(!this.__widgetCounter, "Attempt to remove eleme
nt containing widget via regular DOM operation"); |
| 791 WebInspector.Widget._originalRemoveChildren.call(this); | 793 WebInspector.Widget._originalRemoveChildren.call(this); |
| 792 } | 794 } |
| OLD | NEW |